bool wxStatusBarGeneric::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { style |= wxTAB_TRAVERSAL | wxFULL_REPAINT_ON_RESIZE; if ( !wxWindow::Create(parent, id, wxDefaultPosition, wxDefaultSize, style, name) ) return false; // The status bar should have a themed background SetThemeEnabled( true ); InitColours(); int height = (int)((11*GetCharHeight())/10 + 2*GetBorderY()); SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height); SetFieldsCount(1); #if defined( __WXGTK20__ ) #if GTK_CHECK_VERSION(2,12,0) if (HasFlag(wxSTB_SHOW_TIPS) && wx_is_at_least_gtk2(12)) { g_object_set(m_widget, "has-tooltip", TRUE, NULL); g_signal_connect(m_widget, "query-tooltip", G_CALLBACK(statusbar_query_tooltip), this); } #endif #endif return true; }
bool wxStatusBarGeneric::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { if ( !wxWindow::Create(parent, id, wxDefaultPosition, wxDefaultSize, style | wxTAB_TRAVERSAL, name) ) return false; // The status bar should have a themed background SetThemeEnabled( true ); InitColours(); #ifdef __WXPM__ SetFont(*wxSMALL_FONT); #endif // Set the height according to the font and the border size wxClientDC dc(this); dc.SetFont(GetFont()); wxCoord y; dc.GetTextExtent(_T("X"), NULL, &y ); int height = (int)( (11*y)/10 + 2*GetBorderY()); SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height); SetFieldsCount(1); return true; }
cbSplashScreen::cbSplashScreen(wxBitmap &label, long timeout, wxWindow *parent, wxWindowID id, long style) : wxFrame(parent, id, wxEmptyString, wxPoint(0, 0), wxSize(100, 100), style), m_timer(this, cbSplashScreen_timer_id)//, r(0, 0, 181, 181) { //r.Union(50, 35, 181, 181); //r.Union(166, 13, 181, 181); //r.Union(259, 29, 181, 181); int w = label.GetWidth(); int h = label.GetHeight(); SetClientSize(w, h); CentreOnScreen(); wxScreenDC screen_dc; wxMemoryDC label_dc; #ifndef __WXMAC__ int x = GetPosition().x; int y = GetPosition().y; #endif m_label.Create(w, h); label_dc.SelectObject(m_label); #ifndef __WXMAC__ label_dc.Blit(0, 0, w, h, &screen_dc, x, y); #else label_dc.SetBackground(*wxWHITE_BRUSH); label_dc.Clear(); #endif label_dc.DrawBitmap(label, 0, 0, true); label_dc.SelectObject(wxNullBitmap); //SetShape(r); Show(true); SetThemeEnabled(false); // seems to be useful by description SetBackgroundStyle(wxBG_STYLE_CUSTOM); // the trick for GTK+ (notice it's after Show()) #if ( defined( __WXMAC__ ) || defined( __WXMSW__ ) ) Update(); #else wxYieldIfNeeded(); #endif if (timeout != -1) { m_timer.Start(timeout, true); } }
bool wxPanelBase::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if ( !wxWindow::Create(parent, id, pos, size, style, name) ) return false; // so that non-solid background renders correctly under GTK+: SetThemeEnabled(true); #if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__)) // Required to get solid control backgrounds under WinCE SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); #endif return true; }
AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller, agi::Context *context) : wxWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxBORDER_SIMPLE) , audio_open_connection(controller->AddAudioOpenListener(&AudioDisplay::OnAudioOpen, this)) , context(context) , audio_renderer(new AudioRenderer) , controller(controller) , scrollbar(new AudioDisplayScrollbar(this)) , timeline(new AudioDisplayTimeline(this)) , dragged_object(0) , scroll_left(0) , pixel_audio_width(0) , ms_per_pixel(0.0) , scale_amplitude(1.0f) , audio_top(0) , audio_height(0) , track_cursor_pos(-1) { style_ranges[0] = AudioStyle_Normal; audio_renderer->SetAmplitudeScale(scale_amplitude); SetZoomLevel(0); SetMinClientSize(wxSize(-1, 70)); SetBackgroundStyle(wxBG_STYLE_PAINT); SetThemeEnabled(false); Bind(wxEVT_LEFT_DOWN, &AudioDisplay::OnMouseEvent, this); Bind(wxEVT_MIDDLE_DOWN, &AudioDisplay::OnMouseEvent, this); Bind(wxEVT_RIGHT_DOWN, &AudioDisplay::OnMouseEvent, this); Bind(wxEVT_LEFT_UP, &AudioDisplay::OnMouseEvent, this); Bind(wxEVT_MIDDLE_UP, &AudioDisplay::OnMouseEvent, this); Bind(wxEVT_RIGHT_UP, &AudioDisplay::OnMouseEvent, this); Bind(wxEVT_MOTION, &AudioDisplay::OnMouseEvent, this); Bind(wxEVT_ENTER_WINDOW, &AudioDisplay::OnMouseEnter, this); Bind(wxEVT_LEAVE_WINDOW, &AudioDisplay::OnMouseLeave, this); Bind(wxEVT_PAINT, &AudioDisplay::OnPaint, this); Bind(wxEVT_SIZE, &AudioDisplay::OnSize, this); Bind(wxEVT_KILL_FOCUS, &AudioDisplay::OnFocus, this); Bind(wxEVT_SET_FOCUS, &AudioDisplay::OnFocus, this); Bind(wxEVT_CHAR_HOOK, &AudioDisplay::OnKeyDown, this); Bind(wxEVT_KEY_DOWN, &AudioDisplay::OnKeyDown, this); scroll_timer.Bind(wxEVT_TIMER, &AudioDisplay::OnScrollTimer, this); }
// ----------------------------------------------------------------------------- // Sets up the wxWidgets window layout // ----------------------------------------------------------------------------- void MainWindow::setupLayout() { // Create the wxAUI manager & related things aui_mgr_ = new wxAuiManager(this); aui_mgr_->SetArtProvider(new SAuiDockArt()); wxAuiPaneInfo p_inf; // Set icon auto icon_filename = App::path(App::iconFile(), App::Dir::Temp); App::archiveManager().programResourceArchive()->entry(App::iconFile())->exportFile(icon_filename); SetIcon(wxIcon(icon_filename, wxBITMAP_TYPE_ICO)); wxRemoveFile(icon_filename); // -- Editor Area -- stc_tabs_ = new STabCtrl(this, true, true, tabs_condensed ? 27 : 31, true, true); // Setup panel info & add panel p_inf.CenterPane(); p_inf.Name("editor_area"); p_inf.PaneBorder(false); aui_mgr_->AddPane(stc_tabs_, p_inf); // Create Start Page start_page_ = new SStartPage(stc_tabs_); if (show_start_page) { stc_tabs_->AddPage(start_page_, "Start Page"); stc_tabs_->SetPageBitmap(0, Icons::getIcon(Icons::General, "logo")); start_page_->init(); createStartPage(); } else start_page_->Show(false); // -- Console Panel -- auto panel_console = new ConsolePanel(this, -1); // Setup panel info & add panel p_inf.DefaultPane(); p_inf.Float(); p_inf.FloatingSize(WxUtils::scaledSize(600, 400)); p_inf.FloatingPosition(WxUtils::scaledPoint(100, 100)); p_inf.MinSize(WxUtils::scaledSize(-1, 192)); p_inf.Show(false); p_inf.Caption("Console"); p_inf.Name("console"); aui_mgr_->AddPane(panel_console, p_inf); // -- Archive Manager Panel -- panel_archivemanager_ = new ArchiveManagerPanel(this, stc_tabs_); // Setup panel info & add panel p_inf.DefaultPane(); p_inf.Left(); p_inf.BestSize(WxUtils::scaledSize(192, 480)); p_inf.Caption("Archive Manager"); p_inf.Name("archive_manager"); p_inf.Show(true); p_inf.Dock(); aui_mgr_->AddPane(panel_archivemanager_, p_inf); // -- Undo History Panel -- panel_undo_history_ = new UndoManagerHistoryPanel(this, nullptr); // Setup panel info & add panel p_inf.DefaultPane(); p_inf.Right(); p_inf.BestSize(WxUtils::scaledSize(128, 480)); p_inf.Caption("Undo History"); p_inf.Name("undo_history"); p_inf.Show(false); p_inf.Dock(); aui_mgr_->AddPane(panel_undo_history_, p_inf); // -- Menu bar -- auto menu = new wxMenuBar(); menu->SetThemeEnabled(false); // File menu auto file_new_menu = new wxMenu(""); SAction::fromId("aman_newwad")->addToMenu(file_new_menu, "&Wad Archive"); SAction::fromId("aman_newzip")->addToMenu(file_new_menu, "&Zip Archive"); SAction::fromId("aman_newmap")->addToMenu(file_new_menu, "&Map"); auto file_menu = new wxMenu(""); file_menu->AppendSubMenu(file_new_menu, "&New", "Create a new Archive"); SAction::fromId("aman_open")->addToMenu(file_menu); SAction::fromId("aman_opendir")->addToMenu(file_menu); file_menu->AppendSeparator(); SAction::fromId("aman_save")->addToMenu(file_menu); SAction::fromId("aman_saveas")->addToMenu(file_menu); SAction::fromId("aman_saveall")->addToMenu(file_menu); file_menu->AppendSubMenu(panel_archivemanager_->getRecentMenu(), "&Recent Files"); file_menu->AppendSeparator(); SAction::fromId("aman_close")->addToMenu(file_menu); SAction::fromId("aman_closeall")->addToMenu(file_menu); file_menu->AppendSeparator(); SAction::fromId("main_exit")->addToMenu(file_menu); menu->Append(file_menu, "&File"); // Edit menu auto editor_menu = new wxMenu(""); SAction::fromId("main_undo")->addToMenu(editor_menu); SAction::fromId("main_redo")->addToMenu(editor_menu); editor_menu->AppendSeparator(); SAction::fromId("main_setbra")->addToMenu(editor_menu); SAction::fromId("main_preferences")->addToMenu(editor_menu); menu->Append(editor_menu, "E&dit"); // View menu auto view_menu = new wxMenu(""); SAction::fromId("main_showam")->addToMenu(view_menu); SAction::fromId("main_showconsole")->addToMenu(view_menu); SAction::fromId("main_showundohistory")->addToMenu(view_menu); SAction::fromId("main_showstartpage")->addToMenu(view_menu); toolbar_menu_ = new wxMenu(); view_menu->AppendSubMenu(toolbar_menu_, "Toolbars"); menu->Append(view_menu, "&View"); // Tools menu auto tools_menu = new wxMenu(""); SAction::fromId("main_runscript")->addToMenu(tools_menu); menu->Append(tools_menu, "&Tools"); // Help menu auto help_menu = new wxMenu(""); SAction::fromId("main_onlinedocs")->addToMenu(help_menu); SAction::fromId("main_about")->addToMenu(help_menu); #ifdef __WXMSW__ SAction::fromId("main_updatecheck")->addToMenu(help_menu); #endif menu->Append(help_menu, "&Help"); // Set the menu SetMenuBar(menu); // -- Toolbars -- toolbar_ = new SToolBar(this, true); // Create File toolbar auto tbg_file = new SToolBarGroup(toolbar_, "_File"); tbg_file->addActionButton("aman_newwad"); tbg_file->addActionButton("aman_newzip"); tbg_file->addActionButton("aman_open"); tbg_file->addActionButton("aman_opendir"); tbg_file->addActionButton("aman_save"); tbg_file->addActionButton("aman_saveas"); tbg_file->addActionButton("aman_saveall"); tbg_file->addActionButton("aman_close"); tbg_file->addActionButton("aman_closeall"); toolbar_->addGroup(tbg_file); // Create Archive toolbar auto tbg_archive = new SToolBarGroup(toolbar_, "_Archive"); tbg_archive->addActionButton("arch_newentry"); tbg_archive->addActionButton("arch_newdir"); tbg_archive->addActionButton("arch_importfiles"); tbg_archive->addActionButton("arch_texeditor"); tbg_archive->addActionButton("arch_mapeditor"); tbg_archive->addActionButton("arch_run"); toolbar_->addGroup(tbg_archive); // Create Entry toolbar auto tbg_entry = new SToolBarGroup(toolbar_, "_Entry"); tbg_entry->addActionButton("arch_entry_rename"); tbg_entry->addActionButton("arch_entry_delete"); tbg_entry->addActionButton("arch_entry_import"); tbg_entry->addActionButton("arch_entry_export"); tbg_entry->addActionButton("arch_entry_moveup"); tbg_entry->addActionButton("arch_entry_movedown"); toolbar_->addGroup(tbg_entry); // Create Base Resource Archive toolbar auto tbg_bra = new SToolBarGroup(toolbar_, "_Base Resource", true); auto brc = new BaseResourceChooser(tbg_bra); tbg_bra->addCustomControl(brc); tbg_bra->addActionButton("main_setbra", "settings"); toolbar_->addGroup(tbg_bra); // Create Palette Chooser toolbar auto tbg_palette = new SToolBarGroup(toolbar_, "_Palette", true); palette_chooser_ = new PaletteChooser(tbg_palette, -1); palette_chooser_->selectPalette(global_palette); tbg_palette->addCustomControl(palette_chooser_); toolbar_->addGroup(tbg_palette); // Archive and Entry toolbars are initially disabled toolbar_->enableGroup("_archive", false); toolbar_->enableGroup("_entry", false); // Add toolbar aui_mgr_->AddPane( toolbar_, wxAuiPaneInfo() .Top() .CaptionVisible(false) .MinSize(-1, SToolBar::getBarHeight()) .Resizable(false) .PaneBorder(false) .Name("toolbar")); // Populate the 'View->Toolbars' menu populateToolbarsMenu(); toolbar_->enableContextMenu(); // -- Status Bar -- CreateStatusBar(3); // Load previously saved perspective string loadLayout(); // Finalize aui_mgr_->Update(); Layout(); // Bind events Bind(wxEVT_SIZE, &MainWindow::onSize, this); Bind(wxEVT_CLOSE_WINDOW, &MainWindow::onClose, this); Bind(wxEVT_AUINOTEBOOK_PAGE_CHANGED, &MainWindow::onTabChanged, this); Bind(wxEVT_STOOLBAR_LAYOUT_UPDATED, &MainWindow::onToolBarLayoutChanged, this, toolbar_->GetId()); Bind(wxEVT_ACTIVATE, &MainWindow::onActivate, this); Bind(wxEVT_AUINOTEBOOK_PAGE_CLOSE, [&](wxAuiNotebookEvent& e) { // Null start_page pointer if start page tab is closed auto page = stc_tabs_->GetPage(stc_tabs_->GetSelection()); if (page->GetName() == "startpage") start_page_ = nullptr; }); // Initial focus to toolbar toolbar_->SetFocus(); }
SplashScreen::SplashScreen( wxBitmap &label, long timeout, wxWindow *parent, wxWindowID id, long style ) : wxFrame( parent, id, wxEmptyString, wxPoint( 0, 0 ), wxSize( 100, 100 ), style ), r( 0, 0, 181, 181 ), m_timer( this, cbSplashScreen_timer_id ), timeUp(false) { r.Union( label ); int w = label.GetWidth(); int h = label.GetHeight(); SetClientSize( w, h ); CentreOnScreen(); wxScreenDC screen_dc; wxMemoryDC label_dc; int x; int y; x = GetPosition().x; y = GetPosition().y; m_label.Create( w, h ); label_dc.SelectObject( m_label ); label_dc.Blit( 0, 0, w, h, &screen_dc, x, y ); label_dc.DrawBitmap( label, 0, 0, true ); label_dc.SelectObject( wxNullBitmap ); SetShape( r ); Show( true ); SetThemeEnabled( false ); // seems to be useful by description SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // the trick for GTK+ (notice it's after Show()) SetTitle("GDevelop"); wxIconBundle icons; icons.AddIcon("res/icon16.png"); icons.AddIcon("res/icon24.png"); #if defined(LINUX) || defined(MACOS) icons.AddIcon("res/icon32linux.png"); icons.AddIcon("res/icon48linux.png"); icons.AddIcon("res/icon64linux.png"); icons.AddIcon("res/icon128linux.png"); #else icons.AddIcon("res/icon32.png"); icons.AddIcon("res/icon48.png"); icons.AddIcon("res/icon128.png"); #endif SetIcons(icons); Centre( wxBOTH | wxCENTRE_ON_SCREEN ); // centre only works when the window is showing Update(); wxYieldIfNeeded(); if ( timeout != -1 ) { m_timer.Start( timeout, true ); } }
PackageList::PackageList(Window* parent, int id, int direction, bool always_focused) : GalleryList(parent, id, direction, always_focused) { item_size = subcolumns[0].size = wxSize(125, 150); SetThemeEnabled(true); }
// -------------------------------------------------------------------------------- // guSplashFrame::guSplashFrame( wxWindow * parent, int timeout ) : wxFrame( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 500,275 ), wxSTAY_ON_TOP | wxNO_BORDER | wxFRAME_TOOL_WINDOW ) { CentreOnScreen(); this->SetSizeHints( wxDefaultSize, wxDefaultSize ); m_Bitmap = new wxBitmap( guImage( guIMAGE_INDEX_splash ) ); wxBoxSizer* MainSizer; MainSizer = new wxBoxSizer( wxVERTICAL ); wxColour FontColor = wxColour( 100, 100, 100 ); wxString Version = wxT( ID_GUAYADEQUE_VERSION ); #ifdef ID_GUAYADEQUE_REVISION Version += wxT( "-" ID_GUAYADEQUE_REVISION ); #endif m_Version = new wxStaticText( this, wxID_ANY, Version, wxDefaultPosition, wxDefaultSize, 0 ); wxFont CurFont = m_Version->GetFont(); CurFont.SetPointSize( CurFont.GetPointSize() + 2 ); m_Version->SetFont( CurFont ); m_Version->Wrap( -1 ); m_Version->SetForegroundColour( FontColor ); m_Version->SetBackgroundColour( * wxWHITE ); MainSizer->Add( m_Version, 0, wxALIGN_RIGHT|wxTOP|wxRIGHT|wxLEFT, 5 ); MainSizer->Add( 0, 0, 1, wxEXPAND, 5 ); m_Email = new wxHyperlinkCtrl( this, wxID_ANY, guSPLASH_NAME wxT( " " ) guSPLASH_EMAIL, wxT( "mailto:" ) guSPLASH_EMAIL, wxDefaultPosition, wxDefaultSize, wxHL_ALIGN_RIGHT ); m_Email->SetHoverColour( FontColor ); m_Email->SetNormalColour( FontColor ); m_Email->SetVisitedColour( FontColor ); m_Email->SetBackgroundColour( * wxWHITE ); m_Email->SetCanFocus( false ); MainSizer->Add( m_Email, 0, wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 ); m_HomePage = new wxHyperlinkCtrl( this, wxID_ANY, guSPLASH_HOMEPAGE, guSPLASH_HOMEPAGE, wxDefaultPosition, wxDefaultSize, wxHL_ALIGN_RIGHT ); m_HomePage->SetHoverColour( FontColor ); m_HomePage->SetNormalColour( FontColor ); m_HomePage->SetVisitedColour( FontColor ); m_HomePage->SetBackgroundColour( * wxWHITE ); m_HomePage->SetCanFocus( false ); MainSizer->Add( m_HomePage, 0, wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 ); m_Donate = new wxHyperlinkCtrl( this, wxID_ANY, _( "Please Donate!" ), guSPLASH_DONATION_LINK ); m_Donate->SetHoverColour( FontColor ); m_Donate->SetNormalColour( FontColor ); m_Donate->SetVisitedColour( FontColor ); m_Donate->SetBackgroundColour( * wxWHITE ); m_Donate->SetCanFocus( false ); MainSizer->Add( m_Donate, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); this->SetSizer( MainSizer ); this->Layout(); Show( true ); SetThemeEnabled( false ); SetBackgroundStyle( wxBG_STYLE_ERASE ); m_Timer.SetOwner( this ); m_Timer.Start( timeout, wxTIMER_ONE_SHOT ); // Bind Events Bind( wxEVT_ERASE_BACKGROUND, &guSplashFrame::OnEraseBackground, this ); Bind( wxEVT_LEFT_DOWN, &guSplashFrame::OnSplashClick, this ); Bind( wxEVT_TIMER, &guSplashFrame::OnTimeout, this ); }