ReactOS 0.4.15-dev-7906-g1b85a5f
PictureButton Struct Reference

#include <window.h>

Inheritance diagram for PictureButton:
Collaboration diagram for PictureButton:

Public Types

typedef OwnerdrawnButton super
 
- Public Types inherited from OwnerdrawnButton
typedef SubclassedWindow super
 
- Public Types inherited from SubclassedWindow
typedef Window super
 
- Public Types inherited from Window
typedef map< HWND, Window * > WindowMap
 
typedef Window *(* CREATORFUNC) (HWND)
 
typedef Window *(* CREATORFUNC_INFO) (HWND, const void *)
 

Public Member Functions

 PictureButton (HWND hwnd, HICON hIcon, HBRUSH hbrush=GetSysColorBrush(COLOR_BTNFACE), bool flat=false)
 
 PictureButton (HWND hparent, int id, HICON hIcon, HBRUSH hbrush=GetSysColorBrush(COLOR_BTNFACE), bool flat=false)
 
 PictureButton (HWND hwnd, HBITMAP hBmp, HBRUSH hbrush=GetSysColorBrush(COLOR_BTNFACE), bool flat=false)
 
 PictureButton (HWND hparent, int id, HBITMAP hBmp, HBRUSH hbrush=GetSysColorBrush(COLOR_BTNFACE), bool flat=false)
 
- Public Member Functions inherited from OwnerdrawnButton
 OwnerdrawnButton (HWND hwnd)
 
- Public Member Functions inherited from SubclassedWindow
 SubclassedWindow (HWND)
 
- Public Member Functions inherited from Window
 Window (HWND hwnd)
 
virtual ~Window ()
 
LRESULT SendParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 
LRESULT PostParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 
 Window (INT cx, INT cy, BOOL fAutoHide=FALSE)
 
virtual ~Window ()
 
virtual LRESULT CALLBACK WindowProcDx (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void DoAction ()
 

Protected Member Functions

virtual void DrawItem (LPDRAWITEMSTRUCT dis)
 
- Protected Member Functions inherited from OwnerdrawnButton
LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
virtual void DrawItem (LPDRAWITEMSTRUCT dis)=0
 
- Protected Member Functions inherited from SubclassedWindow
virtual LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
virtual int Command (int id, int code)
 
virtual int Notify (int id, NMHDR *pnmh)
 
- Protected Member Functions inherited from Window
virtual LRESULT Init (LPCREATESTRUCT pcs)
 
virtual LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
virtual int Command (int id, int code)
 
virtual int Notify (int id, NMHDR *pnmh)
 
void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
void OnPaint (HWND hwnd)
 
void OnRButtonDown (HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
 
void OnKey (HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags)
 
void OnAppBarCallback (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL AppBar_Register (HWND hwnd)
 
BOOL AppBar_UnRegister (HWND hwnd)
 
BOOL AppBar_SetAutoHide (HWND hwnd, BOOL fHide)
 
BOOL AppBar_AutoHide (HWND hwnd)
 
BOOL AppBar_NoAutoHide (HWND hwnd)
 
BOOL AppBar_SetSide (HWND hwnd, UINT uSide)
 
void AppBar_SetAlwaysOnTop (HWND hwnd, BOOL fOnTop)
 
void AppBar_Hide (HWND hwnd)
 
void AppBar_UnHide (HWND hwnd)
 
void AppBar_SetAutoHideTimer (HWND hwnd)
 
void AppBar_SetAutoUnhideTimer (HWND hwnd)
 
void AppBar_Size (HWND hwnd)
 
void AppBar_QueryPos (HWND hwnd, LPRECT lprc)
 
void AppBar_QuerySetPos (UINT uEdge, LPRECT lprc, PAPPBARDATA pabd, BOOL fMove)
 
void AppBar_PosChanged (PAPPBARDATA pabd)
 
BOOL OnCreate (HWND hwnd, LPCREATESTRUCT lpCreateStruct)
 
void OnActivate (HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized)
 
void OnWindowPosChanged (HWND hwnd, const LPWINDOWPOS lpwpos)
 
void OnSize (HWND hwnd, UINT state, int cx, int cy)
 
void OnMove (HWND hwnd, int x, int y)
 
void OnNCDestroy (HWND hwnd)
 
void OnTimer (HWND hwnd, UINT id)
 
UINT OnNCHitTest (HWND hwnd, int x, int y)
 
void OnLButtonDown (HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
 
void OnMouseMove (HWND hwnd, int x, int y, UINT keyFlags)
 
void OnLButtonUp (HWND hwnd, int x, int y, UINT keyFlags)
 
void GetWorkArea (LPRECT prc) const
 

Protected Attributes

HICON _hIcon
 
HBITMAP _hBmp
 
HBRUSH _hBrush
 
int _cx
 
int _cy
 
bool _flat
 
- Protected Attributes inherited from SubclassedWindow
WNDPROC _orgWndProc
 
- Protected Attributes inherited from Window
HWND m_hwnd
 
BOOL m_fAutoHide
 
BOOL m_fOnTop
 
BOOL m_fHiding
 
UINT m_uSide
 
LONG m_cxWidth
 
LONG m_cyHeight
 
LONG m_cxSave
 
LONG m_cySave
 
BOOL m_fAppBarRegd
 
BOOL m_fMoving
 
BOOL m_bDragged
 
POINT m_ptDragOn
 
RECT m_rcAppBar
 
RECT m_rcDrag
 

Additional Inherited Members

- Static Public Member Functions inherited from Window
static HWND Create (CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
 
static HWND Create (CREATORFUNC_INFO creator, const void *info, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
 
static Windowcreate_mdi_child (const ChildWndInfo &info, const MDICREATESTRUCT &mcs, CREATORFUNC_INFO creator)
 
static LRESULT CALLBACK WindowWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK DialogProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static Windowget_window (HWND hwnd)
 get window controller from window handle
 
template<typename CLASS >
static CLASS * get_window (HWND hwnd)
 
static void register_pretranslate (HWND hwnd)
 
static void unregister_pretranslate (HWND hwnd)
 
static BOOL pretranslate_msg (LPMSG pmsg)
 
static void register_dialog (HWND hwnd)
 
static void unregister_dialog (HWND hwnd)
 
static BOOL dispatch_dialog_msg (LPMSG pmsg)
 
static int MessageLoop ()
 
static void CancelModes ()
 
static BOOL DoRegisterClass (HINSTANCE hInstance)
 
static HWND DoCreateMainWnd (HINSTANCE hInstance, LPCTSTR pszText, INT cx, INT cy, DWORD style=WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN, DWORD exstyle=WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_TOPMOST, BOOL fAutoHide=FALSE)
 
static INT DoMainLoop ()
 
static WindowGetAppbarData (HWND hwnd)
 
static LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static DWORD WINAPI ActionThreadFunc (LPVOID args)
 
- Public Attributes inherited from Window
IAccessible IAccessible_iface
 
IOleWindow IOleWindow_iface
 
IEnumVARIANT IEnumVARIANT_iface
 
LONG ref
 
- Static Protected Member Functions inherited from SubclassedWindow
static LRESULT CALLBACK SubclassedWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
- Static Protected Member Functions inherited from Window
static Windowcreate_controller (HWND hwnd)
 create controller for a new window
 
static StaticWindowDataGetStaticWindowData ()
 
static LRESULT CALLBACK MDICBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK PropSheetCBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 
- Static Protected Attributes inherited from Window
static WindowMap s_wnd_map
 
static const voids_new_info = NULL
 
static CREATORFUNC s_window_creator = NULL
 
static HHOOK s_hcbtHook = 0
 
static WindowSet s_pretranslate_windows
 
static WindowSet s_dialogs
 

Detailed Description

Subclass button controls to paint pictures left to the labels. The buttons should have set the style bit BS_OWNERDRAW. The owning window should use the OwnerDrawParent template to route owner draw messages to the buttons.

Definition at line 717 of file window.h.

Member Typedef Documentation

◆ super

Definition at line 719 of file window.h.

Constructor & Destructor Documentation

◆ PictureButton() [1/4]

PictureButton::PictureButton ( HWND  hwnd,
HICON  hIcon,
HBRUSH  hbrush = GetSysColorBrush(COLOR_BTNFACE),
bool  flat = false 
)
inline

Definition at line 721 of file window.h.

722 : super(hwnd), _hIcon(hIcon), _hBmp(0), _hBrush(hbrush), _flat(flat)
723 {
724 _cx = 16;
725 _cy = 16;
726 }
static HBRUSH hbrush
HICON hIcon
Definition: msconfig.c:44
OwnerdrawnButton super
Definition: window.h:719
HBITMAP _hBmp
Definition: window.h:757
bool _flat
Definition: window.h:763
HICON _hIcon
Definition: window.h:756
HBRUSH _hBrush
Definition: window.h:758
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

◆ PictureButton() [2/4]

PictureButton::PictureButton ( HWND  hparent,
int  id,
HICON  hIcon,
HBRUSH  hbrush = GetSysColorBrush(COLOR_BTNFACE),
bool  flat = false 
)
inline

Definition at line 728 of file window.h.

729 : super(GetDlgItem(hparent, id)), _hIcon(hIcon), _hBmp(0), _hBrush(hbrush), _flat(flat)
730 {
731 _cx = 16;
732 _cy = 16;
733 }
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)

◆ PictureButton() [3/4]

PictureButton::PictureButton ( HWND  hwnd,
HBITMAP  hBmp,
HBRUSH  hbrush = GetSysColorBrush(COLOR_BTNFACE),
bool  flat = false 
)
inline

Definition at line 735 of file window.h.

736 : super(hwnd), _hIcon(0), _hBmp(hBmp), _hBrush(hbrush), _flat(flat)
737 {
738 BITMAP bmp;
739 GetObject(hBmp, sizeof(bmp), &bmp);
740 _cx = bmp.bmWidth;
741 _cy = bmp.bmHeight;
742 }
BITMAP bmp
Definition: alphablend.c:62
Definition: bl.h:1331
#define GetObject
Definition: wingdi.h:4468

◆ PictureButton() [4/4]

PictureButton::PictureButton ( HWND  hparent,
int  id,
HBITMAP  hBmp,
HBRUSH  hbrush = GetSysColorBrush(COLOR_BTNFACE),
bool  flat = false 
)
inline

Definition at line 744 of file window.h.

745 : super(GetDlgItem(hparent, id)), _hIcon(0), _hBmp(hBmp), _hBrush(hbrush), _flat(flat)
746 {
747 BITMAP bmp;
748 GetObject(hBmp, sizeof(bmp), &bmp);
749 _cx = bmp.bmWidth;
750 _cy = bmp.bmHeight;
751 }

Member Function Documentation

◆ DrawItem()

void PictureButton::DrawItem ( LPDRAWITEMSTRUCT  dis)
protectedvirtual

Implements OwnerdrawnButton.

Definition at line 965 of file window.cpp.

966{
968 int style = GetWindowStyle(_hwnd);
969
970 if (dis->itemState & ODS_DISABLED)
972
973 POINT imagePos;
975 int dt_flags;
976
977 if (style & BS_BOTTOM) {
978 // align horizontal centered, vertical floating
979 imagePos.x = (dis->rcItem.left + dis->rcItem.right - _cx) / 2;
980 imagePos.y = dis->rcItem.top + 3;
981
982 textRect.left = dis->rcItem.left + 2;
983 textRect.top = dis->rcItem.top + _cy + 4;
984 textRect.right = dis->rcItem.right - 4;
985 textRect.bottom = dis->rcItem.bottom - 4;
986
988 } else {
989 // horizontal floating, vertical centered
990 imagePos.x = dis->rcItem.left + 3;
991 imagePos.y = (dis->rcItem.top + dis->rcItem.bottom - _cy)/2;
992
993 textRect.left = dis->rcItem.left + _cx + 4;
994 textRect.top = dis->rcItem.top + 2;
995 textRect.right = dis->rcItem.right - 4;
996 textRect.bottom = dis->rcItem.bottom - 4;
997
998 dt_flags = DT_SINGLELINE|DT_VCENTER/*|DT_CENTER*/;
999 }
1000
1001 if (dis->itemState & ODS_SELECTED) {
1002 state |= DFCS_PUSHED;
1003 ++imagePos.x; ++imagePos.y;
1006 }
1007
1008 if (_flat) {
1009 FillRect(dis->hDC, &dis->rcItem, _hBrush);
1010
1011 if (style & BS_FLAT) // Only with BS_FLAT set, there will be drawn a frame without highlight.
1013 } else
1015
1016 if (_hIcon)
1017 DrawIconEx(dis->hDC, imagePos.x, imagePos.y, _hIcon, _cx, _cy, 0, _hBrush, DI_NORMAL);
1018 else {
1019 MemCanvas mem_dc;
1020 BitmapSelection sel(mem_dc, _hBmp);
1021 BitBlt(dis->hDC, imagePos.x, imagePos.y, _cx, _cy, mem_dc, 0, 0, SRCCOPY);
1022 }
1023
1026
1027 BkMode bk_mode(dis->hDC, TRANSPARENT);
1028
1029 if (dis->itemState & (ODS_DISABLED|ODS_GRAYED))
1030 DrawGrayText(dis->hDC, &textRect, title, dt_flags);
1031 else {
1032 TextColor lcColor(dis->hDC, GetSysColor(COLOR_BTNTEXT));
1033 DrawText(dis->hDC, title, -1, &textRect, dt_flags);
1034 }
1035
1036 if (dis->itemState & ODS_FOCUS) {
1037 RECT rect = {
1038 dis->rcItem.left+3, dis->rcItem.top+3,
1039 dis->rcItem.right-dis->rcItem.left-4, dis->rcItem.bottom-dis->rcItem.top-4
1040 };
1041 if (dis->itemState & ODS_SELECTED) {
1042 ++rect.left; ++rect.top;
1043 ++rect.right; ++rect.bottom;
1044 }
1045 DrawFocusRect(dis->hDC, &rect);
1046 }
1047}
Arabic default style
Definition: afstyles.h:94
static int state
Definition: maze.c:121
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
#define BUFFER_LEN
Definition: utility.h:97
void DrawGrayText(HDC hdc, LPRECT pRect, LPCTSTR text, int dt_flags)
Definition: window.cpp:891
unsigned int UINT
Definition: ndis.h:50
static char title[]
Definition: ps.c:92
RECT textRect
Definition: startmenu.cpp:1392
& rect
Definition: startmenu.cpp:1413
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define GetWindowStyle(hwnd)
Definition: windowsx.h:315
#define DI_NORMAL
Definition: wingdi.h:72
#define TRANSPARENT
Definition: wingdi.h:950
#define SRCCOPY
Definition: wingdi.h:333
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define ODS_DISABLED
Definition: winuser.h:2547
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2545
#define COLOR_BTNTEXT
Definition: winuser.h:933
#define DT_CENTER
Definition: winuser.h:527
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DT_SINGLELINE
Definition: winuser.h:540
#define DFCS_INACTIVE
Definition: winuser.h:502
#define DFC_BUTTON
Definition: winuser.h:476
#define BS_BOTTOM
Definition: winuser.h:259
#define BF_FLAT
Definition: winuser.h:471
#define DrawText
Definition: winuser.h:5771
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BS_FLAT
Definition: winuser.h:280
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2028
#define GetWindowText
Definition: winuser.h:5798
#define DT_VCENTER
Definition: winuser.h:543
#define ODS_GRAYED
Definition: winuser.h:2546
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define BF_RECT
Definition: winuser.h:462
#define EDGE_RAISED
Definition: winuser.h:450
#define DFCS_PUSHED
Definition: winuser.h:503
#define ODS_FOCUS
Definition: winuser.h:2549
char TCHAR
Definition: xmlstorage.h:189

Member Data Documentation

◆ _cx

int PictureButton::_cx
protected

Definition at line 760 of file window.h.

Referenced by DrawItem(), and PictureButton().

◆ _cy

int PictureButton::_cy
protected

Definition at line 761 of file window.h.

Referenced by DrawItem(), and PictureButton().

◆ _flat

bool PictureButton::_flat
protected

Definition at line 763 of file window.h.

Referenced by DrawItem().

◆ _hBmp

HBITMAP PictureButton::_hBmp
protected

Definition at line 757 of file window.h.

Referenced by DrawItem().

◆ _hBrush

HBRUSH PictureButton::_hBrush
protected

Definition at line 758 of file window.h.

Referenced by DrawItem().

◆ _hIcon

HICON PictureButton::_hIcon
protected

Definition at line 756 of file window.h.

Referenced by DrawItem().


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