Exemplo n.º 1
0
void VisualEditor::SetupWizard( PObjectBase obj, wxWindow *window, bool pageAdding )
{
    WizardPageSimple *wizpage = wxDynamicCast( window, WizardPageSimple );

    if ( pageAdding )
    {
        m_wizard->AddPage( wizpage );
        m_wizard->Connect( wxID_ANY, wxFB_EVT_WIZARD_PAGE_CHANGED, WizardEventHandler( VisualEditor::OnWizardPageChanged ) );
    }
    else
    {
        WizardEvent eventChanged( wxFB_EVT_WIZARD_PAGE_CHANGED, m_wizard->GetId(), false, wizpage );
        eventChanged.SetInt( 1 );
        wizpage->GetEventHandler()->ProcessEvent( eventChanged );

        bool wizBmpOk = !obj->GetParent()->GetProperty( wxT("bitmap") )->IsNull();
        bool pgeBmpOk = !obj->GetProperty( wxT("bitmap") )->IsNull();
        wxBitmap wizBmp = obj->GetParent()->GetPropertyAsBitmap( wxT("bitmap") );
        wxBitmap pgeBmp = obj->GetPropertyAsBitmap( wxT("bitmap") );

        if ( pgeBmpOk && pgeBmp.IsOk() )
        {
            m_wizard->SetBitmap( pgeBmp );
        }
        else if ( wizBmpOk && wizBmp.IsOk() )
        {
            m_wizard->SetBitmap( wizBmp );
        }
        size_t selection = m_wizard->GetPageIndex( wizpage );
        m_wizard->SetSelection( selection );
    }
}
Exemplo n.º 2
0
void VisualEditor::ClearWizard()
{
    if ( m_wizard )
    {
        m_wizard->Disconnect( wxID_ANY, wxFB_EVT_WIZARD_PAGE_CHANGED, WizardEventHandler( VisualEditor::OnWizardPageChanged ) );
        m_wizard->Destroy();
        m_wizard = NULL;
    }
}
Exemplo n.º 3
0
Wizard::~Wizard()
{
	m_btnHelp->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Wizard::OnHelp),
	                      nullptr, this);
	m_btnPrev->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Wizard::OnBackOrNext),
	                      nullptr, this);
	m_btnNext->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Wizard::OnBackOrNext),
	                      nullptr, this);
	m_btnCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Wizard::OnCancel),
	                        nullptr, this);

    this->Disconnect( wxID_ANY, wxFB_EVT_WIZARD_PAGE_CHANGED, WizardEventHandler( Wizard::OnWizEvent ) );
    this->Disconnect( wxID_ANY, wxFB_EVT_WIZARD_PAGE_CHANGING, WizardEventHandler( Wizard::OnWizEvent ) );
    this->Disconnect( wxID_ANY, wxFB_EVT_WIZARD_CANCEL, WizardEventHandler( Wizard::OnWizEvent ) );
    this->Disconnect( wxID_ANY, wxFB_EVT_WIZARD_FINISHED, WizardEventHandler( Wizard::OnWizEvent ) );
    this->Disconnect( wxID_ANY, wxFB_EVT_WIZARD_HELP, WizardEventHandler( Wizard::OnWizEvent ) );

    m_statbmp->SetBitmap( wxNullBitmap );
    m_bitmap = wxNullBitmap;
	m_page = nullptr;
    m_pages.Clear();
}
Exemplo n.º 4
0
Wizard::Wizard( wxWindow* parent, wxWindowID id,
                const wxPoint& pos, const wxSize& size, long style )
: wxPanel( parent, id, pos, size, style )
{
	m_page = nullptr;
    m_bitmap = wxNullBitmap;

	const auto windowSizer = new wxBoxSizer(wxVERTICAL);
	const auto mainColumn = new wxBoxSizer(wxVERTICAL);
	const auto buttonRow = new wxBoxSizer(wxHORIZONTAL);
	const auto backNextPair = new wxBoxSizer(wxHORIZONTAL);
    m_sizerBmpAndPage        = new wxBoxSizer( wxHORIZONTAL );
    m_sizerPage              = new wxBoxSizer( wxVERTICAL );

    m_statbmp                = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap );

    m_sizerBmpAndPage->SetMinSize( wxSize( 270, 270 ) );
    m_sizerBmpAndPage->Add( m_statbmp, 0, wxALL, 5 );
    m_sizerBmpAndPage->Add( 5, 0, 0, wxEXPAND, 0 );
    m_sizerBmpAndPage->Add( m_sizerPage, 1, wxEXPAND, 0 );

    m_btnHelp   = new wxButton( this, wxID_HELP,     _("&Help")   );
    m_btnPrev   = new wxButton( this, wxID_BACKWARD, _("< &Back") );
    m_btnNext   = new wxButton( this, wxID_FORWARD,  _("&Next >") );
    m_btnCancel = new wxButton( this, wxID_CANCEL,   _("&Cancel") );

    m_btnPrev->Enable( false );
    m_btnNext->Enable( false );

    backNextPair->Add( m_btnPrev, 0, wxBOTTOM|wxLEFT|wxTOP, 0 );
    backNextPair->Add( 10, 0, 0, wxEXPAND, 0 );
    backNextPair->Add( m_btnNext, 0, wxBOTTOM|wxRIGHT|wxTOP, 0 );

    buttonRow->Add( m_btnHelp, 0, wxALL, 5 );

    m_btnHelp->Hide();

    buttonRow->Add( backNextPair, 0, wxALL, 5 );
    buttonRow->Add( m_btnCancel, 0, wxALL, 5 );

    mainColumn->Add( m_sizerBmpAndPage, 1, wxEXPAND );
    mainColumn->Add( 0, 5, 0, wxEXPAND );
    mainColumn->Add( new wxStaticLine( this ), 0, wxEXPAND | wxALL, 5 );
	mainColumn->Add(0, 5, 0, wxEXPAND);
    mainColumn->Add( buttonRow, 0, wxALIGN_RIGHT );

    windowSizer->Add( mainColumn, 1, wxALL|wxEXPAND, 5 );

    this->SetSizer( windowSizer );
    this->Layout();
    windowSizer->Fit( this );

	m_btnHelp->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Wizard::OnHelp), nullptr,
	                   this);
	m_btnPrev->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Wizard::OnBackOrNext),
	                   nullptr, this);
	m_btnNext->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Wizard::OnBackOrNext),
	                   nullptr, this);
	m_btnCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Wizard::OnCancel),
	                     nullptr, this);

    this->Connect( wxID_ANY, wxFB_EVT_WIZARD_PAGE_CHANGED, WizardEventHandler( Wizard::OnWizEvent ) );
    this->Connect( wxID_ANY, wxFB_EVT_WIZARD_PAGE_CHANGING, WizardEventHandler( Wizard::OnWizEvent ) );
    this->Connect( wxID_ANY, wxFB_EVT_WIZARD_CANCEL, WizardEventHandler( Wizard::OnWizEvent ) );
    this->Connect( wxID_ANY, wxFB_EVT_WIZARD_FINISHED, WizardEventHandler( Wizard::OnWizEvent ) );
    this->Connect( wxID_ANY, wxFB_EVT_WIZARD_HELP, WizardEventHandler( Wizard::OnWizEvent ) );
}