void XGProgress::InitControl (void) { XRect r; fControl = NULL; if (!_GAppearance) return; if (IsVisible()) { r = GetContentRect(); ViewToGlobal(&r); } else { r.left = -20, r.top = -20, r.right = -10, r.bottom = -10; } Rect mr = r; fControl = ::NewControl(GetRootWindow(), &mr, "\p", false, fValue, fMin, fMax, kControlProgressBarProc, GetViewID()); }
XxWindow::XxWindow ( EzString Name , XxWindow *Parent , int XPos, int YPos, int Width, int Height , EzString Title ) : XxDrawable (Name), Member (this), WindowsMember (this) { Window XxParentWindow; Atom atom; XxWindow::Parent = Parent; Hints.x = XPos; Hints.y = YPos; Hints.width = Width; Hints.height = Height; XxAttrs.event_mask = ExposureMask | EnterWindowMask | LeaveWindowMask | ButtonPressMask | ButtonReleaseMask; XxAttrMask = CWEventMask; WindowsMember.Attach (WindowsOwner); if (Parent != NULL) Member.Attach (Parent->Owner); XxParentWindow = (Parent == NULL ? GetRootWindow () : Parent->Xid); Xid = XCreateWindow ( GetDisplay (), XxParentWindow , Hints.x, Hints.y, Hints.width, Hints.height , 0, GetDepth () , InputOutput, CopyFromParent , XxAttrMask, &XxAttrs); XxAttrMask = 0; Hints.max_width = Width; Hints.max_height = Height; Hints.min_width = Width; Hints.min_height = Height; Hints.flags = PMinSize | PMaxSize | PPosition | PSize; XSetNormalHints (GetDisplay (), Xid, &Hints); // XStoreName (GetDisplay (), Xid, "Test"); XMapRaised (GetDisplay (), Xid); XSelectInput (GetDisplay (), Xid, XxAttrs.event_mask); if (Parent == NULL) { atom = GetWmDeleteWindow (); XStoreName (GetDisplay (), Xid, Title); XSetWMProtocols (GetDisplay (), Xid, &atom, 1); }; };
// // 使窗口常居顶层/退居二线 // bool TopMostWndFromPoint( POINT *pPoint, bool bTopMost ) { HWND hWnd = WindowFromPoint( *pPoint ); if( hWnd ) { HWND hWndAncestor = GetRootWindow( hWnd ); if( hWndAncestor ) return( TopMostWndFromPoint( hWndAncestor, bTopMost ) ); } return( false ); }
// // 判断窗口是否常居顶层 // bool IsWndTopMost( POINT *pPoint ) { HWND hWnd = WindowFromPoint( *pPoint ); if( hWnd ) { HWND hWndAncestor = GetRootWindow( hWnd ); if( hWndAncestor ) return( IsWndTopMost( hWndAncestor ) ); } return( false ); }
HRESULT PlatformWindowSite::DragOver( /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ __RPC__inout DWORD *pdwEffect) { Point screenMousePos(pt.x, pt.y); ScreenToClient(m_platformWindow->get_Handle(), (POINT*)&pt); Point clientMousePos(pt.x, pt.y); if (m_DragOverElement) { DragEventArgs* args = new DragEventArgs(m_pDataObject); args->set_RoutedEvent(UIElement::get_DragLeaveEvent()); // args->m_screenpos = Point(float(screenMousePos.x), float(screenMousePos.y)); // args->m_clientpos = clientMousePos; m_DragOverElement->RaiseEvent(args); } UIElement* child = GetRootElement(); if (child) { m_DragOverElement = child->HitTest_(clientMousePos); } if (m_DragOverElement == nullptr) { m_DragOverElement = GetRootWindow(); } if (m_DragOverElement) { DragEventArgs* args = new DragEventArgs(m_pDataObject); args->set_RoutedEvent(UIElement::get_DragEnterEvent()); // args->m_screenpos = Point(float(screenMousePos.x), float(screenMousePos.y)); // args->m_clientpos = clientMousePos; m_DragOverElement->RaiseEvent(args); } // Call IDragImages::DragEnter last m_dropTargetHelper->DragOver((POINT*)&pt, *pdwEffect); return S_OK; }
CRenderWindow * CSDLSupport::CreateRenderWindowTarget(nstring & name, int priority) { CLog::GetInstance().PrintMessage("(!)Creating sdl window... "); CSDLWorkspace * space; space = new CSDLWorkspace(name, priority, this); if(!GetRootWindow()) mRootWindow = dynamic_cast<CRenderWindow *>(space); else throw NOVA_EXP("CSDLSupport::CreateRenderWindowTarget - \ Root windows already created!", BAD_OPERATION); CLog::GetInstance().PrintMessage("(!)Success!\n"); return space; }
void XGProgress::InitControl (void) { XRect r; r = GetContentRect(); ViewToGlobal(&r); fControl = ::CreateWindow(PROGRESS_CLASS, "", WS_CHILD, r.left, r.top, r.right - r.left, r.bottom - r.top, GetRootWindow(), NULL, _GInstance, NULL); }
void XGPopControl::InitControl (void) { XRect r; fControl = NULL; if (IsVisible()) { r = GetContentRect(); ViewToGlobal(&r); } else { r.left = -20, r.top = -20, r.right = -10, r.bottom = -10; } /* * #warning I inserted the kControlPopupFixedWidthVariant into here; how to deal??? * maybe use an additional bool in the ArgStream that indicates whether or not to * size the control to fit. */ fControl = ::NewControl(GetRootWindow(), &r, "\pP", false, popupTitleLeftJust, -12345, 0, kControlPopupButtonProc | kControlPopupUseWFontVariant | kControlPopupFixedWidthVariant, GetViewID()); if (!fControl) return; MenuHandle menu = NewMenu(0x4000 + GetViewID(), "\pP"); SetMenuHandle(menu); }
void XGPopControl::InitControl (void) { XRect r; r = GetContentRect(); ViewToGlobal(&r); fControl = ::CreateWindow("COMBOBOX", "", WS_CHILD | CBS_DROPDOWNLIST, r.left, r.top, r.right - r.left, r.bottom - r.top + 500, GetRootWindow(), NULL, _GInstance, NULL); ::SetProp(fControl,_GControlClass,(HANDLE)(XGView *)this); if (fFont) { ::SendMessage(fControl,WM_SETFONT,(WPARAM)(fFont->GetFont()),0L); } }
HRESULT PlatformWindowSite::DragEnter( ::IDataObject* pDataObject, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ __RPC__inout DWORD *pdwEffect) { m_pDataObject = pDataObject; /* if (m_pDataObject != pDataObject) { m_pDataObject = pDataObject; m_dataObject = new DataObject; m_dataObject->m_pDataObject = m_pDataObject; }*/ if (m_dropTargetHelper == nullptr) { HRESULT hr; hr = m_dropTargetHelper.CoCreateInstance(CLSID_DragDropHelper); if (FAILED(hr)) return hr; } // ComPtr<IEnumFORMATETC> enumfmt; // pDataObject->EnumFormatEtc(DATADIR_GET, &enumfmt); /* FORMATETC fetc; DWORD fetched; while ((enumfmt->Next(1, &fetc, &fetched) == S_OK) && fetched) { DebugTrace("Format " << fetc.cfFormat << "\n"); //CF_TEXT } */ UIElement* hitElement = nullptr; gm::PointF screenMousePos(float(pt.x), float(pt.y)); ScreenToClient(m_platformWindow->get_Handle(), (POINT*)&pt); Point clientMousePos(pt.x, pt.y); UIElement* child = GetRootElement(); if (child) { hitElement = child->HitTest_(clientMousePos); } if (hitElement == nullptr) { hitElement = GetRootWindow(); } if (hitElement) { m_DragOverElement = hitElement; DragEventArgs* args = new DragEventArgs(pDataObject); args->set_RoutedEvent(UIElement::get_DragEnterEvent()); // args->m_screenpos = Point(float(screenMousePos.x), float(screenMousePos.y)); // args->m_clientpos = clientMousePos; hitElement->RaiseEvent(args); } // Call IDragImages::DragEnter last m_dropTargetHelper->DragEnter(m_platformWindow->get_Handle(), pDataObject, (POINT*)&pt, *pdwEffect); return S_OK; }