ToasterBoxWindow::ToasterBoxWindow(wxWindow* parent, wxTimer *_parent2) : ToasterBase(parent, wxNO_BORDER|wxSTAY_ON_TOP|wxFRAME_NO_TASKBAR) { startTime = wxGetLocalTime(); parent2 = _parent2; sleepTime = 10; step = 4; pauseTime = 1700; textColor = *wxWHITE; popupText = _T("Change Me!"); //the size we want the dialog to be wxSize dialogSize(150, 170); count++; bottomRight = wxPoint(wxGetDisplaySize().GetWidth(), wxGetDisplaySize().GetHeight()); SetSize(bottomRight.x, bottomRight.y, dialogSize.GetWidth(), dialogSize.GetHeight()); ToasterBase::Connect( wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction)& ToasterBoxWindow::OnEraseBackground); ToasterBase::Connect( wxEVT_PAINT, (wxObjectEventFunction)& ToasterBoxWindow::OnPaint); #ifndef __WXMSW__ PushEventHandler( new wxBackgroundBitmap( charArr2wxBitmap( notif_bg_png, sizeof(notif_bg_png) ) ) ); #endif }
bool JMApp::OnInit() { // Create main window frame int windowx,windowy; windowx = min(480,wxGetDisplaySize().x); windowy = min(400,wxGetDisplaySize().y); jmlib = JMLib::alloc(); //jmlib = JMLib::alloc_JuggleMaster(); //jmlib = JMLib::alloc_JuggleSaver(); jmlib->setWindowSize(windowx, windowy); jmlib->setPatternDefault(); jmlib->setStyleDefault(); jmlib->setScalingMethod(SCALING_METHOD_DYNAMIC); jmlib->startJuggle(); wxCmdLineParser cmdline(cmdLineDesc, argc, argv); cmdline.SetLogo(_T("JuggleMaster Deluxe")); if(cmdline.Parse() == -1) { exit(0); } wxString initialsiteswap,initialstyle,named_pattern,semaphore; if(cmdline.Found(_T("help"))) { cmdline.Usage(); printf((const char*)_T("\n Style can be anything in the \"Change Style\" menu, eg \"Mills Mess\"\n")); exit(0); } if(cmdline.Found(_T("style"),&initialstyle)) { jmlib->setStyle((JML_CHAR *)(const char *)initialstyle.mb_str(wxConvUTF8)); } if(cmdline.Found(_T("pattern"),&named_pattern)) { /* FIXME */ printf((const char*)_T("Named Pattern: %s\n"),(const char *)named_pattern.mb_str(wxConvUTF8)); } if(cmdline.Found(_T("semaphore"),&semaphore)) { /* FIXME */ printf((const char*)_T("Semaphore Requested: %s\n"),(const char *)semaphore.mb_str(wxConvUTF8)); } if (cmdline.GetParamCount() > 0) { initialsiteswap = cmdline.GetParam(0); if(!initialsiteswap.IsEmpty()) { jmlib->setPattern((JML_CHAR *)(const char *)initialsiteswap.mb_str(wxConvUTF8), (JML_CHAR *)(const char *)initialsiteswap.mb_str(wxConvUTF8),HR_DEF, DR_DEF); } } frame = new JMFrame(NULL, -1, _T("JuggleMaster Deluxe"), wxDefaultPosition, wxSize(windowx,windowy), jmlib); // Show the frame frame->Show(true); return true; }
void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ) { wxTopLevelWindowBase::DoSetSizeHints( minW, minH, maxW, maxH, incW, incH ); if (m_widget) { int minWidth = GetMinWidth(), minHeight = GetMinHeight(), maxWidth = GetMaxWidth(), maxHeight = GetMaxHeight(); // set size hints gint flag = 0; // GDK_HINT_POS; GdkGeometry geom; if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE; if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE; geom.min_width = minWidth; geom.min_height = minHeight; // Because of the way we set GDK_HINT_MAX_SIZE above, if either of // maxHeight or maxWidth is set, we must set them both, else the // remaining -1 will be taken literally. // I'm certain this also happens elsewhere, and is the probable // cause of other such things as: // Gtk-WARNING **: gtk_widget_size_allocate(): // attempt to allocate widget with width 65535 and height 600 // but I don't have time to track them all now.. // // Really we need to encapulate all this height/width business and // stop any old method from ripping at the members directly and // scattering -1's without regard for who might resolve them later. geom.max_width = ( maxHeight == -1 ) ? maxWidth : ( maxWidth == -1 ) ? wxGetDisplaySize().GetWidth() : maxWidth ; geom.max_height = ( maxWidth == -1 ) ? maxHeight // ( == -1 here ) : ( maxHeight == -1 ) ? wxGetDisplaySize().GetHeight() : maxHeight ; gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), (GtkWidget*) NULL, &geom, (GdkWindowHints) flag ); } }
JMCanvas::JMCanvas(JMFrame *p, JMLib *j) : wxScrolledWindow( p, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE ) { jmlib = j; parent = p; ball_colors[0] = (wxBrush*)wxRED_BRUSH; ball_colors[1] = (wxBrush*)wxGREEN_BRUSH; ball_colors[2] = (wxBrush*)wxBLUE_BRUSH; ball_colors[3] = (wxBrush*)wxWHITE_BRUSH; ball_colors[4] = (wxBrush*)wxBLACK_BRUSH; ball_colors[5] = (wxBrush*)wxCYAN_BRUSH; ball_colors[6] = (wxBrush*)wxGREY_BRUSH; ball_colors[7] = (wxBrush*)wxLIGHT_GREY_BRUSH; backBuffer = new wxBitmap(wxGetDisplaySize().x, wxGetDisplaySize().y); }
void wxDFBDCImpl::DFBInit(const wxIDirectFBSurfacePtr& surface) { m_surface = surface; wxCHECK_RET( surface != NULL, "invalid surface" ); m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() / (double)wxGetDisplaySizeMM().GetWidth(); m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() / (double)wxGetDisplaySizeMM().GetHeight(); SetFont(DEFAULT_FONT); SetPen(DEFAULT_PEN); SetBrush(DEFAULT_BRUSH); }
bool HypoApp::OnInit() { int x = 700; int y = 920; // 1100 // 850 wxPoint pos; if(GetSystem() == Mac) { x = 685; pos.x = 50; pos.y = 23; // 0; } else pos = wxDefaultPosition; OptionLoad(); if(viewwidth < 400) viewwidth = 400; y = viewheight; x = viewwidth; wxSize screensize = wxGetDisplaySize(); if(x > screensize.GetX()) x = screensize.GetX() - 50; if(y > screensize.GetY()) y = screensize.GetY() - 50; //MainFrame *mainwin = new MainFrame("Hypo Net Model", wxPoint(50, 10), wxSize(700, y)); // 850 // 920 HypoMain *mainwin = new HypoMain("HypoMod", pos, wxSize(x, y)); // 850 // 920 //HypoMain *mainwin = new HypoMain("HypoMod", wxDefaultPosition, wxSize(400, 500)); mainwin->Show(TRUE); SetTopWindow(mainwin); return TRUE; }
wxMoldeoLineCtrl::wxMoldeoLineCtrl( wxWindow* parent, wxWindowID id, const int value, const int minvalue, const int maxvalue, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) : wxControl( parent, id, pos, size, style | wxNO_BORDER, validator, name ) { m_min = minvalue; m_max = maxvalue; m_value = value; m_bStartDragging = false; m_bLeftSizeDragging = false; m_bRightSizeDragging = false; m_bMovingDragging = false; Mx = 0; SetBackgroundStyle(wxBG_STYLE_CUSTOM ); m_pixel_interval = 500; m_play_value = 0; m_play_in = 0; m_max_play_value = m_max * m_pixel_interval; m_play_out = m_max_play_value; m_render_in = m_play_in; m_render_out = m_play_out; //m_timer.SetOwner( this, wxMoldeoLineCtrl::MOLDEOLINETIMER_ID); //m_timer.Start(30); wxSize screenSize = wxGetDisplaySize(); bitmap = wxBitmap(screenSize.x, screenSize.y); wxScreenDC sdc; wxMemoryDC mdc; wxPoint AP = ClientToScreen(wxPoint(0,0)); mdc.SelectObject(bitmap); mdc.Blit( 0, 0, screenSize.x, screenSize.y, &sdc, AP.x, AP.y); mdc.SelectObject(wxNullBitmap); }
/** * Initializes the main game frame. */ void GcbApp::InitializeGameFrame() { try { tcDisplayModes::Get()->LoadModeFromOptions(); int windowedMode = tcOptions::Get()->windowedMode; if (windowedMode) { int x, y; wxSize size; wxClientDisplayRect(&x, &y, &size.x, &size.y); // account for task bar size long frameStyle = wxDEFAULT_FRAME_STYLE; gameFrame = new tcGame(wxPoint(0,0), size, frameStyle); } else { long frameStyle = wxNO_FULL_REPAINT_ON_RESIZE; gameFrame = new tcGame(wxPoint(0,0), wxGetDisplaySize(), frameStyle); } gameFrame->Init(); } catch(...) { wxMessageBox("The game frame failed to initialize."); WTL("The game frame failed to initialize."); throw std::exception(); } }
void MainFrame::onWizardShow(wxCommandEvent& event) { RuleWizard *wizard = new RuleWizard(this); wxCommandEvent showEvent(anEVT_WIZARD_SHOW); wxSize displaySize; wxString displayMsg; displaySize = wxGetDisplaySize(); displayMsg = wxString::Format(_("Display size of %dx%d is too small " "for the wizard.\nPresentation may be broken!"), displaySize.GetWidth(), displaySize.GetHeight()); an_menubar->Check(ID_MITOOLSWIZARD, event.GetInt()); event.Skip(); if (event.GetInt() != 0) { if (displaySize.GetWidth() < 1024) { anMessageBox(displayMsg, _("Wizard warning"), wxOK|wxICON_EXCLAMATION, this); } wizard->RunWizard(wizard->getPage(RuleWizard::PAGE_PROGRAM)); /* After finishing wizard, we uncheck menu and statusbar. */ showEvent.SetInt(0); wxPostEvent(AnEvents::instance(), showEvent); } wizard->Destroy(); }
void RainExceptionDialog::_addExtraControls() { m_pSaveBtn = new wxButton(this, wxID_SAVE, wxT("Copy to Clipboard")); m_pStaticLine = new wxStaticLine(this, wxID_ANY); m_pDetailList = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL); m_pDetailList->InsertColumn(0, wxT("Message")); m_pDetailList->InsertColumn(1, wxT("File")); m_pDetailList->InsertColumn(2, wxT("Ln.")); size_t count = m_aMessages.GetCount(); for(size_t n = 0; n < count; ++n) { m_pDetailList->InsertItem(n, m_aMessages[n]); m_pDetailList->SetItem(n, 1, m_aFiles[n]); m_pDetailList->SetItem(n, 2, wxString::Format(wxT("%li"), m_aLines[n])); } m_pDetailList->SetColumnWidth(0, wxLIST_AUTOSIZE); m_pDetailList->SetColumnWidth(1, wxLIST_AUTOSIZE); m_pDetailList->SetColumnWidth(2, wxLIST_AUTOSIZE); int height = GetCharHeight()*(count + 4); int heightMax = wxGetDisplaySize().y - GetPosition().y - 2*GetMinHeight(); heightMax *= 9; heightMax /= 10; m_pDetailList->SetSize(wxDefaultCoord, wxMin(height, heightMax)); }
numberPopup::numberPopup(wxWindow* parent,int ratio, wxColour colourGreen, wxWindowID) { //wxSizerFlags flagsExpand(1); //flagsExpand.Expand().Border(wxALL, 2); //(*Initialize(numberPopup) wxBoxSizer* BoxSizer1; Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSTAY_ON_TOP|wxDEFAULT_FRAME_STYLE|wxFRAME_NO_TASKBAR|wxNO_BORDER, _T("wxID_ANY")); BoxSizer1 = new wxBoxSizer(wxHORIZONTAL); Button1 = new wxButton(this, ID_BUTTON1, _("Label"), wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxDefaultValidator, _T("ID_BUTTON1")); BoxSizer1->Add(Button1, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); SetSizer(BoxSizer1); Timer1.SetOwner(this, ID_TIMER1); BoxSizer1->Fit(this); BoxSizer1->SetSizeHints(this); Center(); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&numberPopup::OnButton1Click); Connect(ID_TIMER1,wxEVT_TIMER,(wxObjectEventFunction)&numberPopup::OnTimer1Trigger); //*) //find the screen size wxSize displaySize = wxGetDisplaySize(); this->SetSize(wxDefaultCoord,wxDefaultCoord,wxRound((double(displaySize.GetWidth()))*(((double)ratio)/100)), wxRound((double(displaySize.GetHeight()))*(((double)ratio)/100)),wxSIZE_FORCE); Button1->SetBackgroundColour(colourGreen); this->SetBackgroundColour(colourGreen); }
void GEUIDialog::SaveViewAsJPG( wxString filename ) { if (NULL == app || !m_bgeisuseable) { wxMessageBox(_("Screenshot can't be created, GE looks uninitialized..."), _("Problem!")); return; } RECT rect; GetWindowRect((HWND) LongToHandle(app->GetRenderHwnd()), &rect); int width, height, x, y; width = rect.right - rect.left - 1; height = rect.bottom - rect.top - 1; x = rect.left; y = rect.top; wxSize screenSize = wxGetDisplaySize(); wxBitmap bitmap(screenSize.x, screenSize.y); wxScreenDC dc; wxMemoryDC memDC; memDC.SelectObject(bitmap); memDC.Blit(0, 0, screenSize.x, screenSize.y, & dc, 0, 0); memDC.SelectObject(wxNullBitmap); wxMemoryDC cropDC(bitmap); wxBitmap screenshot(width, height, -1); memDC.SelectObject(screenshot); memDC.Blit( 0, 0, width, height, &cropDC, x, y ); memDC.SelectObject(wxNullBitmap); screenshot.SaveFile(filename, wxBITMAP_TYPE_JPEG); }
void CheckOnScreen(wxWindow *win, wxPoint &pos, wxSize &size, const int w0, const int h0) { wxRect rect; int scrH, scrW; wxSize screenSize = wxGetDisplaySize(); scrW = screenSize.x; scrH = screenSize.y; if (pos.x > scrW - w0) pos.x = scrW - w0; if (pos.y > scrH - h0) pos.y = scrH - h0; if (pos.x < 0) pos.x = 0; if (pos.y < 0) pos.y = 0; if (size.GetWidth() < w0) size.SetWidth(w0); if (size.GetHeight() < h0) size.SetHeight(h0); if (size.GetWidth() > scrW) size.SetWidth(scrW); if (size.GetHeight() > scrH) size.SetHeight(scrH); }
wxSize wxGetDisplayPPI() { const wxSize pixels = wxGetDisplaySize(); const wxSize mm = wxGetDisplaySizeMM(); return wxSize((int)((pixels.x * inches2mm) / mm.x), (int)((pixels.y * inches2mm) / mm.y)); }
wxBitmap RectangleDrawer::GetScreenShot(wxDC& dc) { const size_t HEIGHT = ConfigReader::GetInstance()->GetFileConfigIntValue("CANVAS_HEIGHT"); const size_t WIDTH = ConfigReader::GetInstance()->GetFileConfigIntValue("CANVAS_WIDTH"); const size_t SCALING_COEFF = ConfigReader::GetInstance()->GetFileConfigIntValue("CANVAS_SCALE"); const size_t SHIFT_X = ConfigReader::GetInstance()->GetFileConfigIntValue("CANVAS_SHIFT_X"); const size_t SHIFT_Y = ConfigReader::GetInstance()->GetFileConfigIntValue("CANVAS_SHIFT_Y"); wxSize screenSize(wxGetDisplaySize().x, wxGetDisplaySize().y); wxBitmap bitmap(WIDTH * SCALING_COEFF + 2, HEIGHT * SCALING_COEFF + 2); wxMemoryDC memDC; memDC.SelectObject(bitmap); memDC.Blit(0, 0, wxGetDisplaySize().x, wxGetDisplaySize().y, &dc, SHIFT_X, SHIFT_Y); memDC.SelectObject(wxNullBitmap); return bitmap; }
void wxDisplaySize(int *width, int *height) { const wxSize size = wxGetDisplaySize(); if ( width ) *width = size.x; if ( height ) *height = size.y; }
void HtMainFrame::OnToolsLog (wxCommandEvent &WXUNUSED(event)) { wxSize display_sz = wxGetDisplaySize(); wxSize logger_sz = logger->GetFrame()->GetSize(); logger->GetFrame()->SetPosition(wxPoint(display_sz.x - logger_sz.x, display_sz.y - logger_sz.y - 30)); logger->Show(); }
wxDC::wxDC() { m_ok = FALSE; m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() / (double)wxGetDisplaySizeMM().GetWidth(); m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() / (double)wxGetDisplaySizeMM().GetHeight(); m_needComputeScaleX = FALSE; /* not used yet */ m_needComputeScaleY = FALSE; /* not used yet */ m_logicalFunction = wxCOPY; m_pen = *wxBLACK_PEN; m_font = *wxNORMAL_FONT; m_brush = *wxWHITE_BRUSH; }
void Model_Usage::pageview(const wxString& documentPath, const wxString& documentTitle, int plt /* = 0 msec*/) { if (!Option::instance().SendUsageStatistics()) { return; } static std::string GA_URL_ENDPOINT = "http://www.google-analytics.com/collect?"; std::string url = GA_URL_ENDPOINT; std::vector<std::pair<wxString, wxString>> parameters = { { "v", "1" }, { "t", "pageview" }, { "tid", "UA-51521761-6" }, { "cid", uuid() }, { "dp", documentPath }, { "dt", documentTitle }, // {"geoid", }, { "ul", Option::instance().Language() }, { "sr", wxString::Format("%ix%i", wxGetDisplaySize().GetX(), wxGetDisplaySize().GetY()) }, { "vp", "" }, { "sd", wxString::Format("%i-bits", wxDisplayDepth()) }, // application { "an", "MoneyManagerEx" }, { "av", mmex::version::string }, // application version // custom dimensions { "cd1", wxPlatformInfo::Get().GetPortIdShortName() }, { "plt", wxString::Format("%d", plt)} }; for (const auto& kv : parameters) { if (kv.second.empty()) continue; url += wxString::Format("%s=%s&", kv.first, kv.second).ToStdString(); } url.back() = ' '; // override the last & // Spawn thread to send statistics SendStatsThread* thread = new SendStatsThread(url); if (thread) thread->Run(); }
ClusterMap::ClusterMap(wxWindow* parent) : wxWindow(parent,wxID_ANY) { HDC hdc = GetDC((HWND)GetHandle()); m_cacheDC = ::CreateCompatibleDC(hdc); if(!m_cacheDC) letrace("cannot create cache dc"); m_cacheBmp = ::CreateCompatibleBitmap(hdc, wxGetDisplaySize().GetWidth(), wxGetDisplaySize().GetHeight() ); if(!m_cacheBmp) letrace("cannot create cache bitmap"); ::SelectObject(m_cacheDC,m_cacheBmp); ::SetBkMode(m_cacheDC,TRANSPARENT); ::ReleaseDC((HWND)GetHandle(),hdc); for(int i = 0; i < SPACE_STATES; i++) m_brushes[i] = ::CreateSolidBrush(g_colors[i]); m_width = m_height = 0; }
wxSize wxGetDisplaySizeMM() { const wxSize ppi = wxGetDisplayPPI(); if ( !ppi.x || !ppi.y ) return wxSize(0, 0); const wxSize pixels = wxGetDisplaySize(); return wxSize(wxRound(pixels.x * inches2mm / ppi.x), wxRound(pixels.y * inches2mm / ppi.y)); }
bool RadarPanel::Create() { m_aui_mgr = GetFrameAuiManager(); m_aui_name = wxString::Format(wxT("BR24radar_pi-%d"), m_ri->m_radar); wxAuiPaneInfo pane = wxAuiPaneInfo() .Name(m_aui_name) .Caption(m_ri->m_name) .CaptionVisible(true) // Show caption even when docked .TopDockable(false) .BottomDockable(false) .RightDockable(true) .LeftDockable(true) .CloseButton(true) .Gripper(false); m_sizer = new wxBoxSizer(wxHORIZONTAL); m_text = new wxStaticText(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); m_sizer->Add(m_text, 0, wxEXPAND | wxALL, 0); SetSizer(m_sizer); DimeWindow(this); Fit(); Layout(); // SetMinSize(GetBestSize()); m_best_size = wxGetDisplaySize(); m_best_size.x /= 2; m_best_size.y /= 2; pane.MinSize(256, 256); pane.BestSize(m_best_size); pane.FloatingSize(512, 512); pane.FloatingPosition(m_pi->m_settings.window_pos[m_ri->m_radar]); pane.Float(); pane.dock_proportion = 100000; // Secret sauce to get panels to use entire bar m_aui_mgr->AddPane(this, pane); m_aui_mgr->Update(); m_aui_mgr->Connect(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(RadarPanel::close), NULL, this); m_dock_size = 0; if (m_pi->m_perspective[m_ri->m_radar].length()) { // Do this first and it doesn't work if the pane starts docked. LOG_DIALOG(wxT("BR24radar_pi: Restoring panel %s to AUI control manager: %s"), m_aui_name.c_str(), m_pi->m_perspective[m_ri->m_radar].c_str()); m_aui_mgr->LoadPaneInfo(m_pi->m_perspective[m_ri->m_radar], pane); m_aui_mgr->Update(); } else { LOG_DIALOG(wxT("BR24radar_pi: Added panel %s to AUI control manager"), m_aui_name.c_str()); } return true; }
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))); }
wxString pxFormatToolTipText( wxWindow* wind, const wxString& src ) { // Windows needs manual tooltip word wrapping (sigh). // GTK and Mac are a wee bit more clever (except in GTK tooltips don't show at all // half the time because of some other bug .. sigh) #ifdef __WXMSW__ if( wind == NULL ) return src; // Silently ignore nulls int whee = wxGetDisplaySize().GetWidth() * 0.75; return pxTextWrapper().Wrap( *wind, src, std::min( whee, 600 ) ).GetResult(); #else return src; #endif }
void ToasterBox::SetPopupPosition(int pos) { bottomRight = wxPoint(wxGetDisplaySize().GetWidth(), wxGetDisplaySize().GetHeight()); //top left if (pos == 0) popupPosition = wxPoint(0, 0); //top right if (pos == 1) popupPosition = wxPoint(wxGetDisplaySize().GetWidth() - popupSize.GetWidth(), 0); //bottom left if (pos == 2) popupPosition = wxPoint(0, wxGetDisplaySize().GetHeight() - popupSize.GetHeight()); //bottom right if (pos == 3) popupPosition = wxPoint(bottomRight.x - popupSize.GetWidth(), bottomRight.y - popupSize.GetHeight()); bottomRight = wxPoint(popupPosition.x + popupSize.GetWidth(), popupPosition.y + popupSize.GetHeight()); }
ToasterBox::ToasterBox(wxWindow* _parent) : parent(_parent) , sleepTime(10) , pauseTime(1700) , popupText(_T("default")) , popupTop(wxPoint(0, 0)) , popupPosition(wxPoint(100, 100)) , popupSize(wxSize(150, 170)) , colFg(*wxWHITE) , colBg(*wxBLACK) , bitmapFile(wxEmptyString) , m_bitmap(wxNullBitmap) , m_stack_direction(StackUp) { //where to keep track of all the toasterboxwindows winList = new ToasterBoxWindowList(); winList->DeleteContents(true); //set the bottom right corner of the dialog //at the bottom right of the screen bottomRight = wxPoint(wxGetDisplaySize().GetWidth(), wxGetDisplaySize().GetHeight()); }
bool wxTopLevelWindowMGL::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& posOrig, const wxSize& sizeOrig, long style, const wxString &name) { // always create a frame of some reasonable, even if arbitrary, size (at // least for MSW compatibility) wxSize size = sizeOrig; if ( size.x == wxDefaultCoord || size.y == wxDefaultCoord ) { wxSize sizeDefault = GetDefaultSize(); if ( size.x == wxDefaultCoord ) size.x = sizeDefault.x; if ( size.y == wxDefaultCoord ) size.y = sizeDefault.y; } // for default positioning, centre the first top level window and // cascade any addtional ones from there. wxPoint pos = posOrig; if ( pos.x == wxDefaultCoord || pos.y == wxDefaultCoord ) { wxSize sizeDisplay = wxGetDisplaySize(); static wxPoint nextPos((sizeDisplay.x - size.x) / 2, (sizeDisplay.y - size.y) / 2); if ( pos.x == wxDefaultCoord ) pos.x = nextPos.x; if ( pos.y == wxDefaultCoord ) pos.y = nextPos.y; if ( pos.x + size.x > sizeDisplay.x || pos.y + size.y > sizeDisplay.y ) pos = wxPoint(); const wxSize cascadeOffset(16, 20); nextPos = pos + cascadeOffset; } wxWindow::Create(NULL, id, pos, size, style, name); SetParent(parent); if ( parent ) parent->AddChild(this); wxTopLevelWindows.Append(this); m_title = title; return true; }
void wxGenericAboutDialog::AddCollapsiblePane(const wxString& title, const wxString& text) { wxCollapsiblePane *pane = new wxCollapsiblePane(this, wxID_ANY, title); wxStaticText *txt = new wxStaticText(pane->GetPane(), wxID_ANY, text, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); // don't make the text unreasonably wide static const int maxWidth = wxGetDisplaySize().x/3; txt->Wrap(maxWidth); // NB: all the wxCollapsiblePanes must be added with a null proportion value m_sizerText->Add(pane, wxSizerFlags(0).Expand().Border(wxBOTTOM)); }
void wxPostScriptPrintPreview::DetermineScaling() { wxPaperSize paperType = m_printDialogData.GetPrintData().GetPaperId(); if (paperType == wxPAPER_NONE) paperType = wxPAPER_NONE; wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType); if (!paper) paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4); if (paper) { wxSize ScreenPixels = wxGetDisplaySize(); wxSize ScreenMM = wxGetDisplaySizeMM(); int resolution = 600; // TODO, this is correct, but get this from wxPSDC somehow m_previewPrintout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()), (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) ); m_previewPrintout->SetPPIPrinter( resolution, resolution ); wxSize sizeDevUnits(paper->GetSizeDeviceUnits()); sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * resolution / 72.0); sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * resolution / 72.0); wxSize sizeTenthsMM(paper->GetSize()); wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10); // If in landscape mode, we need to swap the width and height. if ( m_printDialogData.GetPrintData().GetOrientation() == wxLANDSCAPE ) { m_pageWidth = sizeDevUnits.y; m_pageHeight = sizeDevUnits.x; m_previewPrintout->SetPageSizeMM(sizeMM.y, sizeMM.x); } else { m_pageWidth = sizeDevUnits.x; m_pageHeight = sizeDevUnits.y; m_previewPrintout->SetPageSizeMM(sizeMM.x, sizeMM.y); } m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight); m_previewPrintout->SetPaperRectPixels(wxRect(0, 0, m_pageWidth, m_pageHeight)); // At 100%, the page should look about page-size on the screen. m_previewScaleX = (float)0.8 * 72.0 / (float)resolution; m_previewScaleY = m_previewScaleX; } }
extern "C" WXDLLIMPEXP_CORE void wxPopupMenuPositionCallback( GtkMenu *menu, gint *x, gint *y, gpointer user_data ) { // ensure that the menu appears entirely on screen GtkRequisition req; gtk_widget_get_child_requisition(GTK_WIDGET(menu), &req); wxSize sizeScreen = wxGetDisplaySize(); wxPoint *pos = (wxPoint*)user_data; gint xmax = sizeScreen.x - req.width, ymax = sizeScreen.y - req.height; *x = pos->x < xmax ? pos->x : xmax; *y = pos->y < ymax ? pos->y : ymax; }