soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SMenuODWnd Class Reference

所有者绘制菜单窗口类 More...

#include <SMenu.h>

Inheritance diagram for SMenuODWnd:
SNativeWnd SOwnerDraw< SMenuODWnd > TObjRefImpl< INativeWnd > INativeWnd IObjRef

Public Member Functions

 SMenuODWnd (HWND hMenuOwner, SMenuAttr *pMenuAttr)
 构造函数
 
 ~SMenuODWnd ()
 析构函数
 
- Public Member Functions inherited from SNativeWnd
int GetID () SCONST
 Retrieves the window ID.
 
void SetID (int nID)
 Sets the window ID.
 
HWND CreateNative (LPCTSTR lpWindowName, DWORD dwStyle, DWORD dwExStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, int nID=0, LPVOID lpParam=0) OVERRIDE
 Creates a native window.
 
HWND GetHwnd () OVERRIDE
 Retrieves the handle to the window.
 
BOOL SubclassWindow (HWND hWnd) OVERRIDE
 Subclasses an existing window.
 
HWND UnsubclassWindow (BOOL bForce=FALSE) OVERRIDE
 Unsubclasses a window.
 
const MSG * GetCurrentMessage () SCONST OVERRIDE
 Retrieves the current message being processed.
 
int GetDlgCtrlID () SCONST OVERRIDE
 Retrieves the dialog control ID.
 
DWORD GetStyle () SCONST OVERRIDE
 Retrieves the window style.
 
DWORD GetExStyle () SCONST OVERRIDE
 Retrieves the extended window style.
 
LONG_PTR GetWindowLongPtr (int nIndex) SCONST OVERRIDE
 Retrieves the long pointer value at the specified index.
 
LONG_PTR SetWindowLongPtr (int nIndex, LONG_PTR dwNewLong) OVERRIDE
 Sets the long pointer value at the specified index.
 
HWND GetParent () OVERRIDE
 Retrieves the handle to the parent window.
 
HWND SetParent (HWND hWndNewParent) OVERRIDE
 Sets the handle to the parent window.
 
BOOL IsWindowEnabled () SCONST OVERRIDE
 Checks if the window is enabled.
 
BOOL ModifyStyle (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0) OVERRIDE
 Modifies the window style.
 
BOOL ModifyStyleEx (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0) OVERRIDE
 Modifies the extended window style.
 
BOOL SetWindowPos (HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags) OVERRIDE
 Sets the window position.
 
BOOL CenterWindow (HWND hWndCenter=0) OVERRIDE
 Centers the window relative to another window.
 
BOOL DestroyWindow () OVERRIDE
 Destroys the window.
 
BOOL IsWindow () SCONST OVERRIDE
 Checks if the handle is a valid window handle.
 
BOOL Invalidate (BOOL bErase=TRUE) OVERRIDE
 Invalidates the entire window.
 
BOOL InvalidateRect (LPCRECT lpRect, BOOL bErase=TRUE) OVERRIDE
 Invalidates a specified rectangle of the window.
 
BOOL GetWindowRect (LPRECT lpRect) SCONST OVERRIDE
 Retrieves the window rectangle.
 
BOOL GetClientRect (LPRECT lpRect) SCONST OVERRIDE
 Retrieves the client rectangle.
 
BOOL ClientToScreen (LPPOINT lpPoint) SCONST OVERRIDE
 Converts client coordinates to screen coordinates.
 
BOOL ClientToScreen2 (LPRECT lpRect) SCONST OVERRIDE
 Converts client rectangle coordinates to screen coordinates.
 
BOOL ScreenToClient (LPPOINT lpPoint) SCONST OVERRIDE
 Converts screen coordinates to client coordinates.
 
BOOL ScreenToClient2 (LPRECT lpRect) SCONST OVERRIDE
 Converts screen rectangle coordinates to client coordinates.
 
int MapWindowPoints (HWND hWndTo, LPPOINT lpPoint, UINT nCount) SCONST OVERRIDE
 Maps points from one window to another.
 
int MapWindowRect (HWND hWndTo, LPRECT lpRect) SCONST OVERRIDE
 Maps a rectangle from one window to another.
 
UINT_PTR SetTimer (UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL) OVERRIDE
 Sets a timer for the window.
 
BOOL KillTimer (UINT_PTR nIDEvent) OVERRIDE
 Kills a timer for the window.
 
HDC GetDC () OVERRIDE
 Retrieves a device context for the window.
 
HDC GetWindowDC () OVERRIDE
 Retrieves a device context for the entire window.
 
int ReleaseDC (HDC hDC) OVERRIDE
 Releases a device context.
 
BOOL CreateCaret (HBITMAP hBitmap, int nWidth, int nHeight) OVERRIDE
 Creates a caret for the window.
 
BOOL HideCaret () OVERRIDE
 Hides the caret.
 
BOOL ShowCaret () OVERRIDE
 Shows the caret.
 
HWND GetCapture () OVERRIDE
 Retrieves the handle to the window that has captured the mouse.
 
HWND SetCapture () OVERRIDE
 Sets the window to capture the mouse.
 
BOOL ReleaseCapture () OVERRIDE
 Releases the mouse capture.
 
HWND SetFocus () OVERRIDE
 Sets the input focus to the window.
 
LRESULT SendMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0) OVERRIDE
 Sends a message to the window.
 
BOOL PostMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0) OVERRIDE
 Posts a message to the window.
 
BOOL SendNotifyMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0) OVERRIDE
 Sends a notify message to the window.
 
BOOL SetWindowText (LPCTSTR lpszString) OVERRIDE
 Sets the window text.
 
int GetWindowText (LPTSTR lpszStringBuf, int nMaxCount) SCONST OVERRIDE
 Retrieves the window text.
 
BOOL IsIconic () SCONST OVERRIDE
 Checks if the window is iconic (minimized).
 
BOOL IsZoomed () SCONST OVERRIDE
 Checks if the window is zoomed (maximized).
 
BOOL IsWindowVisible () SCONST OVERRIDE
 Checks if the window is visible.
 
BOOL MoveWindow (int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE) OVERRIDE
 Moves the window to the specified position and resizes it.
 
BOOL MoveWindow2 (LPCRECT lpRect, BOOL bRepaint=TRUE) OVERRIDE
 Moves the window to the specified position and resizes it using a rectangle.
 
BOOL ShowWindow (int nCmdShow) OVERRIDE
 Sets the show state of the window.
 
int SetWindowRgn (HRGN hRgn, BOOL bRedraw=TRUE) OVERRIDE
 Sets the window region.
 
BOOL SetLayeredWindowAttributes (COLORREF crKey, BYTE bAlpha, DWORD dwFlags) OVERRIDE
 Sets the layered window attributes.
 
BOOL UpdateLayeredWindow (HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags) OVERRIDE
 Updates the layered window.
 
void SetMsgHandler (FunMsgHandler fun, void *ctx) OVERRIDE
 Sets the message handler for the window.
 
MsgHandlerInfoGetMsgHandler () OVERRIDE
 Retrieves the message handler for the window.
 
LRESULT DefWindowProc ()
 Calls the default window procedure.
 
LRESULT ForwardNotifications (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 Forwards notifications to the appropriate handler.
 
LRESULT ReflectNotifications (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 Reflects notifications to the appropriate handler.
 
virtual BOOL ProcessWindowMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID=0)
 Processes a window message.
 
- Public Member Functions inherited from TObjRefImpl< INativeWnd >
 TObjRefImpl ()
 Constructor that initializes the reference count to 1.
 
virtual ~TObjRefImpl ()
 Virtual destructor.
 
long AddRef () override
 Increments the reference count.
 
long Release () override
 Decrements the reference count and deletes the object if the count reaches zero.
 
void OnFinalRelease () override
 Deletes the object.
 
- Public Member Functions inherited from IObjRef
long AddRef () PURE
 Increases the reference count.
 
long Release () PURE
 Decreases the reference count.
 
void OnFinalRelease () PURE
 Called when the reference count reaches zero and the object is about to be released.
 
- Public Member Functions inherited from SOwnerDraw< SMenuODWnd >
LRESULT OnDrawItem (UINT, WPARAM, LPARAM lParam, BOOL &bHandled)
 处理WM_DRAWITEM消息
 
LRESULT OnMeasureItem (UINT, WPARAM, LPARAM lParam, BOOL &bHandled)
 处理WM_MEASUREITEM消息
 
LRESULT OnCompareItem (UINT, WPARAM, LPARAM lParam, BOOL &bHandled)
 处理WM_COMPAREITEM消息
 
LRESULT OnDeleteItem (UINT, WPARAM, LPARAM lParam, BOOL &bHandled)
 处理WM_DELETEITEM消息
 
LRESULT OnMenuChar (UINT, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 处理WM_MENUCHAR消息
 
void DrawItem (LPDRAWITEMSTRUCT)
 绘制菜单项
 
void MeasureItem (LPMEASUREITEMSTRUCT lpMeasureItemStruct)
 测量菜单项
 
int CompareItem (LPCOMPAREITEMSTRUCT)
 比较菜单项
 
void DeleteItem (LPDELETEITEMSTRUCT)
 删除菜单项
 

Protected Member Functions

void OnInitMenu (HMENU menu)
 初始化菜单
 
void OnInitMenuPopup (HMENU menuPopup, UINT nIndex, BOOL bSysMenu)
 初始化弹出菜单
 
void DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
 绘制菜单项
 
void MeasureItem (LPMEASUREITEMSTRUCT lpMeasureItemStruct)
 测量菜单项
 
void OnMenuSelect (UINT nItemID, UINT nFlags, HMENU menu)
 处理菜单选择消息
 
LRESULT OnMenuChar (UINT nChar, UINT nFlags, HMENU hMenu)
 处理菜单字符消息
 
- Protected Member Functions inherited from SNativeWnd
LRESULT DefWindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam)
 Calls the default window procedure with specific parameters.
 
virtual void OnFinalMessage (HWND hWnd)
 Handles the final message for the window.
 

Protected Attributes

HWND m_hMenuOwner
 
SAutoRefPtr< SMenuAttrm_attr
 
- Protected Attributes inherited from SNativeWnd
const MSG * m_pCurrentMsg
 Pointer to the current message.
 
BOOL m_bDestoryed
 Flag indicating if the window is destroyed.
 
MsgHandlerInfo m_msgHandlerInfo
 Message handler information.
 
tagThunk * m_pThunk
 Thunk structure.
 
WNDPROC m_pfnSuperWindowProc
 Pointer to the superclass window procedure.
 
- Protected Attributes inherited from TObjRefImpl< INativeWnd >
LONG m_cRef
 Reference count.
 

Friends

class SOwnerDraw< SMenuODWnd >
 

Additional Inherited Members

- Static Public Member Functions inherited from SNativeWnd
static ATOM RegisterSimpleWnd (HINSTANCE hInst, LPCTSTR pszSimpleWndName, BOOL bImeWnd)
 Registers a simple window class.
 
static void InitWndClass (HINSTANCE hInst, LPCTSTR pszSimpleWndName, BOOL bImeWnd)
 Initializes the window class.
 
static BOOL DefaultReflectionHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult)
 Default reflection handler for notifications.
 
- Public Attributes inherited from SNativeWnd
HWND m_hWnd
 Handle to the window.
 
- Static Protected Member Functions inherited from SNativeWnd
static LRESULT CALLBACK WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 Window procedure callback function.
 
static LRESULT CALLBACK StartWindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 Start window procedure callback function (executed once).
 

Detailed Description

所有者绘制菜单窗口类

Definition at line 321 of file SMenu.h.

Constructor & Destructor Documentation

◆ SMenuODWnd()

SMenuODWnd::SMenuODWnd ( HWND hMenuOwner,
SMenuAttr * pMenuAttr )

构造函数

Parameters
hMenuOwner菜单所有者窗口句柄
pMenuAttr菜单属性对象指针

Definition at line 113 of file SMenu.cpp.

◆ ~SMenuODWnd()

SMenuODWnd::~SMenuODWnd ( )

析构函数

Definition at line 119 of file SMenu.cpp.

Member Function Documentation

◆ DrawItem()

void SMenuODWnd::DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct)
protected

绘制菜单项

Parameters
lpDrawItemStruct绘制项结构

Definition at line 133 of file SMenu.cpp.

◆ MeasureItem()

void SMenuODWnd::MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct)
protected

测量菜单项

Parameters
lpMeasureItemStruct测量项结构

Definition at line 228 of file SMenu.cpp.

◆ OnInitMenu()

void SMenuODWnd::OnInitMenu ( HMENU menu)
protected

初始化菜单

Parameters
menu菜单句柄

Definition at line 123 of file SMenu.cpp.

◆ OnInitMenuPopup()

void SMenuODWnd::OnInitMenuPopup ( HMENU menuPopup,
UINT nIndex,
BOOL bSysMenu )
protected

初始化弹出菜单

Parameters
menuPopup弹出菜单句柄
nIndex索引
bSysMenu是否为系统菜单

Definition at line 128 of file SMenu.cpp.

◆ OnMenuChar()

LRESULT SMenuODWnd::OnMenuChar ( UINT nChar,
UINT nFlags,
HMENU hMenu )
protected

处理菜单字符消息

Parameters
nChar字符
nFlags标志
hMenu菜单句柄
Returns
处理结果

Definition at line 265 of file SMenu.cpp.

◆ OnMenuSelect()

void SMenuODWnd::OnMenuSelect ( UINT nItemID,
UINT nFlags,
HMENU menu )
protected

处理菜单选择消息

Parameters
nItemID项ID
nFlags标志
menu菜单句柄

Definition at line 260 of file SMenu.cpp.

Friends And Related Symbol Documentation

◆ SOwnerDraw< SMenuODWnd >

friend class SOwnerDraw< SMenuODWnd >
friend

Definition at line 311 of file SMenu.h.

Member Data Documentation

◆ m_attr

SAutoRefPtr<SMenuAttr> SMenuODWnd::m_attr
protected

Definition at line 392 of file SMenu.h.

◆ m_hMenuOwner

HWND SMenuODWnd::m_hMenuOwner
protected

Definition at line 391 of file SMenu.h.


The documentation for this class was generated from the following files: