wxIScan
wxOptionsDialog Class Reference

The standard options dialog. More...

#include <wxoptionsdialog.h>

List of all members.

Public Member Functions

 wxOptionsDialog (wxWindow *poParentWindow)
 Standard constructor.
virtual ~wxOptionsDialog ()
 Virtual destructor.
virtual void SetupDialog ()
 Setup the dialog window.
virtual bool AppendOption (wxOptionBase *poOption)
 Append the given option object to the options list.
virtual wxWindow * GetParent ()
 ...

Protected Member Functions

void OnOk (wxCommandEvent &oEvent)
 Handler for pressed OK button.

Protected Attributes

int m_nOptionCount
 Number of option objects.
int m_nOptionId
 ID of the next control to add.
wxOptionBasem_apoOptions [100]
 Array of option objects.

Detailed Description

The standard options dialog.

This class represents the application's options dialog.

Definition at line 186 of file wxoptionsdialog.h.


Constructor & Destructor Documentation

wxOptionsDialog::wxOptionsDialog ( wxWindow *  poParentWindow)

Standard constructor.

Parameters:
poParentWindowa pointer to parent window (the window owner).

Definition at line 250 of file wxoptionsdialog.cpp.

  : wxDialog( poParentWindow, -1,
              wxTheApp->GetAppName()  + wxT( " - " ) + _( "Options" ),
              wxDefaultPosition,
              wxDefaultSize,
              wxDEFAULT_DIALOG_STYLE /* | wxRESIZE_BORDER */ ),
    m_nOptionCount( 0 ),
    m_nOptionId( WXOPTIONSDIALOGIDOPTION )
{
    // Initialize members. (Nothing to do, yet.)
}
wxOptionsDialog::~wxOptionsDialog ( ) [virtual]

Virtual destructor.

Definition at line 262 of file wxoptionsdialog.cpp.

References m_apoOptions, and m_nOptionCount.

{
    // Clean up options.
    while( m_nOptionCount > 0 )
    {
        m_nOptionCount--;
        delete m_apoOptions[m_nOptionCount];
    }
}

Member Function Documentation

bool wxOptionsDialog::AppendOption ( wxOptionBase poOption) [virtual]

Append the given option object to the options list.

Definition at line 301 of file wxoptionsdialog.cpp.

References GetParent(), m_apoOptions, m_nOptionCount, m_nOptionId, wxOptionBase::Setup(), and WXOPTIONSDIALOGMAXOPTION.

Referenced by wxIScanFrame::OnEditSettings().

{
    if( !poOption )
    {
        return false;
    }
    if( m_nOptionCount >= WXOPTIONSDIALOGMAXOPTION )
    {
        return false;
    }
    poOption->Setup( GetParent(), m_nOptionId );
    m_nOptionId++;
    m_apoOptions[m_nOptionCount]= poOption;
    m_nOptionCount++;
    return true;
}
virtual wxWindow* wxOptionsDialog::GetParent ( ) [inline, virtual]

...

Definition at line 201 of file wxoptionsdialog.h.

Referenced by AppendOption(), and SetupDialog().

void wxOptionsDialog::OnOk ( wxCommandEvent &  oEvent) [protected]

Handler for pressed OK button.

Definition at line 318 of file wxoptionsdialog.cpp.

References m_apoOptions, m_nOptionCount, and wxOptionBase::StoreValue().

{
    // Get values.
    for( int i= 0; i < m_nOptionCount; i++ )
    {
        m_apoOptions[i]->StoreValue();
    }

    // End modal dialog mode and set the return value to 'OK'.
    EndModal( wxID_OK );
}
void wxOptionsDialog::SetupDialog ( ) [virtual]

Setup the dialog window.

Definition at line 272 of file wxoptionsdialog.cpp.

References wxOptionBase::AddToSizer(), GetParent(), m_apoOptions, and m_nOptionCount.

Referenced by wxIScanFrame::OnEditSettings().

{
    // Create layout.
    wxBoxSizer *poSizer= new wxBoxSizer( wxVERTICAL );

    // Create controls.
    for( int i= 0; i < m_nOptionCount; i++ )
    {
        m_apoOptions[i]->AddToSizer( poSizer );
    }
    poSizer->Add( new wxStaticLine( this ), 0, wxGROW | wxLEFT | wxRIGHT, 1 );
    poSizer->Add( CreateButtonSizer( wxOK | wxCANCEL ), 0, wxALIGN_CENTER | wxALL, 5 );

    // Activate.
//    SetSizer( poSizer );
GetParent()->SetSizer( poSizer );
//GetParent()->Layout();
//poSizer->SetSizeHints( GetParent() );
//poSizer->Fit( GetParent() );
//GetParent()->SetAutoLayout( true );
//wxBoxSizer *poMSizer= new wxBoxSizer( wxVERTICAL );
//SetSizer( poMSizer );
//Layout();
    SetAutoLayout( true );
    poSizer->SetSizeHints( this );
    poSizer->Fit( this );
    Centre( wxBOTH | wxCENTRE_ON_SCREEN );
}

Member Data Documentation

Array of option objects.

Definition at line 209 of file wxoptionsdialog.h.

Referenced by AppendOption(), OnOk(), SetupDialog(), and ~wxOptionsDialog().

Number of option objects.

Definition at line 207 of file wxoptionsdialog.h.

Referenced by AppendOption(), OnOk(), SetupDialog(), and ~wxOptionsDialog().

ID of the next control to add.

Definition at line 208 of file wxoptionsdialog.h.

Referenced by AppendOption().


The documentation for this class was generated from the following files: