MainFrame::MainFrame() : wxFrame(NULL, wxID_ANY, "Main wx app", wxDefaultPosition, wxSize(400, 300)) { wxPanel *p = new wxPanel(this, wxID_ANY); wxSizer *sizer = new wxBoxSizer(wxVERTICAL); sizer->Add ( new wxStaticText ( p, wxID_ANY, wxString::Format ( "Main wxApp instance is %p (%s),\n" "thread ID %ld.\n", wxApp::GetInstance(), wxVERSION_STRING, wxThread::GetCurrentId() ) ), wxSizerFlags(1).Expand().Border(wxALL, 10) ); sizer->Add ( new wxButton(p, ID_RUN_DLL, "Run GUI from DLL"), wxSizerFlags(0).Right().Border(wxALL, 10) ); p->SetSizerAndFit(sizer); wxSizer *fsizer = new wxBoxSizer(wxVERTICAL); fsizer->Add(p, wxSizerFlags(1).Expand()); SetSizerAndFit(fsizer); }
void wxRearrangeDialog::AddExtraControls(wxWindow *win) { wxSizer * const sizer = GetSizer(); wxCHECK_RET( sizer, "the dialog must be created first" ); wxASSERT_MSG( sizer->GetChildren().GetCount() == Pos_Max, "calling AddExtraControls() twice?" ); sizer->Insert(Pos_Buttons, win, wxSizerFlags().Expand().Border()); win->MoveAfterInTabOrder(m_ctrl); // we need to update the initial/minimal window size sizer->SetSizeHints(this); }
bool wxRearrangeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayInt& order, const wxArrayString& items, long style, const wxValidator& validator, const wxString& name) { // create all the windows if ( !wxPanel::Create(parent, id, pos, size, wxTAB_TRAVERSAL, name) ) return false; m_list = new wxRearrangeList(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, order, items, style, validator); wxButton * const btnUp = new wxButton(this, wxID_UP); wxButton * const btnDown = new wxButton(this, wxID_DOWN); // arrange them in a sizer wxSizer * const sizerBtns = new wxBoxSizer(wxVERTICAL); sizerBtns->Add(btnUp, wxSizerFlags().Centre().Border(wxBOTTOM)); sizerBtns->Add(btnDown, wxSizerFlags().Centre().Border(wxTOP)); wxSizer * const sizerTop = new wxBoxSizer(wxHORIZONTAL); sizerTop->Add(m_list, wxSizerFlags(1).Expand().Border(wxRIGHT)); sizerTop->Add(sizerBtns, wxSizerFlags(0).Centre().Border(wxLEFT)); SetSizer(sizerTop); m_list->SetFocus(); return true; }
void OptionPage::OptionFont(wxSizer *sizer, std::string opt_prefix) { const agi::OptionValue *face_opt = OPT_GET(opt_prefix + "Font Face"); const agi::OptionValue *size_opt = OPT_GET(opt_prefix + "Font Size"); parent->AddChangeableOption(face_opt->GetName()); parent->AddChangeableOption(size_opt->GetName()); wxTextCtrl *font_name = new wxTextCtrl(this, -1, face_opt->GetString()); font_name->SetMinSize(wxSize(160, -1)); font_name->Bind(wxEVT_COMMAND_TEXT_UPDATED, StringUpdater(face_opt->GetName().c_str(), parent)); wxSpinCtrl *font_size = new wxSpinCtrl(this, -1, wxString::Format("%d", (int)size_opt->GetInt()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 42, size_opt->GetInt()); font_size->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, IntUpdater(size_opt->GetName().c_str(), parent)); wxButton *pick_btn = new wxButton(this, -1, _("Choose...")); pick_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(font_button, parent, font_name, font_size)); wxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL); button_sizer->Add(font_name, wxSizerFlags(1).Expand()); button_sizer->Add(pick_btn, wxSizerFlags().Expand()); Add(sizer, _("Font Face"), button_sizer); Add(sizer, _("Font Size"), font_size); }
PreferencesWindow::PreferencesWindow(wxWindow* parent) : wxDialog(parent, wxID_ANY, wxT("Preferences"), wxDefaultPosition, wxSize(400, 400), wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX) { wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); book = newd wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_TOP); //book->SetPadding(4); book->AddPage(CreateGeneralPage(), wxT("General"), true); book->AddPage(CreateEditorPage(), wxT("Editor")); book->AddPage(CreateGraphicsPage(), wxT("Graphics")); book->AddPage(CreateUIPage(), wxT("Interface")); book->AddPage(CreateClientPage(), wxT("Client Version")); sizer->Add(book, 1, wxEXPAND | wxALL, 10); wxSizer* subsizer = newd wxBoxSizer(wxHORIZONTAL); subsizer->Add(newd wxButton(this, wxID_OK, wxT("OK")), wxSizerFlags(1).Center()); subsizer->Add(newd wxButton(this, wxID_CANCEL, wxT("Cancel")), wxSizerFlags(1).Center()); subsizer->Add(newd wxButton(this, wxID_APPLY, wxT("Apply")), wxSizerFlags(1).Center()); sizer->Add(subsizer, 0, wxCENTER | wxLEFT | wxBOTTOM | wxRIGHT, 10); SetSizerAndFit(sizer); // FindWindowById(PANE_ADVANCED_GRAPHICS, this)->GetParent()->Fit(); }
RelationshipWindow::RelationshipWindow(wxWindow * parent) : wxPanel(parent) , m_imageList(0) { // ImageList const wxSize imageSize(32, 32); m_imageList = new wxImageList(imageSize.GetWidth(), imageSize.GetHeight()); m_imageList->Add(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, imageSize)); m_imageList->Add(wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, imageSize)); m_imageList->Add(wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, imageSize)); m_imageList->Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, imageSize)); m_searchTextCtrl = new wxTextCtrl(this, Ctrl_SearchText); m_searchTextCtrl->SetToolTip(gLangText.textSearchTip()); #if USES_TOOLBOOK m_bookCtrl = new wxToolbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_BOTTOM); #else m_bookCtrl = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM); #endif // USES_TOOLBOOK m_bookCtrl->Hide(); m_bookCtrl->AssignImageList(m_imageList); m_rsp0 = new RelationshipPanel(m_bookCtrl); m_rsp1 = new RelationshipPanel(m_bookCtrl); m_bookCtrl->AddPage( m_rsp0, gLangText.btnMyCompanyText(), false, 0 ); m_bookCtrl->AddPage( m_rsp1, gLangText.btnMyDepartmentText(), true, 1 ); gMyCompany = m_rsp0; gMyCoGroup = m_rsp1; gMsgHandler = m_rsp1; m_rsp0->buildAllContacts(); m_rsp1->buildConversations(); m_sizerFrame = new wxBoxSizer(wxVERTICAL); m_sizerFrame->Insert(0, m_bookCtrl, wxSizerFlags(4).Expand().Border(wxALL, 0)); m_sizerFrame->Show(m_bookCtrl); m_sizerFrame->Layout(); this->SetSizer(m_sizerFrame); m_sizerFrame->SetSizeHints(this); m_sizerFrame->Fit(this); //m_timer.SetOwner(this); }
int wxGenericFileDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); if (CreateExtraControl()) { wxSizer *sizer = GetSizer(); sizer->Insert(2 /* after m_filectrl */, m_extraControl, wxSizerFlags().Expand().HorzBorder()); sizer->Fit(this); } m_filectrl->SetDirectory(m_dir); return wxDialog::ShowModal(); }
void AdvancedDialog::AddAoPage(void) { if (TheAO()) { m_pAOPane = new AOConfigDialogPane(m_pDevicesSettingsPanel, TheAO()); m_pAOPane->LayoutControls(m_pDevicesSettingsPanel, m_brainCtrls); m_pAOPane->Layout(); m_pDevicesSettingsPanel->GetSizer()->Add(m_pAOPane, wxSizerFlags(0).Border(wxTOP, 10).Expand()); m_pDevicesSettingsPanel->Layout(); } else { m_pAOPane = NULL; } }
DbSelectionPanel::DbSelectionPanel(wxWindow* parent, const wxString& filePrompt, const wxString& filePickerCtrlTitle, bool autoValidate, PWScore* core, unsigned rowsep) : wxPanel(parent), m_filepicker(0), m_sc(0), m_bAutoValidate(autoValidate), m_core(core) { wxSizerFlags borderFlags = wxSizerFlags().Border(wxLEFT|wxRIGHT, SideMargin); /* This doesn't work since the second Border() call overwrites all the * previous border values. So now we have to insert separators by hand */ //wxSizerFlags rowFlags = borderFlags.Border(wxBOTTOM, RowSeparation); wxBoxSizer* panelSizer = new wxBoxSizer(wxVERTICAL); panelSizer->AddSpacer(TopMargin); panelSizer->Add(new wxStaticText(this, wxID_ANY, filePrompt), borderFlags); panelSizer->AddSpacer(RowSeparation); COpenFilePickerValidator validator(m_filepath); m_filepicker = new wxFilePickerCtrl(this, wxID_ANY, wxEmptyString, filePickerCtrlTitle, _("Password Safe Databases (*.psafe4; *.psafe3; *.dat)|*.psafe4;*.psafe3;*.dat|Password Safe Backups (*.bak)|*.bak|Password Safe Intermediate Backups (*.ibak)|*.ibak|All files (*.*; *)|*.*;*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE | wxFLP_USE_TEXTCTRL, validator); panelSizer->Add(m_filepicker, borderFlags.Expand()); panelSizer->AddSpacer(RowSeparation*rowsep); m_filepicker->Connect( m_filepicker->GetEventType(), wxFileDirPickerEventHandler(DbSelectionPanel::OnFilePicked), NULL, this); panelSizer->Add(new wxStaticText(this, wxID_ANY, _("Safe Combination:")), borderFlags); panelSizer->AddSpacer(RowSeparation); m_sc = new CSafeCombinationCtrl(this); m_sc->SetValidatorTarget(&m_combination); panelSizer->Add(m_sc, borderFlags.Expand()); SetSizerAndFit(panelSizer); //The parent window must call our TransferDataToWindow and TransferDataFromWindow m_parent->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY); }
wxNotificationMessageWindow::wxNotificationMessageWindow(wxGenericNotificationMessageImpl* notificationImpl) : wxFrame(NULL, wxID_ANY, _("Notice"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxFRAME_TOOL_WINDOW | wxSTAY_ON_TOP /* no caption, no border styles */), m_timer(this), m_mouseActiveCount(0), m_notificationImpl(notificationImpl) { m_buttonSizer = NULL; SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); m_messagePanel = new wxPanel(this, wxID_ANY); wxSizer * const msgSizer = new wxBoxSizer(wxHORIZONTAL); m_messagePanel->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); m_messagePanel->SetSizer(msgSizer); PrepareNotificationControl(m_messagePanel); // Add message icon to layout m_messageBmp = new wxStaticBitmap ( m_messagePanel, wxID_ANY, wxArtProvider::GetMessageBoxIcon(wxICON_INFORMATION) ); m_messageBmp->Hide(); PrepareNotificationControl(m_messageBmp); msgSizer->Add(m_messageBmp, wxSizerFlags().Centre().DoubleBorder()); // Create title and message sizers wxSizer* textSizer = new wxBoxSizer(wxVERTICAL); m_messageTitle = new wxStaticText(m_messagePanel, wxID_ANY, wxString()); m_messageTitle->SetFont(m_messageTitle->GetFont().MakeBold()); textSizer->Add(m_messageTitle, wxSizerFlags(0).Border()); m_messageTitle->Hide(); PrepareNotificationControl(m_messageTitle); m_messageText = new wxStaticText(m_messagePanel, wxID_ANY, wxString()); textSizer->Add(m_messageText, wxSizerFlags(0).Border(wxLEFT | wxRIGHT | wxBOTTOM)); PrepareNotificationControl(m_messageText); msgSizer->Add(textSizer, wxSizerFlags(1).Center()); // Add a single close button if no actions are specified m_closeBtn = wxBitmapButton::NewCloseButton(m_messagePanel, wxID_ANY); msgSizer->Add(m_closeBtn, wxSizerFlags(0).Border(wxALL, 3).Top()); m_closeBtn->Bind(wxEVT_BUTTON, &wxNotificationMessageWindow::OnCloseClicked, this); PrepareNotificationControl(m_closeBtn, false); wxSizer * const sizerTop = new wxBoxSizer(wxHORIZONTAL); sizerTop->Add(m_messagePanel, wxSizerFlags().Border(wxALL, FromDIP(1))); SetSizer(sizerTop); }
DialogDummyVideo::DialogDummyVideo(wxWindow *parent) : wxDialog(parent, -1, _("Dummy video options")) , fps(OPT_GET("Video/Dummy/FPS")->GetDouble()) , width(OPT_GET("Video/Dummy/Last/Width")->GetInt()) , height(OPT_GET("Video/Dummy/Last/Height")->GetInt()) , length(OPT_GET("Video/Dummy/Last/Length")->GetInt()) , color(OPT_GET("Colour/Video Dummy/Last Colour")->GetColor()) , pattern(OPT_GET("Video/Dummy/Pattern")->GetBool()) { SetIcon(GETICON(use_dummy_video_menu_16)); auto res_sizer = new wxBoxSizer(wxHORIZONTAL); res_sizer->Add(spin_ctrl(this, 1, 10000, &width), wxSizerFlags(1).Expand()); res_sizer->Add(new wxStaticText(this, -1, " x "), wxSizerFlags().Center()); res_sizer->Add(spin_ctrl(this, 1, 10000, &height), wxSizerFlags(1).Expand()); auto color_sizer = new wxBoxSizer(wxHORIZONTAL); auto color_btn = new ColourButton(this, wxSize(30, 17), false, color); color_sizer->Add(color_btn, wxSizerFlags().DoubleBorder(wxRIGHT)); color_sizer->Add(new wxCheckBox(this, -1, _("Checkerboard &pattern"), wxDefaultPosition, wxDefaultSize, 0, wxGenericValidator(&pattern)), wxSizerFlags(1).Center()); sizer = new wxFlexGridSizer(2, 5, 5); AddCtrl(_("Video resolution:"), resolution_shortcuts(this, width, height)); AddCtrl("", res_sizer); AddCtrl(_("Color:"), color_sizer); AddCtrl(_("Frame rate (fps):"), spin_ctrl(this, .1, 1000.0, &fps)); AddCtrl(_("Duration (frames):"), spin_ctrl(this, 2, 36000000, &length)); // Ten hours of 1k FPS AddCtrl("", length_display = new wxStaticText(this, -1, "")); wxStdDialogButtonSizer *btn_sizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL | wxHELP); btn_sizer->GetHelpButton()->Bind(wxEVT_BUTTON, std::bind(&HelpButton::OpenPage, "Dummy Video")); auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(sizer, wxSizerFlags(1).Border().Expand()); main_sizer->Add(new wxStaticLine(this, wxHORIZONTAL), wxSizerFlags().HorzBorder().Expand()); main_sizer->Add(btn_sizer, wxSizerFlags().Expand().Border()); UpdateLengthDisplay(); SetSizerAndFit(main_sizer); CenterOnParent(); Bind(wxEVT_COMBOBOX, &DialogDummyVideo::OnResolutionShortcut, this); color_btn->Bind(EVT_COLOR, [=](wxThreadEvent& e) { color = color_btn->GetColor(); }); Bind(wxEVT_SPINCTRL, [=](wxCommandEvent&) { TransferDataFromWindow(); UpdateLengthDisplay(); }); }
void AdvancedDialog::AddRotatorPage(void) { if (pRotator) { // We have a rotator selected m_pRotatorPane = new RotatorConfigDialogPane(m_pDevicesSettingsPanel, pRotator); m_pRotatorPane->LayoutControls(m_pDevicesSettingsPanel, m_brainCtrls); m_pRotatorPane->Layout(); m_pDevicesSettingsPanel->GetSizer()->Add(m_pRotatorPane, wxSizerFlags(0).Border(wxTOP, 10).Expand()); m_pDevicesSettingsPanel->Layout(); } else { m_pRotatorPane = NULL; } }
void AttentionBar::ShowMessage(const AttentionMessage& msg) { if ( msg.IsBlacklisted() ) return; wxString iconName; switch ( msg.m_kind ) { case AttentionMessage::Info: iconName = wxART_INFORMATION; break; case AttentionMessage::Warning: iconName = wxART_WARNING; break; case AttentionMessage::Error: iconName = wxART_ERROR; break; } m_icon->SetBitmap(wxArtProvider::GetBitmap(iconName, wxART_MENU, wxSize(16, 16))); m_label->SetLabelText(msg.m_text); m_buttons->Clear(true/*delete_windows*/); m_actions.clear(); for ( AttentionMessage::Actions::const_iterator i = msg.m_actions.begin(); i != msg.m_actions.end(); ++i ) { wxButton *b = new wxButton(this, wxID_ANY, i->first); #ifdef __WXMAC__ MakeButtonRounded(b->GetHandle()); #endif m_buttons->Add(b, wxSizerFlags().Center().Border(wxRIGHT, BUTTONS_SPACE)); m_actions[b] = i->second; } // we need to size the control correctly _and_ lay out the controls if this // is the first time it's being shown, otherwise we can get garbled look: SetSize(GetParent()->GetClientSize().x, GetBestSize().y); Layout(); Show(); GetParent()->Layout(); }
CreateTextureXDialog(wxWindow* parent) : wxDialog(parent, -1, "Create Texture Definitions") { // Setup layout auto m_vbox = new wxBoxSizer(wxVERTICAL); SetSizer(m_vbox); // --- Format options --- auto frame = new wxStaticBox(this, -1, "Format"); auto framesizer = new wxStaticBoxSizer(frame, wxVERTICAL); m_vbox->Add(framesizer, 0, wxEXPAND | wxALL, UI::pad()); // Doom format rb_format_doom_ = new wxRadioButton( this, -1, "Doom (TEXTURE1 + PNAMES)", wxDefaultPosition, wxDefaultSize, wxRB_GROUP); rb_format_strife_ = new wxRadioButton(this, -1, "Strife (TEXTURE1 + PNAMES)"); rb_format_textures_ = new wxRadioButton(this, -1, "ZDoom (TEXTURES)"); WxUtils::layoutVertically( framesizer, { rb_format_doom_, rb_format_strife_, rb_format_textures_ }, wxSizerFlags(1).Expand().Border(wxALL, UI::pad())); // --- Source options --- frame = new wxStaticBox(this, -1, "Source"); framesizer = new wxStaticBoxSizer(frame, wxVERTICAL); m_vbox->Add(framesizer, 0, wxEXPAND | wxALL, UI::pad()); // New list rb_new_ = new wxRadioButton(this, -1, "Create New (Empty)", wxDefaultPosition, wxDefaultSize, wxRB_GROUP); framesizer->Add(rb_new_, 0, wxEXPAND | wxALL, UI::pad()); // Import from Base Resource Archive rb_import_bra_ = new wxRadioButton(this, -1, "Import from Base Resource Archive:"); framesizer->Add(rb_import_bra_, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, UI::pad()); // Add buttons m_vbox->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, UI::pad()); // Bind events rb_new_->Bind(wxEVT_RADIOBUTTON, &CreateTextureXDialog::onRadioNewSelected, this); rb_import_bra_->Bind(wxEVT_RADIOBUTTON, &CreateTextureXDialog::onRadioNewSelected, this); SetInitialSize(wxSize(-1, -1)); wxWindowBase::Layout(); }
// ----------------------------------------------------------------------------- // OpenGLPrefsPanel class constructor // ----------------------------------------------------------------------------- OpenGLPrefsPanel::OpenGLPrefsPanel(wxWindow* parent) : PrefsPanelBase(parent), last_font_size_{ gl_font_size } { // Create sizer auto sizer = new wxBoxSizer(wxVERTICAL); SetSizer(sizer); WxUtils::layoutVertically( sizer, vector<wxObject*>{ cb_gl_np2_ = new wxCheckBox(this, -1, "Enable Non-power-of-two textures if supported"), cb_gl_point_sprite_ = new wxCheckBox(this, -1, "Enable point sprites if supported"), cb_gl_use_vbo_ = new wxCheckBox(this, -1, "Use Vertex Buffer Objects if supported"), WxUtils::createLabelHBox(this, "Font Size:", ntc_font_size_ = new NumberTextCtrl(this)) }, wxSizerFlags(0).Expand()); cb_gl_point_sprite_->SetToolTip( "Only disable this if you are experiencing graphical glitches like things disappearing"); ntc_font_size_->SetToolTip("The size of the font to use in OpenGL, eg. for info overlays in the map editor"); }
ObjectSidebar::ObjectSidebar( ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer ) : Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer), p(new ObjectSidebarImpl(scenarioEditor)) { wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(new wxStaticText(this, wxID_ANY, _("Filter")), wxSizerFlags().Align(wxALIGN_CENTER)); sizer->Add( Tooltipped( new wxTextCtrl(this, ID_ObjectFilter), _("Enter text to filter object list") ), wxSizerFlags().Expand().Proportion(1) ); m_MainSizer->Add(sizer, wxSizerFlags().Expand()); m_MainSizer->AddSpacer(3); // ------------------------------------------------------------------------------------------ wxArrayString strings; strings.Add(_("Entities")); strings.Add(_("Actors (all)")); wxChoice* objectType = new wxChoice(this, ID_ObjectType, wxDefaultPosition, wxDefaultSize, strings); objectType->SetSelection(0); m_MainSizer->Add(objectType, wxSizerFlags().Expand()); m_MainSizer->AddSpacer(3); // ------------------------------------------------------------------------------------------ p->m_ObjectListBox = new wxListBox(this, ID_SelectObject, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_HSCROLL); m_MainSizer->Add(p->m_ObjectListBox, wxSizerFlags().Proportion(1).Expand()); m_MainSizer->AddSpacer(3); // ------------------------------------------------------------------------------------------ m_MainSizer->Add(new wxButton(this, ID_ToggleViewer, _("Switch to Actor Viewer")), wxSizerFlags().Expand()); // ------------------------------------------------------------------------------------------ m_BottomBar = new ObjectBottomBar( bottomBarContainer, scenarioEditor, scenarioEditor.GetObjectSettings(), scenarioEditor.GetMapSettings(), p ); p->m_ToolConn = scenarioEditor.GetToolManager().GetCurrentTool().RegisterObserver(0, &ObjectSidebar::OnToolChange, this); }
wxFoldPanel wxFoldPanelBar::AddFoldPanel(const wxString &caption, int proportion, bool collapsedInitially, const wxCaptionBarStyle &style) { wxASSERT(m_controlCreated); // create a fold panel item, which is first only the caption. // the user can now add a panel area which will be folded in // when pressed. wxFoldPanelItem *item = new wxFoldPanelItem(this, caption, m_images, collapsedInitially, style); //item->SetWindowStyle(wxBORDER_STATIC); m_panelSizer->Add(item, wxSizerFlags().Expand().Proportion(proportion)); m_panels.Add(item); return wxFoldPanel(item); }
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); }
void wxGenericRichMessageDialog::AddMessageDialogDetails(wxSizer *sizer) { if ( !m_detailedText.empty() ) { wxSizer *sizerDetails = new wxBoxSizer( wxHORIZONTAL ); m_detailsPane = new wxCollapsiblePane( this, -1, m_detailsExpanderCollapsedLabel ); // add the detailed text wxWindow *windowPane = m_detailsPane->GetPane(); wxSizer *sizerPane = new wxBoxSizer( wxHORIZONTAL ); sizerPane->Add( new wxStaticText( windowPane, -1, m_detailedText ) ); windowPane->SetSizer( sizerPane ); sizerDetails->Add( m_detailsPane, wxSizerFlags().Right().Expand() ); sizer->Add( sizerDetails, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 ); } }
ScummToolsFrame::ScummToolsFrame(const wxString &title, const wxPoint &pos, const wxSize& size) : wxFrame((wxFrame *)NULL, -1, title, pos, size) { // Load the default configuration _configuration.load(); // We need a parent frame for correct background color (default frame looks 'disabled' in the background) wxPanel *main = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxT("Wizard Main Panel")); wxSizer *sizer = new wxBoxSizer(wxVERTICAL); // Add the top header, it's sweet! sizer->Add( new Header(main, wxT("logo.jpg"), wxT("tile.gif"), wxT("Extraction & Compression Wizard")), wxSizerFlags(0).Expand()); // Pane that holds the wizard window _wizardpane = new wxPanel(main); _wizardpane->SetSizer(new wxBoxSizer(wxVERTICAL)); sizer->Add(_wizardpane, wxSizerFlags(1).Expand().Border()); // Add a spacer line // We split it in two parts over a panel to have a small text there wxPanel *linepanel = new wxPanel(main, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxT("Wizard Line Panel")); wxSizer *linesizer = new wxBoxSizer(wxHORIZONTAL); wxStaticText *linetext = new wxStaticText(linepanel, wxID_ANY, wxGetApp().GetAppName()); linesizer->Add(linetext, wxSizerFlags()); linetext->Disable(); wxStaticLine *line = new wxStaticLine( linepanel, wxID_ANY, wxDefaultPosition, wxSize(300, 1), wxBORDER_SIMPLE | wxLI_HORIZONTAL, wxT("Line Spacer") ); line->Disable(); linesizer->Add(line, wxSizerFlags(1).Center()); linepanel->SetSizer(linesizer); // Add the line to the main panel sizer->Add(linepanel, wxSizerFlags().Expand().Center().Border()); // Buttons on the bottom _buttons = new WizardButtons(main, linetext, _configuration); sizer->Add(_buttons, wxSizerFlags().Border().Center().Expand()); main->SetSizer(sizer); }
TimelinePanel::TimelinePanel(wxScrolledWindow* scrollMe, int timeline, bool isConstant, wxString timelineTitle, wxString addLabel, wxWindow *parent, wxWindowID id) : wxPanel(parent, id, wxDefaultPosition, wxDefaultSize) { this->timeline = timeline; this->isConstant = isConstant; this->scrollMe = scrollMe; inst = 0; speedChange = 0; PushEventHandler(new WheelCatcher(scrollMe)); wxStaticText *text; wxStaticBox *staticBox = new wxStaticBox (this, wxID_ANY, timelineTitle); topBox = new wxStaticBoxSizer (staticBox, wxVERTICAL ); staticBox->PushEventHandler(new WheelCatcher(scrollMe)); SetSizer( topBox ); SetAutoLayout( true ); if (isConstant == false) { speedBox = new wxBoxSizer(wxHORIZONTAL); topBox->Add(speedBox, wxSizerFlags(0).Expand().Border(wxBOTTOM, 5)); text = new wxStaticText( this, wxID_ANY, _T("Slow "), wxDefaultPosition, wxDefaultSize); speedBox->Add(text, wxSizerFlags(0)); text->PushEventHandler(new WheelCatcher(scrollMe)); speedSlider = new wxSlider( this, SPEED_SLIDER, 0, 0, 254, wxDefaultPosition, wxSize(125,wxDefaultCoord), wxSL_AUTOTICKS); speedBox->Add(speedSlider, wxSizerFlags(1)); speedSlider->PushEventHandler(new WheelCatcher(scrollMe)); text = new wxStaticText( this, wxID_ANY, _T(" Fast"), wxDefaultPosition, wxDefaultSize); speedBox->Add(text, wxSizerFlags(0)); text->PushEventHandler(new WheelCatcher(scrollMe)); speedBox->Show(false); } else { speedBox = 0; speedSlider = 0; } effectBox = new wxBoxSizer(wxVERTICAL); topBox->Add(effectBox, wxSizerFlags(0).Expand()); addButton = new wxButton(this, ADD_BUTTON, addLabel, wxDefaultPosition, wxDefaultSize); topBox->Add(addButton, wxSizerFlags(0).Center()); addButton->PushEventHandler(new WheelCatcher(scrollMe)); }
void wxInfoBarGeneric::RemoveButton(wxWindowID btnid) { wxSizer * const sizer = GetSizer(); wxCHECK_RET( sizer, "must be created first" ); // iterate over the sizer items in reverse order to find the last added // button with this id (ids of all buttons should be unique anyhow but if // they are repeated removing the last added one probably makes more sense) const wxSizerItemList& items = sizer->GetChildren(); for ( wxSizerItemList::compatibility_iterator node = items.GetLast(); node != items.GetFirst(); node = node->GetPrevious() ) { const wxSizerItem * const item = node->GetData(); // if we reached the spacer separating the buttons from the text // preceding them without finding our button, it must mean it's not // there at all if ( item->IsSpacer() ) { wxFAIL_MSG( wxString::Format("button with id %d not found", btnid) ); return; } // check if we found our button if ( item->GetWindow()->GetId() == btnid ) { delete item->GetWindow(); break; } } // check if there are any custom buttons left if ( sizer->GetChildren().GetLast()->GetData()->IsSpacer() ) { // if the last item is the spacer, none are left so restore the // standard close button sizer->Add(m_button, wxSizerFlags().Centre().DoubleBorder()); m_button->Show(); } }
void wxInfoBarGeneric::AddButton(wxWindowID btnid, const wxString& label) { wxSizer * const sizer = GetSizer(); wxCHECK_RET( sizer, "must be created first" ); // user-added buttons replace the standard close button so remove it if we // hadn't done it yet if ( sizer->Detach(m_button) ) { m_button->Hide(); } wxButton * const button = new wxButton(this, btnid, label); #ifdef __WXMAC__ // smaller buttons look better in the (narrow) info bar under OS X button->SetWindowVariant(wxWINDOW_VARIANT_SMALL); #endif // __WXMAC__ sizer->Add(button, wxSizerFlags().Centre().DoubleBorder()); }
BacklashGraph::BacklashGraph(wxDialog *parent, BacklashTool *pBL) : wxDialog(parent, wxID_ANY, wxGetTranslation(_("Backlash Results")), wxDefaultPosition, wxSize(500, 400)) { m_BLT = pBL; // Just but a big button area for the graph with a button below it wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL); // Use a bitmap button so we don't waste cycles in paint events wxBitmap theGraph = CreateGraph(450, 300); wxBitmapButton *graphButton = new wxBitmapButton(this, wxID_ANY, theGraph, wxDefaultPosition, wxSize(450, 300), wxBU_AUTODRAW | wxBU_EXACTFIT); vSizer->Add(graphButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL | wxFIXED_MINSIZE, 5); graphButton->SetBitmapDisabled(theGraph); graphButton->Enable(false); // ok button because we're modal vSizer->Add( CreateButtonSizer(wxOK), wxSizerFlags(0).Expand().Border(wxALL, 10)); SetSizerAndFit(vSizer); }
// ----------------------------------------------------------------------------- // Sets up the lines tab // ----------------------------------------------------------------------------- void MapDisplayPrefsPanel::setupLinesTab() { // Add tab auto panel = new wxPanel(stc_pages_, -1); stc_pages_->AddPage(panel, "Lines"); auto sz_border = new wxBoxSizer(wxVERTICAL); panel->SetSizer(sz_border); auto sizer = new wxBoxSizer(wxVERTICAL); sz_border->Add(sizer, 1, wxEXPAND | wxALL, UI::padLarge()); WxUtils::layoutVertically( sizer, { WxUtils::createLabelHBox( panel, "Line width:", slider_line_width_ = new wxSlider( panel, -1, line_width * 10, 10, 30, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS)), cb_line_smooth_ = new wxCheckBox(panel, -1, "Smooth lines"), cb_line_fade_ = new wxCheckBox(panel, -1, "Fade when not in lines mode") }, wxSizerFlags(0).Expand()); }
SuggestionsSidebarBlock::SuggestionsSidebarBlock(Sidebar *parent, wxMenu *menu) : SidebarBlock(parent, _("Translation suggestions:"), NoUpperMargin), m_suggestionsMenu(menu), m_msgPresent(false), m_pendingQueries(0), m_latestQueryId(0), m_lastUpdateTime(0) { m_provider.reset(new SuggestionsProvider); m_msgSizer = new wxBoxSizer(wxHORIZONTAL); m_msgIcon = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap); m_msgText = new ExplanationLabel(parent, ""); m_msgSizer->Add(m_msgIcon, wxSizerFlags().Center().PXBorderAll()); m_msgSizer->Add(m_msgText, wxSizerFlags(1).Center().PXBorder(wxTOP|wxBOTTOM)); m_innerSizer->Add(m_msgSizer, wxSizerFlags().Expand()); m_innerSizer->AddSpacer(PX(10)); m_suggestionsSizer = new wxBoxSizer(wxVERTICAL); m_extrasSizer = new wxBoxSizer(wxVERTICAL); m_innerSizer->Add(m_suggestionsSizer, wxSizerFlags().Expand()); m_innerSizer->Add(m_extrasSizer, wxSizerFlags().Expand()); m_iGotNothing = new wxStaticText(parent, wxID_ANY, #ifdef __WXMSW__ // TRANSLATORS: This is shown when no translation suggestions can be found in the TM (Windows). _("No matches found") #else // TRANSLATORS: This is shown when no translation suggestions can be found in the TM (OS X, Linux). _("No Matches Found") #endif ); m_iGotNothing->SetForegroundColour(ExplanationLabel::GetTextColor().ChangeLightness(150)); m_iGotNothing->SetWindowVariant(wxWINDOW_VARIANT_NORMAL); #ifdef __WXMSW__ m_iGotNothing->SetFont(m_iGotNothing->GetFont().Larger()); #endif m_innerSizer->Add(m_iGotNothing, wxSizerFlags().Center().Border(wxTOP|wxBOTTOM, PX(100))); BuildSuggestionsMenu(); m_suggestionsTimer.SetOwner(parent); parent->Bind(wxEVT_TIMER, &SuggestionsSidebarBlock::OnDelayedShowSuggestionsForItem, this, m_suggestionsTimer.GetId()); }
// ----------------------------------------------------------------------------- // Sets up the vertices tab // ----------------------------------------------------------------------------- void MapDisplayPrefsPanel::setupVerticesTab() { // Add tab auto panel = new wxPanel(stc_pages_, -1); stc_pages_->AddPage(panel, "Vertices"); auto sz_border = new wxBoxSizer(wxVERTICAL); panel->SetSizer(sz_border); auto sizer = new wxBoxSizer(wxVERTICAL); sz_border->Add(sizer, 1, wxEXPAND | wxALL, UI::padLarge()); slider_vertex_size_ = new wxSlider(panel, -1, vertex_size, 2, 16, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS); choice_vertices_always_ = new wxChoice(panel, -1); choice_vertices_always_->Set(WxUtils::arrayString({ "Hide", "Show", "Fade" })); cb_vertex_round_ = new wxCheckBox(panel, -1, "Round vertices"); WxUtils::layoutVertically( sizer, { WxUtils::createLabelHBox(panel, "Vertex Size:", slider_vertex_size_), WxUtils::createLabelHBox(panel, "When not in vertices mode:", choice_vertices_always_), cb_vertex_round_ }, wxSizerFlags(0).Expand()); }
bool PreviewPanel::previewFile( DatFile& p_datFile, const DatIndexEntry& p_entry ) { auto entryData = p_datFile.readFile( p_entry.mftEntry( ) ); if ( !entryData.GetSize( ) ) { return false; } // Create file reader auto reader = FileReader::readerForData( entryData, p_datFile, p_entry.fileType( ) ); if ( reader ) { if ( m_currentView ) { // Check if we can re-use the current viewer if ( m_currentDataType == reader->dataType( ) ) { m_currentView->setReader( reader ); return true; } // Destroy the old viewer if ( m_currentView ) { this->GetSizer( )->Remove( 0 ); m_currentView->Destroy( ); } } m_currentView = this->createViewerForDataType( reader->dataType( ), p_datFile ); if ( m_currentView ) { // Workaround for wxWidgets fuckups this->GetSizer( )->Add( m_currentView, wxSizerFlags( ).Expand( ).Proportion( 1 ) ); this->GetSizer( )->Layout( ); this->GetSizer( )->Fit( this ); // Set the reader m_currentView->setReader( reader ); m_currentDataType = reader->dataType( ); return true; } } return false; }
VHDDSetInfoDialog::VHDDSetInfoDialog(wxWindow* parent) : wxDialog(parent, wxID_ANY, "HDD Settings") { m_spin_size = new wxSpinCtrl(this); m_ch_type = new wxChoice(this, wxID_ANY); m_spin_block_size = new wxSpinCtrl(this); wxBoxSizer* s_sinf = new wxBoxSizer(wxHORIZONTAL); s_sinf->Add(m_spin_size, wxSizerFlags().Border(wxALL, 5).Expand()); s_sinf->Add(m_ch_type, wxSizerFlags().Border(wxALL, 5).Expand()); wxBoxSizer* s_binf = new wxBoxSizer(wxHORIZONTAL); s_binf->Add(m_spin_block_size, wxSizerFlags().Border(wxALL, 5).Expand()); wxBoxSizer* s_btns = new wxBoxSizer(wxHORIZONTAL); s_btns->Add(new wxButton(this, wxID_OK), wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL, 5)); s_btns->Add(new wxButton(this, wxID_CANCEL), wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxALL, 5)); wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL); s_main->Add(s_sinf, wxSizerFlags().Align(wxALIGN_TOP).Expand()); s_main->Add(s_binf, wxSizerFlags().Align(wxALIGN_TOP).Expand()); s_main->Add(s_btns, wxSizerFlags().Align(wxALIGN_BOTTOM).Expand()); SetSizerAndFit(s_main); m_ch_type->Append("B"); m_ch_type->Append("KB"); m_ch_type->Append("MB"); m_ch_type->Append("GB"); m_spin_size->SetRange(1, 0x7fffffff); m_spin_size->SetValue(64); m_ch_type->SetSelection(3); m_spin_block_size->SetRange(64, 0x7fffffff); m_spin_block_size->SetValue(2048); Bind(wxEVT_BUTTON, &VHDDSetInfoDialog::OnOk, this, wxID_OK); }
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(); }