void wxTopLevelWindowMac::Restore() { if ( IsMaximized() ) Maximize(false); else if ( IsIconized() ) Iconize(false); }
void Frame::FrameClickEvents(wxCommandEvent& event) { switch(event.GetId()){ case BUTTON_CHANGE_IP:{ guiChangeIP(this, event.GetId()); break; } case wxID_EXIT:{ trayIcon->RemoveIcon(); Destroy(); break; } case BUTTON_ADD_TO_TRAY:{ Iconize(true); Show(false); break; } case MENU_INFO:{ sendDialog(wxT("This program change IP tibia client in order to connect to Open Tibia Server.\nLicense: GNU GPL\nProgrammer: Miziak.\nAdress Finder: Virtelio.\nWrote in wxWidgets library."), wxOK | wxICON_INFORMATION); break; } case MENU_CLEAR_HISTORY:{ ofstream plik(string("./history").c_str()); plik<<""; plik.close(); sb->SetStatusText(wxT("History Cleared!"),0); ip->SetValue(wxT("")); ip->Clear(); break; } } }
void wxMFrame::Create(const String &framename, wxWindow *parent) { wxCHECK_RET( !m_initialised, _T("wxMFrame created twice") ); SetName(framename); int xpos, ypos, width, height; bool startIconised, startMaximised; RestorePosition(MFrameBase::GetName(), &xpos, &ypos, &width, &height, &startIconised, &startMaximised); // use name as default title if ( !wxFrame::Create(parent, -1, framename, wxPoint(xpos, ypos), wxSize(width,height)) ) { wxFAIL_MSG( _T("Failed to create a frame!") ); return; } SetIcon(ICON(_T("MFrame"))); // no "else": a frame can be maximized and iconized, meaning that it will // become maximized when restored if ( startMaximised ) Maximize(); if ( startIconised ) Iconize(); m_initialised = true; SetMenuBar(new wxMenuBar(wxMB_DOCKABLE)); }
void MainFrame::RestorePosition(const wxString &name) { bool maximized; int x, y, w, h; m_currentDir = wxT("./projects"); wxConfigBase *config = wxConfigBase::Get(); config->SetPath(name); if (config->Read(wxT("IsMaximized"), &maximized)) { Maximize(maximized); x = y = w = h = -1; config->Read(wxT("PosX"), &x); config->Read(wxT("PosY"), &y); config->Read(wxT("SizeW"), &w); config->Read(wxT("SizeH"), &h); SetSize(x, y, w, h); bool iconized = false; config->Read(wxT("IsIconized"), &iconized); if (iconized) Iconize(iconized); } config->Read(wxT("CurrentDirectory"), &m_currentDir); config->Read(wxT("RecentFile0"),&m_recentProjects[0]); config->Read(wxT("RecentFile1"),&m_recentProjects[1]); config->Read(wxT("RecentFile2"),&m_recentProjects[2]); config->Read(wxT("RecentFile3"),&m_recentProjects[3]); config->SetPath(wxT("..")); UpdateRecentProjects(); }
void wxZRColaFrame::OnTaskbarIconClick(wxTaskBarIconEvent& event) { Iconize(false); Show(true); Raise(); event.Skip(); }
void CDlgMessages::RestoreWindowDimensions() { wxString strBaseConfigLocation = wxString(wxT("/Simple/Messages")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); bool bWindowIconized = false; bool bWindowMaximized = false; int iHeight = 0; int iWidth = 0; int iTop = 0; int iLeft = 0; wxASSERT(pConfig); pConfig->SetPath(strBaseConfigLocation); pConfig->Read(wxT("YPos"), &iTop, 30); pConfig->Read(wxT("XPos"), &iLeft, 30); pConfig->Read(wxT("Width"), &iWidth, 640); pConfig->Read(wxT("Height"), &iHeight, 480); pConfig->Read(wxT("WindowIconized"), &bWindowIconized, false); pConfig->Read(wxT("WindowMaximized"), &bWindowMaximized, false); // Guard against a rare situation where registry values are zero if (iWidth < 50) iWidth = 640; if (iHeight < 50) iHeight = 480; #ifndef __WXMAC__ // If either co-ordinate is less then 0 then set it equal to 0 to ensure // it displays on the screen. if ( iLeft < 0 ) iLeft = 30; if ( iTop < 0 ) iTop = 30; // Read the size of the screen wxInt32 iMaxWidth = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ); wxInt32 iMaxHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); // Max sure that it doesn't go off to the right or bottom if ( iLeft + iWidth > iMaxWidth ) iLeft = iMaxWidth - iWidth; if ( iTop + iHeight > iMaxHeight ) iTop = iMaxHeight - iHeight; if (!IsIconized() && !IsMaximized()) { SetSize(iLeft, iTop, iWidth, iHeight); } Iconize(bWindowIconized); Maximize(bWindowMaximized); #else // ! __WXMAC__ // If the user has changed the arrangement of multiple // displays, make sure the window title bar is still on-screen. if (!IsWindowOnScreen(iLeft, iTop, iWidth, iHeight)) { iTop = iLeft = 30; } SetSize(iLeft, iTop, iWidth, iHeight); #endif // ! __WXMAC__ }
void wxTopLevelWindowMGL::Restore() { if ( IsIconized() ) { Iconize(false); } if ( IsMaximized() ) { Maximize(false); } }
void CDlgMessages::RestoreWindowDimensions() { wxString strBaseConfigLocation = wxString(wxT("/Simple/Messages")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); bool bWindowIconized = false; bool bWindowMaximized = false; int iHeight = 0; int iWidth = 0; int iTop = 0; int iLeft = 0; wxASSERT(pConfig); pConfig->SetPath(strBaseConfigLocation); pConfig->Read(wxT("YPos"), &iTop, 30); pConfig->Read(wxT("XPos"), &iLeft, 30); pConfig->Read(wxT("Width"), &iWidth, 640); pConfig->Read(wxT("Height"), &iHeight, 480); pConfig->Read(wxT("WindowIconized"), &bWindowIconized, false); pConfig->Read(wxT("WindowMaximized"), &bWindowMaximized, false); #ifndef __WXMAC__ Iconize(bWindowIconized); Maximize(bWindowMaximized); if (!IsIconized() && !IsMaximized()) { SetSize(-1, -1, iWidth, iHeight); } #else // ! __WXMAC__ // If the user has changed the arrangement of multiple // displays, make sure the window title bar is still on-screen. Rect titleRect = {iTop, iLeft, iTop+22, iLeft+iWidth }; InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible RgnHandle displayRgn = NewRgn(); CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays Rect menuRect = ((**GetMainDevice())).gdRect; menuRect.bottom = GetMBarHeight() + menuRect.top; RgnHandle menuRgn = NewRgn(); RectRgn(menuRgn, &menuRect); // Region hidden by menu bar DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar retion if (!RectInRgn(&titleRect, displayRgn)) iTop = iLeft = 30; DisposeRgn(menuRgn); DisposeRgn(displayRgn); SetSize(iLeft, iTop, iWidth, iHeight); #endif // ! __WXMAC__ }
/*! Report error message * * @param msg Message to display * @param rc Error code */ USBDM_ErrorCode GdbServerWindow::reportError(const char *msg, GdbMessageLevel level, USBDM_ErrorCode rc) { if ((rc != BDM_RC_OK) || (level >= getLoggingLevel())) { statusTextControl->AppendText(wxString(msg, wxConvUTF8)); if (level == M_FATAL) { setDeferredFail(); } } if (level&M_DIALOGUE) { Iconize(false); // restore the window if minimized SetFocus(); // focus on my window Raise(); // bring window to front Show(true); // show the window wxMessageBox( wxString(msg, wxConvUTF8), /* message */ wxString("Message", wxConvUTF8), /* caption */ wxOK|wxICON_ERROR, /* style */ this /* parent */ ); } if (rc != BDM_RC_OK) { statusTextControl->AppendText(wxString(USBDM_GetErrorString(rc), wxConvUTF8)); statusTextControl->AppendText(_("\n")); Iconize(false); // restore the window if minimized SetFocus(); // focus on my window Raise(); // bring window to front Show(true); // show the window wxMessageBox( wxString(USBDM_GetErrorString(rc), wxConvUTF8), /* message */ wxString(msg, wxConvUTF8), /* caption */ wxOK|wxICON_ERROR, /* style */ this /* parent */ ); } return rc; }
//--------------------------------------------------------- CSAGA_Frame::~CSAGA_Frame(void) { //----------------------------------------------------- if( IsIconized() ) { Iconize(false); } if( IsMaximized() ) { CONFIG_Write(wxT("/FL"), wxT("STATE"), (long)1); } else { CONFIG_Write(wxT("/FL"), wxT("STATE"), (long)0); CONFIG_Write(wxT("/FL"), wxT("X" ), (long)GetPosition().x); CONFIG_Write(wxT("/FL"), wxT("Y" ), (long)GetPosition().y); CONFIG_Write(wxT("/FL"), wxT("DX" ), (long)GetSize().x); CONFIG_Write(wxT("/FL"), wxT("DY" ), (long)GetSize().y); } //----------------------------------------------------- CONFIG_Write(wxT("/FL"), wxT("MANAGER"), m_pLayout->SavePerspective()); m_pLayout->UnInit(); delete(m_pLayout); //----------------------------------------------------- delete(m_pMN_Table); delete(m_pMN_Diagram); delete(m_pMN_Map); delete(m_pMN_Map_3D); delete(m_pMN_Histogram); delete(m_pMN_ScatterPlot); delete(m_pMN_Layout); //----------------------------------------------------- if( m_pTopWindows ) { delete(m_pTopWindows); } SG_Set_UI_Callback(NULL); g_pSAGA_Frame = NULL; }
void CBOINCBaseFrame::OnClose(wxCloseEvent& event) { wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnClose - Function Begin")); if (!event.CanVeto() || IsIconized()) { wxGetApp().FrameClosed(); Destroy(); } else { #ifdef __WXGTK__ // Apparently aborting a close event just causes the main window to be displayed // again. Just minimize the window instead. Iconize(); #else Hide(); #endif } wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnClose - Function End")); }
void wxGD::MainFrame::LoadLayout() { wxString perspective; bool maximized, iconized; wxConfigBase::Get()->Read( "/mainframe/perspective", &perspective ); wxConfigBase::Get()->Read( "/mainframe/maximized", &maximized, true ); wxConfigBase::Get()->Read( "/mainframe/iconized", &iconized, false ); if( !perspective.empty() ) { m_mgr->LoadPerspective( perspective ); m_mgr->Update(); } if( maximized ) { Maximize( maximized ); } else if( iconized ) { Iconize( iconized ); } else { int x, y, w, h; x = y = w = h = -1; wxConfigBase::Get()->Read( "/mainframe/left", &x ); wxConfigBase::Get()->Read( "/mainframe/top", &y ); wxConfigBase::Get()->Read( "/mainframe/width", &w ); wxConfigBase::Get()->Read( "/mainframe/height", &h ); if( x > -1 && y > -1 && w >= 630 && h >= 480 ) { SetSize( x, y, w, h ); } } wxConfigBase::Get()->Read( "last_dir", &m_lastDir ); m_history.Load( *wxConfigBase::Get() ); }
//------------------------------------------------------------------------------ // void SaveChildPositionAndSize() //------------------------------------------------------------------------------ void GmatMdiChildFrame::SaveChildPositionAndSize() { if (mCanSaveLocation == false) return; if (IsIconized()) return; // Get the position and size of the window first #ifdef __WXMAC__ Integer screenWidth = wxSystemSettings::GetMetric(wxSYS_SCREEN_X); Integer screenHeight = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y); #else Integer screenWidth; Integer screenHeight; GmatAppData::Instance()->GetMainFrame()->GetActualClientSize(&screenWidth, &screenHeight, true); // Since GmatMainFrame::GetActualClientSize() subtracts one, add one here (LOJ: 2012.07.23) screenWidth++; screenHeight++; #endif bool isMinimized = IsIconized(), isMaximized = IsMaximized(); if (isMinimized) Iconize(false); else if (isMaximized) Maximize(false); int tmpX = -1, tmpY = -1; int tmpW = -1, tmpH = -1; GetPosition(&tmpX, &tmpY); GetSize(&tmpW, &tmpH); Rvector upperLeft(2, ((Real) tmpX /(Real) screenWidth), ((Real) tmpY /(Real) screenHeight)); Rvector childSize(2, ((Real) tmpW /(Real) screenWidth), ((Real) tmpH /(Real) screenHeight)); if (isMinimized) Iconize(); else if (isMaximized) Maximize(); #ifdef DEBUG_PERSISTENCE // ======================= begin temporary ============================== MessageInterface::ShowMessage("*** Size of SCREEN %s is: width = %d, height = %d\n", mChildName.WX_TO_C_STRING, screenWidth, screenHeight); MessageInterface::ShowMessage("Position of View plot %s is: x = %d, y = %d\n", mChildName.WX_TO_C_STRING, tmpX, tmpY); MessageInterface::ShowMessage("Size of View plot %s is: width = %d, height = %d\n", mChildName.WX_TO_C_STRING, tmpW, tmpH); // ======================= end temporary ============================== #endif if ((mItemType == GmatTree::OUTPUT_REPORT) || (mItemType == GmatTree::OUTPUT_CCSDS_OEM_FILE ) || (mItemType == GmatTree::OUTPUT_ORBIT_VIEW) || (mItemType == GmatTree::OUTPUT_XY_PLOT) || (mItemType == GmatTree::OUTPUT_GROUND_TRACK_PLOT) // We'll want to add the event reports eventually, but they are not subscriber based //|| (mItemType == GmatTree::EVENT_REPORT) ) { GmatBase *obj = theGuiInterpreter->GetConfiguredObject(mChildName.c_str()); #ifdef DEBUG_FUNCTION // Check if child name is the configured object name MessageInterface::ShowMessage ("GmatMdiChildFrame::SaveChildPositionAndSize() the child '%s' %s a " "configured object, obj = <%p>[%s]'%s'\n", mChildName.WX_TO_C_STRING, obj ? "is" : "is not", obj, obj ? obj->GetTypeName().c_str() : "NULL", obj ? obj->GetName().c_str() : "NULL"); #endif if (!obj) { // Just return if child is not a configured subscriber,ie, // plotting from GMAT function (LOJ: 2015.06.26) #ifdef DEBUG_FUNCTION MessageInterface::ShowMessage ("**** WARNING **** GmatMdiChildFrame::SaveChildPositionAndSize() " "will not save position and size for unconfigured subscriber '%s'\n", mChildName.WX_TO_C_STRING); #endif return; } else if (!obj->IsOfType("Subscriber")) { #ifdef DEBUG_PERSISTENCE MessageInterface::ShowMessage ("**** WARNING **** GmatMdiChildFrame::SaveChildPositionAndSize() " "cannot not save position and size for non-subscriber '%s'\n", mChildName.WX_TO_C_STRING); #endif SubscriberException se; se.SetDetails("Cannot set position and size for non-subscriber '%s'"); throw se; } Subscriber *sub = (Subscriber*) obj; #ifdef DEBUG_PERSISTENCE MessageInterface::ShowMessage("...... Now saving plot data to %s:\n", (sub->GetName()).c_str()); MessageInterface::ShowMessage(" Upper left = %12.10f %12.10f\n", upperLeft[0], upperLeft[1]); MessageInterface::ShowMessage(" Size = %12.10f %12.10f\n", childSize[0], childSize[1]); MessageInterface::ShowMessage(" RelativeZOrder = %d\n", relativeZOrder); #endif sub->SetRvectorParameter(sub->GetParameterID("UpperLeft"), upperLeft); sub->SetRvectorParameter(sub->GetParameterID("Size"), childSize); sub->SetIntegerParameter(sub->GetParameterID("RelativeZOrder"), relativeZOrder); sub->SetBooleanParameter(sub->GetParameterID("Maximized"), isMaximized); } else if (mItemType == GmatTree::MISSION_TREE_UNDOCKED) { // get the config object wxFileConfig *pConfig; pConfig = (wxFileConfig *) GmatAppData::Instance()->GetPersonalizationConfig(); std::stringstream location(""); location << upperLeft[0] << " " << upperLeft[1]; std::stringstream size(""); size << childSize[0] << " " << childSize[1]; pConfig->Write("/MissionTree/UpperLeft", location.str().c_str()); pConfig->Write("/MissionTree/Size", size.str().c_str()); pConfig->Write("/MissionTree/IsMaximized", isMaximized); pConfig->Write("/MissionTree/IsMinimized", isMinimized); } else if (mItemType == GmatTree::SCRIPT_FILE) { // get the config object wxFileConfig *pConfig; pConfig = (wxFileConfig *) GmatAppData::Instance()->GetPersonalizationConfig(); std::stringstream location(""); location << upperLeft[0] << " " << upperLeft[1]; std::stringstream size(""); size << childSize[0] << " " << childSize[1]; pConfig->Write("/ScriptEditor/UpperLeft", location.str().c_str()); pConfig->Write("/ScriptEditor/Size", size.str().c_str()); pConfig->Write("/ScriptEditor/IsMaximized", isMaximized); pConfig->Write("/ScriptEditor/IsMinimized", isMinimized); } }
void Frame::OnClose(wxCloseEvent& event){ Iconize(true); Show(false); }