bool CollectionNavigationPane::ShowContextMenu(const OpPoint &point, BOOL center, OpTreeView* view, BOOL use_keyboard_context) { const char* menu_name = GetMenuName(); if (!menu_name) return true; NavigationItem* item = static_cast<NavigationItem*>(m_tree_view->GetOpWidget()->GetSelectedItem()); OpPoint p(point.x+GetScreenRect().x, point.y+GetScreenRect().y); g_application->GetMenuHandler()->ShowPopupMenu(menu_name, PopupPlacement::AnchorAt(p, center), item->GetID(), use_keyboard_context); return true; }
void CCWidget::Draw(CCDrawContext* pDC){ if(m_bVisible==false) return; unsigned char nLastOpacity; nLastOpacity = pDC->GetOpacity(); sRect sr = GetScreenRect(); pDC->SetOrigin(sPoint(sr.x, sr.y)); if(m_pFont!=NULL) pDC->SetFont(m_pFont); else pDC->SetFont(CCFontManager::Get(NULL)); pDC->SetOpacity((unsigned char)(nLastOpacity * (float)(m_iOpacity / 255.0f))); if(!IsEnable()) pDC->SetOpacity((unsigned char)(pDC->GetOpacity()*0.70)); bool bIntersect = true; sRect rectScreen(0, 0, CCGetWorkspaceWidth()-1, CCGetWorkspaceHeight()-1); sRect PrevClipRect; if(GetParent()!=NULL) { sRect parentClipRect = CCClientToScreen(GetParent(), GetParent()->GetClientRect()); bIntersect = rectScreen.Intersect(&PrevClipRect,parentClipRect); }else PrevClipRect = rectScreen; sRect CurrClipRect = GetScreenRect(); sRect IntersectClipRect; if(m_bClipByParent==true){ if(PrevClipRect.Intersect(&IntersectClipRect, CurrClipRect)==true){ sRect test = IntersectClipRect; if(IntersectClipRect.w>0 && IntersectClipRect.h>0) { pDC->SetClipRect(IntersectClipRect); OnDraw(pDC); } } } else{ pDC->SetClipRect(CurrClipRect); OnDraw(pDC); } for(int i=0; i<m_Children.GetCount(); i++){ CCWidget* pCurWnd = m_Children.Get(i); if(pCurWnd==GetLatestExclusive()) continue; if(pCurWnd != NULL ) pCurWnd->Draw(pDC); } if(GetLatestExclusive()!=NULL) GetLatestExclusive()->Draw(pDC); pDC->SetOpacity(nLastOpacity); }
void vncServer::SetMatchSizeFields(int left,int top,int right,int bottom) { RECT trect = GetScreenRect(); /* if ( right - left < 32 ) right = left + 32; if ( bottom - top < 32) bottom = top + 32 ;*/ if( right > trect.right ) right = trect.right; if( bottom > trect.bottom ) bottom = trect.bottom; if( left < trect.left) left = trect.left; if( top < trect.top) top = trect.top; m_screenarea_rect.left=left; m_screenarea_rect.top=top; m_screenarea_rect.bottom=bottom; m_screenarea_rect.right=right; }
void DockCont::EventProc(XWindow& w, XEvent *event) { if (IsOpen()) { switch(event->type) { case ConfigureNotify:{ XConfigureEvent& e = event->xconfigure; if (Point(e.x, e.y) != GetScreenRect().TopLeft()) { if (!dragging) MoveBegin(); Moving(); SetFocus(); dragging = true; } } break; case FocusIn: { XFocusChangeEvent &e = event->xfocus; if (e.mode == NotifyUngrab && dragging) { dragging = false; MoveEnd(); // SetFocus(); return; } break; } } } TopWindow::EventProc(w, event); }
void CCWidget::MakeLocalEvent(CCEvent* pLoalEvent, const CCEvent* pEvent){ memcpy(pLoalEvent, pEvent, sizeof(CCEvent)); sRect sr = GetScreenRect(); pLoalEvent->sPos.x -= sr.x; pLoalEvent->sPos.y -= sr.y; }
bool SharedDesktopArea::Apply() { if (IsChecked(IDC_WINDOW) && m_hwndShared == NULL) { MessageBox(NULL, "You have not yet selected a window to share.\n" "Please first select a window with the 'Window Target'\n" "icon, and try again.", "No Window Selected", MB_OK | MB_ICONEXCLAMATION); return false; } m_server->FullScreen(IsChecked(IDC_FULLSCREEN)); m_server->PrimaryDisplayOnlyShared(IsChecked(IDC_PRIMARY_DISPLAY_ONLY)); m_server->ScreenAreaShared(IsChecked(IDC_SCREEN)); m_server->WindowShared(IsChecked(IDC_WINDOW)); if (m_server->FullScreen()) { RECT temp = GetScreenRect(); m_server->SetMatchSizeFields(temp.left, temp.top, temp.right, temp.bottom); } else if (m_server->PrimaryDisplayOnlyShared()) { int w = GetSystemMetrics(SM_CXSCREEN); int h = GetSystemMetrics(SM_CYSCREEN); m_server->SetMatchSizeFields(0, 0, w, h); } else if (m_server->ScreenAreaShared()) { int left, right, top, bottom; m_pMatchWindow->GetPosition(left, top, right, bottom); m_server->SetMatchSizeFields(left, top, right, bottom); } else if (m_server->WindowShared()) { m_server->SetWindowShared(m_hwndShared); } return true; }
//====================================================================== // valid combinations for now are: // title: left, value: left == [TITLE VALUE ] // title: left, value: right == [TITLE VALUE] // title: right, value: right == [ VALUE TITLE] //====================================================================== void NvUIValueText::PositionOutput() { const float enSpace = GetFontSize() * 0.25f; // !!!!TBD TODO look up real en space size? NvUIRect tr; GetScreenRect(tr); // reset. m_valueText->SetDimensions(tr.width, tr.height); m_valueText->SetOrigin(tr.left, tr.top); const float tw = INHERITED::GetStringPixelWidth(); if (m_valueAlign == NvUITextAlign::RIGHT) { // if both alignments are right, then put number on the LEFT if (m_titleAlign == NvUITextAlign::RIGHT) { // reset WIDTH of valuetext to base width minus title width minus padding if (tw>0) // then we need to offset, else we're fine. m_valueText->SetOrigin(tr.left - tw - enSpace, tr.top); } else // put number far right of rect { m_valueText->SetOrigin(tr.left + tr.width, tr.top); } } else // else value must be left-aligned, base off title { if (tw>0) // then we need to offset, else we're fine. m_valueText->SetOrigin(tr.left + tw + enSpace, tr.top); } }
/**< context menu */ void ImagePanel::OnContextMenu(wxContextMenuEvent& event) { if (m_stMP.iState != 0) return; wxMenu* pMenu = new wxMenu(); wxASSERT_MSG(pMenu != nullptr, _T("Create Popup Menu failed.")); wxMenuItem* pMenuItem = nullptr; // group 1 if (m_img.IsOk()) { pMenuItem = new wxMenuItem(pMenu, ID_CMENU_SAVE, _("&Save Image"), _("Save the Image")); pMenu->Append(pMenuItem); } // popup if (pMenuItem != nullptr) { wxPoint pt = event.GetPosition(); if (pt == wxDefaultPosition) { // position invalide, get the mouse position pt = wxGetMousePosition(); wxRect rc = GetScreenRect(); if (!rc.Contains(pt)) { // mouse is't in the panel, get the panel center pt.x = rc.x + rc.width/2; pt.y = rc.y + rc.height/2; } } pt = ScreenToClient(pt); PopupMenu(pMenu, pt); } delete pMenu; }
static int OnModulesLoded(WPARAM, LPARAM) { HookEvent(ME_CLIST_CONTACTICONCHANGED, OnContactIconChanged); HookEvent(ME_SKIN_ICONSCHANGED, OnSkinIconsChanged); HookEvent(ME_CLUI_CONTACTDRAGGING, OnContactDrag); HookEvent(ME_CLUI_CONTACTDROPPED, OnContactDrop); HookEvent(ME_CLUI_CONTACTDRAGSTOP, OnContactDragStop); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged); HookEvent(ME_DB_CONTACT_DELETED, OnContactDeleted); HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize); HookEvent(ME_CLIST_STATUSMODECHANGE, OnStatusModeChange); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu); hwndMiranda = pcli->hwndContactList; mir_subclassWindow(hwndMiranda, newMirandaWndProc); // No thumbs yet bEnableTip = ServiceExists("mToolTip/ShowTip"); RegisterWindowClass(); GetScreenRect(); LoadDBSettings(); CreateBackgroundBrush(); CreateThumbsFont(); LoadContacts(); LoadMenus(); if (fcOpt.bToTop) { fcOpt.ToTopTime = (fcOpt.ToTopTime < 1) ? 1 : fcOpt.ToTopTime; fcOpt.ToTopTime = (fcOpt.ToTopTime > TOTOPTIME_MAX) ? TOTOPTIME_MAX : fcOpt.ToTopTime; ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc); } return 0; }
const Rect ColorPicker::GetDialogRect() const { Rect dialogRect; dialogRect.dx = ControlsFactory::COLOR_MAP_SIDE + ControlsFactory::COLOR_SELECTOR_WIDTH + ControlsFactory::COLOR_PREVIEW_SIDE + ControlsFactory::OFFSET * 4; dialogRect.dy = ControlsFactory::COLOR_MAP_SIDE + ControlsFactory::BUTTON_HEIGHT*2 + ControlsFactory::OFFSET * 3; dialogRect.x = (GetScreenRect().dx - dialogRect.dx) / 2; dialogRect.y = (GetScreenRect().dy - dialogRect.dy) / 2; return dialogRect; }
void GUIEditMultiString::Draw() { Rect rc; GetScreenRect(rc); if(GUISystem::Instance()->GetFocus() == this) { if(textChanged) { GUIControlContainer::Draw(); DrawText(rc, false); textChanged = false; } if(showCursor) { pApp->GetGraphicsSystem()->SetColor(0,0,0); pApp->GetGraphicsSystem()->DrawRect(rc.x + cursorX, rc.y + cursorY - yOffset, cursorWidth, pFont->GetHeight()); } } else { GUIControlContainer::Draw(); DrawText(rc, false); } }
void tabButton::updateMouse(wxMouseEvent& event) { if (m_bSelected) return; wxRect panelRec = GetScreenRect(); panelRec.x += 2; panelRec.y += 2; panelRec.width -= 4; panelRec.height -= 4; wxPoint mousePoint = wxGetMousePosition(); bool t1 = panelRec.x <= mousePoint.x; bool t2 = panelRec.y <= mousePoint.y; bool t3 = (panelRec.x + panelRec.width ) >= mousePoint.x; bool t4 = (panelRec.y + panelRec.height) >= mousePoint.y; if (t1 && t2 && t3 && t4) { this->SetBackgroundColour( MOUSEOVER ); } else { this->SetBackgroundColour( NORMAL ); } this->Refresh(); }
void Ctrl::ScrollView(const Rect& _r, int dx, int dy) { GuiLock __; LLOG("ScrollView " << _r << " " << dx << " " << dy); if(IsFullRefresh() || !IsVisible()) return; Size vsz = GetSize(); dx = sgn(dx) * min(abs(dx), vsz.cx); dy = sgn(dy) * min(abs(dy), vsz.cy); Rect r = _r & vsz; LLOG("ScrollView2 " << r << " " << dx << " " << dy); Ctrl *w; for(w = this; w->parent; w = w->parent) if(w->InFrame()) { Refresh(); return; } if(!w || !w->top) return; Rect view = InFrame() ? GetView() : GetClippedView(); Rect sr = (r + view.TopLeft()) & view; sr += GetScreenRect().TopLeft() - w->GetScreenRect().TopLeft(); if(w->AddScroll(sr, dx, dy)) Refresh(); else { LTIMING("ScrollCtrls1"); Top *top = GetTopCtrl()->top; for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) if(q->InView()) ScrollCtrl(top, q, r, q->GetRect(), dx, dy); if(parent) for(Ctrl *q = parent->GetFirstChild(); q; q = q->GetNext()) if(q->InView() && q != this) ScrollCtrl(top, q, r, q->GetScreenRect() - GetScreenView().TopLeft(), dx, dy); } }
bool ETHRenderEntity::IsSpriteVisible(const ETHSceneProperties& sceneProps, const ETHBackBufferTargetManagerPtr& backBuffer) const { if (!m_pSprite || IsHidden()) return false; const float angle = GetAngle(); if (GetType() == ETHEntityProperties::ET_VERTICAL || angle == 0.0f) { const Vector2& bufferSize = backBuffer->GetBufferSize(); const ETHEntityProperties::VIEW_RECT& rect = GetScreenRect(sceneProps); const Vector2& min = rect.min; const Vector2& max = rect.max; if (min.x > bufferSize.x || min.y > bufferSize.y) { return false; } else if (max.x < 0.0f || max.y < 0.0f) { return false; } else { return true; } } else { // TODO/TO-DO perform this in the OrientedBoundingBox class const Vector2& size = GetCurrentSize(); const float radianAngle = -DegreeToRadian(angle); const OrientedBoundingBox entityObb(ComputeInScreenSpriteCenter(sceneProps), size, radianAngle); return entityObb.Overlaps(*(backBuffer->GetOBB().get())); } }
bool CGUIObject::StealsMouse(int x, int y) { if (isDisabled()) return false; else return InRect(x, y, GetScreenRect()); }
void StripMenuButton::updateMouse() { wxRect panelRec = GetScreenRect(); panelRec.x += 2; panelRec.y += 2; panelRec.width -= 4; panelRec.height -= 4; wxPoint mousePoint = wxGetMousePosition(); bool t1 = panelRec.x <= mousePoint.x; bool t2 = panelRec.y <= mousePoint.y; bool t3 = (panelRec.x + panelRec.width ) >= mousePoint.x; bool t4 = (panelRec.y + panelRec.height) >= mousePoint.y; if (t1 && t2 && t3 && t4) { if (!m_bHovering) { SetForegroundColour( m_colHover ); m_bHovering = true; invalidatePaint(); this->Refresh(); } } else if (m_bHovering) { SetForegroundColour( m_colNormal ); m_bHovering = false; invalidatePaint(); this->Refresh(); } }
void PopUpDockWindow::ShowInnerPopUps(DockCont &dc, DockCont *target) { ASSERT(target); Rect wrect = GetScreenRect(); Size psz(style->innersize, style->innersize); Rect prect = Rect(psz); Point cp; psz /= 2; cp = target->GetScreenRect().CenterPoint(); int d = psz.cy * 5; cp.x = minmax(cp.x, wrect.left + d, wrect.right - d); cp.y = minmax(cp.y, wrect.top + d, wrect.bottom - d); int align = GetDockAlign(*target); if (IsTB(align)) { // Left/right docking allowed ShowPopUp(inner[DOCK_LEFT], prect.Offseted(cp.x - psz.cx*3, cp.y - psz.cy)); ShowPopUp(inner[DOCK_RIGHT], prect.Offseted(cp.x + psz.cx, cp.y - psz.cy)); } else { inner[DOCK_LEFT].Close(); inner[DOCK_RIGHT].Close(); } if (!IsTB(align)) { // Top/bottom docking allowed ShowPopUp(inner[DOCK_TOP], prect.Offseted(cp.x - psz.cx, cp.y - psz.cy*3)); ShowPopUp(inner[DOCK_BOTTOM], prect.Offseted(cp.x - psz.cx, cp.y + psz.cy)); } else { inner[DOCK_TOP].Close(); inner[DOCK_BOTTOM].Close(); } if (IsTabbing()) ShowPopUp(inner[4], prect.Offseted(cp.x-psz.cx, cp.y-psz.cy)); }
void TopWindow::Open(HWND hwnd) { GuiLock __; if(dokeys && (!GUI_AKD_Conservative() || GetAccessKeysDeep() <= 1)) DistributeAccessKeys(); USRLOG(" OPEN " << Desc(this)); LLOG("TopWindow::Open, owner HWND = " << FormatIntHex((int)hwnd, 8) << ", Active = " << FormatIntHex((int)::GetActiveWindow(), 8)); IgnoreMouseUp(); SyncCaption(); #ifdef PLATFORM_WINCE if(!GetRect().IsEmpty()) #endif if(fullscreen) { SetRect(GetScreenRect()); // 12-05-23 Tom changed from GetScreenSize() to GetScreenRect() in order to get full screen on correct display Create(hwnd, WS_POPUP, 0, false, SW_SHOWMAXIMIZED, false); } else { CenterRect(hwnd, hwnd && hwnd == GetTrayHWND__() ? center ? 2 : 0 : center); Create(hwnd, style, exstyle, false, state == OVERLAPPED ? SW_SHOWNORMAL : state == MINIMIZED ? SW_MINIMIZE : SW_MAXIMIZE, false); } PlaceFocus(); SyncCaption(); FixIcons(); }
void Shader::LoadConfig() { wxConfigBase *config = wxConfigBase::Get(); //config->DeleteAll(); // Load the window position on the screen. wxRect pos = GetScreenRect(); long value; bool ok = config->Read(wxT("main_x"), &value); pos.SetX(value); ok = ok && config->Read(wxT("main_y"), &value); pos.SetY(value); ok = ok && config->Read(wxT("main_width"), &value); pos.SetWidth(value); ok = ok && config->Read(wxT("main_height"), &value); pos.SetHeight(value); if (ok) { SetSize(pos); } // Check if the window was maximized. if (config->Read(wxT("main_maximized"), &value) && value != 0) { Maximize(); } // Load the list of recent projects. m_RecentMenu->Load(*config, wxT("main_recent")); }
void DisplayVariableDlg::DoUpdateSize(bool performClean) { if ( m_dragging ) { wxRect curect = GetScreenRect(); curect.SetBottomRight( ::wxGetMousePosition() ); if ( curect.GetHeight() <= 100 || curect.GetWidth() <= 100 ) { if ( performClean ) { m_dragging = false; if ( m_panelStatusBar->HasCapture() ) { m_panelStatusBar->ReleaseMouse(); } wxSetCursor( wxNullCursor ); } return; } #ifdef __WXMSW__ wxWindowUpdateLocker locker(clMainFrame::Get()); #endif SetSize( curect ); if ( performClean ) { m_dragging = false; if ( m_panelStatusBar->HasCapture() ) { m_panelStatusBar->ReleaseMouse(); } wxSetCursor( wxNullCursor ); } } }
BOOL Hotlist::ShowContextMenu(const OpPoint &point, BOOL center, BOOL use_keyboard_context) { const char* menu_name = m_selector->GetFocused() != -1 ? "Hotlist Item Popup Menu" : "Hotlist Popup Menu"; const OpPoint p = point + GetScreenRect().TopLeft(); g_application->GetMenuHandler()->ShowPopupMenu(menu_name, PopupPlacement::AnchorAt(p, center), 0, use_keyboard_context); return TRUE; }
void DockWindow::Float(DockableCtrl &dc, Point p) { if (dc.GetParent() && p.IsNullInstance()) p = GetScreenRect().TopLeft(); else Register(dc); FloatContainer(*GetReleasedContainer(dc), p); }
Math::Vector2 ConvertWinToEngineScreenPos(Math::Vector2 winScreenPos) { ScreenRect screenRect = GetScreenRect(); Math::Vector2 engineScreenPos = Math::Vector2::Zero; engineScreenPos._x = winScreenPos._x; engineScreenPos._y = screenRect._height - winScreenPos._y; return engineScreenPos; }
Math::Vector2 ConvertEngineToWinScreenPos(Math::Vector2 engineScreenPos) { ScreenRect screenRect = GetScreenRect(); Math::Vector2 winScreenPos = Math::Vector2::Zero; winScreenPos._x = engineScreenPos._x; winScreenPos._y = screenRect._height - engineScreenPos._y; return winScreenPos; }
Vector<Rect> Ctrl::GetPaintRects() { Vector<Rect> r; r.Add(GetScreenRect()); for(int i = max(FindTopCtrl() + 1, 0); i < topctrl.GetCount(); i++) Subtract(r, topctrl[i]->GetScreenRect()); return r; }
void StaticBarArea::Paint(Draw& w) { if(IsNull(ToolBar().StyleDefault().arealook)) ChPaint(w, GetSize(), ToolBar().StyleDefault().look); else PaintBarArea(w, this, ToolBar().StyleDefault().arealook, upperframe ? Null : GetScreenRect().bottom); }
const Rect TextureTrianglesDialog::GetDialogRect() const { Rect rect = GetScreenRect(); if(rect.dx < rect.dy) { rect.dy = rect.dx + ControlsFactory::BUTTON_HEIGHT * 2; } else { rect.dx = rect.dy - ControlsFactory::BUTTON_HEIGHT * 2; } rect.y = (GetScreenRect().dy - rect.dy) / 2; rect.x = (GetScreenRect().dx - rect.dx) / 2; return rect; }
BOOL OpWindowList::OnContextMenu(const OpPoint& point, const OpRect* avoid_rect, BOOL keyboard_invoked) { DesktopWindowCollectionItem* item = static_cast<DesktopWindowCollectionItem*>(GetSelectedItem()); if (!item) return FALSE; OpPoint p = point + GetScreenRect().TopLeft(); g_application->GetMenuHandler()->ShowPopupMenu(item->GetContextMenu(), PopupPlacement::AnchorAt(p), 0, keyboard_invoked); return TRUE; }
void SubMenuItem::Pull() { Rect r = GetScreenRect(); Point p = r.TopRight(); p.x -= 3; p.y -= 2; SubMenuBase::Pull(this, p, Size(-r.Width(), 0)); if(parentmenu) parentmenu->SyncState(); }
void RenderDataUI::RenderText(TextRender* pTextRender) { Rectangle rect = pTextRender->_pRectTransform->GetScreenSpaceRect(); Text* pText = pTextRender->_pText; ScreenRect screenInfo = GetScreenRect(); float screenHeight = screenInfo._height; rect._bottom = screenHeight - rect._bottom; rect._top = screenHeight - rect._top; FontManager::GetInstance()->DrawString(rect, pText->_value.c_str()); }