// {{{ PropertyDialog::PropertyDialog(wxWindow *parent, wxWindowID id, const DBGp::Property *prop, const wxPoint &pos, const wxSize &size, long style, const wxString &name) PropertyDialog::PropertyDialog(wxWindow *parent, wxWindowID id, const DBGp::Property *prop, const wxPoint &pos, const wxSize &size, long style, const wxString &name) : wxDialog(parent, id, prop->GetFullName(), pos, size, style | wxMAXIMIZE_BOX | wxRESIZE_BORDER, name) { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); grid = new wxGrid(this, wxID_ANY); grid->Freeze(); grid->EnableEditing(false); grid->CreateGrid(0, 3); grid->SetColLabelValue(0, _("Name")); grid->SetColLabelValue(1, _("Type")); grid->SetColLabelValue(2, _("Value")); grid->SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); grid->SetRowLabelSize(0); AddProperty(prop, 0); grid->AutoSizeColumns(); grid->Thaw(); SetAutoLayout(true); SetSizer(sizer); sizer->SetSizeHints(this); sizer->Add(grid, 1, wxEXPAND | wxALL); sizer->Add(CreateSeparatedButtonSizer(wxOK), 0, wxEXPAND | wxALL); }
DialogVideoDetails::DialogVideoDetails(agi::Context *c) : wxDialog(c->parent , -1, _("Video Details")) { auto width = c->videoController->GetWidth(); auto height = c->videoController->GetHeight(); auto framecount = c->videoController->GetLength(); auto fps = c->videoController->FPS(); boost::rational<int> ar(width, height); auto fg = new wxFlexGridSizer(2, 5, 10); auto make_field = [&](wxString const& name, wxString const& value) { fg->Add(new wxStaticText(this, -1, name), 0, wxALIGN_CENTRE_VERTICAL); fg->Add(new wxTextCtrl(this, -1, value, wxDefaultPosition, wxSize(300,-1), wxTE_READONLY), 0, wxALIGN_CENTRE_VERTICAL | wxEXPAND); }; make_field(_("File name:"), c->videoController->GetVideoName().wstring()); make_field(_("FPS:"), wxString::Format("%.3f", fps.FPS())); make_field(_("Resolution:"), wxString::Format("%dx%d (%d:%d)", width, height, ar.numerator(), ar.denominator())); make_field(_("Length:"), wxString::Format(_("%d frames (%s)"), framecount, to_wx(AssTime(fps.TimeAtFrame(framecount - 1)).GetAssFormated(true)))); make_field(_("Decoder:"), to_wx(c->videoController->GetProvider()->GetDecoderName())); wxStaticBoxSizer *video_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Video")); video_sizer->Add(fg); auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(video_sizer, 1, wxALL|wxEXPAND, 5); main_sizer->Add(CreateSeparatedButtonSizer(wxOK), 0, wxALL|wxEXPAND, 5); SetSizerAndFit(main_sizer); CenterOnParent(); }
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(); }
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); }
DialogVideoDetails::DialogVideoDetails(agi::Context *c) : wxDialog(c->parent , -1, _("Video Details")) { int width = c->videoController->GetWidth(); int height = c->videoController->GetHeight(); int framecount = c->videoController->GetLength(); double fps = c->videoController->FPS().FPS(); wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 10); make_field(this, fg, _("File name:"), c->videoController->videoName); make_field(this, fg, _("FPS:"), wxString::Format("%.3f", fps)); make_field(this, fg, _("Resolution:"), wxString::Format("%dx%d (%s)", width, height, pretty_ar(width, height))); make_field(this, fg, _("Length:"), wxString::Format("%d frames (%s)", framecount, pretty_time_stamp(framecount, fps))); make_field(this, fg, _("Decoder:"), c->videoController->GetProvider()->GetDecoderName()); wxStaticBoxSizer *video_sizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Video")); video_sizer->Add(fg); wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(video_sizer, 1, wxALL|wxEXPAND, 5); main_sizer->Add(CreateSeparatedButtonSizer(wxOK), 0, wxALL|wxEXPAND, 5); main_sizer->SetSizeHints(this); SetSizer(main_sizer); CenterOnParent(); }
bool wxRearrangeDialog::Create(wxWindow *parent, const wxString& message, const wxString& title, const wxArrayInt& order, const wxArrayString& items, const wxPoint& pos, const wxString& name) { if ( !wxDialog::Create(parent, wxID_ANY, title, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER, name) ) return false; m_ctrl = new wxRearrangeCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, order, items); // notice that the items in this sizer should be inserted accordingly to // wxRearrangeDialogSizerPositions order wxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL); sizerTop->Add(new wxStaticText(this, wxID_ANY, message), wxSizerFlags().Border()); sizerTop->Add(m_ctrl, wxSizerFlags(1).Expand().Border()); sizerTop->Add(CreateSeparatedButtonSizer(wxOK | wxCANCEL), wxSizerFlags().Expand().Border()); SetSizerAndFit(sizerTop); return true; }
wxSizer *wxGenericMessageDialog::CreateMsgDlgButtonSizer() { #ifndef __SMARTPHONE__ if ( HasCustomLabels() ) { wxStdDialogButtonSizer * const sizerStd = new wxStdDialogButtonSizer; wxButton *btnDef = NULL; if ( m_dialogStyle & wxOK ) { btnDef = new wxButton(this, wxID_OK, GetCustomOKLabel()); sizerStd->AddButton(btnDef); } if ( m_dialogStyle & wxCANCEL ) { wxButton * const cancel = new wxButton(this, wxID_CANCEL, GetCustomCancelLabel()); sizerStd->AddButton(cancel); if ( m_dialogStyle & wxCANCEL_DEFAULT ) btnDef = cancel; } if ( m_dialogStyle & wxYES_NO ) { wxButton * const yes = new wxButton(this, wxID_YES, GetCustomYesLabel()); sizerStd->AddButton(yes); wxButton * const no = new wxButton(this, wxID_NO, GetCustomNoLabel()); sizerStd->AddButton(no); if ( m_dialogStyle & wxNO_DEFAULT ) btnDef = no; else if ( !btnDef ) btnDef = yes; } if ( btnDef ) { btnDef->SetDefault(); btnDef->SetFocus(); } sizerStd->Realize(); return CreateSeparatedSizer(sizerStd); } #endif // !__SMARTPHONE__ // Use standard labels for all buttons return CreateSeparatedButtonSizer ( m_dialogStyle & (wxOK | wxCANCEL | wxYES_NO | wxNO_DEFAULT | wxCANCEL_DEFAULT) ); }
void wxGenericColourDialog::CreateWidgets() { wxBeginBusyCursor(); wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); const int sliderHeight = 160; // first sliders #if wxUSE_SLIDER const int sliderX = m_singleCustomColourRect.x + m_singleCustomColourRect.width + m_sectionSpacing; m_redSlider = new wxSlider(this, wxID_RED_SLIDER, m_colourData.m_dataColour.Red(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); m_greenSlider = new wxSlider(this, wxID_GREEN_SLIDER, m_colourData.m_dataColour.Green(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); m_blueSlider = new wxSlider(this, wxID_BLUE_SLIDER, m_colourData.m_dataColour.Blue(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); wxBoxSizer *sliderSizer = new wxBoxSizer( wxHORIZONTAL ); sliderSizer->Add(sliderX, sliderHeight ); wxSizerFlags flagsRight; flagsRight.Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL).DoubleBorder(); sliderSizer->Add(m_redSlider, flagsRight); sliderSizer->Add(m_greenSlider,flagsRight); sliderSizer->Add(m_blueSlider,flagsRight); topSizer->Add(sliderSizer, wxSizerFlags().Centre().DoubleBorder()); #else topSizer->Add(1, sliderHeight, wxSizerFlags(1).Centre().TripleBorder()); #endif // wxUSE_SLIDER // then the custom button topSizer->Add(new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours") ), wxSizerFlags().DoubleHorzBorder()); // then the standard buttons wxSizer *buttonsizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); if ( buttonsizer ) { topSizer->Add(buttonsizer, wxSizerFlags().Expand().DoubleBorder()); } SetAutoLayout( true ); SetSizer( topSizer ); topSizer->SetSizeHints( this ); topSizer->Fit( this ); Centre( wxBOTH ); wxEndBusyCursor(); }
TestDialog::TestDialog( bool use_testgrid ) : wxDialog(static_cast<wxWindow*>(0), wxID_ANY, wxString(wxT("Pane-in-the-Grid Test Application"))), m_collapsedSize(wxDefaultSize) { wxBoxSizer* dlgSizer = new wxBoxSizer(wxVERTICAL); // Create controls to set the number of rows and columns in the grid wxBoxSizer* rowcolSizer = new wxBoxSizer(wxHORIZONTAL); rowcolSizer->Add(new wxStaticText(this, wxID_ANY, wxT("Rows: ")), wxSizerFlags().Border()); wxSpinCtrl* rowSpin = new wxSpinCtrl(this, ID_SPIN_ROW); rowSpin->SetRange(1, MAX_ROWS); rowSpin->SetValue(NUM_ROWS); rowcolSizer->Add(rowSpin, wxSizerFlags().Border().Proportion(1)); rowcolSizer->AddSpacer(20); rowcolSizer->Add(new wxStaticText(this, wxID_ANY, wxT("Columns: ")), wxSizerFlags().Border()); wxSpinCtrl* colSpin = new wxSpinCtrl(this, ID_SPIN_COL); colSpin->SetRange(1, MAX_COLS); colSpin->SetValue(NUM_COLS); rowcolSizer->Add(colSpin, wxSizerFlags().Border().Proportion(1)); rowcolSizer->AddSpacer(20); wxButton* populateButton = new wxButton(this, ID_POPULATE, wxT("&Set Rows and Columns")); rowcolSizer->Add(populateButton, wxSizerFlags().Right().Border()); rowcolSizer->AddSpacer(20); rowcolSizer->Add(new wxButton(this, ID_LOGSIZES, wxT("Log sizes")), wxSizerFlags().Right().Border()); dlgSizer->Add(rowcolSizer, wxSizerFlags().Border()); int style = wxCP_DEFAULT_STYLE | (use_testgrid? 0: wxCP_NO_TLW_RESIZE); //create the collapsible pane wxCollapsiblePane* pane = new wxCollapsiblePane(this, ID_COLLPANE, wxT("Expand/Collapse to see/hide the grid"), wxDefaultPosition, wxDefaultSize, style); if (!use_testgrid) pane->Connect( wxEVT_COMMAND_COLLPANE_CHANGED, wxCollapsiblePaneEventHandler(TestDialog::OnCollpaneChanged), NULL, this ); //create the grid inside the collapsible pane by passing pane->GetPane() as parent wxGrid *grid; if (use_testgrid) grid = new TestGrid( this, pane->GetPane(), ID_GRID ); else grid = new wxGrid(pane->GetPane(), ID_GRID); grid->CreateGrid(NUM_ROWS, NUM_COLS); // Create the containing sizer to resize the grid on expand/collapse wxBoxSizer *gridSizer = new wxBoxSizer(wxVERTICAL); gridSizer->Add(grid, wxSizerFlags().Expand().Proportion(1)); // That sizer should be used by the collapsible panel's pane pane->GetPane()->SetSizer(gridSizer); //add the collapsible pane to the dialog's sizer dlgSizer->Add(pane, wxSizerFlags().Border().Expand().Proportion(0)); dlgSizer->Add(CreateSeparatedButtonSizer(wxCANCEL), wxSizerFlags().Border().Expand()); SetSizerAndFit(dlgSizer); }
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; }
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(); }
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; }
AutocloseMessageBox::AutocloseMessageBox(wxWindow* parent, const wxString& message, const wxString& caption, unsigned int delay, long style, const wxPoint& pos) : TimedMessageBox(SL_MAIN_ICON, parent, message, caption, delay, style, pos) , delay_timerID(wxNewId()) { m_delay_timer.SetOwner(this, delay_timerID); Connect(delay_timerID, wxEVT_TIMER, wxTimerEventHandler(AutocloseMessageBox::OnUnlock)); wxSizer* topsizer = GetSizer(); wxSizer* sizerBtn = CreateSeparatedButtonSizer(wxCANCEL); topsizer->Add(sizerBtn, 0, wxALL | wxALIGN_CENTRE, 10); topsizer->SetSizeHints(this); topsizer->Fit(this); Layout(); }
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(); }
CDlgAddUser::CDlgAddUser(wxWindow *parent) : wxDialog(parent, wxID_ANY, gLangText.dlgAddUserTitle()) { BOOST_ASSERT (gMyAccount.get() != NULL); wxString sTemp(gAppPath); sTemp.Append(wxT("/res/mainframe.ico")); wxIcon icon(sTemp, wxBITMAP_TYPE_ICO); // set the frame icon SetIcon(icon); wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); wxBoxSizer * sizerChoose = new wxBoxSizer(wxHORIZONTAL); wxSizer * sizerChooseLeft = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, gLangText.dlgStaticChooseFrom()), wxVERTICAL); wxSizer * sizerChooseRight = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, gLangText.dlgStaticChooseTo()), wxVERTICAL); m_searchTextCtrl = new wxTextCtrl(this, Ctrl_SearchText, "", wxDefaultPosition, wxSize(180, 22)); m_searchTextCtrl->SetToolTip(gLangText.textSearchTip()); m_listboxChooseFrom = new wxListBox(this, Ctrl_ChooseFrom, wxDefaultPosition, wxSize(180, 280)); m_listboxChooseTo = new wxListBox(this, Ctrl_ChooseTo, wxDefaultPosition, wxSize(180, 280)); sizerChooseLeft->Add(m_searchTextCtrl, 0, wxALL|wxALIGN_CENTER, 5); sizerChooseLeft->Add(m_listboxChooseFrom, 1, wxGROW | wxALL, 5); sizerChooseRight->Add(m_listboxChooseTo, 1, wxGROW | wxALL, 5); sizerChoose->Add(sizerChooseLeft, 1, wxGROW|wxALL, 5 ); sizerChoose->Add(sizerChooseRight, 1, wxGROW|wxALL, 5 ); sizerTop->Add(sizerChoose, 1, wxEXPAND | wxLEFT|wxRIGHT, 5 ); wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); if ( buttonSizer ) { this->GetWindowChild(wxID_OK)->SetLabel(gLangText.btnAddUserText()); this->GetWindowChild(wxID_OK)->SetToolTip(gLangText.btnAddUserHelp()); this->GetWindowChild(wxID_OK)->Disable(); this->GetWindowChild(wxID_CANCEL)->SetLabel(gLangText.btnCancelText()); this->GetWindowChild(wxID_CANCEL)->SetToolTip(gLangText.btnCancelHelp()); sizerTop->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder()); } SetSizer(sizerTop); sizerTop->SetSizeHints(this); sizerTop->Fit(this); }
reNewProjectDialog::reNewProjectDialog() :wxDialog(nullptr, wxID_ANY, "New Project") { m_nameText = new wxTextCtrl(this, wxID_ANY); m_directoryPicker = new wxDirPickerCtrl(this, wxID_ANY, wxEmptyString, "Choose Project Directory"); wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL); wxFlexGridSizer* flexSizer = new wxFlexGridSizer(2, 2, 3, 3); flexSizer->Add(new wxStaticText(this, wxID_ANY, "Project Name:")); flexSizer->Add(m_nameText); flexSizer->Add(new wxStaticText(this, wxID_ANY, "Project Directory:")); flexSizer->Add(m_directoryPicker); mainSizer->Add(flexSizer, 0, wxALL, 5); mainSizer->Add(CreateSeparatedButtonSizer(wxOK | wxCANCEL), 1, wxEXPAND| wxALL, 5); SetSizerAndFit(mainSizer); }
DialogTextImport::DialogTextImport() : wxDialog(nullptr , -1, _("Text import options")) { // Main controls wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 5); wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL); edit_separator = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Import/Text/Actor Separator")->GetString())); edit_comment = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Import/Text/Comment Starter")->GetString())); // Dialog layout fg->Add(new wxStaticText(this, -1, _("Actor separator:")), 0, wxALIGN_CENTRE_VERTICAL); fg->Add(edit_separator, 0, wxEXPAND); fg->Add(new wxStaticText(this, -1, _("Comment starter:")), 0, wxALIGN_CENTRE_VERTICAL); fg->Add(edit_comment, 0, wxEXPAND); main_sizer->Add(fg, 1, wxALL|wxEXPAND, 5); main_sizer->Add(CreateSeparatedButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5); SetSizerAndFit(main_sizer); Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogTextImport::OnOK, this, wxID_OK); }
bool wxCurlConnectionSettingsDialog::Create(const wxString& title, const wxString& message, wxWindow *parent, long style) { if (!wxDialog::Create(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)) return false; m_pPanel = new wxCurlConnectionSettingsPanel(this, wxID_ANY, message, wxDefaultPosition, wxDefaultSize, style); wxSizer *main = new wxBoxSizer(wxVERTICAL); wxSizer *buttons = CreateSeparatedButtonSizer(wxOK|wxCANCEL); main->Add(m_pPanel, 1, wxGROW|wxALL, 10); main->Add(buttons, 0, wxGROW|wxALL, 10); SetSizerAndFit(main); return true; }
SupressibleMessageDialog::SupressibleMessageDialog(wxWindow *parent, const wxString &message, const wxString &caption, long style /* = wxICON_EXCLAMATION|wxOK */) { Init(); Create(parent, SYMBOL_SUPRESSIBLEMESSAGEDIALOG_IDNAME, caption, SYMBOL_SUPRESSIBLEMESSAGEDIALOG_POSITION, SYMBOL_SUPRESSIBLEMESSAGEDIALOG_SIZE, SYMBOL_SUPRESSIBLEMESSAGEDIALOG_STYLE); m_lIconStyle = style & wxICON_MASK; m_lButtonStyle = style & ~wxICON_MASK; switch (m_lIconStyle) { case wxICON_EXCLAMATION: m_pDialogIcon->SetBitmap(wxArtProvider::GetBitmap(wxART_WARNING, wxART_MESSAGE_BOX)); break; case wxICON_ERROR: m_pDialogIcon->SetBitmap(wxArtProvider::GetBitmap(wxART_ERROR, wxART_MESSAGE_BOX)); break; case wxICON_QUESTION: m_pDialogIcon->SetBitmap(wxArtProvider::GetBitmap(wxART_QUESTION, wxART_MESSAGE_BOX)); break; case wxICON_INFORMATION: m_pDialogIcon->SetBitmap(wxArtProvider::GetBitmap(wxART_INFORMATION, wxART_MESSAGE_BOX)); break; } wxSizer *sz = GetSizer(); if (sz) { wxSizer *bs = CreateSeparatedButtonSizer(m_lButtonStyle); if (bs) { sz->Add(bs, wxSizerFlags().Expand().Border(wxALL, 5)); } if (m_lButtonStyle & wxYES_NO) { // Add missing event handler for "No" button. Connect(XRCID("wxID_NO"), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SupressibleMessageDialog::OnNoClick)); } } SetTitle(caption); m_pMessage->SetLabel(message); Fit(); }
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); }
frmExtract::frmExtract(wxWindow *pParent, IFileStore *pArchive, RainString sDefaultExtractFolder, const RainString& sPathToExtract, wxStatusBar *pResultNotification) : m_pArchive(pArchive), m_pPositiveResultNoficiationBar(pResultNotification), m_sPathToExtract(sPathToExtract) { m_bIsDirectory = !pArchive->doesFileExist(m_sPathToExtract); if(m_bIsDirectory && m_sPathToExtract.suffix(1) != L"\\") m_sPathToExtract += L"\\"; if(sDefaultExtractFolder.suffix(1) != L"\\") sDefaultExtractFolder += L"\\"; Create(pParent, wxID_ANY, m_bIsDirectory ? L"Extract directory" : L"Extract file", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); wxBoxSizer *pMainSizer = new wxBoxSizer(wxVERTICAL); wxFlexGridSizer *pPathsSizer = new wxFlexGridSizer(3, 3, 3); pPathsSizer->AddGrowableCol(1, 1); // column 1, 100% wxStaticText *pTemp; pPathsSizer->Add(pTemp = new wxStaticText(this, wxID_ANY, L"Extracting:"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT); wxFont oFont = pTemp->GetFont(); oFont.SetWeight(wxFONTWEIGHT_BOLD); pTemp->SetFont(oFont); pPathsSizer->Add(new wxStaticText(this, wxID_ANY, m_sPathToExtract), 1, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT); pPathsSizer->AddSpacer(0); pPathsSizer->Add(pTemp = new wxStaticText(this, wxID_ANY, L"Destination:"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT); pTemp->SetFont(oFont); pPathsSizer->Add(m_pDestinationPath = new wxComboBox(this, TXT_FILENAME), 1, wxALIGN_CENTER_VERTICAL | wxEXPAND); pPathsSizer->Add(new wxButton(this, BTN_BROWSE, L"Browse..."), 0, wxALIGN_CENTER_VERTICAL); { sDefaultExtractFolder += m_sPathToExtract; RainString sSaved = s_sLastSaveDir; if(sSaved.isEmpty()) sSaved = sDefaultExtractFolder; else { if(s_bLastSaveDirHasDir) { size_t iLen = 1; while(m_sPathToExtract[m_sPathToExtract.length() - iLen - 1] != '\\') ++iLen; sSaved += m_sPathToExtract.suffix(iLen); } else sSaved += m_sPathToExtract; } m_pDestinationPath->SetValue(sSaved); m_pDestinationPath->Append(sSaved); if(sSaved != sDefaultExtractFolder) m_pDestinationPath->Append(sDefaultExtractFolder); } pMainSizer->Add(pPathsSizer, 1, wxEXPAND | wxALL, 3); m_pButtonsSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); if(m_pButtonsSizer) { pMainSizer->Add(m_pButtonsSizer, 0, wxEXPAND | wxALL, 3); FindWindow(wxID_OK)->SetLabel(L"Extract"); } pMainSizer->SetSizeHints(this); SetSizer(pMainSizer); Layout(); }
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(); }
void wxGenericColourDialog::CreateWidgets() { wxBeginBusyCursor(); #if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA // Bitmap to preview selected colour (with alpha channel) wxBitmap customColourBmp(m_singleCustomColourRect.GetSize(), 32); customColourBmp.UseAlpha(); DoPreviewBitmap(customColourBmp, m_colourData.GetColour()); m_customColourBmp = new wxStaticBitmap(this, wxID_ANY, customColourBmp, m_singleCustomColourRect.GetLeftTop(), m_singleCustomColourRect.GetSize(), wxBORDER_SUNKEN); // 16 bitmaps to preview custom colours (with alpha channel) for (int i = 0; i < WXSIZEOF(m_customColoursBmp); i++) { int x = ((i % 8)*(m_smallRectangleSize.x+m_gridSpacing)) + m_customColoursRect.x; int y = ((i / 8)*(m_smallRectangleSize.y+m_gridSpacing)) + m_customColoursRect.y; wxBitmap bmp(m_smallRectangleSize, 32); bmp.UseAlpha(); DoPreviewBitmap(bmp, m_customColours[i]); m_customColoursBmp[i] = new wxStaticBitmap(this, wxID_ANY, bmp, wxPoint(x, y), m_smallRectangleSize); m_customColoursBmp[i]->Bind(wxEVT_LEFT_DOWN, &wxGenericColourDialog::OnCustomColourMouseClick, this); } #endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); const int sliderHeight = 160; // first sliders #if wxUSE_SLIDER const int sliderX = m_singleCustomColourRect.x + m_singleCustomColourRect.width + m_sectionSpacing; wxColour c = m_colourData.GetColour(); m_redSlider = new wxSlider(this, wxID_RED_SLIDER, c.Red(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); m_greenSlider = new wxSlider(this, wxID_GREEN_SLIDER, c.Green(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); m_blueSlider = new wxSlider(this, wxID_BLUE_SLIDER, c.Blue(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); if ( m_colourData.GetChooseAlpha() ) { m_alphaSlider = new wxSlider(this, wxID_ANY, c.Alpha(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); m_alphaSlider->Bind(wxEVT_SLIDER, &wxGenericColourDialog::OnAlphaSlider, this); } else { m_alphaSlider = NULL; } wxBoxSizer *sliderSizer = new wxBoxSizer( wxHORIZONTAL ); sliderSizer->Add(sliderX, sliderHeight ); const wxSizerFlags sliderLabelFlags = wxSizerFlags().Right().Border(); const wxSizerFlags onesliderFlags = wxSizerFlags().CenterHorizontal(); const wxSizerFlags sliderFlags = wxSizerFlags().CentreVertical().DoubleBorder(); wxBoxSizer *redSliderSizer = new wxBoxSizer(wxVERTICAL); redSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Red:")), sliderLabelFlags); redSliderSizer->Add(m_redSlider, onesliderFlags); wxBoxSizer *greenSliderSizer = new wxBoxSizer(wxVERTICAL); greenSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Green:")), sliderLabelFlags); greenSliderSizer->Add(m_greenSlider, onesliderFlags); wxBoxSizer *blueSliderSizer = new wxBoxSizer(wxVERTICAL); blueSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Blue:")), sliderLabelFlags); blueSliderSizer->Add(m_blueSlider, onesliderFlags); sliderSizer->Add(redSliderSizer, sliderFlags); sliderSizer->Add(greenSliderSizer, sliderFlags); sliderSizer->Add(blueSliderSizer, sliderFlags); if ( m_colourData.GetChooseAlpha() ) { wxBoxSizer *alphaSliderSizer = new wxBoxSizer(wxVERTICAL); alphaSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Opacity:")), sliderLabelFlags); alphaSliderSizer->Add(m_alphaSlider, onesliderFlags); sliderSizer->Add(alphaSliderSizer, sliderFlags); } topSizer->Add(sliderSizer, wxSizerFlags().Centre().DoubleBorder()); #else topSizer->Add(1, sliderHeight, wxSizerFlags(1).Centre().TripleBorder()); #endif // wxUSE_SLIDER // then the custom button topSizer->Add(new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours") ), wxSizerFlags().DoubleHorzBorder()); // then the standard buttons wxSizer *buttonsizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); if ( buttonsizer ) { topSizer->Add(buttonsizer, wxSizerFlags().Expand().DoubleBorder()); } SetAutoLayout( true ); SetSizer( topSizer ); topSizer->SetSizeHints( this ); topSizer->Fit( this ); Centre( wxBOTH ); wxEndBusyCursor(); }
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(); }
void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent)) { // wxDialog::Create(parent, wxID_ANY, _("Print"), wxPoint(0,0), wxSize(600, 600), // wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL); wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL ); // 1) top row wxPrintFactory* factory = wxPrintFactory::GetFactory(); wxStaticBoxSizer *topsizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _( "Printer options" ) ), wxHORIZONTAL ); wxFlexGridSizer *flex = new wxFlexGridSizer( 2 ); flex->AddGrowableCol( 1 ); topsizer->Add( flex, 1, wxGROW ); m_printToFileCheckBox = new wxCheckBox( this, wxPRINTID_PRINTTOFILE, _("Print to File") ); flex->Add( m_printToFileCheckBox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup...") ); flex->Add( m_setupButton, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); if (!factory->HasPrintSetupDialog()) m_setupButton->Enable( false ); if (factory->HasPrinterLine()) { flex->Add( new wxStaticText( this, wxID_ANY, _("Printer:") ), 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); flex->Add( new wxStaticText( this, wxID_ANY, factory->CreatePrinterLine() ), 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); } if (factory->HasStatusLine()) { flex->Add( new wxStaticText( this, wxID_ANY, _("Status:") ), 0, wxALIGN_CENTER_VERTICAL|wxALL-wxTOP, 5 ); flex->Add( new wxStaticText( this, wxID_ANY, factory->CreateStatusLine() ), 0, wxALIGN_CENTER_VERTICAL|wxALL-wxTOP, 5 ); } mainsizer->Add( topsizer, 0, wxLEFT|wxTOP|wxRIGHT|wxGROW, 10 ); // 2) middle row with radio box wxString *choices = new wxString[2]; choices[0] = _("All"); choices[1] = _("Pages"); m_fromText = (wxTextCtrl*)NULL; m_toText = (wxTextCtrl*)NULL; m_rangeRadioBox = (wxRadioBox *)NULL; if (m_printDialogData.GetFromPage() != 0) { m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"), wxDefaultPosition, wxDefaultSize, 2, choices, 1, wxRA_VERTICAL); m_rangeRadioBox->SetSelection(1); mainsizer->Add( m_rangeRadioBox, 0, wxLEFT|wxTOP|wxRIGHT, 10 ); } // 3) bottom row wxBoxSizer *bottomsizer = new wxBoxSizer( wxHORIZONTAL ); if (m_printDialogData.GetFromPage() != 0) { bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("From:") ), 0, wxCENTER|wxALL, 5 ); m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, wxEmptyString, wxDefaultPosition, wxSize(40, wxDefaultCoord)); bottomsizer->Add( m_fromText, 1, wxCENTER|wxRIGHT, 10 ); bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("To:") ), 0, wxCENTER|wxALL, 5); m_toText = new wxTextCtrl(this, wxPRINTID_TO, wxEmptyString, wxDefaultPosition, wxSize(40, wxDefaultCoord)); bottomsizer->Add( m_toText, 1, wxCENTER|wxRIGHT, 10 ); } bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Copies:") ), 0, wxCENTER|wxALL, 5 ); m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, wxEmptyString, wxPoint(252, 130), wxSize(40, wxDefaultCoord)); bottomsizer->Add( m_noCopiesText, 1, wxCENTER|wxRIGHT, 10 ); mainsizer->Add( bottomsizer, 0, wxTOP|wxLEFT|wxRIGHT, 12 ); // 4) buttons wxSizer *sizerBtn = CreateSeparatedButtonSizer( wxOK|wxCANCEL); if ( sizerBtn ) mainsizer->Add(sizerBtn, 0, wxEXPAND|wxALL, 10 ); SetAutoLayout( true ); SetSizer( mainsizer ); mainsizer->Fit( this ); Centre(wxBOTH); // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow InitDialog(); delete[] choices; }
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; }
bool wxGenericDirDialog::Create(wxWindow* parent, const wxString& title, const wxString& defaultPath, long style, const wxPoint& pos, const wxSize& sz, const wxString& name) { wxBusyCursor cursor; parent = GetParentForModalDialog(parent, style); if (!wxDirDialogBase::Create(parent, title, defaultPath, style, pos, sz, name)) return false; m_path = defaultPath; if (m_path == wxT("~")) wxGetHomeDir(&m_path); if (m_path == wxT(".")) m_path = wxGetCwd(); wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); // smartphones does not support or do not waste space for wxButtons #if defined(__SMARTPHONE__) wxMenu *dirMenu = new wxMenu; dirMenu->Append(ID_GO_HOME, _("Home")); if (!HasFlag(wxDD_DIR_MUST_EXIST)) { dirMenu->Append(ID_NEW, _("New directory")); } dirMenu->AppendCheckItem(ID_SHOW_HIDDEN, _("Show hidden directories")); dirMenu->AppendSeparator(); dirMenu->Append(wxID_CANCEL, _("Cancel")); #else // 0) 'New' and 'Home' Buttons wxSizer* buttonsizer = new wxBoxSizer( wxHORIZONTAL ); // VS: 'Home directory' concept is unknown to MS-DOS #if !defined(__DOS__) wxBitmapButton* homeButton = new wxBitmapButton(this, ID_GO_HOME, wxArtProvider::GetBitmap(wxART_GO_HOME, wxART_BUTTON)); buttonsizer->Add( homeButton, 0, wxLEFT|wxRIGHT, 10 ); #endif // I'm not convinced we need a New button, and we tend to get annoying // accidental-editing with label editing enabled. if (!HasFlag(wxDD_DIR_MUST_EXIST)) { wxBitmapButton* newButton = new wxBitmapButton(this, ID_NEW, wxArtProvider::GetBitmap(wxART_NEW_DIR, wxART_BUTTON)); buttonsizer->Add( newButton, 0, wxRIGHT, 10 ); #if wxUSE_TOOLTIPS newButton->SetToolTip(_("Create new directory")); #endif } #if wxUSE_TOOLTIPS homeButton->SetToolTip(_("Go to home directory")); #endif topsizer->Add( buttonsizer, 0, wxTOP | wxALIGN_RIGHT, 10 ); #endif // __SMARTPHONE__/!__SMARTPHONE__ // 1) dir ctrl m_dirCtrl = NULL; // this is necessary, event handler called from // wxGenericDirCtrl would crash otherwise! long dirStyle = wxDIRCTRL_DIR_ONLY | wxDEFAULT_CONTROL_BORDER; #ifdef __WXMSW__ if (!HasFlag(wxDD_DIR_MUST_EXIST)) { // Only under Windows do we need the wxTR_EDIT_LABEL tree control style // before we can call EditLabel (required for "New directory") dirStyle |= wxDIRCTRL_EDIT_LABELS; } #endif m_dirCtrl = new wxGenericDirCtrl(this, ID_DIRCTRL, m_path, wxDefaultPosition, wxSize(300, 200), dirStyle); wxSizerFlags flagsBorder2; flagsBorder2.DoubleBorder(wxTOP | wxLEFT | wxRIGHT); topsizer->Add(m_dirCtrl, wxSizerFlags(flagsBorder2).Proportion(1).Expand()); #ifndef __SMARTPHONE__ // TODO: Make this an option depending on a flag? wxCheckBox * check = new wxCheckBox(this, ID_SHOW_HIDDEN, _("Show &hidden directories")); topsizer->Add(check, wxSizerFlags(flagsBorder2).Right()); #endif // !__SMARTPHONE__ // 2) text ctrl m_input = new wxTextCtrl( this, ID_TEXTCTRL, m_path, wxDefaultPosition ); topsizer->Add(m_input, wxSizerFlags(flagsBorder2).Expand()); // 3) buttons if any wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); if ( buttonSizer ) { topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder()); } #ifdef __SMARTPHONE__ // overwrite menu set by CreateSeparatedButtonSizer() call above SetRightMenu(wxID_ANY, _("Options"), dirMenu); #endif m_input->SetFocus(); SetAutoLayout( true ); SetSizer( topsizer ); topsizer->SetSizeHints( this ); topsizer->Fit( this ); Centre( wxBOTH ); return true; }
LanguageSelector::LanguageSelector(wxWindow *parent, const wxString& message, const wxString& caption, const wxString& rootLngFolder, const wxString& flagsFolder, const wxPoint& pos ) :wxDialog(parent, wxID_ANY, caption, pos, wxDefaultSize) { wxBeginBusyCursor(); wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* lstsizer = new wxBoxSizer( wxVERTICAL ); topsizer->Add(lstsizer,1,wxLEFT | wxTOP | wxGROW); wxListCtrl* flagList=new wxListCtrl(this,WindowLanguageSelectorId_FLAG_LIST,wxDefaultPosition,wxDefaultSize,wxLC_SMALL_ICON | wxSUNKEN_BORDER | wxLC_SINGLE_SEL ); lstsizer->Add(flagList,0,wxLEFT | wxTOP | wxGROW,5); wxImageList* icoLst=new wxImageList(16,11); wxString ressourceFolder=rootLngFolder; wxString Canonical_lng,ISO3166_lng,ISO639_lng; int defaultSelection=0; int systemLanguage=wxLocale::GetSystemLanguage(); wxSortedArrayString flagsFileName; wxSortedArrayString lngFolders; wxDirList traverser(lngFolders); wxDir folderRoot(rootLngFolder); folderRoot.Traverse(traverser); wxDir::GetAllFiles(flagsFolder,&flagsFileName,"*.png",wxDIR_FILES); for(int idlang=wxLANGUAGE_UNKNOWN+1;idlang<wxLANGUAGE_USER_DEFINED;idlang++) { if(wxLocale::IsAvailable(idlang)) { Canonical_lng=wxLocale(idlang).GetCanonicalName(); ISO3166_lng=Canonical_lng.Mid(Canonical_lng.rfind("_")+1).Lower(); ISO639_lng=Canonical_lng.Left(Canonical_lng.rfind("_")).Lower(); if(lngFolders.Index(ressourceFolder+Canonical_lng)>=0)//lngFolders.Index(ressourceFolder+ISO639_lng)>=0 || lngFolders.Index(ressourceFolder+Canonical_lng)>=0 ) { if(systemLanguage==idlang) defaultSelection=flagList->GetItemCount(); wxString flag_filepath=flagsFolder+wxString::Format("%s.png",ISO3166_lng); //if(wxFileExists(flag_filepath)) if(flagsFileName.Index(flag_filepath)>=0) { wxIcon flagImage(flag_filepath, wxBITMAP_TYPE_PNG); if(flagImage.IsOk()) { int indexico=icoLst->Add(flagImage); flagList->SetItemData(flagList->InsertItem(flagList->GetItemCount(),wxLocale::GetLanguageName(idlang),indexico),idlang); } }else{ flagList->SetItemData(flagList->InsertItem(flagList->GetItemCount(),wxLocale::GetLanguageName(idlang)),idlang); } } } } flagList->AssignImageList(icoLst,wxIMAGE_LIST_SMALL); if(flagList->GetItemCount()>0) flagList->SetItemState(defaultSelection,wxLIST_STATE_SELECTED,wxLIST_STATE_SELECTED); // 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 ); wxEndBusyCursor(); }