void WFileList::UpdateDisplayMode(int newmode) { switch (newmode) { case 0: SetWindowStyleFlag(wxLC_ICON | wxLC_EDIT_LABELS); displaymode = 0; break; case 1: SetWindowStyleFlag(wxLC_LIST | wxLC_EDIT_LABELS); displaymode = 1; break; case 2: { SetWindowStyleFlag(wxLC_REPORT | wxLC_EDIT_LABELS); displaymode = 2; int col = 0; if (metasettings.show_filename >= 0) { InsertColumn(col++, _("Filename"), wxLIST_FORMAT_LEFT, metasettings.show_filename); } if (metasettings.show_size >= 0) { InsertColumn(col++, _("Size"), wxLIST_FORMAT_RIGHT, metasettings.show_size); } if (metasettings.show_compressed >= 0) { InsertColumn(col++, _("Compressed"), wxLIST_FORMAT_RIGHT, metasettings.show_compressed); } if (metasettings.show_compression >= 0) { InsertColumn(col++, _("Compression"), wxLIST_FORMAT_LEFT, metasettings.show_compression); } if (metasettings.show_encryption >= 0) { InsertColumn(col++, _("Encryption"), wxLIST_FORMAT_LEFT, metasettings.show_encryption); } if (metasettings.show_mtime >= 0) { InsertColumn(col++, _("MTime"), wxLIST_FORMAT_LEFT, metasettings.show_mtime); } if (metasettings.show_ctime >= 0) { InsertColumn(col++, _("CTime"), wxLIST_FORMAT_LEFT, metasettings.show_ctime); } if (metasettings.show_author >= 0) { InsertColumn(col++, _("Author"), wxLIST_FORMAT_LEFT, metasettings.show_author); } if (metasettings.show_subject >= 0) { InsertColumn(col++, _("Subject"), wxLIST_FORMAT_LEFT, metasettings.show_subject); } } break; default: displaymode = newmode; break; } }
void Viewer::ViewportMode(ScreenMode newMode) { if (m_screenMode == newMode) { return; } m_screenMode = newMode; if (newMode == Viewer::SM_Fullscreen) { m_userInitiatedMove = false; wxDisplay mon(DisplayFromPointFallback(PositionScreen())); m_statusBar->Show(false); m_previousWindowStyle = GetWindowStyle(); SetWindowStyleFlag(wxBORDER_NONE); m_previousWindowRegion = wxToRect(GetRect()); auto monRegion = wxToRect(mon.GetClientArea()); SetSize(monRegion.Left(), monRegion.Top(), monRegion.Width(), monRegion.Height()); m_viewPort.ActiveCursorMode(ViewPort::CursorHideAutomatic); Raise(); m_userInitiatedMove = true; } else { m_userInitiatedMove = false; SetWindowStyleFlag(m_previousWindowStyle); m_statusBar->Show(m_cfg.View.ShowStatusBar); SetSize(m_previousWindowRegion.Left(), m_previousWindowRegion.Top(), m_previousWindowRegion.Width(), m_previousWindowRegion.Height()); m_viewPort.ActiveCursorMode(ViewPort::CursorShow); m_userInitiatedMove = true; } // Make sure that the settings and adjust dialogs are on top (if running) InitDialogs(); if (m_settings->IsVisible()) { ShowSettings(); } if (m_adjust->IsVisible()) { ShowAdjust(); } ImageChanged(); UpdateImageInformation(); }
dlgSelectDatabase::dlgSelectDatabase(wxWindow *parent, int id, const wxPoint &pos, const wxSize &size, long style): wxDialog(parent, id, wxT("Select Database"), pos, size, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { #ifdef __WXMSW__ SetWindowStyleFlag(GetWindowStyleFlag() & ~wxMAXIMIZE_BOX); #endif wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); tcServers = new wxTreeCtrl(this, TCSERVER_ID); mainSizer->Add(tcServers, 1, wxEXPAND, 0); wxBoxSizer *bottomSizer = new wxBoxSizer(wxHORIZONTAL); bottomSizer->AddStretchSpacer(); wxButton *btnOk = new wxButton(this, wxID_OK, wxT("&OK")); bottomSizer->Add(btnOk); wxButton *btnCANCEL = new wxButton(this, wxID_CANCEL, wxT("&Cancel")); bottomSizer->Add(btnCANCEL, 0, wxLEFT, 10); mainSizer->Add(bottomSizer, 0, wxALL | wxALIGN_RIGHT, 5); SetSizer(mainSizer); SetSize(wxSize(200, 240)); Layout(); Centre(); Initialize(); }
void wxSpeedButton::SetAlign(int inAlign) { int i,n; // make sure a valid alignment n = inAlign; if ((n != wxBU_LEFT) && (n != wxBU_TOP) &&(n != wxBU_RIGHT) &&(n != wxBU_BOTTOM)) n = wxBU_LEFT; // get current style i = GetWindowStyleFlag(); // remove old alignment, and border info i = i & (~ wxBORDER_MASK); i = i & (~ wxBU_ALIGN_MASK); // put in alignment and no-border i = i | wxBORDER_NONE; i = i | n; i = i | wxCLIP_CHILDREN; // save new style SetWindowStyleFlag(i); Refresh(false); }
bool wxTopLevelWindowQt::Create( wxWindow *parent, wxWindowID winId, const wxString &title, const wxPoint &pos, const wxSize &sizeOrig, long style, const wxString &name ) { wxSize size(sizeOrig); if ( !size.IsFullySpecified() ) size.SetDefaults( GetDefaultSize() ); wxTopLevelWindows.Append( this ); if (!CreateBase( parent, winId, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxTopLevelWindowNative creation failed") ); return false; } SetTitle( title ); SetWindowStyleFlag( style ); if (pos != wxDefaultPosition) m_qtWindow->move( pos.x, pos.y ); m_qtWindow->resize( wxQtConvertSize( size ) ); // Prevent automatic deletion of Qt main window on close // (this should be the default, but left just fo enforce it) GetHandle()->setAttribute(Qt::WA_DeleteOnClose, false); // not calling to wxWindow::Create, so do the rest of initialization: if (parent) parent->AddChild( this ); return true; }
bool wxAuiMDIClientWindow::CreateClient(wxAuiMDIParentFrame* parent, long style) { SetWindowStyleFlag(style); wxSize caption_icon_size = wxSize(wxSystemSettings::GetMetric(wxSYS_SMALLICON_X), wxSystemSettings::GetMetric(wxSYS_SMALLICON_Y)); SetUniformBitmapSize(caption_icon_size); if (!wxAuiNotebook::Create(parent, wxID_ANY, wxPoint(0,0), wxSize(100, 100), wxAUI_NB_DEFAULT_STYLE | wxNO_BORDER)) { return false; } wxColour bkcolour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE); SetOwnBackgroundColour(bkcolour); m_mgr.GetArtProvider()->SetColour(wxAUI_DOCKART_BACKGROUND_COLOUR, bkcolour); return true; }
/* FlatTexCanvas::FlatTexCanvas * FlatTexCanvas class constructor *******************************************************************/ FlatTexCanvas::FlatTexCanvas(wxWindow* parent) : OGLCanvas(parent, -1) { // Init variables texture = NULL; SetWindowStyleFlag(wxBORDER_SIMPLE); SetInitialSize(wxSize(136, 136)); }
/* SpriteTexCanvas::SideTexCanvas * SpriteTexCanvas class constructor *******************************************************************/ SpriteTexCanvas::SpriteTexCanvas(wxWindow* parent) : OGLCanvas(parent, -1) { // Init variables texture = NULL; col = COL_WHITE; icon = false; SetWindowStyleFlag(wxBORDER_SIMPLE); SetInitialSize(wxSize(128, 128)); }
InfoPane::InfoPane(wxWindow* parent) : cbAuiNotebook(parent, idNB, wxDefaultPosition, wxDefaultSize, infopane_flags), baseID(wxNewId()) { defaultBitmap = cbLoadBitmap(ConfigManager::GetDataFolder() + _T("/images/edit_16x16.png"), wxBITMAP_TYPE_PNG); if (Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/environment/infopane_tabs_bottom"), false)) SetWindowStyleFlag(GetWindowStyleFlag() | wxAUI_NB_BOTTOM); wxRegisterId(baseID + num_pages); for(int i = 0; i < num_pages; ++i) { page[i] = Page(); } }
void InfoPane::OnTabPosition(wxCommandEvent& event) { long style = GetWindowStyleFlag(); style &= ~wxAUI_NB_BOTTOM; if (event.GetId() == idNB_TabBottom) style |= wxAUI_NB_BOTTOM; SetWindowStyleFlag(style); Refresh(); // (style & wxAUI_NB_BOTTOM) saves info only about the the tabs position Manager::Get()->GetConfigManager(_T("app"))->Write(_T("/environment/infopane_tabs_bottom"), (bool)(style & wxAUI_NB_BOTTOM)); }
void Viewer::AlwaysOnTop(bool doAlwaysOnTop) { auto style = GetWindowStyleFlag(); if (doAlwaysOnTop) { style |= wxSTAY_ON_TOP; } else { style &= ~(wxSTAY_ON_TOP); } SetWindowStyleFlag(style); }
bool wxTopLevelWindowMSW::EnableMinimizeButton(bool enable) { if ( ( HasFlag(wxCAPTION) && ( HasFlag(wxCLOSE_BOX) || HasFlag(wxSYSTEM_MENU) ) ) && HasFlag(wxMINIMIZE_BOX) ) { if ( enable ) { SetWindowStyleFlag(GetWindowStyleFlag() | wxMINIMIZE_BOX); } else { SetWindowStyleFlag(GetWindowStyleFlag() ^ wxMINIMIZE_BOX); // Restore the style to our internal store wxWindowBase::SetWindowStyleFlag(GetWindowStyle() | wxMINIMIZE_BOX); } return true; } return false; }
void WXAppBar::SetBorderDecorations (bool enable, bool apply) { if (enable == GetBorderDecorations()) return; // Changes the flag long style= GetWindowStyleFlag(); if (enable) { // Enable decorations style= style & ~wxNO_BORDER; // style= style | wxCAPTION; } else { // Disable decorations style= style | wxNO_BORDER; // style= style & ~wxCAPTION; } SetWindowStyleFlag(style); // According to the manual, after changing flags a Refresh is needed Refresh(); #if defined(__WXMSW__) // TODO (void)(apply); // Remove warning assert (false); #elif defined(__WXGTK__) // // On WXGTK the above code is not enough, so we change this property // using gtk+ directly // // Get X11 handle for our window GtkWindow *gtkWindow= (GtkWindow *) GetHandle(); assert (gtkWindow); if (!gtkWindow) return; bool isShown= IsShown(); if (apply && isShown) wxDialog::Show(false); gtk_window_set_decorated ((GtkWindow *) GetHandle(), (enable? TRUE : FALSE)); if (apply && isShown) { wxDialog::Show(true); Refresh(); Update(); } #else assert (false); #endif }
bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { m_qtToolBar = new wxQtToolbar( parent, this ); m_qtToolBar->setWindowTitle( wxQtConvertString( name ) ); SetWindowStyleFlag(style); // not calling to wxWindow::Create, so do the rest of initialization: if (parent) parent->AddChild( this ); PostCreation(); return wxWindowBase::CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ); }
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) { SetWindowStyleFlag(style); // m_windowParent = parent; // m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE); bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0); if (success) { wxFont font(10, wxSWISS, wxNORMAL, wxNORMAL); SetFont(font); return true; } else return false; }
ToasterBoxWindow::ToasterBoxWindow(wxWindow* parent, wxTimer* _parent2) : startTime(wxGetLocalTime()) , parent2(_parent2) , sleepTime(10) , pauseTime(1700) , textColor(*wxWHITE) , headerTextColor(*wxBLUE) , popupText(_T("Change Me!")) , shrink(false) { Create(parent, wxID_ANY); SetWindowStyleFlag(wxNO_BORDER | wxSTAY_ON_TOP | wxFRAME_NO_TASKBAR); count++; //the size we want the dialog to be wxSize dialogSize(150, 170); bottomRight = wxPoint(wxGetDisplaySize().GetWidth(), wxGetDisplaySize().GetHeight()); SetSize(bottomRight.x, bottomRight.y, dialogSize.GetWidth(), dialogSize.GetHeight()); ToasterBase::Connect(wxEVT_PAINT, (wxObjectEventFunction)&ToasterBoxWindow::OnPaint); SetBackgroundBitmap(charArr2wxBitmap(notif_bg_png, sizeof(notif_bg_png))); }
// ---------------------------------------------------------------------------- // SpriteTexCanvas::SideTexCanvas // // SpriteTexCanvas class constructor // ---------------------------------------------------------------------------- SpriteTexCanvas::SpriteTexCanvas(wxWindow* parent) : OGLCanvas(parent, -1) { SetWindowStyleFlag(wxBORDER_SIMPLE); SetInitialSize(WxUtils::scaledSize(128, 128)); }
void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane) { m_pane_window = pane.window; m_pane_window->Reparent(this); wxAuiPaneInfo contained_pane = pane; contained_pane.Dock().Center().Show(). CaptionVisible(false). PaneBorder(false). Layer(0).Row(0).Position(0); // Carry over the minimum size wxSize pane_min_size = pane.window->GetMinSize(); // if the frame window's max size is greater than the min size // then set the max size to the min size as well wxSize cur_max_size = GetMaxSize(); if (cur_max_size.IsFullySpecified() && (cur_max_size.x < pane.min_size.x || cur_max_size.y < pane.min_size.y) ) { SetMaxSize(pane_min_size); } SetMinSize(pane.window->GetMinSize()); m_mgr.AddPane(m_pane_window, contained_pane); m_mgr.Update(); if (pane.min_size.IsFullySpecified()) { // because SetSizeHints() calls Fit() too (which sets the window // size to its minimum allowed), we keep the size before calling // SetSizeHints() and reset it afterwards... wxSize tmp = GetSize(); GetSizer()->SetSizeHints(this); SetSize(tmp); } SetTitle(pane.caption); // This code is slightly awkward because we need to reset wxRESIZE_BORDER // before calling SetClientSize() below as doing it after setting the // client size would actually change it, at least under MSW, where the // total window size doesn't change and hence, as the borders size changes, // the client size does change. // // So we must call it first but doing it generates a size event and updates // pane.floating_size from inside it so we must also record its original // value before doing it. const bool hasFloatingSize = pane.floating_size != wxDefaultSize; if (pane.IsFixed()) { SetWindowStyleFlag(GetWindowStyleFlag() & ~wxRESIZE_BORDER); } if ( hasFloatingSize ) { SetSize(pane.floating_size); } else { wxSize size = pane.best_size; if (size == wxDefaultSize) size = pane.min_size; if (size == wxDefaultSize) size = m_pane_window->GetSize(); if (m_owner_mgr && pane.HasGripper()) { if (pane.HasGripperTop()) size.y += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); else size.x += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); } SetClientSize(size); } }
TrackPropDlg::TrackPropDlg( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { long wstyle = style; #ifdef __WXOSX__ wstyle |= wxSTAY_ON_TOP; #endif SetWindowStyleFlag( wstyle ); this->SetSizeHints( wxSize( 670,440 ), wxDefaultSize ); wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_panelBasic = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerBasic; bSizerBasic = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bSizerName; bSizerName = new wxBoxSizer( wxHORIZONTAL ); m_stName = new wxStaticText( m_panelBasic, wxID_ANY, _("Name"), wxDefaultPosition, wxDefaultSize, 0 ); m_stName->Wrap( -1 ); bSizerName->Add( m_stName, 0, wxALL, 5 ); m_tName = new wxTextCtrl( m_panelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizerName->Add( m_tName, 1, 0, 5 ); bSizerBasic->Add( bSizerName, 0, wxALL|wxEXPAND, 5 ); wxBoxSizer* bSizerFromTo; bSizerFromTo = new wxBoxSizer( wxHORIZONTAL ); m_stFrom = new wxStaticText( m_panelBasic, wxID_ANY, _("From"), wxDefaultPosition, wxDefaultSize, 0 ); m_stFrom->Wrap( -1 ); bSizerFromTo->Add( m_stFrom, 0, wxALL, 5 ); m_tFrom = new wxTextCtrl( m_panelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizerFromTo->Add( m_tFrom, 1, 0, 5 ); m_stTo = new wxStaticText( m_panelBasic, wxID_ANY, _("To"), wxDefaultPosition, wxDefaultSize, 0 ); m_stTo->Wrap( -1 ); bSizerFromTo->Add( m_stTo, 0, wxALL, 5 ); m_tTo = new wxTextCtrl( m_panelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizerFromTo->Add( m_tTo, 1, 0, 5 ); bSizerBasic->Add( bSizerFromTo, 0, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizerParams; sbSizerParams = new wxStaticBoxSizer( new wxStaticBox( m_panelBasic, wxID_ANY, _("Display parameters") ), wxHORIZONTAL ); m_cbShow = new wxCheckBox( m_panelBasic, wxID_ANY, _("Show on chart"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerParams->Add( m_cbShow, 0, wxALL, 5 ); m_stColor = new wxStaticText( m_panelBasic, wxID_ANY, _("Color"), wxDefaultPosition, wxDefaultSize, 0 ); m_stColor->Wrap( -1 ); sbSizerParams->Add( m_stColor, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxString m_cColorChoices[] = { _("Default color"), _("Black"), _("Dark Red"), _("Dark Green"), _("Dark Yellow"), _("Dark Blue"), _("Dark Magenta"), _("Dark Cyan"), _("Light Gray"), _("Dark Gray"), _("Red"), _("Green"), _("Yellow"), _("Blue"), _("Magenta"), _("Cyan"), _("White") }; int m_cColorNChoices = sizeof( m_cColorChoices ) / sizeof(wxString); m_cColor = new wxChoice( m_panelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cColorNChoices, m_cColorChoices, 0 ); m_cColor->SetSelection( 0 ); sbSizerParams->Add( m_cColor, 1, 0, 5 ); m_stStyle = new wxStaticText( m_panelBasic, wxID_ANY, _("Style"), wxDefaultPosition, wxDefaultSize, 0 ); m_stStyle->Wrap( -1 ); sbSizerParams->Add( m_stStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxString m_cStyleChoices[] = { _("Default"), _("Solid"), _("Dot"), _("Long dash"), _("Short dash"), _("Dot dash") }; int m_cStyleNChoices = sizeof( m_cStyleChoices ) / sizeof(wxString); m_cStyle = new wxChoice( m_panelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cStyleNChoices, m_cStyleChoices, 0 ); m_cStyle->SetSelection( 0 ); sbSizerParams->Add( m_cStyle, 1, 0, 5 ); m_stWidth = new wxStaticText( m_panelBasic, wxID_ANY, _("Width"), wxDefaultPosition, wxDefaultSize, 0 ); m_stWidth->Wrap( -1 ); sbSizerParams->Add( m_stWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxString m_cWidthChoices[] = { _("Default"), _("1 pixel"), _("2 pixels"), _("3 pixels"), _("4 pixels"), _("5 pixels"), _("6 pixels"), _("7 pixels"), _("8 pixels"), _("9 pixels"), _("10 pixels") }; int m_cWidthNChoices = sizeof( m_cWidthChoices ) / sizeof(wxString); m_cWidth = new wxChoice( m_panelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cWidthNChoices, m_cWidthChoices, 0 ); m_cWidth->SetSelection( 0 ); sbSizerParams->Add( m_cWidth, 1, 0, 5 ); bSizerBasic->Add( sbSizerParams, 0, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizerStats; sbSizerStats = new wxStaticBoxSizer( new wxStaticBox( m_panelBasic, wxID_ANY, _("Statistics") ), wxVERTICAL ); wxBoxSizer* bSizerStats; bSizerStats = new wxBoxSizer( wxHORIZONTAL ); m_stTotDistance = new wxStaticText( m_panelBasic, wxID_ANY, _("Total distance"), wxDefaultPosition, wxDefaultSize, 0 ); m_stTotDistance->Wrap( -1 ); bSizerStats->Add( m_stTotDistance, 0, wxALL, 5 ); m_tTotDistance = new wxTextCtrl( m_panelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); bSizerStats->Add( m_tTotDistance, 1, 0, 5 ); m_stAvgSpeed = new wxStaticText( m_panelBasic, wxID_ANY, _("Avg. speed"), wxDefaultPosition, wxDefaultSize, 0 ); m_stAvgSpeed->Wrap( -1 ); bSizerStats->Add( m_stAvgSpeed, 0, wxALL, 5 ); m_tAvgSpeed = new wxTextCtrl( m_panelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); bSizerStats->Add( m_tAvgSpeed, 1, 0, 5 ); m_stTimeEnroute = new wxStaticText( m_panelBasic, wxID_ANY, _("Time enroute"), wxDefaultPosition, wxDefaultSize, 0 ); m_stTimeEnroute->Wrap( -1 ); bSizerStats->Add( m_stTimeEnroute, 0, wxALL, 5 ); m_tTimeEnroute = new wxTextCtrl( m_panelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); bSizerStats->Add( m_tTimeEnroute, 2, 0, 5 ); sbSizerStats->Add( bSizerStats, 0, wxEXPAND, 5 ); bSizerBasic->Add( sbSizerStats, 0, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizerPoints; sbSizerPoints = new wxStaticBoxSizer( new wxStaticBox( m_panelBasic, wxID_ANY, _("Recorded points") ), wxVERTICAL ); m_lcPoints = new OCPNTrackListCtrl( m_panelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_EDIT_LABELS | wxLC_VIRTUAL ); m_lcPoints->InsertColumn( 0, _("Leg"), wxLIST_FORMAT_LEFT, 45 ); m_lcPoints->InsertColumn( 2, _("Distance"), wxLIST_FORMAT_RIGHT, 70 ); m_lcPoints->InsertColumn( 3, _("Bearing"), wxLIST_FORMAT_LEFT, 70 ); m_lcPoints->InsertColumn( 4, _("Latitude"), wxLIST_FORMAT_LEFT, 85 ); m_lcPoints->InsertColumn( 5, _("Longitude"), wxLIST_FORMAT_LEFT, 90 ); m_lcPoints->InsertColumn( 6, _("Timestamp"), wxLIST_FORMAT_LEFT, 135 ); m_lcPoints->InsertColumn( 7, _("Speed"), wxLIST_FORMAT_CENTER, 100 ); sbSizerPoints->Add( m_lcPoints, 1, wxALL|wxEXPAND, 5 ); bSizerBasic->Add( sbSizerPoints, 1, wxALL|wxEXPAND, 5 ); m_panelBasic->SetSizer( bSizerBasic ); m_panelBasic->Layout(); bSizerBasic->Fit( m_panelBasic ); m_notebook1->AddPage( m_panelBasic, _("Basic"), true ); m_panelAdvanced = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerAdvanced; bSizerAdvanced = new wxBoxSizer( wxVERTICAL ); m_stDescription = new wxStaticText( m_panelAdvanced, wxID_ANY, _("Description"), wxDefaultPosition, wxDefaultSize, 0 ); m_stDescription->Wrap( -1 ); bSizerAdvanced->Add( m_stDescription, 0, wxALL, 5 ); m_tDescription = new wxTextCtrl( m_panelAdvanced, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); bSizerAdvanced->Add( m_tDescription, 1, wxALL|wxEXPAND, 5 ); sbSizerLinks = new wxStaticBoxSizer( new wxStaticBox( m_panelAdvanced, wxID_ANY, _("Links") ), wxVERTICAL ); m_scrolledWindowLinks = new wxScrolledWindow( m_panelAdvanced, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); m_scrolledWindowLinks->SetScrollRate( 5, 5 ); bSizerLinks = new wxBoxSizer( wxVERTICAL ); m_hyperlink1 = new wxHyperlinkCtrl( m_scrolledWindowLinks, wxID_ANY, _("wxFB Website"), wxT("http://www.wxformbuilder.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_menuLink = new wxMenu(); wxMenuItem* m_menuItemEdit; m_menuItemEdit = new wxMenuItem( m_menuLink, wxID_ANY, wxString( _("Edit") ) , wxEmptyString, wxITEM_NORMAL ); m_menuLink->Append( m_menuItemEdit ); wxMenuItem* m_menuItemAdd; m_menuItemAdd = new wxMenuItem( m_menuLink, wxID_ANY, wxString( _("Add new") ) , wxEmptyString, wxITEM_NORMAL ); m_menuLink->Append( m_menuItemAdd ); wxMenuItem* m_menuItemDelete; m_menuItemDelete = new wxMenuItem( m_menuLink, wxID_ANY, wxString( _("Delete") ) , wxEmptyString, wxITEM_NORMAL ); m_menuLink->Append( m_menuItemDelete ); m_hyperlink1->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( TrackPropDlg::m_hyperlink1OnContextMenu ), NULL, this ); bSizerLinks->Add( m_hyperlink1, 0, wxALL, 5 ); m_scrolledWindowLinks->SetSizer( bSizerLinks ); m_scrolledWindowLinks->Layout(); bSizerLinks->Fit( m_scrolledWindowLinks ); sbSizerLinks->Add( m_scrolledWindowLinks, 1, wxEXPAND | wxALL, 5 ); wxBoxSizer* bSizer27; bSizer27 = new wxBoxSizer( wxHORIZONTAL ); m_buttonAddLink = new wxButton( m_panelAdvanced, wxID_ANY, _("Add"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); bSizer27->Add( m_buttonAddLink, 0, wxALL, 5 ); m_toggleBtnEdit = new wxToggleButton( m_panelAdvanced, wxID_ANY, _("Edit"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer27->Add( m_toggleBtnEdit, 0, wxALL, 5 ); m_staticTextEditEnabled = new wxStaticText( m_panelAdvanced, wxID_ANY, _("Links are opened in the default browser."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextEditEnabled->Wrap( -1 ); bSizer27->Add( m_staticTextEditEnabled, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); sbSizerLinks->Add( bSizer27, 0, wxEXPAND, 5 ); bSizerAdvanced->Add( sbSizerLinks, 1, wxEXPAND, 5 ); m_panelAdvanced->SetSizer( bSizerAdvanced ); m_panelAdvanced->Layout(); bSizerAdvanced->Fit( m_panelAdvanced ); m_notebook1->AddPage( m_panelAdvanced, _("Advanced"), false ); bSizerMain->Add( m_notebook1, 1, wxEXPAND | wxALL, 5 ); m_sdbBtmBtnsSizer = new wxStdDialogButtonSizer(); m_sdbBtmBtnsSizerOK = new wxButton( this, wxID_OK ); m_sdbBtmBtnsSizer->AddButton( m_sdbBtmBtnsSizerOK ); m_sdbBtmBtnsSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbBtmBtnsSizer->AddButton( m_sdbBtmBtnsSizerCancel ); m_sdbBtmBtnsSizerPrint = new wxButton( this, wxID_ANY, _("Print"), wxDefaultPosition, wxDefaultSize ); m_sdbBtmBtnsSizer->Add( m_sdbBtmBtnsSizerPrint ); m_sdbBtmBtnsSizerSplit = new wxButton( this, wxID_ANY, _("Split"), wxDefaultPosition, wxDefaultSize ); m_sdbBtmBtnsSizer->Add( m_sdbBtmBtnsSizerSplit ); m_sdbBtmBtnsSizerExtend = new wxButton( this, wxID_ANY, _("Extend"), wxDefaultPosition, wxDefaultSize ); m_sdbBtmBtnsSizer->Add( m_sdbBtmBtnsSizerExtend ); m_sdbBtmBtnsSizerToRoute = new wxButton( this, wxID_ANY, _("To route"), wxDefaultPosition, wxDefaultSize ); m_sdbBtmBtnsSizer->Add( m_sdbBtmBtnsSizerToRoute ); m_sdbBtmBtnsSizerExport = new wxButton( this, wxID_ANY, _("Export"), wxDefaultPosition, wxDefaultSize ); m_sdbBtmBtnsSizer->Add( m_sdbBtmBtnsSizerExport ); m_sdbBtmBtnsSizer->Realize(); bSizerMain->Add( m_sdbBtmBtnsSizer, 0, wxALL|wxEXPAND, 5 ); //Make it look nice and add the needed non-standard buttons int w1, w2, h; ((wxWindowBase *)m_stName)->GetSize( &w1, &h ); ((wxWindowBase *)m_stFrom)->GetSize( &w2, &h ); ((wxWindowBase *)m_stName)->SetMinSize( wxSize(wxMax(w1, w2), h) ); ((wxWindowBase *)m_stFrom)->SetMinSize( wxSize(wxMax(w1, w2), h) ); this->SetSizer( bSizerMain ); this->Layout(); this->Centre( wxBOTH ); // Connect Events m_sdbBtmBtnsSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackPropDlg::OnCancelBtnClick ), NULL, this ); m_sdbBtmBtnsSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackPropDlg::OnOKBtnClick ), NULL, this ); m_sdbBtmBtnsSizerPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackPropDlg::OnPrintBtnClick ), NULL, this ); m_sdbBtmBtnsSizerSplit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackPropDlg::OnSplitBtnClick ), NULL, this ); m_sdbBtmBtnsSizerExtend->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackPropDlg::OnExtendBtnClick ), NULL, this ); m_sdbBtmBtnsSizerToRoute->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackPropDlg::OnToRouteBtnClick ), NULL, this ); m_sdbBtmBtnsSizerExport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackPropDlg::OnExportBtnClick ), NULL, this ); m_lcPoints->Connect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( TrackPropDlg::OnTrackPropListClick ), NULL, this ); Connect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler(TrackPropDlg::OnTrackPropRightClick), NULL, this ); Connect( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TrackPropDlg::OnTrackPropMenuSelected), NULL, this ); Connect( m_menuItemDelete->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( TrackPropDlg::OnDeleteLink ) ); Connect( m_menuItemEdit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( TrackPropDlg::OnEditLink ) ); Connect( m_menuItemAdd->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( TrackPropDlg::OnAddLink ) ); m_buttonAddLink->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TrackPropDlg::OnAddLink ), NULL, this ); m_toggleBtnEdit->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( TrackPropDlg::OnEditLinkToggle ), NULL, this ); m_pLinkProp = new LinkPropImpl( this ); m_pMyLinkList = NULL; }
void wxExFrame::OnCommand(wxCommandEvent& command) { m_IsCommand = true; switch (command.GetId()) { case wxID_FIND: { if (m_FindReplaceDialog != NULL) { m_FindReplaceDialog->Destroy(); } m_FindFocus = wxWindow::FindFocus(); // If stc text is selected, copy to find replace data. wxExSTC* stc = GetSTC(); if (stc != NULL) { stc->GetFindString(); } m_FindReplaceDialog = new wxFindReplaceDialog( this, wxExFindReplaceData::Get(), _("Find")); m_FindReplaceDialog->Show(); } break; case wxID_REPLACE: { if (m_FindReplaceDialog != NULL) { m_FindReplaceDialog->Destroy(); } m_FindFocus = wxWindow::FindFocus(); // If stc text is selected, copy to find replace data. wxExSTC* stc = GetSTC(); if (stc != NULL) { stc->GetFindString(); } m_FindReplaceDialog = new wxFindReplaceDialog( this, wxExFindReplaceData::Get(), _("Replace"), wxFR_REPLACEDIALOG); m_FindReplaceDialog->Show(); } break; case wxID_OPEN: if (!command.GetString().empty()) { wxExSTC* stc = GetSTC(); if (stc != NULL) { wxSetWorkingDirectory(stc->GetFileName().GetPath()); } wxArrayString files; wxStringTokenizer tkz(command.GetString()); while (tkz.HasMoreTokens()) { files.Add(tkz.GetNextToken()); } wxExOpenFiles(this, files); } else { wxExOpenFilesDialog(this); } break; case ID_VIEW_MENUBAR: if (GetMenuBar() != NULL) { SetMenuBar(NULL); } else { SetMenuBar(m_MenuBar); } break; case ID_VIEW_STATUSBAR: #if wxUSE_STATUSBAR if (GetStatusBar() != NULL) { GetStatusBar()->Show(!GetStatusBar()->IsShown()); SendSizeEvent(); } #endif break; case ID_VIEW_TITLEBAR: if (!(GetWindowStyleFlag() & wxCAPTION)) { SetWindowStyleFlag(wxDEFAULT_FRAME_STYLE); Refresh(); } else { SetWindowStyleFlag(GetWindowStyleFlag() & ~wxCAPTION); Refresh(); } break; default: wxFAIL; break; } }
void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane) { m_pane_window = pane.window; m_pane_window->Reparent(this); wxAuiPaneInfo contained_pane = pane; contained_pane.Dock().Center().Show(). CaptionVisible(false). PaneBorder(false). Layer(0).Row(0).Position(0); // Carry over the minimum size wxSize pane_min_size = pane.window->GetMinSize(); // if the frame window's max size is greater than the min size // then set the max size to the min size as well wxSize cur_max_size = GetMaxSize(); if (cur_max_size.IsFullySpecified() && (cur_max_size.x < pane.min_size.x || cur_max_size.y < pane.min_size.y) ) { SetMaxSize(pane_min_size); } SetMinSize(pane.window->GetMinSize()); m_mgr.AddPane(m_pane_window, contained_pane); m_mgr.Update(); if (pane.min_size.IsFullySpecified()) { // because SetSizeHints() calls Fit() too (which sets the window // size to its minimum allowed), we keep the size before calling // SetSizeHints() and reset it afterwards... wxSize tmp = GetSize(); GetSizer()->SetSizeHints(this); SetSize(tmp); } SetTitle(pane.caption); if (pane.floating_size != wxDefaultSize) { SetSize(pane.floating_size); } else { wxSize size = pane.best_size; if (size == wxDefaultSize) size = pane.min_size; if (size == wxDefaultSize) size = m_pane_window->GetSize(); if (m_owner_mgr && pane.HasGripper()) { if (pane.HasGripperTop()) size.y += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); else size.x += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); } SetClientSize(size); } if (pane.IsFixed()) { SetWindowStyleFlag(GetWindowStyleFlag() & ~wxRESIZE_BORDER); } }
bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { wxCHECK_MSG( parent, false, wxT("status bar must have a parent") ); SetName(name); SetWindowStyleFlag(style); SetParent(parent); parent->AddChild(this); m_windowId = id == wxID_ANY ? NewControlId() : id; DWORD wstyle = WS_CHILD | WS_VISIBLE; if ( style & wxCLIP_SIBLINGS ) wstyle |= WS_CLIPSIBLINGS; // setting SBARS_SIZEGRIP is perfectly useless: it's always on by default // (at least in the version of comctl32.dll I'm using), and the only way to // turn it off is to use CCS_TOP style - as we position the status bar // manually anyhow (see DoMoveWindow), use CCS_TOP style if wxST_SIZEGRIP // is not given if ( !(style & wxST_SIZEGRIP) ) { wstyle |= CCS_TOP; } else { #ifndef __WXWINCE__ // may be some versions of comctl32.dll do need it - anyhow, it won't // do any harm wstyle |= SBARS_SIZEGRIP; #endif } m_hWnd = (WXHWND)CreateStatusWindow(wstyle, wxEmptyString, GetHwndOf(parent), m_windowId); if ( m_hWnd == 0 ) { wxLogSysError(_("Failed to create a status bar.")); return false; } SetFieldsCount(1); SubclassWin(m_hWnd); InheritAttributes(); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); // we must refresh the frame size when the statusbar is created, because // its client area might change wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); if ( frame ) { frame->SendSizeEvent(); } return true; }
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { SetName(name); SetWindowStyleFlag(style); m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE); m_foregroundColour = *wxBLACK; m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); if ( id > -1 ) m_windowId = id; else m_windowId = (int)NewControlId(); wxMDIClientWindow* clientWindow = parent->GetClientWindow(); wxASSERT_MSG( (clientWindow != (wxWindow*) NULL), "Missing MDI client window."); if (clientWindow) clientWindow->AddChild(this); SetMDIParentFrame(parent); int width = size.x; int height = size.y; if (width == -1) width = 200; // TODO: give reasonable default if (height == -1) height = 200; // TODO: give reasonable default // We're deactivating the old child wxMDIChildFrame* oldActiveChild = parent->GetActiveChild(); if (oldActiveChild) { wxActivateEvent event(wxEVT_ACTIVATE, false, oldActiveChild->GetId()); event.SetEventObject( oldActiveChild ); oldActiveChild->GetEventHandler()->ProcessEvent(event); } // This is the currently active child parent->SetActiveChild((wxMDIChildFrame*) this); // This time we'll try a bog-standard bulletin board for // the 'frame'. A main window doesn't seem to work. m_mainWidget = (WXWidget) XtVaCreateWidget("client", xmBulletinBoardWidgetClass, (Widget) clientWindow->GetTopWidget(), XmNmarginWidth, 0, XmNmarginHeight, 0, /* XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, */ XmNresizePolicy, XmRESIZE_NONE, NULL); XtAddEventHandler((Widget) m_mainWidget, ExposureMask,False, wxUniversalRepaintProc, (XtPointer) this); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); ChangeBackgroundColour(); XtManageChild((Widget) m_mainWidget); SetTitle(title); clientWindow->AddPage(this, title, true); clientWindow->Refresh(); // Positions the toolbar and status bar -- but we don't have any. // PreResize(); wxModelessWindows.Append(this); return true; }