VisualEditor::VisualEditor(wxWindow *parent) : wxScrolledWindow(parent,-1,wxDefaultPosition,wxDefaultSize,wxSUNKEN_BORDER), m_stopSelectedEvent( false ), m_stopModifiedEvent( false ) { SetExtraStyle( wxWS_EX_BLOCK_EVENTS ); AppData()->AddHandler( this->GetEventHandler() ); #ifdef __WXMSW__ SetOwnBackgroundColour(wxColour(150,150,150)); #else SetOwnBackgroundColour(wxColour(192,192,192)); #endif SetScrollRate(5, 5); m_back = new DesignerWindow( this, wxID_ANY, wxPoint(10,10) ); m_back->GetEventHandler()->Connect( wxID_ANY, wxEVT_LEFT_DOWN, wxMouseEventHandler( VisualEditor::OnClickBackPanel ), NULL, this ); m_auimgr = NULL; m_auipanel = NULL; // scan aui panes in run-time m_AuiScaner.SetOwner( this, ID_TIMER_SCAN ); m_AuiScaner.Start( 200 ); m_wizard = NULL; }
// Responds to colour changes, and passes event on to children. void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) { SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); Refresh(); event.Skip(); }
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; }
bool wxFrame::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); #if defined(__SMARTPHONE__) SetLeftMenu(wxID_EXIT, _("Done")); #endif #if wxUSE_ACCEL && defined(__POCKETPC__) // The guidelines state that Ctrl+Q should quit the app. // Let's define an accelerator table to send wxID_EXIT. wxAcceleratorEntry entries[1]; entries[0].Set(wxACCEL_CTRL, 'Q', wxID_EXIT); wxAcceleratorTable accel(1, entries); SetAcceleratorTable(accel); #endif // wxUSE_ACCEL && __POCKETPC__ return true; }
bool wxMDIParentFrame::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { // this style can be used to prevent a window from having the standard MDI // "Window" menu if ( !(style & wxFRAME_NO_WINDOW_MENU) ) { // normal case: we have the window menu, so construct it m_windowMenu = new wxMenu; m_windowMenu->Append(wxID_MDI_WINDOW_CASCADE, _("&Cascade")); m_windowMenu->Append(wxID_MDI_WINDOW_TILE_HORZ, _("Tile &Horizontally")); m_windowMenu->Append(wxID_MDI_WINDOW_TILE_VERT, _("Tile &Vertically")); m_windowMenu->AppendSeparator(); m_windowMenu->Append(wxID_MDI_WINDOW_ARRANGE_ICONS, _("&Arrange Icons")); m_windowMenu->Append(wxID_MDI_WINDOW_NEXT, _("&Next")); m_windowMenu->Append(wxID_MDI_WINDOW_PREV, _("&Previous")); } if (!parent) wxTopLevelWindows.Append(this); SetName(name); m_windowStyle = style; if ( parent ) parent->AddChild(this); if ( id != wxID_ANY ) m_windowId = id; else m_windowId = NewControlId(); WXDWORD exflags; WXDWORD msflags = MSWGetCreateWindowFlags(&exflags); msflags &= ~WS_VSCROLL; msflags &= ~WS_HSCROLL; if ( !wxWindow::MSWCreate(wxApp::GetRegisteredClassName(wxT("wxMDIFrame")), title.wx_str(), pos, size, msflags, exflags) ) { return false; } SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); // unlike (almost?) all other windows, frames are created hidden m_isShown = false; return true; }
VisualEditor::VisualEditor(wxWindow *parent) : wxScrolledWindow(parent,-1,wxDefaultPosition,wxDefaultSize,wxSUNKEN_BORDER), m_stopSelectedEvent( false ), m_stopModifiedEvent( false ) { AppData()->AddHandler( this->GetEventHandler() ); #ifdef __WXMSW__ SetOwnBackgroundColour(wxColour(150,150,150)); #else SetOwnBackgroundColour(wxColour(192,192,192)); #endif SetScrollRate(5, 5); m_back = new DesignerWindow( this, wxID_ANY, wxPoint(10,10) ); m_back->GetEventHandler()->Connect( wxID_ANY, wxEVT_LEFT_DOWN, wxMouseEventHandler( VisualEditor::OnClickBackPanel ), NULL, this ); }
bool wxFrame::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); return true; }
// Responds to colour changes, and passes event on to children. void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) { SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); Refresh(); #if wxUSE_STATUSBAR if ( m_frameStatusBar ) { wxSysColourChangedEvent event2; event2.SetEventObject( m_frameStatusBar ); m_frameStatusBar->HandleWindowEvent(event2); } #endif // wxUSE_STATUSBAR // Propagate the event to the non-top-level children wxWindow::OnSysColourChanged(event); }
bool wxFrame::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); #if wxUSE_TASKBARBUTTON static bool s_taskbarButtonCreatedMsgRegistered = false; if ( !s_taskbarButtonCreatedMsgRegistered ) { s_taskbarButtonCreatedMsgRegistered = true; wxMsgTaskbarButtonCreated = ::RegisterWindowMessage(wxT("TaskbarButtonCreated")); // In case the application is run elevated, allow the // TaskbarButtonCreated and WM_COMMAND messages through. #if wxUSE_DYNLIB_CLASS typedef BOOL (WINAPI *ChangeWindowMessageFilter_t)(UINT message, DWORD dwFlag); wxDynamicLibrary dllUser32(wxT("user32.dll")); ChangeWindowMessageFilter_t pfnChangeWindowMessageFilter = NULL; wxDL_INIT_FUNC(pfn, ChangeWindowMessageFilter, dllUser32); if ( pfnChangeWindowMessageFilter ) { pfnChangeWindowMessageFilter(wxMsgTaskbarButtonCreated, wxMSGFLT_ADD); pfnChangeWindowMessageFilter(WM_COMMAND, wxMSGFLT_ADD); } #else ChangeWindowMessageFilter(wxMsgTaskbarButtonCreated, wxMSGFLT_ADD); ChangeWindowMessageFilter(WM_COMMAND, wxMSGFLT_ADD); #endif // wxUSE_DYNLIB_CLASS } #endif // wxUSE_TASKBARBUTTON return true; }
RenderCanvas::RenderCanvas(wxWindow *parent) : wxScrolledWindow(parent), m_image(NULL), w(NULL), thread(NULL), timer(NULL), updateTimer(this, ID_RENDER_UPDATE) { SetOwnBackgroundColour(wxColour(143,144,150)); }
wxBlokus::wxBlokus(const wxString& title, const wxPoint& pos, const wxSize& size) :wxFrame((wxFrame*) NULL, -1, title, pos, size) { rules = new DefaultRules; game = new Game(rules, &GameEnd); wxMenuBar *menuBar = new wxMenuBar; wxMenu *menu = new wxMenu; menu->Append(ID_New, wxT("&New game\tCtrl+N")); menu->AppendSeparator(); menu->Append(ID_Load, wxT("&Load state\tCtrl+L")); menu->Append(ID_Save, wxT("&Save state\tCtrl+S")); menu->AppendSeparator(); menu->Append(ID_Quit, wxT("E&xit\tCtrl+X")); menuBar->Append(menu, wxT("&File")); menu = new wxMenu; menu->Append(ID_Skip, wxT("&Skip\tAlt+s")); menu->AppendSeparator(); menu->Append(ID_Score, wxT("&Count Score")); menuBar->Append(menu, wxT("A&ction")); menu = new wxMenu; menu->Append(ID_About, wxT("&About...\tF1")); menuBar->Append(menu, wxT("&Help")); SetMenuBar(menuBar); CreateStatusBar(); SetStatusText(wxT("Tjo blokuskamrat!")); //Set minimum size SetMinSize(wxSize(280, 280)); SetOwnBackgroundColour(*wxBLACK); //Create sizers wxBoxSizer *topSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); SetSizer(topSizer); BlokusFieldPanel = new FieldPanel(game, this, -1, wxDefaultPosition, wxDefaultSize); PrevTilePanel = new TilePanel(game->getCurrentPlayer()->getPreviousTile(), game->getCurrentPlayer()->getTeam(), this, -1, wxDefaultPosition, wxDefaultSize); CurrentTilePanel = new TilePanel(game->getCurrentPlayer()->getCurrentTile(), game->getCurrentPlayer()->getTeam(), this, -1, wxDefaultPosition, wxDefaultSize); NextTilePanel=new TilePanel(game->getCurrentPlayer()->getNextTile(), game->getCurrentPlayer()->getTeam(), this, -1, wxDefaultPosition, wxDefaultSize); topSizer->Add(BlokusFieldPanel, 3, wxEXPAND | wxRIGHT, 2); // Add sizer to top-level sizer topSizer->Add(sizer, 1, wxEXPAND); sizer->Add(PrevTilePanel, 1, wxEXPAND); sizer->Add(CurrentTilePanel, 1, wxEXPAND | wxTOP | wxBOTTOM, 1); sizer->Add(NextTilePanel, 1, wxEXPAND); // Allow frame to pick up key events from sub panels. // BlokusFieldPanel->Connect(wxID_ANY, wxEVT_KEY_DOWN, wxKeyEventHandler(wxBlokus::KeyDown)); /*BlokusFieldPanel->Connect(wxID_ANY, wxEVT_KEY_DOWN, wxKeyEventHandler(wxBlokus::KeyDown), (wxObject*) NULL, this); PrevTilePanel->Connect(wxID_ANY, wxEVT_KEY_DOWN, wxKeyEventHandler(wxBlokus::KeyDown), (wxObject*) NULL, this); CurrentTilePanel->Connect(wxID_ANY, wxEVT_KEY_DOWN, wxKeyEventHandler(wxBlokus::KeyDown), (wxObject*) NULL, this); NextTilePanel->Connect(wxID_ANY, wxEVT_KEY_DOWN, wxKeyEventHandler(wxBlokus::KeyDown), (wxObject*) NULL, this);*/ }