AboutDialog::AboutDialog(wxWindow* parent) :
        wxDialog(parent, wxID_ANY, wxT("About")) {
            IO::FileManager fileManager;
            
            wxBitmap icon(fileManager.appendPath(fileManager.resourceDirectory(), "Icon.png"), wxBITMAP_TYPE_PNG);
            
            wxStaticBitmap* appIcon = new wxStaticBitmap(this, wxID_ANY, icon);
            wxStaticLine* appLine = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
            wxStaticText* appName = new wxStaticText(this, wxID_ANY, wxT("TrenchBroom"));
            appName->SetFont(appName->GetFont().Larger().Larger().Larger().Larger().Bold());
            
            wxStaticText* appClaim = new wxStaticText(this, wxID_ANY, wxT("A Modern Level Editor for Quake"));
            
            wxString versionStr(wxT("Version "));
            versionStr << VERSIONSTR;
            
            wxStaticText* version = new wxStaticText(this, wxID_ANY, versionStr);
            
            wxStaticText* devHeader = new wxStaticText(this, wxID_ANY, wxT("Development"));
            devHeader->SetFont(devHeader->GetFont().Bold());
            wxStaticText* devText = new wxStaticText(this, wxID_ANY, wxT("Kristian Duske"));
            
            wxStaticText* contrHeader = new wxStaticText(this, wxID_ANY, wxT("Contributions"));
            contrHeader->SetFont(contrHeader->GetFont().Bold());
            wxSizer* contrText = CreateTextSizer(wxT("Corey Jones (feedback, testing, documentation)\nAndré König (feedback, testing)\nWouter van Oortmerssen (feedback)\nHannes Kröger (testing)\nMorgan Allen (testing)\nForest Hale (fov code)\nChristian Grawert (Quake.fdg)"));
            
            wxSizer* copyright = CreateTextSizer(wxT("Copyright 2010-2013 Kristian Duske\nQuake is a registered trademark of id Software"));

            wxGridBagSizer* sizer = new wxGridBagSizer();

            int row = 0;
            sizer->Add(0, 10, wxGBPosition(row++, 1));
            sizer->AddGrowableRow(static_cast<size_t>(row - 1));
            sizer->Add(appName, wxGBPosition(row++, 1));
            sizer->Add(appLine, wxGBPosition(row++, 1), wxDefaultSpan, wxEXPAND);
            sizer->Add(appClaim, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(version, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(devHeader, wxGBPosition(row++, 1));
            sizer->Add(devText, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(contrHeader, wxGBPosition(row++, 1));
            sizer->Add(contrText, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(copyright, wxGBPosition(row++, 1));
            sizer->Add(0, 10, wxGBPosition(row++, 1));
            sizer->AddGrowableRow(static_cast<size_t>(row - 1));
            sizer->Add(appIcon, wxGBPosition(0, 0), wxGBSpan(row, 1), wxALIGN_CENTER);
            
            SetSizer(sizer);
            SetSize(650, 420);
            CenterOnParent();
            
            SetBackgroundColour(*wxWHITE);
        }
Example #2
0
////////////////////////////////////////////////////////////////////
// Method:	Constructor
// Class:	CWxOpencvAbout
// Purpose:	Initialize my about dialog
// Input:	pointer to reference window
// Output:	nothing	
////////////////////////////////////////////////////////////////////
CWxOpencvAbout::CWxOpencvAbout(wxWindow *parent)
               : wxDialog(parent, -1,
                          _("About wxOpenCv Demo"),
                          wxDefaultPosition,
                          wxDefaultSize,
                          wxDEFAULT_DIALOG_STYLE | wxCLOSE)
{
    // logo
    const wxBitmap bmp(wxImage("wxopencvabout.bmp"));

#if !defined(__WXGTK__) && !defined(__WXMOTIF__) && !defined(__WXMAC__)
    bmp.SetMask(new wxMask(bmp, *wxBLUE));
#endif
    wxStaticBitmap *sbmp = new wxStaticBitmap(this, -1, bmp);

    // layout components
	wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
  sizer->Add( sbmp, 0, wxCENTRE | wxALL, 10 );
	sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
	sizer->Add( CreateTextSizer(_("wxOpenCv Demo\n"
									"(demo of opencv with wxwidgets)\n"
									"Created by: Larry Lart\n"
									"Email To: [email protected]\n") ),
									0, wxCENTRE | wxALL, 10 );

	sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
	sizer->Add( CreateButtonSizer(wxOK), 0, wxCENTRE | wxALL, 10 );

	// activate
	SetSizer(sizer);
	SetAutoLayout(TRUE);
	sizer->SetSizeHints(this);
	sizer->Fit(this);
	Centre(wxBOTH | wxCENTRE_ON_SCREEN);
}
Example #3
0
ReconnectDialog::ReconnectDialog():
	wxDialog( (wxFrame*)&ui().mw(), -1, _( "Reconnect Dialog" ), wxDefaultPosition, wxSize( 400, 150 ), wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE ),
	WindowAttributesPickle( _T("reconnectdialog"), this, wxSize( 400, 150 ) )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	SetSizeHints( wxDefaultSize, wxDefaultSize );

	wxBoxSizer* m_main_sizer = new wxBoxSizer( wxVERTICAL );

	wxBoxSizer* m_buttons_sizer;
	m_buttons_sizer = new wxBoxSizer( wxHORIZONTAL );

	wxButton* m_retry_btn = new wxButton( this, CONNECT_RECONNECT, _( "Try Reconnecting" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_retry_btn->SetToolTip( TE( _( "Tries to connect to the next server in the list." ) ) );
	m_buttons_sizer->Add( m_retry_btn, 0, wxALL, 5 );

	wxButton* m_next_btn = new wxButton( this, CONNECT_NEXT, _( "Try Next Server" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_next_btn->SetToolTip( TE( _( "Tries to connect to the next server in the list." ) ) );
	m_buttons_sizer->Add( m_next_btn, 0, wxALL, 5 );

	wxButton* m_cancel_btn = new wxButton( this, CONNECT_CANCEL, _( "Do nothing" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_buttons_sizer->Add( m_cancel_btn, 0, wxALL, 5 );

	m_main_sizer->Add( CreateTextSizer( _( "Couldn't estabilish a connection with the server\nWhat would you like to do?" ) ), 1, wxALL | wxEXPAND | wxCENTER, 10 );
	m_main_sizer->Add( m_buttons_sizer, 1, wxALL | wxEXPAND | wxCENTER, 10 );

	SetSizer( m_main_sizer );
	SetAutoLayout( true );
	Raise();
	m_next_btn->SetFocus();
	ConnectGlobalEvent(this, GlobalEvent::OnQuit, wxObjectEventFunction(&ReconnectDialog::OnQuit));
}
Example #4
0
wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent,
                                         const wxString& message,
                                         const wxString& prompt,
                                         const wxString& caption,
                                         long value,
                                         long min,
                                         long max,
                                         const wxPoint& pos)
                   : wxDialog(parent, wxID_ANY, caption,
                              pos, wxDefaultSize)
{
    m_value = value;
    m_max = max;
    m_min = min;

    wxBeginBusyCursor();

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
#if wxUSE_STATTEXT
    // 1) text message
    topsizer->Add( CreateTextSizer( message ), 0, wxALL, 10 );
#endif

    // 2) prompt and text ctrl
    wxBoxSizer *inputsizer = new wxBoxSizer( wxHORIZONTAL );

#if wxUSE_STATTEXT
    // prompt if any
    if (!prompt.empty())
        inputsizer->Add( new wxStaticText( this, wxID_ANY, prompt ), 0, wxCENTER | wxLEFT, 10 );
#endif

    // spin ctrl
    wxString valStr;
    valStr.Printf(wxT("%ld"), m_value);
    m_spinctrl = new wxSpinCtrl(this, wxID_ANY, valStr, wxDefaultPosition, wxSize( 140, wxDefaultCoord ), wxSP_ARROW_KEYS, (int)m_min, (int)m_max, (int)m_value);
    inputsizer->Add( m_spinctrl, 1, wxCENTER | wxLEFT | wxRIGHT, 10 );
    // add both
    topsizer->Add( inputsizer, 0, wxEXPAND | wxLEFT|wxRIGHT, 5 );

    // 3) buttons if any
    wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
    if ( buttonSizer )
    {
        topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
    }

    SetSizer( topsizer );
    SetAutoLayout( true );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );

    Centre( wxBOTH );

    m_spinctrl->SetSelection(-1, -1);
    m_spinctrl->SetFocus();

    wxEndBusyCursor();
}
Example #5
0
wxExSTCEntryDialog::wxExSTCEntryDialog(wxWindow* parent,
  const wxString& caption,
  const wxString& text,
  const wxString& prompt,
  long button_style,
  bool use_shell,
  wxWindowID id,
  const wxPoint& pos,
  const wxSize& size, 
  long style,
  const wxString& name)
  : wxExDialog(parent, caption, button_style, id, pos, size, style, name)
  , m_Process(NULL)
{
  if (!prompt.empty())
  {
    AddUserSizer(CreateTextSizer(prompt), wxSizerFlags().Center());
  }

  wxPersistentRegisterAndRestore(this);

  m_STC =  (use_shell ?
    new wxExSTCShell(this, text, wxEmptyString, true, -1, wxEmptyString, wxExSTC::STC_MENU_DEFAULT):
    new wxExSTC(this, text));
  
  m_STC->SetEdgeMode(wxSTC_EDGE_NONE);
  m_STC->ResetMargins();
  m_STC->SetViewEOL(false);
  m_STC->SetViewWhiteSpace(wxSTC_WS_INVISIBLE);

  AddUserSizer(m_STC);

  LayoutSizers();
}
Example #6
0
void wxGenericMessageDialog::DoCreateMsgdialog()
{
    wxDialog::Create(m_parent, wxID_ANY, m_caption, m_pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);

    bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

    wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );

#if wxUSE_STATBMP
    // 1) icon
    if (m_dialogStyle & wxICON_MASK)
    {
        wxStaticBitmap *icon = new wxStaticBitmap
        (
            this,
            wxID_ANY,
            wxArtProvider::GetMessageBoxIcon(m_dialogStyle)
        );
        if (is_pda)
            topsizer->Add( icon, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
        else
            icon_text->Add( icon, 0, wxCENTER );
    }
#endif // wxUSE_STATBMP

#if wxUSE_STATTEXT
    // 2) text
    icon_text->Add( CreateTextSizer( GetFullMessage() ), 0, wxALIGN_CENTER | wxLEFT, 10 );

    topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif // wxUSE_STATTEXT

    // 3) buttons
    int center_flag = wxEXPAND;
    if (m_dialogStyle & wxYES_NO)
        center_flag = wxALIGN_CENTRE;
    wxSizer *sizerBtn = CreateSeparatedButtonSizer
                        (
                            m_dialogStyle & (wxOK | wxCANCEL | wxYES_NO |
                                    wxNO_DEFAULT | wxCANCEL_DEFAULT)
                        );
    if ( sizerBtn )
        topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10 );

    SetAutoLayout( true );
    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );
    wxSize size( GetSize() );
    if (size.x < size.y*3/2)
    {
        size.x = size.y*3/2;
        SetSize( size );
    }

    Centre( wxBOTH | wxCENTER_FRAME);
}
//! SIzers (layout) initialization.
void NanocompAboutDialog::initSizers()
{
    wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
    sizer->Add( logo, 0, wxCENTRE | wxALL, 10 );

    sizer->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 5 );

    wxString message = _("NanoComp version 1.0\n\n\
(c) 2006 Bernat Rafales Mulet\n\n\
<*****@*****.**>");

    sizer->Add( CreateTextSizer(message) , 0, wxCENTRE | wxALL, 20 );


    sizer->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 5 );


    sizer->Add( CreateButtonSizer(wxOK), 0, wxCENTRE | wxALL, 10 );

    SetSizer(sizer);

    sizer->SetSizeHints(this);
    sizer->Fit(this);
    Centre(wxBOTH | wxCENTRE_ON_SCREEN);    
}
EditServerListDlg::EditServerListDlg(wxWindow *parent,
                                     const wxString& caption,
                                     const wxString& message,
				     const wxString& filename) : wxDialog(parent, -1, caption,
								      wxDefaultPosition, wxSize(400,200),
								      wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
  m_file = filename;

  wxBeginBusyCursor();

  wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

  topsizer->Add( CreateTextSizer( message ), 0, wxALL, 10 );

  m_textctrl = new wxTextCtrl(this, -1, wxEmptyString,
			      wxDefaultPosition,
			      wxDefaultSize,
			      wxTE_MULTILINE);
  topsizer->Add( m_textctrl, 1, wxEXPAND | wxLEFT|wxRIGHT, 15 );

  topsizer->Add( CreateButtonSizer( wxOK | wxCANCEL ), 0, wxCENTRE | wxALL, 10 );

  SetAutoLayout( TRUE );
  SetSizer( topsizer );

  Centre( wxBOTH );

  if (wxFile::Exists(filename))
	m_textctrl->LoadFile(filename);

  m_textctrl->SetFocus();

  wxEndBusyCursor();
}
Example #9
0
bool wxAnyChoiceDialog::Create(wxWindow *parent,
                               const wxString& message,
                               const wxString& caption,
                               int n, const wxString *choices,
                               long styleDlg,
                               const wxPoint& pos,
                               long styleLbox)
{
#ifdef __WXMAC__
    // FIXME: why??
    if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) )
        return false;
#else
    if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) )
        return false;
#endif

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

    // 1) text message
    topsizer->
        Add(CreateTextSizer(message), wxSizerFlags().Expand().TripleBorder());

    // 2) list box
    m_listbox = CreateList(n, choices, styleLbox);

    if ( n > 0 )
        m_listbox->SetSelection(0);

    topsizer->
        Add(m_listbox, wxSizerFlags().Expand().TripleBorder(wxLEFT | wxRIGHT));

    // 3) buttons if any
    wxSizer *
        buttonSizer = CreateSeparatedButtonSizer(styleDlg & ButtonSizerFlags);
    if ( buttonSizer )
    {
        topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
    }

    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );

    if ( styleDlg & wxCENTRE )
        Centre(wxBOTH);

    m_listbox->SetFocus();

    return true;
}
Example #10
0
ClientCrashDlg::ClientCrashDlg(double timeDiff) : wxDialog( NULL, wxID_ANY, wxT(""), wxDefaultPosition ) {
    wxString            strDialogTitle = wxEmptyString;
    wxString            strDialogMessage = wxEmptyString;
    int                 minutes = wxMax((int)((timeDiff + 59.) / 60.), 2);
    CSkinAdvanced*      pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
    wxASSERT(pSkinAdvanced);
    
    // %s is the application name
    //    i.e. 'BOINC Manager', 'GridRepublic Manager'
    strDialogTitle.Printf(
        _("%s - Unexpected Exit"),
        pSkinAdvanced->GetApplicationName().c_str()
    );
    SetTitle(strDialogTitle.c_str());

    // 1st %s is the application name
    //    i.e. 'BOINC Manager', 'GridRepublic Manager'
    // 2st %s is the project name
    //    i.e. 'BOINC', 'GridRepublic'
    strDialogMessage.Printf(
        _("The %s client has exited unexpectedly 3 times within the last %d minutes.\nWould you like to restart it again?"),
        pSkinAdvanced->GetApplicationShortName().c_str(),
        minutes        
    );
            
    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
    wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );

    icon_text->Add( CreateTextSizer( strDialogMessage ), 0, wxALIGN_CENTER | wxLEFT, 10 );
    topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
    
    wxStdDialogButtonSizer *sizerBtn = CreateStdDialogButtonSizer(wxYES | wxNO | wxHELP);
    SetEscapeId(wxID_NO);   // Changes return value of NO button to wxID_CANCEL
    
    if ( sizerBtn )
        topsizer->Add(sizerBtn, 0, wxEXPAND | wxALL, 10 );

    SetAutoLayout( true );
    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );
    wxSize size( GetSize() );
    if (size.x < size.y*3/2)
    {
        size.x = size.y*3/2;
        SetSize( size );
    }

    Centre( wxBOTH | wxCENTER_FRAME);
}
Example #11
0
wxCustomEntryDialog::wxCustomEntryDialog(wxWindow *parent,
                                         const wxString& message,
                                         const wxString& caption,
                                         const wxPoint& pos)
                   : wxDialog(parent, wxID_ANY, caption,
				   pos, wxDefaultSize,wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX | wxRESIZE_BORDER)
{

	this->SetMinSize(FromDIP(wxSize(320,320)));
    wxBeginBusyCursor();

	wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );
#if wxUSE_STATTEXT
    // 1) text message
    topsizer->Add( CreateTextSizer( message ), 0, wxALL, 10 );
#endif

    // 2) prompt and text ctrl
	wxBoxSizer* vinputsizer = new wxBoxSizer(wxHORIZONTAL);

	//vinputsizer->SetVGap(5);
	//vinputsizer->SetHGap(5);

	topsizer->Add( vinputsizer, 1, wxEXPAND | wxTOP|wxBOTTOM, 5 );

    // 3) buttons if any
    wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
    if ( buttonSizer )
    {
        topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
    }

	PropGrid* newGrid=new PropGrid(this,wxCustomEntryDialog::CUSTOM_DIALOG_CTRLS_GRID);
	vinputsizer->Add( newGrid,1,wxEXPAND);
	//newGrid->SetMinSize(FromDIP(wxSize(300,200)));
	//newGrid->AppendCols();
	newGrid->SetColLabelValue(0,_("Value"));
	newGrid->SetColLabelAlignment(wxVERTICAL,wxALIGN_LEFT);

    SetSizer( topsizer );
    SetAutoLayout( true );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );

    Centre( wxBOTH );



    wxEndBusyCursor();
}
AsyncRPCDlg::AsyncRPCDlg() : wxDialog( NULL, wxID_ANY, wxT(""), wxDefaultPosition ) {
    CSkinAdvanced*  pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
    wxString exit_label;
    wxASSERT(pSkinAdvanced);

    wxString message = wxString(_("Communicating with BOINC client.  Please wait ..."));
    
#ifdef __WXMAC__
    exit_label.Printf(_("&Quit %s"), pSkinAdvanced->GetApplicationName().c_str());
#else
    exit_label.Printf(_("E&xit %s"), pSkinAdvanced->GetApplicationName().c_str());
#endif

    wxString strCaption;
    strCaption.Printf(_("%s - Communication"), pSkinAdvanced->GetApplicationName().c_str());
    SetTitle(strCaption.c_str());

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
    wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );

    icon_text->Add( CreateTextSizer( message ), 0, wxALIGN_CENTER | wxLEFT, 10 );
    topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
    
    wxStdDialogButtonSizer *sizerBtn = CreateStdDialogButtonSizer(0);
    
    wxButton* exitbutton = new wxButton;
    exitbutton->Create( this, wxID_EXIT, exit_label, wxDefaultPosition, wxDefaultSize, 0 );
    sizerBtn->Add(exitbutton, 0, wxLEFT|wxRIGHT|wxALL, 5);

    wxButton* cancelbutton = new wxButton;
    cancelbutton->Create( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
    sizerBtn->Add(cancelbutton, 0, wxLEFT|wxRIGHT|wxALL, 5);
    
    if ( sizerBtn )
        topsizer->Add(sizerBtn, 0, wxEXPAND | wxALL, 10 );

    SetAutoLayout( true );
    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );
    wxSize size( GetSize() );
    if (size.x < size.y*3/2)
    {
        size.x = size.y*3/2;
        SetSize( size );
    }

    Centre( wxBOTH | wxCENTER_FRAME);
}
Example #13
0
bool wxAnyChoiceDialog::Create(wxWindow *parent,
                               const wxString& message,
                               const wxString& caption,
                               int n, const wxString *choices,
                               long styleDlg,
                               const wxPoint& pos,
                               long styleLbox)
{
    // extract the buttons styles from the dialog one and remove them from it
    const long styleBtns = styleDlg & (wxOK | wxCANCEL);
    styleDlg &= ~styleBtns;

    if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) )
        return false;

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

    // 1) text message
    topsizer->
        Add(CreateTextSizer(message), wxSizerFlags().Expand().TripleBorder());

    // 2) list box
    m_listbox = CreateList(n, choices, styleLbox);

    if ( n > 0 )
        m_listbox->SetSelection(0);

    topsizer->
        Add(m_listbox, wxSizerFlags().Expand().Proportion(1).TripleBorder(wxLEFT | wxRIGHT));

    // 3) buttons if any
    wxSizer *
        buttonSizer = CreateSeparatedButtonSizer(styleBtns);
    if ( buttonSizer )
    {
        topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
    }

    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );

    if ( styleDlg & wxCENTRE )
        Centre(wxBOTH);

    m_listbox->SetFocus();

    return true;
}
Example #14
0
wxMessageDialogEx::wxMessageDialogEx( wxWindow *parent, const wxString& message, const wxString &caption,
    long style, const wxPoint& position) :
    wxDialog( parent, -1, caption, position, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
{
    m_dialogStyle = style;

    wxBeginBusyCursor();

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

    wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );

    // 1) icon
    if (style & wxICON_MASK)
    {
         wxStaticBitmap *icon = new wxStaticBitmap(
            this, -1, wxTheApp->GetStdIcon((int)(style & wxICON_MASK)));
         icon_text->Add( icon, 0, wxCENTER );
    }

    // 2) text
    icon_text->Add( CreateTextSizer( message ), 0, wxCENTER | wxLEFT, 10 );

    topsizer->Add( icon_text, 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );

#if wxUSE_STATLINE
    // 3) static line
    topsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif

    // 4) buttons
    topsizer->Add( CreateButtonSizer( style ), 0, wxCENTRE | wxALL, 10 );

    SetAutoLayout( TRUE );
    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );
    wxSize size( GetSize() );
    if (size.x < size.y*3/2)
    {
        size.x = size.y*3/2;
        SetSize( size );
    }

    Centre( wxBOTH | wxCENTER_FRAME);

    wxEndBusyCursor();
}
Example #15
0
MultiLineDialog::MultiLineDialog(wxWindow *parent,
                                 const wxString& caption,
                                 const wxString& message,
                                 const wxString& value)
     : wxDialog(GetParentForModalDialog(parent, wxOK | wxCANCEL),
                wxID_ANY, caption, wxDefaultPosition, wxDefaultSize,
                wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
    wxBeginBusyCursor();

    wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );

    wxSizerFlags flagsBorder2;
    flagsBorder2.DoubleBorder();

    topsizer->Add(CreateTextSizer(message), flagsBorder2);

    m_textctrl = new wxTextCtrl(this, wxID_ANY, value,
                                wxDefaultPosition, wxSize(100,50), wxTE_MULTILINE | wxTE_PROCESS_TAB);
    #ifdef __WXMAC__
        // need bigger font on Mac, and need to specify facename to get Monaco instead of Courier
        wxFont font(12, wxMODERN, wxNORMAL, wxNORMAL, false, wxT("Monaco"));
    #else
        wxFont font(10, wxTELETYPE, wxFONTSTYLE_NORMAL, wxNORMAL, false, _T("Monospace"), wxFONTENCODING_DEFAULT);
    #endif
    m_textctrl->SetFont(font);
    
    // allow people to use small dialog if they wish
    // m_textctrl->SetMinSize(wxSize(800,500));

    topsizer->Add(m_textctrl, wxSizerFlags(1).Expand().TripleBorder(wxLEFT | wxRIGHT));

    wxSizer* buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
    topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand());

    SetAutoLayout(true);
    SetSizer(topsizer);

    topsizer->SetSizeHints(this);
    topsizer->Fit(this);

    m_textctrl->SetFocus();
    m_textctrl->SetSelection(0,0);      // probably nicer not to select all text

    wxEndBusyCursor();
}
Example #16
0
PasteDialog::PasteDialog(wxWindow* parent, const wxString& message)
    : wxDialog(parent, -1, _("Flood warning"), wxDefaultPosition, wxDefaultSize, wxFRAME_FLOAT_ON_PARENT | wxDEFAULT_DIALOG_STYLE)
{
	wxIcon mainIcon = wxIcon();
	mainIcon.CopyFromBitmap(IconsCollection::Instance()->BMP_SPRINGLOBBY);
	SetIcon(mainIcon);

	//******** copied from wxsource/generic/msgdlgg.cpp with small modifications***********************************************************
	m_main_sizer = new wxBoxSizer(wxVERTICAL);

	wxBoxSizer* icon_text = new wxBoxSizer(wxHORIZONTAL);

	wxBitmap bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX);

	wxStaticBitmap* info_icon = new wxStaticBitmap(this, wxID_ANY, bitmap);
	icon_text->Add(info_icon, 0, wxCENTER);

	// 2) text
	icon_text->Add(CreateTextSizer(message), 0, wxALIGN_TOP | wxLEFT, 10);

	m_main_sizer->Add(icon_text, 1, wxCENTER | wxLEFT | wxRIGHT | wxTOP, 10);
	m_main_sizer->Add(0, 10);

	// 3) buttons
	wxSizer* sizerBtn = CreateButtonSizer(wxYES_NO);
	if (sizerBtn) {
		wxButton* but = new wxButton(this, ID_PASTE_BUTTON, _("Use pastebin"));
		sizerBtn->Add(but, 0, wxALL, 10);
		m_main_sizer->Add(sizerBtn, 0, wxALIGN_CENTRE | wxALL, 10);
		but->SetFocus();
	}


	SetAutoLayout(true);
	SetSizer(m_main_sizer);

	m_main_sizer->SetSizeHints(this);
	m_main_sizer->Fit(this);

	Centre(wxBOTH | wxCENTER_FRAME);
	/***************************************************************************************************/
}
Example #17
0
////////////////////////////////////////////////////////////////////
// Method:	Constructor
// Class:	CX10PingAbout
// Purpose:	Initialize my about dialog
// Input:	pointer to reference window
// Output:	nothing	
////////////////////////////////////////////////////////////////////
CX10PingAbout::CX10PingAbout(wxWindow *parent)
               : wxDialog(parent, -1,
                          _("About X10Ping"),
                          wxDefaultPosition,
                          wxDefaultSize,
                          wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
{
// comment gpahic logo for now
    // logo
    wxBitmap bmp(wxBITMAP(IMG_X10PINGABOUT));
//	bmp.LoadFile( "x10pingabout.bmp", wxBITMAP_TYPE_BMP );
#if !defined(__WXGTK__) && !defined(__WXMOTIF__) && !defined(__WXMAC__)
    bmp.SetMask(new wxMask(bmp, *wxBLUE));
#endif
    wxStaticBitmap *sbmp = new wxStaticBitmap(this, -1, bmp);


    // layout components
	wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
    sizer->Add( sbmp, 0, wxCENTRE | wxALL, 10 );
	sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
	sizer->Add( CreateTextSizer(_("X10Ping version 1.560\n"
									"(X10 Ping Network Monitoring Tool)\n"
									"Created by: Larry Lart\n"
									"Email To: [email protected]\n"
									" \n\n"
									" (c) 2006-2007 Larry Lart")),
									0, wxCENTRE | wxALL, 10 );

	sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
	sizer->Add( CreateButtonSizer(wxOK), 0, wxCENTRE | wxALL, 10 );

	// activate
	SetSizer(sizer);
	SetAutoLayout(TRUE);
	sizer->SetSizeHints(this);
	sizer->Fit(this);
	Centre(wxBOTH | wxCENTRE_ON_SCREEN);
}
Example #18
0
RainExceptionDialog::RainExceptionDialog(wxWindow *parent, RainException *pException)
  : wxDialog(parent, wxID_ANY, wxT("Error"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
  , m_pDetailList(0), m_bShowingDetails(false), m_pDetailsBtn(0), m_pStaticLine(0), m_pSaveBtn(0)
{
  for(RainException *e = pException; e; e = e->getPrevious())
  {
    m_aMessages.Add(e->getMessage());
    m_aFiles.Add(e->getFile());
    m_aLines.Add(e->getLine());
  }

  wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
  wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL);
  wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL);

  wxButton *btnOk = new wxButton(this, wxID_OK);
  sizerButtons->Add(btnOk, 0, wxCENTRE | wxBOTTOM, 5);
  m_pDetailsBtn = new wxButton(this, wxID_MORE, wxT("&Details >>"));
  sizerButtons->Add(m_pDetailsBtn, 0,wxCENTRE | wxTOP, 4);

  wxBitmap bitmap = wxArtProvider::GetBitmap(wxART_ERROR, wxART_MESSAGE_BOX);
  sizerAll->Add(new wxStaticBitmap(this, wxID_ANY, bitmap), 0, wxALIGN_CENTRE_VERTICAL);

  sizerAll->Add(CreateTextSizer(pException->getMessage()), 1, wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT, 10);
  sizerAll->Add(sizerButtons, 0, wxALIGN_RIGHT | wxLEFT, 10);
  sizerTop->Add(sizerAll, 0, wxALL | wxEXPAND, 10);

  SetSizer(sizerTop);

  wxSize size = sizerTop->Fit(this);
  m_maxHeight = size.y;
  SetSizeHints(size.x, size.y, m_maxWidth, m_maxHeight);

  btnOk->SetFocus();
  Centre();
}
Example #19
0
wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
                                                const wxString& message,
                                                const wxString& caption,
                                                long style,
                                                const wxPoint& pos)
                      : wxDialog( parent, wxID_ANY, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
{
    SetMessageDialogStyle(style);

    bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

    wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );

#if wxUSE_STATBMP
    // 1) icon
    if (style & wxICON_MASK)
    {
        wxBitmap bitmap;
        switch ( style & wxICON_MASK )
        {
            default:
                wxFAIL_MSG(_T("incorrect log style"));
                // fall through

            case wxICON_ERROR:
                bitmap = wxArtProvider::GetIcon(wxART_ERROR, wxART_MESSAGE_BOX);
                break;

            case wxICON_INFORMATION:
                bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX);
                break;

            case wxICON_WARNING:
                bitmap = wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX);
                break;

            case wxICON_QUESTION:
                bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX);
                break;
        }
        wxStaticBitmap *icon = new wxStaticBitmap(this, wxID_ANY, bitmap);
        if (is_pda)
            topsizer->Add( icon, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
        else
            icon_text->Add( icon, 0, wxCENTER );
    }
#endif // wxUSE_STATBMP

#if wxUSE_STATTEXT
    // 2) text
    icon_text->Add( CreateTextSizer( message ), 0, wxALIGN_CENTER | wxLEFT, 10 );

    topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif // wxUSE_STATTEXT

    // 3) buttons
    int center_flag = wxEXPAND;
    if (style & wxYES_NO)
        center_flag = wxALIGN_CENTRE;
    wxSizer *sizerBtn = CreateSeparatedButtonSizer(style & ButtonSizerFlags);
    if ( sizerBtn )
        topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10 );

    SetAutoLayout( true );
    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );
    wxSize size( GetSize() );
    if (size.x < size.y*3/2)
    {
        size.x = size.y*3/2;
        SetSize( size );
    }

    Centre( wxBOTH | wxCENTER_FRAME);
}
Example #20
0
wxExSTCEntryDialog::wxExSTCEntryDialog(wxWindow* parent,
  const wxString& caption,
  const wxString& text,
  const wxString& prompt,
  long button_style,
  bool use_shell,
  wxWindowID id,
  const wxPoint& pos,
  const wxSize& size, 
  long style,
  const wxString& name)
  : wxExDialog(parent, caption, button_style, id, pos, size, style, name)
  , m_Process(NULL)
{
#if wxUSE_STATTEXT
  if (!prompt.empty())
  {
    // See wxWidgets: src\generic\textdlgg.cpp, use similar bottom border flags.
    AddUserSizer(CreateTextSizer(prompt), 
      wxSizerFlags().DoubleBorder(wxBOTTOM));
  }
#endif

  wxPersistentRegisterAndRestore(this);

  m_STC = (use_shell ?
    new wxExSTCShell(this, text, wxEmptyString, true, -1, wxEmptyString,
      wxExSTC::STC_MENU_DEFAULT | wxExSTC::STC_MENU_OPEN_LINK):
    new wxExSTC(this, text));
  
  m_STC->SetEdgeMode(wxSTC_EDGE_NONE);
  m_STC->ResetMargins();
  m_STC->SetViewEOL(false);
  m_STC->SetViewWhiteSpace(wxSTC_WS_INVISIBLE);

  AddUserSizer(m_STC);

  LayoutSizers();
  
  Bind(wxEVT_CLOSE_WINDOW, [=](wxCloseEvent& event){
    if (m_Process != NULL)
    {
      if (m_Process->IsRunning())
      {
        m_Process->Kill();
      }
    }});

  Bind(wxEVT_BUTTON, [=](wxCommandEvent& event) {
      if (m_Process != NULL)
      {
        if (m_Process->IsRunning())
        {
          m_Process->Kill();
        }
      }
      event.Skip();}, wxID_OK);
  
  Bind(wxEVT_MENU, [=](wxCommandEvent& event) {
      wxPostEvent(wxTheApp->GetTopWindow(), event);}, wxID_FIND);
  Bind(wxEVT_MENU, [=](wxCommandEvent& event) {
      wxPostEvent(wxTheApp->GetTopWindow(), event);}, wxID_REPLACE);
}
Example #21
0
wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
                                     const wxString& message,
                                     const wxString& caption,
                                     const wxString& value,
                                     long style,
                                     const wxPoint& pos)
                 : wxDialog(GetParentForModalDialog(parent),
                            wxID_ANY, caption, pos, wxDefaultSize,
                            wxDEFAULT_DIALOG_STYLE),
                   m_value(value)
{
    m_dialogStyle = style;
    m_value = value;

    wxBeginBusyCursor();

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

    wxSizerFlags flagsBorder2;
    flagsBorder2.DoubleBorder();

#if wxUSE_STATTEXT
    // 1) text message
    topsizer->Add(CreateTextSizer(message), flagsBorder2);
#endif

    // 2) text ctrl
    m_textctrl = new wxTextCtrl(this, wxID_TEXT, value,
                                wxDefaultPosition, wxSize(300, wxDefaultCoord),
                                style & ~wxTextEntryDialogStyle);

    topsizer->Add(m_textctrl,
                  wxSizerFlags(style & wxTE_MULTILINE ? 1 : 0).
                    Expand().
                    TripleBorder(wxLEFT | wxRIGHT));

#if wxUSE_VALIDATORS
    wxTextValidator validator( wxFILTER_NONE, &m_value );
    m_textctrl->SetValidator( validator );
#endif // wxUSE_VALIDATORS

    // 3) buttons if any
    wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & ButtonSizerFlags);
    if ( buttonSizer )
    {
        topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand());
    }

    SetAutoLayout( true );
    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );

    if ( style & wxCENTRE )
        Centre( wxBOTH );

    m_textctrl->SetSelection(-1, -1);
    m_textctrl->SetFocus();

    wxEndBusyCursor();
}
Example #22
0
void wxExConfigDialog::Layout(int rows, int cols, int bookctrl_style)
{
  if (m_ConfigItems.empty())
  {
    AddUserSizer(CreateTextSizer(
      _("No further info available")),
      wxSizerFlags().Center());
    LayoutSizers();
    return;
  }
  
  bool first_time = true;
  wxFlexGridSizer* sizer = NULL;
  wxFlexGridSizer* previous_item_sizer = NULL;
  int previous_item_type = -1;
  
  wxBookCtrlBase* bookctrl = NULL;
  
  if (!m_ConfigItems.begin()->GetPage().empty())
  {
    switch (bookctrl_style)
    {
    case CONFIG_AUINOTEBOOK:
      bookctrl = new wxAuiNotebook(this);
      break;

    case CONFIG_CHOICEBOOK:
      bookctrl = new wxChoicebook(this, wxID_ANY);
      break;

    case CONFIG_LISTBOOK:
      bookctrl = new wxListbook(this, wxID_ANY);
      break;

    case CONFIG_NOTEBOOK:
      bookctrl = new wxNotebook(this, wxID_ANY);
      break;

    case CONFIG_TOOLBOOK:
      bookctrl = new wxToolbook(this, wxID_ANY);
      break;

    case CONFIG_TREEBOOK:
      bookctrl = new wxTreebook(this, wxID_ANY);
      break;

    default:
      wxFAIL;  
    }
  }
       
  wxString previous_page = "XXXXXX";

  for (
#ifdef wxExUSE_CPP0X	
    auto it = m_ConfigItems.begin();
#else
    std::vector<wxExConfigItem>::iterator it = m_ConfigItems.begin();
#endif	
    it != m_ConfigItems.end();
    ++it)
  {
    if (first_time ||
       (it->GetPage() != previous_page && !it->GetPage().empty()))
    {
      first_time = false;

      if (bookctrl != NULL)
      {
        // Finish the current page.
        if (bookctrl->GetCurrentPage() != NULL)
        {
          bookctrl->GetCurrentPage()->SetSizer(sizer);
        }

        // And make a new one.
        bookctrl->AddPage(
          new wxWindow(bookctrl, wxID_ANY), it->GetPage(), true); // select
      }

      previous_page = it->GetPage();

      const int use_cols = (it->GetColumns() != -1 ? it->GetColumns(): cols);

      sizer = (rows != 0 ? 
        new wxFlexGridSizer(rows, use_cols, 0, 0):
        new wxFlexGridSizer(use_cols));

      for (int i = 0; i < use_cols; i++)
      {
        sizer->AddGrowableCol(i);
      }
    }

    wxFlexGridSizer* use_item_sizer = (it->GetType() == previous_item_type ?
      previous_item_sizer: NULL);

    // Layout the config item.
    previous_item_sizer = it->Layout(
      (bookctrl != NULL ? bookctrl->GetCurrentPage(): this), 
      sizer, 
      GetButtonFlags() == wxCANCEL,
      use_item_sizer);

    previous_item_type = it->GetType();

    if (
      it->GetType() == CONFIG_BUTTON ||
      it->GetType() == CONFIG_COMBOBOXDIR)
    {
      Bind(
        wxEVT_COMMAND_BUTTON_CLICKED, 
        &wxExConfigDialog::OnCommand, 
        this, 
        it->GetWindow()->GetId());
    }

    if (sizer != NULL &&
        sizer->GetEffectiveRowsCount() >= 1 &&
       !sizer->IsRowGrowable(sizer->GetEffectiveRowsCount() - 1) &&
        it->IsRowGrowable())
    {
      sizer->AddGrowableRow(sizer->GetEffectiveRowsCount() - 1);
    }
  }

  if (bookctrl != NULL)
  {
    bookctrl->GetCurrentPage()->SetSizer(sizer);
    bookctrl->SetName("book" + GetName());

    if (!wxPersistenceManager::Get().RegisterAndRestore(bookctrl))
    {
      // nothing was restored, so choose the default page ourselves
      bookctrl->SetSelection(0);
    }

    AddUserSizer(bookctrl);
  }
  else
  {
    AddUserSizer(sizer);
  }

  LayoutSizers(bookctrl == NULL); // add separator line if no bookctrl
}
Example #23
0
wxSizer *wxDialogBase::CreateTextSizer(const wxString& message)
{
    wxTextSizerWrapper wrapper(this);

    return CreateTextSizer(message, wrapper);
}
Example #24
0
wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent,
                                         const wxString& message,
                                         const wxString& prompt,
                                         const wxString& caption,
                                         long value,
                                         long min,
                                         long max,
                                         const wxPoint& pos)
                   : wxDialog(parent, wxID_ANY, caption,
                              pos, wxDefaultSize)
{
    m_value = value;
    m_max = max;
    m_min = min;

    wxBeginBusyCursor();

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
#if wxUSE_STATTEXT
    // 1) text message
    topsizer->Add( CreateTextSizer( message ), 0, wxALL, 10 );
#endif        

    // 2) prompt and text ctrl
    wxBoxSizer *inputsizer = new wxBoxSizer( wxHORIZONTAL );

#if wxUSE_STATTEXT
    // prompt if any
    if (!prompt.IsEmpty())
        inputsizer->Add( new wxStaticText( this, wxID_ANY, prompt ), 0, wxCENTER | wxLEFT, 10 );
#endif
        
    // spin ctrl
    wxString valStr;
    valStr.Printf(wxT("%ld"), m_value);
    m_spinctrl = new wxSpinCtrl(this, wxID_ANY, valStr, wxDefaultPosition, wxSize( 140, wxDefaultCoord ) );
#if wxUSE_SPINCTRL
    m_spinctrl->SetRange((int)m_min, (int)m_max);
#endif
    inputsizer->Add( m_spinctrl, 1, wxCENTER | wxLEFT | wxRIGHT, 10 );
    // add both
    topsizer->Add( inputsizer, 1, wxEXPAND | wxLEFT|wxRIGHT, 5 );

    // smart phones does not support or do not waste space for wxButtons
#ifdef __SMARTPHONE__

    SetRightMenu(wxID_CANCEL, _("Cancel"));

#else // __SMARTPHONE__/!__SMARTPHONE__

#if wxUSE_STATLINE
    // 3) static line
    topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif

    // 4) buttons
    topsizer->Add( CreateButtonSizer( wxOK|wxCANCEL ), 0, wxEXPAND | wxALL, 10 );

#endif // !__SMARTPHONE__

    SetSizer( topsizer );
    SetAutoLayout( true );

#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
    topsizer->SetSizeHints( this );
    topsizer->Fit( this );

    Centre( wxBOTH );
#endif

    m_spinctrl->SetSelection(-1, -1);
    m_spinctrl->SetFocus();

    wxEndBusyCursor();
}
checkbox_message_dialog::checkbox_message_dialog( wxWindow *parent,
                                                  const wxString& message,
                                                  const wxString& caption,
                                                  long style,
                                                  const wxPoint& pos,
                                                  const wxString& checkbox_caption, 
                                                  const wxString& config_path_to_show_key,
                                                  bool default_check_checkbox_if_key_not_found_in_config )
                      : wxDialog( parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
{
    m_dialogStyle = style;
    m_config_path_to_show_key = config_path_to_show_key;

    wxBoxSizer *root_sizer = new wxBoxSizer( wxVERTICAL );

    wxBoxSizer *icon_and_text_sizer = new wxBoxSizer( wxHORIZONTAL );

    // 1) icon
    if ( style & wxICON_MASK )
    {
         wxStaticBitmap *icon = new wxStaticBitmap( this, -1,
                                    wxArtProvider::GetBitmap( wxART_QUESTION, wxART_MESSAGE_BOX )
                                                   );
         icon_and_text_sizer->Add( icon, 0, wxCENTER );
    }

    // 2) text
    icon_and_text_sizer->Add( CreateTextSizer( message ), 0, wxCENTER | wxLEFT, 10 );

    root_sizer->Add( icon_and_text_sizer, 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );

    // 3) Add the checkbox ( already defined in the class definition, so
    // just m_checkbox, not wxCheckbox *m_checkbox.
    m_checkbox = new wxCheckBox( this, ID_SHOW_CHECKBOX, checkbox_caption );
    root_sizer->Add( m_checkbox, 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );

    // 4) buttons
    root_sizer->Add( CreateButtonSizer( style ), 0, wxCENTRE | wxALL, 10 );

    // Have the passed initial value for the checkbox, if it is not in config...
    long default_check_long = (long)default_check_checkbox_if_key_not_found_in_config;   
    bool dialog_checkbox_value = FALSE; 
    // ... and if there is an active config object (FALSE means don't create on demand)
    if ( wxConfigBase::Get( FALSE ) )
    {
        // ..read the key, using the default_check_long value if key not exist
        dialog_checkbox_value = wxConfigBase::Get()->Read( config_path_to_show_key, 
                                                           default_check_long );
    }
    // ..and set the checkbox to that initial value
    m_checkbox->SetValue( dialog_checkbox_value );

    SetAutoLayout( TRUE );
    SetSizer( root_sizer );

    root_sizer->SetSizeHints( this );
    root_sizer->Fit( this );
    wxSize size( GetSize() );
    if (size.x < size.y*3/2)
    {
        size.x = size.y*3/2;
        SetSize( size );
    }

    Centre( wxBOTH | wxCENTER_FRAME);
}
Example #26
0
TimedMessageBox::TimedMessageBox(int whichIcon, wxWindow* parent, const wxString& message,
				 const wxString& caption,
				 unsigned int delay,
				 long style, const wxPoint& pos)
    : wxDialog(parent, -1, caption, pos, wxDefaultSize, style | wxFRAME_FLOAT_ON_PARENT | wxDEFAULT_DIALOG_STYLE)
    , m_delay(delay)
    , m_display_hits(0)
{
	wxIcon ico = getIcon(whichIcon);
	SetIcon(ico);

	//******** copied from wxsource/generic/msgdlgg.cpp with small modifications***********************************************************


	topsizer = new wxBoxSizer(wxVERTICAL);

	wxBoxSizer* icon_text = new wxBoxSizer(wxHORIZONTAL);


	// 1) icon

	wxBitmap bitmap;
	switch (style & wxICON_MASK) {
		default:
			bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX);
			break;

		case wxICON_ERROR:
			bitmap = wxArtProvider::GetIcon(wxART_ERROR, wxART_MESSAGE_BOX);
			break;

		case wxICON_INFORMATION:
			bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX);
			break;

		case wxICON_WARNING:
			bitmap = wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX);
			break;

		case wxICON_QUESTION:
			bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX);
			break;
	}

	wxStaticBitmap* info_icon = new wxStaticBitmap(this, wxID_ANY, bitmap);
	icon_text->Add(info_icon, 0, wxCENTER);

	// 2) text
	icon_text->Add(CreateTextSizer(message), 0, wxALIGN_TOP | wxLEFT, 10);

	topsizer->Add(icon_text, 1, wxCENTER | wxLEFT | wxRIGHT | wxTOP, 10);
	topsizer->Add(0, 10);

	// 3) buttons
	int center_flag = wxEXPAND;
	if (style & wxYES_NO)
		center_flag = wxALIGN_CENTRE;
	sizerBtn = CreateButtonSizer(style & slButtonSizerFlags);
	if (sizerBtn) {
		topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10);
		sizerBtn->Show(false);
	}

	m_delay_sizer = new wxBoxSizer(wxHORIZONTAL);
	m_delay_notif = new wxStaticText(this, -1, wxString::Format(_("Please standby %d seconds"), delay / 1000));
	m_delay_sizer->Add(m_delay_notif, 0, center_flag | wxALL, 10);
	topsizer->Add(m_delay_sizer);


	SetAutoLayout(true);
	SetSizer(topsizer);

	topsizer->SetSizeHints(this);
	topsizer->Fit(this);
	/*
	wxSize size( GetSize() );
	if (size.x > size.y*3/2)
	{
	    size.x = size.y*3/2;
	    SetSize( size );
	}
	*/
	Centre(wxBOTH | wxCENTER_FRAME);

	wxWindowID delay_timerID = wxNewId();
	wxWindowID display_timerID = wxNewId();
	m_delay_timer.SetOwner(this, delay_timerID);
	m_display_timer.SetOwner(this, display_timerID);
	Connect(delay_timerID, wxEVT_TIMER, wxTimerEventHandler(TimedMessageBox::OnUnlock));
	Connect(display_timerID, wxEVT_TIMER, wxTimerEventHandler(TimedMessageBox::OnUpdate));
	m_delay_timer.Start(m_delay, wxTIMER_ONE_SHOT);
	m_display_timer.Start(m_update_interval, wxTIMER_CONTINUOUS);
	/***************************************************************************************************/
}
Example #27
0
CustomMessageBox::CustomMessageBox(wxIcon* icon, wxWindow* parent, const wxString& message,
				   const wxString& caption,
				   long style, const wxPoint& pos)
    : wxDialog(parent, -1, caption, pos, wxDefaultSize, style | wxFRAME_FLOAT_ON_PARENT | wxDEFAULT_DIALOG_STYLE)
{
	if (icon) {
		SetIcon(*icon);
	}
	//******** copied from wxsource/generic/msgdlgg.cpp with small modifications***********************************************************

	m_topsizer = new wxBoxSizer(wxVERTICAL);
	m_icon_text = new wxBoxSizer(wxHORIZONTAL);

	// 1) icon

	//! \todo use bitmap from customisation
	wxBitmap bitmap;
	switch (style & wxICON_MASK) {
		default:
			bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX);
			break;

		case wxICON_ERROR:
			bitmap = wxArtProvider::GetIcon(wxART_ERROR, wxART_MESSAGE_BOX);
			break;

		case wxICON_INFORMATION:
			bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX);
			break;

		case wxICON_WARNING:
			bitmap = wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX);
			break;

		case wxICON_QUESTION:
			bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX);
			break;
	}

	wxStaticBitmap* info_icon = new wxStaticBitmap(this, wxID_ANY, bitmap);
	m_icon_text->Add(info_icon, 0, wxCENTER);

	// 2) text
	m_icon_text->Add(CreateTextSizer(message), 0, wxALIGN_TOP | wxLEFT, 10);

	m_topsizer->Add(m_icon_text, 1, wxCENTER | wxLEFT | wxRIGHT | wxTOP, 10);
	m_topsizer->Add(0, 10);

	// 3) buttons
	int center_flag = wxEXPAND;
	if (style & wxYES_NO)
		center_flag = wxALIGN_CENTRE;

	if ((style & slButtonSizerFlags) == 0) {
		style = wxCLOSE;
	}

	wxSizer* sizerBtn = CreateButtonSizer(style & slButtonSizerFlags);
	if (sizerBtn)
		m_topsizer->Add(sizerBtn, 0, center_flag | wxALL, 10);


	SetAutoLayout(true);
	SetSizer(m_topsizer);

	m_topsizer->SetSizeHints(this);
	m_topsizer->Fit(this);
	/*
	wxSize size( GetSize() );
	if (size.x > size.y*3/2)
	{
	    size.x = size.y*3/2;
	    SetSize( size );
	}
	*/
	Centre(wxBOTH | wxCENTER_FRAME);
	/***************************************************************************************************/
}
Example #28
0
bool wxTextEntryDialog::Create(wxWindow *parent,
                                     const wxString& message,
                                     const wxString& caption,
                                     const wxString& value,
                                     long style,
                                     const wxPoint& pos)
{
    if ( !wxDialog::Create(GetParentForModalDialog(parent, style),
                           wxID_ANY, caption,
                           pos, wxDefaultSize,
                           wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) )
    {
        return false;
    }

    m_dialogStyle = style;
    m_value = value;

    wxBeginBusyCursor();

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

    wxSizerFlags flagsBorder2;
    flagsBorder2.DoubleBorder();

#if wxUSE_STATTEXT
    // 1) text message
    topsizer->Add(CreateTextSizer(message), flagsBorder2);
#endif

    // 2) text ctrl
    m_textctrl = new wxTextCtrl(this, wxID_TEXT, value,
                                wxDefaultPosition, wxSize(300, wxDefaultCoord),
                                style & ~wxTextEntryDialogStyle);

    topsizer->Add(m_textctrl,
                  wxSizerFlags(style & wxTE_MULTILINE ? 1 : 0).
                    Expand().
                    TripleBorder(wxLEFT | wxRIGHT));

    // 3) buttons if any
    wxSizer *buttonSizer = CreateSeparatedButtonSizer(style & (wxOK | wxCANCEL));
    if ( buttonSizer )
    {
        topsizer->Add(buttonSizer, wxSizerFlags(flagsBorder2).Expand());
    }

    SetAutoLayout( true );
    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );

    if ( style & wxCENTRE )
        Centre( wxBOTH );

    m_textctrl->SelectAll();
    m_textctrl->SetFocus();

    wxEndBusyCursor();

    return true;
}
Example #29
0
void wxGenericMessageDialog::DoCreateMsgdialog()
{
    wxDialog::Create(m_parent, wxID_ANY, m_caption, m_pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);

    bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

    wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );

#if wxUSE_STATBMP
    // 1) icon
    if (m_dialogStyle & wxICON_MASK)
    {
        wxStaticBitmap *icon = new wxStaticBitmap
                                   (
                                    this,
                                    wxID_ANY,
                                    wxArtProvider::GetMessageBoxIcon(m_dialogStyle)
                                   );
        if (is_pda)
            topsizer->Add( icon, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
        else
            icon_text->Add(icon, wxSizerFlags().Top().Border(wxRIGHT, 20));
    }
#endif // wxUSE_STATBMP

#if wxUSE_STATTEXT
    // 2) text

    wxBoxSizer * const textsizer = new wxBoxSizer(wxVERTICAL);

    // We want to show the main message in a different font to make it stand
    // out if the extended message is used as well. This looks better and is
    // more consistent with the native dialogs under MSW and GTK.
    wxString lowerMessage;
    if ( !m_extendedMessage.empty() )
    {
        wxTitleTextWrapper titleWrapper(this);
        textsizer->Add(CreateTextSizer(GetMessage(), titleWrapper),
                       wxSizerFlags().Border(wxBOTTOM, 20));

        lowerMessage = GetExtendedMessage();
    }
    else // no extended message
    {
        lowerMessage = GetMessage();
    }

    textsizer->Add(CreateTextSizer(lowerMessage));

    icon_text->Add(textsizer, 0, wxALIGN_CENTER, 10);
    topsizer->Add( icon_text, 1, wxLEFT|wxRIGHT|wxTOP, 10 );
#endif // wxUSE_STATTEXT

    // 3) optional checkbox and detailed text
    AddMessageDialogCheckBox( topsizer );
    AddMessageDialogDetails( topsizer );

    // 4) buttons
    wxSizer *sizerBtn = CreateMsgDlgButtonSizer();
    if ( sizerBtn )
        topsizer->Add(sizerBtn, 0, wxEXPAND | wxALL, 10 );

    SetAutoLayout( true );
    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );
    wxSize size( GetSize() );
    if (size.x < size.y*3/2)
    {
        size.x = size.y*3/2;
        SetSize( size );
    }

    Centre( wxBOTH | wxCENTER_FRAME);
}
Example #30
0
sceneLoadOptionDialog::sceneLoadOptionDialog(wxWindow *parent,
                        const wxString& message,
                        const wxString& caption,
                        const wxString& defaultMeshParams,
                        const wxPoint& pos)
						: wxDialog(parent, wxID_ANY, caption,
                              pos, wxDefaultSize)
							  ,
							  epsilonValue(wxString::Format("%g",0.01))
{

    wxBeginBusyCursor();

	wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );

    // 1) text message
    topsizer->Add( CreateTextSizer( message ), 0, wxALL, 5 );

    // 2) prompt and text ctrl
    wxBoxSizer* vinputsizer = new wxBoxSizer(wxVERTICAL);
    //wxFlexGridSizer* vslidersizer = new wxFlexGridSizer(2,1,0,0);
	wxBoxSizer* vslidersizer=new wxBoxSizer(wxVERTICAL);

	//vinputsizer->SetVGap(5);
	//vinputsizer->SetHGap(5);


	cb_RemeshModel = new wxCheckBox(this,SL_CTRLS_ID_CHECKBOX_REMESH_MODEL,_("Average model remesh"));
	cb_RemeshModel->SetToolTip(_("With this option you are able to remesh the input model to make it compatible with all calculation core. Use this option as a last resort"));
	cb_RemeshModel->SetValue(false);
	topsizer->Add(cb_RemeshModel,0,wxLEFT | wxTOP, 5);
	//Champ choix de la correction du modèle
	cb_TryToRepairMesh = new wxCheckBox(this,wxID_ANY,_("Repair model"));
	cb_TryToRepairMesh->SetToolTip(_("If this option is activated, the scene will be imported with a correction process to improve compatibility with the mesh generator"));
	cb_TryToRepairMesh->SetValue(true);
	topsizer->Add(cb_TryToRepairMesh,0,wxLEFT | wxTOP,5);
	//Champ choix maillage de surface
	cb_TryToMeshSurface = new wxCheckBox(this,SL_CTRLS_ID_CHECKBOX_SURFACE_MESH,_("Surface meshing"));
	cb_TryToMeshSurface->SetToolTip(_("Faces of the scene will be meshed in order to enhance the resolution of the surface receivers display"));
	topsizer->Add(cb_TryToMeshSurface,0,wxLEFT | wxTOP,5);
	// Champ de paramètrage de tetgen
	vinputsizer->Add( new wxStaticText( this, wxID_ANY, _("TetGen parameters") ), 0);
	txt_ParamMesh = new wxTextCtrl(this,wxID_ANY,defaultMeshParams);
	txt_ParamMesh->Disable();
	cb_TryToMeshSurface->SetValue(false);
	vinputsizer->Add( txt_ParamMesh,0,wxGROW| wxALL,1);
	topsizer->Add( vinputsizer, 0, wxEXPAND | wxLEFT, 20);
	//Champ choix de conservation des liens entre les groupes et les faces
	cb_KeepExistingFaceLinks = new wxCheckBox(this,SL_CTRLS_ID_CHECKBOX_RESTOREGROUPS,_("Keep existing groups"));
	cb_KeepExistingFaceLinks->SetValue(true);
	cb_KeepExistingFaceLinks->SetToolTip(_("New faces with the same position than old faces keep materials and surface receivers"));
	topsizer->Add(cb_KeepExistingFaceLinks,0,wxLEFT | wxTOP,5);
	//Champ de choix de l'epsilon
	vslidersizer->Add( new wxStaticText( this, wxID_ANY, _("Association maximum distance (m)") ), 0);
	//slider_EpsilonLinkingFaceGroupe = new wxSlider(this,wxID_ANY,1,0,500,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS);
	//vslidersizer->Add(slider_EpsilonLinkingFaceGroupe,0,wxGROW| wxALL,1);
	wxTextCtrl* sliderCtrl=new wxTextCtrl(this, SL_CTRLS_ID_COMBO_EPSILON, epsilonValue, wxDefaultPosition, wxDefaultSize, 0,wxTextValidator(wxFILTER_NUMERIC, &epsilonValue));
	sliderCtrl->SetHelpText(_("Association maximum distance (m)"));
	vslidersizer->Add(sliderCtrl,0,wxGROW| wxALL,1);
	topsizer->Add( vslidersizer, 0, wxEXPAND | wxLEFT, 20);
	
    // 3) buttons if any
    wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
    if ( buttonSizer )
    {
        topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
    }

    SetSizer( topsizer );
    SetAutoLayout( true );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );

    Centre( wxBOTH );

    wxEndBusyCursor();
}