ReactOS 0.4.15-dev-8621-g4b051b9
toolbar.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/debug.h"
Include dependency graph for toolbar.c:

Go to the source code of this file.

Classes

struct  TBUTTON_INFO
 
struct  TBITMAP_INFO
 
struct  IMLENTRY
 
struct  TOOLBAR_INFO
 
struct  CUSTDLG_INFO
 
struct  CUSTOMBUTTON
 

Macros

#define SEPARATOR_WIDTH   8
 
#define TOP_BORDER   2
 
#define BOTTOM_BORDER   2
 
#define DDARROW_WIDTH   11
 
#define ARROW_HEIGHT   3
 
#define INSERTMARK_WIDTH   2
 
#define DEFPAD_CX   7
 
#define DEFPAD_CY   6
 
#define DEFLISTGAP   4
 
#define LISTPAD_CY   9
 
#define NONLIST_NOTEXT_OFFSET   2
 
#define TOOLBAR_NOWHERE   (-1)
 
#define TBSTYLE_EX_ALL
 
#define COMMON_STYLES
 
#define GETIBITMAP(infoPtr, i)   (infoPtr->iVersion >= 5 ? LOWORD(i) : i)
 
#define GETHIMLID(infoPtr, i)   (infoPtr->iVersion >= 5 ? HIWORD(i) : 0)
 
#define GETDEFIMAGELIST(infoPtr, id)   TOOLBAR_GetImageList(infoPtr->himlDef, infoPtr->cimlDef, id)
 
#define GETHOTIMAGELIST(infoPtr, id)   TOOLBAR_GetImageList(infoPtr->himlHot, infoPtr->cimlHot, id)
 
#define GETDISIMAGELIST(infoPtr, id)   TOOLBAR_GetImageList(infoPtr->himlDis, infoPtr->cimlDis, id)
 
#define MAX_RESOURCE_STRING_LENGTH   512
 

Typedefs

typedef struct IMLENTRYPIMLENTRY
 
typedef struct TOOLBAR_INFOPTOOLBAR_INFO
 
typedef struct CUSTDLG_INFOPCUSTDLG_INFO
 
typedef struct CUSTOMBUTTONPCUSTOMBUTTON
 

Enumerations

enum  IMAGE_LIST_TYPE { IMAGE_LIST_DEFAULT , IMAGE_LIST_HOT , IMAGE_LIST_DISABLED }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (toolbar)
 
static BOOL TOOLBAR_GetButtonInfo (const TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
 
static BOOL TOOLBAR_IsButtonRemovable (const TOOLBAR_INFO *infoPtr, int iItem, const CUSTOMBUTTON *btnInfo)
 
static HIMAGELIST TOOLBAR_GetImageList (const PIMLENTRY *pies, INT cies, INT id)
 
static PIMLENTRY TOOLBAR_GetImageListEntry (const PIMLENTRY *pies, INT cies, INT id)
 
static VOID TOOLBAR_DeleteImageList (PIMLENTRY **pies, INT *cies)
 
static HIMAGELIST TOOLBAR_InsertImageList (PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id)
 
static LRESULT TOOLBAR_LButtonDown (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static void TOOLBAR_LayoutToolbar (TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_AutoSize (TOOLBAR_INFO *infoPtr)
 
static void TOOLBAR_CheckImageListIconSize (TOOLBAR_INFO *infoPtr)
 
static void TOOLBAR_TooltipAddTool (const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
 
static void TOOLBAR_TooltipSetRect (const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
 
static LRESULT TOOLBAR_SetButtonInfo (TOOLBAR_INFO *infoPtr, INT Id, const TBBUTTONINFOW *lptbbi, BOOL isW)
 
static int default_top_margin (const TOOLBAR_INFO *infoPtr)
 
static BOOL TOOLBAR_HasDropDownArrows (DWORD exStyle)
 
static BOOL button_has_ddarrow (const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
 
static LPWSTR TOOLBAR_GetText (const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
 
static void TOOLBAR_DumpTBButton (const TBBUTTON *tbb, BOOL fUnicode)
 
static void TOOLBAR_DumpButton (const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *bP, INT btn_num)
 
static void TOOLBAR_DumpToolbar (const TOOLBAR_INFO *iP, INT line)
 
static BOOL TOOLBAR_ButtonHasString (const TBUTTON_INFO *btnPtr)
 
static void set_string_index (TBUTTON_INFO *btn, INT_PTR str, BOOL unicode)
 
static void set_stringT (TBUTTON_INFO *btn, const WCHAR *str, BOOL unicode)
 
static void free_string (TBUTTON_INFO *btn)
 
static void TOOLBAR_CheckStyle (const TOOLBAR_INFO *infoPtr)
 
static INT TOOLBAR_SendNotify (NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
 
static INT TOOLBAR_GetBitmapIndex (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
 
static BOOL TOOLBAR_IsValidBitmapIndex (const TOOLBAR_INFO *infoPtr, INT index)
 
static BOOL TOOLBAR_IsValidImageList (const TOOLBAR_INFO *infoPtr, INT index)
 
static HIMAGELIST TOOLBAR_GetImageListForDrawing (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMAGE_LIST_TYPE imagelist, INT *index)
 
static void TOOLBAR_DrawFlatSeparator (const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *infoPtr)
 
static void TOOLBAR_DrawFlatHorizontalSeparator (const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *infoPtr)
 
static void TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, COLORREF clr)
 
static void TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText, const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
 
static void TOOLBAR_DrawPattern (const RECT *lpRect, const NMTBCUSTOMDRAW *tbcd)
 
static void TOOLBAR_DrawMasked (HIMAGELIST himl, int index, HDC hdc, INT x, INT y, UINT draw_flags)
 
static UINT TOOLBAR_TranslateState (const TBUTTON_INFO *btnPtr, BOOL captured)
 
static void TOOLBAR_DrawImage (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top, const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
 
static void TOOLBAR_DrawFrame (const TOOLBAR_INFO *infoPtr, const NMTBCUSTOMDRAW *tbcd, const RECT *rect, DWORD dwItemCDFlag)
 
static void TOOLBAR_DrawSepDDArrow (const TOOLBAR_INFO *infoPtr, const NMTBCUSTOMDRAW *tbcd, RECT *rcArrow, BOOL bDropDownPressed, DWORD dwItemCDFlag)
 
static void TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDraw)
 
static void TOOLBAR_Refresh (TOOLBAR_INFO *infoPtr, HDC hdc, const PAINTSTRUCT *ps)
 
static void TOOLBAR_MeasureString (const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr, HDC hdc, LPSIZE lpSize)
 
static void TOOLBAR_CalcStrings (const TOOLBAR_INFO *infoPtr, LPSIZE lpSize)
 
static void TOOLBAR_WrapToolbar (TOOLBAR_INFO *infoPtr)
 
static SIZE TOOLBAR_MeasureButton (const TOOLBAR_INFO *infoPtr, SIZE sizeString, BOOL bHasBitmap, BOOL bValidImageList)
 
static void TOOLBAR_CalcToolbar (TOOLBAR_INFO *infoPtr)
 
static INT TOOLBAR_InternalHitTest (const TOOLBAR_INFO *infoPtr, const POINT *lpPt, BOOL *button)
 
static BOOL TOOLBAR_InternalInsertButtonsT (TOOLBAR_INFO *infoPtr, INT iIndex, UINT nAddButtons, const TBBUTTON *lpTbb, BOOL fUnicode)
 
static INT TOOLBAR_GetButtonIndex (const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
 
static INT TOOLBAR_GetCheckedGroupButtonIndex (const TOOLBAR_INFO *infoPtr, INT nIndex)
 
static VOID TOOLBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void TOOLBAR_TooltipDelTool (const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
 
static void TOOLBAR_TooltipCreateControl (TOOLBAR_INFO *infoPtr)
 
static void TOOLBAR_Cust_InsertAvailButton (HWND hwnd, PCUSTOMBUTTON btnInfoNew)
 
static void TOOLBAR_Cust_MoveButton (const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo)
 
static void TOOLBAR_Cust_AddButton (const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexAvail, INT nIndexTo)
 
static void TOOLBAR_Cust_RemoveButton (const CUSTDLG_INFO *custInfo, HWND hwnd, INT index)
 
static LRESULT TOOLBAR_Cust_ToolbarDragListNotification (const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
 
static LRESULT TOOLBAR_Cust_AvailDragListNotification (const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
 
static INT_PTR CALLBACK TOOLBAR_CustomizeDialogProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL TOOLBAR_AddBitmapToImageList (TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TBITMAP_INFO *bitmap)
 
static LRESULT TOOLBAR_AddBitmap (TOOLBAR_INFO *infoPtr, INT count, const TBADDBITMAP *lpAddBmp)
 
static LRESULT TOOLBAR_AddButtonsT (TOOLBAR_INFO *infoPtr, INT nAddButtons, const TBBUTTON *lpTbb, BOOL fUnicode)
 
static LRESULT TOOLBAR_AddStringW (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
 
static LRESULT TOOLBAR_AddStringA (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
 
static LRESULT TOOLBAR_ButtonCount (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_ButtonStructSize (TOOLBAR_INFO *infoPtr, DWORD Size)
 
static LRESULT TOOLBAR_ChangeBitmap (TOOLBAR_INFO *infoPtr, INT Id, INT Index)
 
static LRESULT TOOLBAR_CheckButton (TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
 
static LRESULT TOOLBAR_CommandToIndex (const TOOLBAR_INFO *infoPtr, INT Id)
 
static LRESULT TOOLBAR_Customize (TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_DeleteButton (TOOLBAR_INFO *infoPtr, INT nIndex)
 
static LRESULT TOOLBAR_EnableButton (TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
 
static LRESULT TOOLBAR_GetAnchorHighlight (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetBitmap (const TOOLBAR_INFO *infoPtr, INT Id)
 
static LRESULT TOOLBAR_GetBitmapFlags (void)
 
static LRESULT TOOLBAR_GetButton (const TOOLBAR_INFO *infoPtr, INT nIndex, TBBUTTON *lpTbb)
 
static LRESULT TOOLBAR_GetButtonInfoT (const TOOLBAR_INFO *infoPtr, INT Id, LPTBBUTTONINFOW lpTbInfo, BOOL bUnicode)
 
static LRESULT TOOLBAR_GetButtonSize (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetButtonText (const TOOLBAR_INFO *infoPtr, INT Id, LPWSTR lpStr, BOOL isW)
 
static LRESULT TOOLBAR_GetDisabledImageList (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TOOLBAR_GetExtendedStyle (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetHotImageList (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TOOLBAR_GetHotItem (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetDefImageList (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TOOLBAR_GetInsertMark (const TOOLBAR_INFO *infoPtr, TBINSERTMARK *lptbim)
 
static LRESULT TOOLBAR_GetInsertMarkColor (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetItemRect (const TOOLBAR_INFO *infoPtr, INT nIndex, LPRECT lpRect)
 
static LRESULT TOOLBAR_GetMaxSize (const TOOLBAR_INFO *infoPtr, LPSIZE lpSize)
 
static LRESULT TOOLBAR_GetPadding (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetRect (const TOOLBAR_INFO *infoPtr, INT Id, LPRECT lpRect)
 
static LRESULT TOOLBAR_GetRows (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetState (const TOOLBAR_INFO *infoPtr, INT Id)
 
static LRESULT TOOLBAR_GetStyle (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetTextRows (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetToolTips (TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetUnicodeFormat (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetVersion (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_HideButton (TOOLBAR_INFO *infoPtr, INT Id, BOOL fHide)
 
static LRESULT TOOLBAR_HitTest (const TOOLBAR_INFO *infoPtr, const POINT *lpPt)
 
static LRESULT TOOLBAR_Indeterminate (const TOOLBAR_INFO *infoPtr, INT Id, BOOL fIndeterminate)
 
static LRESULT TOOLBAR_InsertButtonT (TOOLBAR_INFO *infoPtr, INT nIndex, const TBBUTTON *lpTbb, BOOL fUnicode)
 
static LRESULT TOOLBAR_IsButtonChecked (const TOOLBAR_INFO *infoPtr, INT Id)
 
static LRESULT TOOLBAR_IsButtonEnabled (const TOOLBAR_INFO *infoPtr, INT Id)
 
static LRESULT TOOLBAR_IsButtonHidden (const TOOLBAR_INFO *infoPtr, INT Id)
 
static LRESULT TOOLBAR_IsButtonHighlighted (const TOOLBAR_INFO *infoPtr, INT Id)
 
static LRESULT TOOLBAR_IsButtonIndeterminate (const TOOLBAR_INFO *infoPtr, INT Id)
 
static LRESULT TOOLBAR_IsButtonPressed (const TOOLBAR_INFO *infoPtr, INT Id)
 
static LRESULT TOOLBAR_LoadImages (TOOLBAR_INFO *infoPtr, WPARAM wParam, HINSTANCE hInstance)
 
static LRESULT TOOLBAR_MapAccelerator (const TOOLBAR_INFO *infoPtr, WCHAR wAccel, UINT *pIDButton)
 
static LRESULT TOOLBAR_MarkButton (const TOOLBAR_INFO *infoPtr, INT Id, BOOL fMark)
 
static void TOOLBAR_MoveFixupIndex (INT *pIndex, INT nIndex, INT nMoveIndex, BOOL bMoveUp)
 
static LRESULT TOOLBAR_MoveButton (TOOLBAR_INFO *infoPtr, INT Id, INT nMoveIndex)
 
static LRESULT TOOLBAR_PressButton (const TOOLBAR_INFO *infoPtr, INT Id, BOOL fPress)
 
static LRESULT TOOLBAR_ReplaceBitmap (TOOLBAR_INFO *infoPtr, const TBREPLACEBITMAP *lpReplace)
 
static BOOL TOOLBAR_Save (TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *params)
 
static void TOOLBAR_DeleteAllButtons (TOOLBAR_INFO *infoPtr)
 
static BOOL TOOLBAR_Restore (TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
 
static LRESULT TOOLBAR_SaveRestoreW (TOOLBAR_INFO *infoPtr, WPARAM wParam, const TBSAVEPARAMSW *lpSave)
 
static LRESULT TOOLBAR_SaveRestoreA (TOOLBAR_INFO *infoPtr, WPARAM wParam, const TBSAVEPARAMSA *lpSave)
 
static LRESULT TOOLBAR_SetAnchorHighlight (TOOLBAR_INFO *infoPtr, BOOL bAnchor)
 
static LRESULT TOOLBAR_SetBitmapSize (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_SetButtonSize (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 
static LRESULT TOOLBAR_SetButtonWidth (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 
static LRESULT TOOLBAR_SetCmdId (TOOLBAR_INFO *infoPtr, INT nIndex, INT nId)
 
static LRESULT TOOLBAR_SetDisabledImageList (TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST himl)
 
static LRESULT TOOLBAR_SetDrawTextFlags (TOOLBAR_INFO *infoPtr, DWORD mask, DWORD flags)
 
static LRESULT TOOLBAR_SetExtendedStyle (TOOLBAR_INFO *infoPtr, DWORD mask, DWORD style)
 
static LRESULT TOOLBAR_SetHotImageList (TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST himl)
 
static void TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason)
 
static LRESULT TOOLBAR_SetHotItem (TOOLBAR_INFO *infoPtr, INT nHotItem)
 
static LRESULT TOOLBAR_SetImageList (TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST himl)
 
static LRESULT TOOLBAR_SetIndent (TOOLBAR_INFO *infoPtr, INT nIndent)
 
static LRESULT TOOLBAR_SetInsertMark (TOOLBAR_INFO *infoPtr, const TBINSERTMARK *lptbim)
 
static LRESULT TOOLBAR_SetInsertMarkColor (TOOLBAR_INFO *infoPtr, COLORREF clr)
 
static LRESULT TOOLBAR_SetMaxTextRows (TOOLBAR_INFO *infoPtr, INT nMaxRows)
 
static LRESULT TOOLBAR_SetPadding (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 
static LRESULT TOOLBAR_SetParent (TOOLBAR_INFO *infoPtr, HWND hParent)
 
static LRESULT TOOLBAR_SetRows (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPRECT lprc)
 
static LRESULT TOOLBAR_SetState (TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
 
static void unwrap (TOOLBAR_INFO *info)
 
static LRESULT TOOLBAR_SetStyle (TOOLBAR_INFO *infoPtr, DWORD style)
 
static LRESULT TOOLBAR_SetToolTips (TOOLBAR_INFO *infoPtr, HWND hwndTooltip)
 
static LRESULT TOOLBAR_SetUnicodeFormat (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TOOLBAR_GetColorScheme (const TOOLBAR_INFO *infoPtr, LPCOLORSCHEME lParam)
 
static LRESULT TOOLBAR_SetColorScheme (TOOLBAR_INFO *infoPtr, const COLORSCHEME *lParam)
 
static LRESULT TOOLBAR_SetVersion (TOOLBAR_INFO *infoPtr, INT iVersion)
 
static LRESULT TOOLBAR_GetStringA (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPSTR str)
 
static LRESULT TOOLBAR_GetStringW (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPWSTR str)
 
static LRESULT TOOLBAR_SetBoundingSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_SetHotItem2 (TOOLBAR_INFO *infoPtr, INT nHotItem, LPARAM lParam)
 
static LRESULT TOOLBAR_SetListGap (TOOLBAR_INFO *infoPtr, INT iListGap)
 
static LRESULT TOOLBAR_GetImageListCount (const TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_GetIdealSize (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_Unkwn464 (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 
static LRESULT TOOLBAR_Destroy (TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_EraseBackground (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_GetFont (const TOOLBAR_INFO *infoPtr)
 
static void TOOLBAR_SetRelativeHotItem (TOOLBAR_INFO *infoPtr, INT iDirection, DWORD dwReason)
 
static LRESULT TOOLBAR_KeyDown (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_LButtonDblClk (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_LButtonUp (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_RButtonUp (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_RButtonDblClk (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_CaptureChanged (TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_MouseLeave (TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_MouseMove (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_NCActivate (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_NCCalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
 
static LRESULT TOOLBAR_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnmtdi)
 
static LRESULT TOOLBAR_Notify (TOOLBAR_INFO *infoPtr, LPNMHDR lpnmh)
 
static LRESULT TOOLBAR_NotifyFormat (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLBAR_Paint (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TOOLBAR_SetFocus (TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_SetFont (TOOLBAR_INFO *infoPtr, HFONT hFont, WORD Redraw)
 
static LRESULT TOOLBAR_SetRedraw (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TOOLBAR_Size (TOOLBAR_INFO *infoPtr)
 
static LRESULT TOOLBAR_StyleChanged (TOOLBAR_INFO *infoPtr, INT nType, const STYLESTRUCT *lpStyle)
 
static LRESULT TOOLBAR_SysColorChange (void)
 
static LRESULT theme_changed (HWND hwnd)
 
static LRESULT WINAPI ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID TOOLBAR_Register (void)
 
VOID TOOLBAR_Unregister (void)
 

Variables

static HCURSOR hCursorDrag = NULL
 
static const WCHAR themeClass [] = { 'T','o','o','l','b','a','r',0 }
 
UINT uDragListMessage DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ ARROW_HEIGHT

#define ARROW_HEIGHT   3

Definition at line 206 of file toolbar.c.

◆ BOTTOM_BORDER

#define BOTTOM_BORDER   2

Definition at line 204 of file toolbar.c.

◆ COMMON_STYLES

#define COMMON_STYLES
Value:
#define CCS_BOTTOM
Definition: commctrl.h:2249
#define CCS_ADJUSTABLE
Definition: commctrl.h:2252
#define CCS_VERT
Definition: commctrl.h:2254
#define CCS_NODIVIDER
Definition: commctrl.h:2253
#define CCS_TOP
Definition: commctrl.h:2247
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2251
#define CCS_NORESIZE
Definition: commctrl.h:2250
#define CCS_NOMOVEY
Definition: commctrl.h:2248

Definition at line 241 of file toolbar.c.

◆ DDARROW_WIDTH

#define DDARROW_WIDTH   11

Definition at line 205 of file toolbar.c.

◆ DEFLISTGAP

#define DEFLISTGAP   4

Definition at line 219 of file toolbar.c.

◆ DEFPAD_CX

#define DEFPAD_CX   7

Definition at line 210 of file toolbar.c.

◆ DEFPAD_CY

#define DEFPAD_CY   6

Definition at line 211 of file toolbar.c.

◆ GETDEFIMAGELIST

#define GETDEFIMAGELIST (   infoPtr,
  id 
)    TOOLBAR_GetImageList(infoPtr->himlDef, infoPtr->cimlDef, id)

Definition at line 246 of file toolbar.c.

◆ GETDISIMAGELIST

#define GETDISIMAGELIST (   infoPtr,
  id 
)    TOOLBAR_GetImageList(infoPtr->himlDis, infoPtr->cimlDis, id)

Definition at line 248 of file toolbar.c.

◆ GETHIMLID

#define GETHIMLID (   infoPtr,
  i 
)    (infoPtr->iVersion >= 5 ? HIWORD(i) : 0)

Definition at line 245 of file toolbar.c.

◆ GETHOTIMAGELIST

#define GETHOTIMAGELIST (   infoPtr,
  id 
)    TOOLBAR_GetImageList(infoPtr->himlHot, infoPtr->cimlHot, id)

Definition at line 247 of file toolbar.c.

◆ GETIBITMAP

#define GETIBITMAP (   infoPtr,
  i 
)    (infoPtr->iVersion >= 5 ? LOWORD(i) : i)

Definition at line 244 of file toolbar.c.

◆ INSERTMARK_WIDTH

#define INSERTMARK_WIDTH   2

Definition at line 207 of file toolbar.c.

◆ LISTPAD_CY

#define LISTPAD_CY   9

Definition at line 225 of file toolbar.c.

◆ MAX_RESOURCE_STRING_LENGTH

#define MAX_RESOURCE_STRING_LENGTH   512

◆ NONLIST_NOTEXT_OFFSET

#define NONLIST_NOTEXT_OFFSET   2

Definition at line 229 of file toolbar.c.

◆ SEPARATOR_WIDTH

#define SEPARATOR_WIDTH   8

Definition at line 202 of file toolbar.c.

◆ TBSTYLE_EX_ALL

#define TBSTYLE_EX_ALL
Value:
#define TBSTYLE_EX_DRAWDDARROWS
Definition: commctrl.h:1009
#define TBSTYLE_EX_MIXEDBUTTONS
Definition: commctrl.h:1012
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:1013
#define TBSTYLE_EX_DOUBLEBUFFER
Definition: commctrl.h:1014
#define TBSTYLE_EX_VERTICAL
Definition: commctrl.h:1011

Definition at line 234 of file toolbar.c.

◆ TOOLBAR_NOWHERE

#define TOOLBAR_NOWHERE   (-1)

Definition at line 231 of file toolbar.c.

◆ TOP_BORDER

#define TOP_BORDER   2

Definition at line 203 of file toolbar.c.

Typedef Documentation

◆ PCUSTDLG_INFO

◆ PCUSTOMBUTTON

◆ PIMLENTRY

◆ PTOOLBAR_INFO

Enumeration Type Documentation

◆ IMAGE_LIST_TYPE

Enumerator
IMAGE_LIST_DEFAULT 
IMAGE_LIST_HOT 
IMAGE_LIST_DISABLED 

Definition at line 195 of file toolbar.c.

196{
IMAGE_LIST_TYPE
Definition: toolbar.c:196
@ IMAGE_LIST_HOT
Definition: toolbar.c:198
@ IMAGE_LIST_DISABLED
Definition: toolbar.c:199
@ IMAGE_LIST_DEFAULT
Definition: toolbar.c:197

Function Documentation

◆ button_has_ddarrow()

static BOOL button_has_ddarrow ( const TOOLBAR_INFO infoPtr,
const TBUTTON_INFO btnPtr 
)
inlinestatic

Definition at line 282 of file toolbar.c.

283{
284 return (TOOLBAR_HasDropDownArrows( infoPtr->dwExStyle ) && (btnPtr->fsStyle & BTNS_DROPDOWN)) ||
285 (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN);
286}
static BOOL TOOLBAR_HasDropDownArrows(DWORD exStyle)
Definition: toolbar.c:277
#define BTNS_DROPDOWN
Definition: commctrl.h:1003
#define BTNS_WHOLEDROPDOWN
Definition: commctrl.h:1007
BYTE fsStyle
Definition: toolbar.c:93
DWORD dwExStyle
Definition: toolbar.c:164

Referenced by TOOLBAR_DrawButton(), TOOLBAR_LayoutToolbar(), and TOOLBAR_WrapToolbar().

◆ default_top_margin()

static int default_top_margin ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 268 of file toolbar.c.

269{
270#ifdef __REACTOS__
271 if (infoPtr->iVersion == 6)
272 return infoPtr->szBarPadding.cy;
273#endif
274 return (infoPtr->dwStyle & TBSTYLE_FLAT ? 0 : TOP_BORDER);
275}
#define TOP_BORDER
Definition: toolbar.c:203
#define TBSTYLE_FLAT
Definition: commctrl.h:992
INT iVersion
Definition: toolbar.c:170
DWORD dwStyle
Definition: toolbar.c:163

Referenced by TOOLBAR_CalcToolbar(), TOOLBAR_NCCreate(), and TOOLBAR_SetButtonSize().

◆ free_string()

static void free_string ( TBUTTON_INFO btn)
static

Definition at line 386 of file toolbar.c.

387{
388 set_string_index( btn, 0, TRUE );
389
390}
#define TRUE
Definition: types.h:120
static void set_string_index(TBUTTON_INFO *btn, INT_PTR str, BOOL unicode)
Definition: toolbar.c:361

Referenced by TOOLBAR_DeleteAllButtons(), TOOLBAR_DeleteButton(), TOOLBAR_Destroy(), and TOOLBAR_Restore().

◆ set_string_index()

static void set_string_index ( TBUTTON_INFO btn,
INT_PTR  str,
BOOL  unicode 
)
static

Definition at line 361 of file toolbar.c.

362{
363 if (!IS_INTRESOURCE( str ) && str != -1)
364 {
365 if (!TOOLBAR_ButtonHasString( btn )) btn->iString = 0;
366
367 if (unicode)
368 Str_SetPtrW( (WCHAR **)&btn->iString, (WCHAR *)str );
369 else
370 Str_SetPtrAtoW( (WCHAR **)&btn->iString, (char *)str );
371 }
372 else
373 {
374 if (TOOLBAR_ButtonHasString( btn )) Free( (WCHAR *)btn->iString );
375
376 btn->iString = str;
377 }
378}
BOOL Str_SetPtrAtoW(LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:232
static BOOL TOOLBAR_ButtonHasString(const TBUTTON_INFO *btnPtr)
Definition: toolbar.c:356
const WCHAR * str
INT_PTR iString
Definition: toolbar.c:97
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by free_string(), set_stringT(), and TOOLBAR_InternalInsertButtonsT().

◆ set_stringT()

static void set_stringT ( TBUTTON_INFO btn,
const WCHAR str,
BOOL  unicode 
)
static

Definition at line 380 of file toolbar.c.

381{
382 if (IS_INTRESOURCE( (DWORD_PTR)str ) || (DWORD_PTR)str == -1) return;
383 set_string_index( btn, (DWORD_PTR)str, unicode );
384}
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by TOOLBAR_SetButtonInfo().

◆ theme_changed()

static LRESULT theme_changed ( HWND  hwnd)
static

Definition at line 6846 of file toolbar.c.

6847{
6848 HTHEME theme = GetWindowTheme (hwnd);
6849 CloseThemeData (theme);
6851 return 0;
6852}
static const WCHAR themeClass[]
Definition: toolbar.c:250
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddBitmap()

static LRESULT TOOLBAR_AddBitmap ( TOOLBAR_INFO infoPtr,
INT  count,
const TBADDBITMAP lpAddBmp 
)
static

Definition at line 2990 of file toolbar.c.

2991{
2993 INT iSumButtons, i;
2994 HIMAGELIST himlDef;
2995
2996 TRACE("hwnd=%p count=%d lpAddBmp=%p\n", infoPtr->hwndSelf, count, lpAddBmp);
2997 if (!lpAddBmp)
2998 return -1;
2999
3000 if (lpAddBmp->hInst == HINST_COMMCTRL)
3001 {
3002 info.hInst = COMCTL32_hModule;
3003 switch (lpAddBmp->nID)
3004 {
3006 case 2:
3007 info.nButtons = 15;
3008 info.nID = IDB_STD_SMALL;
3009 break;
3011 case 3:
3012 info.nButtons = 15;
3013 info.nID = IDB_STD_LARGE;
3014 break;
3016 case 6:
3017 info.nButtons = 12;
3018 info.nID = IDB_VIEW_SMALL;
3019 break;
3021 case 7:
3022 info.nButtons = 12;
3023 info.nID = IDB_VIEW_LARGE;
3024 break;
3026 info.nButtons = 5;
3027 info.nID = IDB_HIST_SMALL;
3028 break;
3030 info.nButtons = 5;
3031 info.nID = IDB_HIST_LARGE;
3032 break;
3033 default:
3034 WARN("unknown bitmap id, %ld\n", lpAddBmp->nID);
3035 return -1;
3036 }
3037
3038 TRACE ("adding %d internal bitmaps\n", info.nButtons);
3039
3040 /* Windows resize all the buttons to the size of a newly added standard image */
3041 if (lpAddBmp->nID & 1)
3042 {
3043 /* large icons: 24x24. Will make the button 31x30 */
3044 SendMessageW (infoPtr->hwndSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(24, 24));
3045 }
3046 else
3047 {
3048 /* small icons: 16x16. Will make the buttons 23x22 */
3049 SendMessageW (infoPtr->hwndSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
3050 }
3051
3052 TOOLBAR_CalcToolbar (infoPtr);
3053 }
3054 else
3055 {
3056 info.nButtons = count;
3057 info.hInst = lpAddBmp->hInst;
3058 info.nID = lpAddBmp->nID;
3059 TRACE("adding %d bitmaps\n", info.nButtons);
3060 }
3061
3062 /* check if the bitmap is already loaded and compute iSumButtons */
3063 iSumButtons = 0;
3064 for (i = 0; i < infoPtr->nNumBitmapInfos; i++)
3065 {
3066 if (infoPtr->bitmaps[i].hInst == info.hInst &&
3067 infoPtr->bitmaps[i].nID == info.nID)
3068 return iSumButtons;
3069 iSumButtons += infoPtr->bitmaps[i].nButtons;
3070 }
3071
3072 if (!infoPtr->cimlDef) {
3073 /* create new default image list */
3074 TRACE ("creating default image list\n");
3075
3076 himlDef = ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
3077 ILC_COLOR32 | ILC_MASK, info.nButtons, 2);
3078 TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlDef, 0);
3079 infoPtr->himlInt = himlDef;
3080 }
3081 else {
3082 himlDef = GETDEFIMAGELIST(infoPtr, 0);
3083 }
3084
3085 if (!himlDef) {
3086 WARN("No default image list available\n");
3087 return -1;
3088 }
3089
3090 if (!TOOLBAR_AddBitmapToImageList(infoPtr, himlDef, &info))
3091 return -1;
3092
3093 TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
3094 infoPtr->bitmaps = ReAlloc(infoPtr->bitmaps, (infoPtr->nNumBitmapInfos + 1) * sizeof(TBITMAP_INFO));
3095 infoPtr->bitmaps[infoPtr->nNumBitmapInfos] = info;
3096 infoPtr->nNumBitmapInfos++;
3097 TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
3098
3099 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
3100 return iSumButtons;
3101}
#define WARN(fmt,...)
Definition: precomp.h:61
PVOID ReAlloc(IN DWORD dwFlags, IN PVOID lpMem, IN SIZE_T dwBytes)
Definition: main.c:76
#define IDB_VIEW_SMALL
Definition: comctl32.h:79
#define IDB_HIST_LARGE
Definition: comctl32.h:82
#define IDB_STD_LARGE
Definition: comctl32.h:78
#define IDB_VIEW_LARGE
Definition: comctl32.h:80
#define IDB_STD_SMALL
Definition: comctl32.h:77
#define IDB_HIST_SMALL
Definition: comctl32.h:81
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
#define NULL
Definition: types.h:112
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
static void TOOLBAR_CalcToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1809
static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id)
Definition: toolbar.c:7338
static BOOL TOOLBAR_AddBitmapToImageList(TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TBITMAP_INFO *bitmap)
Definition: toolbar.c:2912
#define GETDEFIMAGELIST(infoPtr, id)
Definition: toolbar.c:246
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IDB_VIEW_LARGE_COLOR
Definition: commctrl.h:1067
#define IDB_HIST_LARGE_COLOR
Definition: commctrl.h:1069
#define HINST_COMMCTRL
Definition: commctrl.h:1063
#define IDB_HIST_SMALL_COLOR
Definition: commctrl.h:1068
#define IDB_VIEW_SMALL_COLOR
Definition: commctrl.h:1066
#define ILC_COLOR32
Definition: commctrl.h:358
#define IDB_STD_LARGE_COLOR
Definition: commctrl.h:1065
#define TB_SETBITMAPSIZE
Definition: commctrl.h:1136
#define ILC_MASK
Definition: commctrl.h:351
#define IDB_STD_SMALL_COLOR
Definition: commctrl.h:1064
#define TRACE(s)
Definition: solgame.cpp:4
UINT nID
Definition: toolbar.c:107
HINSTANCE hInst
Definition: toolbar.c:106
UINT nButtons
Definition: toolbar.c:105
INT cimlDef
Definition: toolbar.c:150
TBITMAP_INFO * bitmaps
Definition: toolbar.c:176
HWND hwndSelf
Definition: toolbar.c:157
INT nBitmapHeight
Definition: toolbar.c:123
INT nNumBitmapInfos
Definition: toolbar.c:133
HIMAGELIST himlInt
Definition: toolbar.c:148
PIMLENTRY * himlDef
Definition: toolbar.c:149
INT nBitmapWidth
Definition: toolbar.c:124
UINT_PTR nID
Definition: commctrl.h:1060
HINSTANCE hInst
Definition: commctrl.h:1059
int32_t INT
Definition: typedefs.h:58
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by TOOLBAR_LoadImages(), and ToolbarWindowProc().

◆ TOOLBAR_AddBitmapToImageList()

static BOOL TOOLBAR_AddBitmapToImageList ( TOOLBAR_INFO infoPtr,
HIMAGELIST  himlDef,
const TBITMAP_INFO bitmap 
)
static

Definition at line 2912 of file toolbar.c.

2913{
2914 HBITMAP hbmLoad;
2915 INT nCountBefore = ImageList_GetImageCount(himlDef);
2916 INT nCountAfter;
2917 INT cxIcon, cyIcon;
2918 INT nAdded;
2919 INT nIndex;
2920
2921 TRACE("adding hInst=%p nID=%d nButtons=%d\n", bitmap->hInst, bitmap->nID, bitmap->nButtons);
2922 /* Add bitmaps to the default image list */
2923 if (bitmap->hInst == NULL) /* a handle was passed */
2924 hbmLoad = CopyImage(ULongToHandle(bitmap->nID), IMAGE_BITMAP, 0, 0, 0);
2925 else if (bitmap->hInst == COMCTL32_hModule)
2926 hbmLoad = LoadImageW( bitmap->hInst, MAKEINTRESOURCEW(bitmap->nID),
2928 else
2929 hbmLoad = CreateMappedBitmap(bitmap->hInst, bitmap->nID, 0, NULL, 0);
2930
2931 /* enlarge the bitmap if needed */
2932 ImageList_GetIconSize(himlDef, &cxIcon, &cyIcon);
2933 if (bitmap->hInst != COMCTL32_hModule)
2934 COMCTL32_EnsureBitmapSize(&hbmLoad, cxIcon*(INT)bitmap->nButtons, cyIcon, comctl32_color.clrBtnFace);
2935
2936 nIndex = ImageList_AddMasked(himlDef, hbmLoad, comctl32_color.clrBtnFace);
2937 DeleteObject(hbmLoad);
2938 if (nIndex == -1)
2939 return FALSE;
2940
2941 nCountAfter = ImageList_GetImageCount(himlDef);
2942 nAdded = nCountAfter - nCountBefore;
2943 if (bitmap->nButtons == 0) /* wParam == 0 is special and means add only one image */
2944 {
2945 ImageList_SetImageCount(himlDef, nCountBefore + 1);
2946 } else if (nAdded > (INT)bitmap->nButtons) {
2947 TRACE("Added more images than wParam: Previous image number %i added %i while wParam %i. Images in list %i\n",
2948 nCountBefore, nAdded, bitmap->nButtons, nCountAfter);
2949 }
2950
2951 infoPtr->nNumBitmaps += nAdded;
2952 return TRUE;
2953}
#define ULongToHandle(h)
Definition: basetsd.h:81
void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight, COLORREF crBackground) DECLSPEC_HIDDEN
Definition: commctrl.c:1685
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
HBITMAP WINAPI CreateMappedBitmap(HINSTANCE hInstance, INT_PTR idBitmap, UINT wFlags, LPCOLORMAP lpColorMap, INT iNumMaps)
Definition: commctrl.c:1005
#define FALSE
Definition: types.h:117
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2063
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
BOOL WINAPI ImageList_SetImageCount(HIMAGELIST himl, UINT iImageCount)
Definition: imagelist.c:3089
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
pKey DeleteObject()
static HBITMAP
Definition: button.c:44
COLORREF clrBtnFace
Definition: comctl32.h:174
INT nNumBitmaps
Definition: toolbar.c:131
Definition: uimain.c:89
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_CREATEDIBSECTION
Definition: winuser.h:1101
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2247
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2024
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by TOOLBAR_AddBitmap(), and TOOLBAR_CheckImageListIconSize().

◆ TOOLBAR_AddButtonsT()

static LRESULT TOOLBAR_AddButtonsT ( TOOLBAR_INFO infoPtr,
INT  nAddButtons,
const TBBUTTON lpTbb,
BOOL  fUnicode 
)
static

Definition at line 3105 of file toolbar.c.

3106{
3107 TRACE("adding %d buttons (unicode=%d)\n", nAddButtons, fUnicode);
3108
3109 return TOOLBAR_InternalInsertButtonsT(infoPtr, -1, nAddButtons, lpTbb, fUnicode);
3110}
static BOOL TOOLBAR_InternalInsertButtonsT(TOOLBAR_INFO *infoPtr, INT iIndex, UINT nAddButtons, const TBBUTTON *lpTbb, BOOL fUnicode)
Definition: toolbar.c:2025

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringA()

static LRESULT TOOLBAR_AddStringA ( TOOLBAR_INFO infoPtr,
HINSTANCE  hInstance,
LPARAM  lParam 
)
static

Definition at line 3195 of file toolbar.c.

3196{
3197 BOOL fFirstString = (infoPtr->nNumStrings == 0);
3198 LPSTR p;
3199 INT nIndex;
3200 INT len;
3201
3202 TRACE("%p, %lx\n", hInstance, lParam);
3203
3204 if (IS_INTRESOURCE(lParam)) /* load from resources */
3205 return TOOLBAR_AddStringW(infoPtr, hInstance, lParam);
3206
3207 p = (LPSTR)lParam;
3208 if (p == NULL)
3209 return -1;
3210
3211 TRACE("adding string(s) from array\n");
3212 nIndex = infoPtr->nNumStrings;
3213 while (*p) {
3214 len = strlen (p);
3215 TRACE("len=%d \"%s\"\n", len, p);
3216
3217 infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3218 Str_SetPtrAtoW(&infoPtr->strings[infoPtr->nNumStrings], p);
3219 infoPtr->nNumStrings++;
3220
3221 p += (len+1);
3222 }
3223
3224 if (fFirstString)
3225 TOOLBAR_CalcToolbar(infoPtr);
3226 return nIndex;
3227}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HINSTANCE hInstance
Definition: charmap.c:19
LPARAM lParam
Definition: combotst.c:139
static LRESULT TOOLBAR_AddStringW(TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
Definition: toolbar.c:3114
unsigned int BOOL
Definition: ntddk_ex.h:94
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
INT nNumStrings
Definition: toolbar.c:132
LPWSTR * strings
Definition: toolbar.c:175
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringW()

static LRESULT TOOLBAR_AddStringW ( TOOLBAR_INFO infoPtr,
HINSTANCE  hInstance,
LPARAM  lParam 
)
static

Definition at line 3114 of file toolbar.c.

3115{
3116#define MAX_RESOURCE_STRING_LENGTH 512
3117 BOOL fFirstString = (infoPtr->nNumStrings == 0);
3118 INT nIndex = infoPtr->nNumStrings;
3119
3120 TRACE("%p, %lx\n", hInstance, lParam);
3121
3122 if (IS_INTRESOURCE(lParam)) {
3125 WCHAR *next_delim;
3126 HRSRC hrsrc;
3127 WCHAR *p;
3128 INT len;
3129
3130 TRACE("adding string from resource\n");
3131
3132 if (!hInstance) return -1;
3133
3134 hrsrc = FindResourceW( hInstance, MAKEINTRESOURCEW((LOWORD(lParam) >> 4) + 1),
3135 (LPWSTR)RT_STRING );
3136 if (!hrsrc)
3137 {
3138 TRACE("string not found in resources\n");
3139 return -1;
3140 }
3141
3143 szString, MAX_RESOURCE_STRING_LENGTH);
3144
3145 TRACE("len=%d %s\n", len, debugstr_w(szString));
3146 if (len == 0 || len == 1)
3147 return nIndex;
3148
3149 TRACE("delimiter: 0x%x\n", *szString);
3150 delimiter = *szString;
3151 p = szString + 1;
3152
3153 while ((next_delim = wcschr(p, delimiter)) != NULL) {
3154 *next_delim = 0;
3155 if (next_delim + 1 >= szString + len)
3156 {
3157 /* this may happen if delimiter == '\0' or if the last char is a
3158 * delimiter (then it is ignored like the native does) */
3159 break;
3160 }
3161
3162 infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3163 Str_SetPtrW(&infoPtr->strings[infoPtr->nNumStrings], p);
3164 infoPtr->nNumStrings++;
3165
3166 p = next_delim + 1;
3167 }
3168 }
3169 else {
3170 LPWSTR p = (LPWSTR)lParam;
3171 INT len;
3172
3173 if (p == NULL)
3174 return -1;
3175 TRACE("adding string(s) from array\n");
3176 while (*p) {
3177 len = lstrlenW (p);
3178
3179 TRACE("len=%d %s\n", len, debugstr_w(p));
3180 infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3181 Str_SetPtrW (&infoPtr->strings[infoPtr->nNumStrings], p);
3182 infoPtr->nNumStrings++;
3183
3184 p += (len+1);
3185 }
3186 }
3187
3188 if (fFirstString)
3189 TOOLBAR_CalcToolbar(infoPtr);
3190 return nIndex;
3191}
#define MAX_RESOURCE_STRING_LENGTH
#define wcschr
Definition: compat.h:17
#define lstrlenW
Definition: compat.h:750
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define debugstr_w
Definition: kernel32.h:32
const char * delimiter
Definition: string.c:1566
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define RT_STRING
Definition: pedump.c:368
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

Referenced by TOOLBAR_AddStringA(), and ToolbarWindowProc().

◆ TOOLBAR_AutoSize()

static LRESULT TOOLBAR_AutoSize ( TOOLBAR_INFO infoPtr)
static

Definition at line 3231 of file toolbar.c.

3232{
3233 TRACE("auto sizing, style=%#x\n", infoPtr->dwStyle);
3234 TRACE("nRows: %d, infoPtr->nButtonHeight: %d\n", infoPtr->nRows, infoPtr->nButtonHeight);
3235
3236#ifdef __REACTOS__ /* workaround CORE-16169 part 2 of 2 */
3237 if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL))
3238 {
3239 TOOLBAR_LayoutToolbar(infoPtr);
3240 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
3241 }
3242#endif
3243
3244 if (!(infoPtr->dwStyle & CCS_NORESIZE))
3245 {
3246 RECT window_rect, parent_rect;
3247 UINT uPosFlags = SWP_NOZORDER | SWP_NOACTIVATE;
3248 HWND parent;
3249 INT x, y, cx, cy;
3250
3251 parent = GetParent (infoPtr->hwndSelf);
3252
3253 if (!parent || !infoPtr->bDoRedraw)
3254 return 0;
3255
3256 GetClientRect(parent, &parent_rect);
3257
3258 x = parent_rect.left;
3259 y = parent_rect.top;
3260
3261 cy = TOP_BORDER + infoPtr->nRows * infoPtr->nButtonHeight + BOTTOM_BORDER;
3262 cx = parent_rect.right - parent_rect.left;
3263
3264 if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_NOMOVEY)
3265 {
3266 GetWindowRect(infoPtr->hwndSelf, &window_rect);
3267 MapWindowPoints( 0, parent, (POINT *)&window_rect, 2 );
3268 y = window_rect.top;
3269 }
3270 if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_BOTTOM)
3271 {
3272 GetWindowRect(infoPtr->hwndSelf, &window_rect);
3273 y = parent_rect.bottom - ( window_rect.bottom - window_rect.top);
3274 }
3275
3276 if (infoPtr->dwStyle & CCS_NOPARENTALIGN)
3277 uPosFlags |= SWP_NOMOVE;
3278
3279 if (!(infoPtr->dwStyle & CCS_NODIVIDER))
3281
3282 if (infoPtr->dwStyle & WS_BORDER)
3283 {
3286 }
3287
3288 SetWindowPos(infoPtr->hwndSelf, NULL, x, y, cx, cy, uPosFlags);
3289 }
3290
3291 if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL))
3292 {
3293 TOOLBAR_LayoutToolbar(infoPtr);
3294 InvalidateRect( infoPtr->hwndSelf, NULL, TRUE );
3295 }
3296
3297 return 0;
3298}
#define BOTTOM_BORDER
Definition: toolbar.c:204
static void TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1834
r parent
Definition: btrfs.c:3010
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define WS_BORDER
Definition: pedump.c:625
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:990
BOOL bDoRedraw
Definition: toolbar.c:159
INT nButtonHeight
Definition: toolbar.c:121
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 SWP_NOACTIVATE
Definition: winuser.h:1245
#define SM_CYEDGE
Definition: winuser.h:1012
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1247
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define SM_CYBORDER
Definition: winuser.h:968
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SM_CXBORDER
Definition: winuser.h:967
HWND WINAPI GetParent(_In_ HWND)
#define SWP_NOZORDER
Definition: winuser.h:1250
int WINAPI GetSystemMetrics(_In_ int)

Referenced by TOOLBAR_InternalInsertButtonsT(), TOOLBAR_MoveButton(), TOOLBAR_SetExtendedStyle(), TOOLBAR_SetStyle(), TOOLBAR_Size(), and ToolbarWindowProc().

◆ TOOLBAR_ButtonCount()

static LRESULT TOOLBAR_ButtonCount ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3302 of file toolbar.c.

3303{
3304 return infoPtr->nNumButtons;
3305}
INT nNumButtons
Definition: toolbar.c:130

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ButtonHasString()

static BOOL TOOLBAR_ButtonHasString ( const TBUTTON_INFO btnPtr)
inlinestatic

Definition at line 356 of file toolbar.c.

357{
358 return HIWORD(btnPtr->iString) && btnPtr->iString != -1;
359}
#define HIWORD(l)
Definition: typedefs.h:247

Referenced by set_string_index(), and TOOLBAR_InternalInsertButtonsT().

◆ TOOLBAR_ButtonStructSize()

static LRESULT TOOLBAR_ButtonStructSize ( TOOLBAR_INFO infoPtr,
DWORD  Size 
)
inlinestatic

Definition at line 3309 of file toolbar.c.

3310{
3311 infoPtr->dwStructSize = Size;
3312
3313 return 0;
3314}
DWORD dwStructSize
Definition: toolbar.c:118
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CalcStrings()

static void TOOLBAR_CalcStrings ( const TOOLBAR_INFO infoPtr,
LPSIZE  lpSize 
)
static

Definition at line 1410 of file toolbar.c.

1411{
1412 TBUTTON_INFO *btnPtr;
1413 INT i;
1414 SIZE sz;
1415 HDC hdc;
1416 HFONT hOldFont;
1417
1418 lpSize->cx = 0;
1419 lpSize->cy = 0;
1420
1421 if (infoPtr->nMaxTextRows == 0)
1422 return;
1423
1424 hdc = GetDC (infoPtr->hwndSelf);
1425 hOldFont = SelectObject (hdc, infoPtr->hFont);
1426
1427 if (infoPtr->nNumButtons == 0 && infoPtr->nNumStrings > 0)
1428 {
1430
1432 lpSize->cy = tm.tmHeight;
1433 }
1434
1435 btnPtr = infoPtr->buttons;
1436 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) {
1437 if(TOOLBAR_GetText(infoPtr, btnPtr))
1438 {
1439 TOOLBAR_MeasureString(infoPtr, btnPtr, hdc, &sz);
1440 if (sz.cx > lpSize->cx)
1441 lpSize->cx = sz.cx;
1442 if (sz.cy > lpSize->cy)
1443 lpSize->cy = sz.cy;
1444 }
1445 }
1446
1447 SelectObject (hdc, hOldFont);
1448 ReleaseDC (infoPtr->hwndSelf, hdc);
1449
1450 TRACE("max string size %d x %d\n", lpSize->cx, lpSize->cy);
1451}
static LPWSTR TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
Definition: toolbar.c:299
static void TOOLBAR_MeasureString(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr, HDC hdc, LPSIZE lpSize)
Definition: toolbar.c:1367
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HFONT hFont
Definition: toolbar.c:147
TBUTTON_INFO * buttons
Definition: toolbar.c:174
INT nMaxTextRows
Definition: toolbar.c:127
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
LONG cx
Definition: windef.h:334
LONG cy
Definition: windef.h:335
Definition: time.h:68
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by TOOLBAR_CalcToolbar().

◆ TOOLBAR_CalcToolbar()

static void TOOLBAR_CalcToolbar ( TOOLBAR_INFO infoPtr)
static

Definition at line 1809 of file toolbar.c.

1810{
1811 SIZE sizeString, sizeButton;
1812 BOOL validImageList = FALSE;
1813
1814 TOOLBAR_CalcStrings (infoPtr, &sizeString);
1815
1816 TOOLBAR_DumpToolbar (infoPtr, __LINE__);
1817
1818 if (TOOLBAR_IsValidImageList(infoPtr, 0))
1819 validImageList = TRUE;
1820 sizeButton = TOOLBAR_MeasureButton(infoPtr, sizeString, TRUE, validImageList);
1821 infoPtr->nButtonWidth = sizeButton.cx;
1822 infoPtr->nButtonHeight = sizeButton.cy;
1823 infoPtr->iTopMargin = default_top_margin(infoPtr);
1824
1825 if ( infoPtr->cxMin >= 0 && infoPtr->nButtonWidth < infoPtr->cxMin )
1826 infoPtr->nButtonWidth = infoPtr->cxMin;
1827 if ( infoPtr->cxMax > 0 && infoPtr->nButtonWidth > infoPtr->cxMax )
1828 infoPtr->nButtonWidth = infoPtr->cxMax;
1829
1830 TOOLBAR_LayoutToolbar(infoPtr);
1831}
static SIZE TOOLBAR_MeasureButton(const TOOLBAR_INFO *infoPtr, SIZE sizeString, BOOL bHasBitmap, BOOL bValidImageList)
Definition: toolbar.c:1733
static int default_top_margin(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:268
static void TOOLBAR_DumpToolbar(const TOOLBAR_INFO *iP, INT line)
Definition: toolbar.c:336
static BOOL TOOLBAR_IsValidImageList(const TOOLBAR_INFO *infoPtr, INT index)
Definition: toolbar.c:478
static void TOOLBAR_CalcStrings(const TOOLBAR_INFO *infoPtr, LPSIZE lpSize)
Definition: toolbar.c:1410
INT nButtonWidth
Definition: toolbar.c:122
INT iTopMargin
Definition: toolbar.c:144

Referenced by TOOLBAR_AddBitmap(), TOOLBAR_AddStringA(), TOOLBAR_AddStringW(), TOOLBAR_InternalInsertButtonsT(), TOOLBAR_SetBitmapSize(), TOOLBAR_SetButtonWidth(), TOOLBAR_SetExtendedStyle(), TOOLBAR_SetFont(), TOOLBAR_SetImageList(), TOOLBAR_SetIndent(), TOOLBAR_SetMaxTextRows(), TOOLBAR_SetRows(), TOOLBAR_SetState(), and TOOLBAR_SetStyle().

◆ TOOLBAR_CaptureChanged()

static LRESULT TOOLBAR_CaptureChanged ( TOOLBAR_INFO infoPtr)
static

Definition at line 6149 of file toolbar.c.

6150{
6151 TBUTTON_INFO *btnPtr;
6152
6153 infoPtr->bCaptured = FALSE;
6154
6155 if (infoPtr->nButtonDown >= 0)
6156 {
6157 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
6158 btnPtr->fsState &= ~TBSTATE_PRESSED;
6159
6160 infoPtr->nOldHit = -1;
6161
6162 if (btnPtr->fsState & TBSTATE_ENABLED)
6163 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
6164 }
6165 return 0;
6166}
#define TBSTATE_ENABLED
Definition: commctrl.h:974
RECT rect
Definition: toolbar.c:99
BYTE fsState
Definition: toolbar.c:92
BOOL bCaptured
Definition: toolbar.c:162
INT nOldHit
Definition: toolbar.c:136
INT nButtonDown
Definition: toolbar.c:134

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ChangeBitmap()

static LRESULT TOOLBAR_ChangeBitmap ( TOOLBAR_INFO infoPtr,
INT  Id,
INT  Index 
)
static

Definition at line 3318 of file toolbar.c.

3319{
3320 TBUTTON_INFO *btnPtr;
3321 INT nIndex;
3322
3323 TRACE("button %d, iBitmap now %d\n", Id, Index);
3324
3325 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3326 if (nIndex == -1)
3327 return FALSE;
3328
3329 btnPtr = &infoPtr->buttons[nIndex];
3330 btnPtr->iBitmap = Index;
3331
3332 /* we HAVE to erase the background, the new bitmap could be */
3333 /* transparent */
3334 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3335
3336 return TRUE;
3337}
DWORD Id
static INT TOOLBAR_GetButtonIndex(const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
Definition: toolbar.c:2079
INT iBitmap
Definition: toolbar.c:90
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CheckButton()

static LRESULT TOOLBAR_CheckButton ( TOOLBAR_INFO infoPtr,
INT  Id,
LPARAM  lParam 
)
static

Definition at line 3341 of file toolbar.c.

3342{
3343 TBUTTON_INFO *btnPtr;
3344 INT nIndex;
3345 INT nOldIndex = -1;
3346 BOOL bChecked = FALSE;
3347
3348 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3349
3350 TRACE("hwnd=%p, btn index=%d, lParam=0x%08lx\n", infoPtr->hwndSelf, nIndex, lParam);
3351
3352 if (nIndex == -1)
3353 return FALSE;
3354
3355 btnPtr = &infoPtr->buttons[nIndex];
3356
3357 bChecked = (btnPtr->fsState & TBSTATE_CHECKED) != 0;
3358
3359 if (!LOWORD(lParam))
3360 btnPtr->fsState &= ~TBSTATE_CHECKED;
3361 else {
3362 if (btnPtr->fsStyle & BTNS_GROUP) {
3363 nOldIndex =
3364 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex);
3365 if (nOldIndex == nIndex)
3366 return 0;
3367 if (nOldIndex != -1)
3368 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;
3369 }
3370 btnPtr->fsState |= TBSTATE_CHECKED;
3371 }
3372
3373 if( bChecked != LOWORD(lParam) )
3374 {
3375 if (nOldIndex != -1)
3376 InvalidateRect(infoPtr->hwndSelf, &infoPtr->buttons[nOldIndex].rect, TRUE);
3377 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3378 }
3379
3380 /* FIXME: Send a WM_NOTIFY?? */
3381
3382 return TRUE;
3383}
static INT TOOLBAR_GetCheckedGroupButtonIndex(const TOOLBAR_INFO *infoPtr, INT nIndex)
Definition: toolbar.c:2102
if(dx< 0)
Definition: linetemp.h:194
#define BTNS_GROUP
Definition: commctrl.h:1001
#define TBSTATE_CHECKED
Definition: commctrl.h:972

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CheckImageListIconSize()

static void TOOLBAR_CheckImageListIconSize ( TOOLBAR_INFO infoPtr)
static

Definition at line 2956 of file toolbar.c.

2957{
2958 HIMAGELIST himlDef;
2959 HIMAGELIST himlNew;
2960 INT cx, cy;
2961 INT i;
2962
2963 himlDef = GETDEFIMAGELIST(infoPtr, 0);
2964 if (himlDef == NULL || himlDef != infoPtr->himlInt)
2965 return;
2966 if (!ImageList_GetIconSize(himlDef, &cx, &cy))
2967 return;
2968 if (cx == infoPtr->nBitmapWidth && cy == infoPtr->nBitmapHeight)
2969 return;
2970
2971 TRACE("Update icon size: %dx%d -> %dx%d\n",
2972 cx, cy, infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
2973
2974 himlNew = ImageList_Create(infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
2975 ILC_COLOR32|ILC_MASK, 8, 2);
2976 for (i = 0; i < infoPtr->nNumBitmapInfos; i++)
2977 TOOLBAR_AddBitmapToImageList(infoPtr, himlNew, &infoPtr->bitmaps[i]);
2978 TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlNew, 0);
2979 infoPtr->himlInt = himlNew;
2980
2981 infoPtr->nNumBitmaps -= ImageList_GetImageCount(himlDef);
2982 ImageList_Destroy(himlDef);
2983}
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928

Referenced by TOOLBAR_Refresh().

◆ TOOLBAR_CheckStyle()

static void TOOLBAR_CheckStyle ( const TOOLBAR_INFO infoPtr)
static

Definition at line 400 of file toolbar.c.

401{
402 if (infoPtr->dwStyle & TBSTYLE_REGISTERDROP)
403 FIXME("[%p] TBSTYLE_REGISTERDROP not implemented\n", infoPtr->hwndSelf);
404}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define TBSTYLE_REGISTERDROP
Definition: commctrl.h:995

Referenced by TOOLBAR_Create(), and TOOLBAR_SetStyle().

◆ TOOLBAR_CommandToIndex()

static LRESULT TOOLBAR_CommandToIndex ( const TOOLBAR_INFO infoPtr,
INT  Id 
)
static

Definition at line 3387 of file toolbar.c.

3388{
3389 return TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3390}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Create()

static LRESULT TOOLBAR_Create ( HWND  hwnd,
const CREATESTRUCTW lpcs 
)
static

Definition at line 5554 of file toolbar.c.

5555{
5557 LOGFONTW logFont;
5558
5559 TRACE("hwnd = %p, style=0x%08x\n", hwnd, lpcs->style);
5560
5561 infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
5562 GetClientRect(hwnd, &infoPtr->client_rect);
5563 infoPtr->bUnicode = infoPtr->hwndNotify &&
5564 (NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_REQUERY));
5565 infoPtr->hwndToolTip = NULL; /* if needed the tooltip control will be created after a WM_MOUSEMOVE */
5566
5568 infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont);
5569
5570#ifdef __REACTOS__
5571 {
5573 if (theme)
5574 GetThemeMargins(theme, NULL, TP_BUTTON, TS_NORMAL, TMT_CONTENTMARGINS, NULL, &infoPtr->themeMargins);
5575 }
5576#else
5578#endif
5579
5580 TOOLBAR_CheckStyle (infoPtr);
5581
5582 return 0;
5583}
static void TOOLBAR_CheckStyle(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:400
HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, RECT *prc, MARGINS *pMargins)
Definition: property.c:216
RECT client_rect
Definition: toolbar.c:119
BOOL bUnicode
Definition: toolbar.c:161
HFONT hDefaultFont
Definition: toolbar.c:146
HWND hwndNotify
Definition: toolbar.c:156
HWND hwndToolTip
Definition: toolbar.c:155
@ TP_BUTTON
Definition: vsstyle.h:1394
@ TS_NORMAL
Definition: vsstyle.h:1405
#define TMT_CONTENTMARGINS
Definition: vssym32.h:324
UINT_PTR WPARAM
Definition: windef.h:207
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define GetWindowLongPtrW
Definition: winuser.h:4832
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1383
#define NF_REQUERY
Definition: winuser.h:2464
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define NFR_UNICODE
Definition: winuser.h:2462
#define GWL_STYLE
Definition: winuser.h:855

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Cust_AddButton()

static void TOOLBAR_Cust_AddButton ( const CUSTDLG_INFO custInfo,
HWND  hwnd,
INT  nIndexAvail,
INT  nIndexTo 
)
static

Definition at line 2311 of file toolbar.c.

2312{
2313 NMTOOLBARW nmtb;
2314
2315 TRACE("Add: nIndexAvail %d, nIndexTo %d\n", nIndexAvail, nIndexTo);
2316
2317 /* MSDN states that iItem is the index of the button, rather than the
2318 * command ID as used by every other NMTOOLBAR notification */
2319 nmtb.iItem = nIndexAvail;
2320 if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
2321 {
2322 PCUSTOMBUTTON btnInfo;
2323 NMHDR hdr;
2325 HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2326 int count = SendMessageW(hwndAvail, LB_GETCOUNT, 0, 0);
2327
2328 btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndAvail, LB_GETITEMDATA, nIndexAvail, 0);
2329
2330 if (nIndexAvail != 0) /* index == 0 indicates separator */
2331 {
2332 /* remove from 'available buttons' list */
2333 SendMessageW(hwndAvail, LB_DELETESTRING, nIndexAvail, 0);
2334 if (nIndexAvail == count-1)
2335 SendMessageW(hwndAvail, LB_SETCURSEL, nIndexAvail-1 , 0);
2336 else
2337 SendMessageW(hwndAvail, LB_SETCURSEL, nIndexAvail , 0);
2338 }
2339 else
2340 {
2341 PCUSTOMBUTTON btnNew;
2342
2343 /* duplicate 'separator' button */
2344 btnNew = Alloc(sizeof(CUSTOMBUTTON));
2345 *btnNew = *btnInfo;
2346 btnInfo = btnNew;
2347 }
2348
2349 /* insert into 'toolbar button' list */
2350 SendMessageW(hwndList, LB_INSERTSTRING, nIndexTo, 0);
2351 SendMessageW(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
2352
2353 SendMessageW(custInfo->tbHwnd, TB_INSERTBUTTONW, nIndexTo, (LPARAM)&(btnInfo->btn));
2354
2356 }
2357}
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:66
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:68
struct CUSTOMBUTTON * PCUSTOMBUTTON
static INT TOOLBAR_SendNotify(NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
Definition: toolbar.c:408
char hdr[14]
Definition: iptest.cpp:33
#define TBN_TOOLBARCHANGE
Definition: commctrl.h:1314
#define TBN_QUERYINSERT
Definition: commctrl.h:1312
#define TB_INSERTBUTTONW
Definition: commctrl.h:1265
PTOOLBAR_INFO tbInfo
Definition: toolbar.c:183
HWND tbHwnd
Definition: toolbar.c:184
TBBUTTON btn
Definition: toolbar.c:189
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETCOUNT
Definition: winuser.h:2041
#define LB_GETITEMDATA
Definition: winuser.h:2044
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define LB_DELETESTRING
Definition: winuser.h:2035
#define LB_INSERTSTRING
Definition: winuser.h:2056
#define LB_SETITEMDATA
Definition: winuser.h:2068
#define LB_SETCURSEL
Definition: winuser.h:2066

Referenced by TOOLBAR_Cust_AvailDragListNotification(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_AvailDragListNotification()

static LRESULT TOOLBAR_Cust_AvailDragListNotification ( const CUSTDLG_INFO custInfo,
HWND  hwnd,
const DRAGLISTINFO pDLI 
)
static

Definition at line 2464 of file toolbar.c.

2466{
2468 switch (pDLI->uNotification)
2469 {
2470 case DL_BEGINDRAG:
2471 return TRUE;
2472 case DL_DRAGGING:
2473 {
2474 INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2475 INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2476 /* no dragging past last item (separator) */
2477 if ((nCurrentItem >= 0) && (nCurrentItem < nCount))
2478 {
2479 DrawInsert(hwnd, hwndList, nCurrentItem);
2480 /* FIXME: native uses "move button" cursor */
2481 return DL_COPYCURSOR;
2482 }
2483
2484 /* not over toolbar buttons list */
2485 if (nCurrentItem < 0)
2486 {
2487 POINT ptWindow = pDLI->ptCursor;
2488 HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2489 MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2490 /* over available buttons list? */
2491 if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2492 /* FIXME: native uses "move button" cursor */
2493 return DL_COPYCURSOR;
2494 }
2495 /* clear drag arrow */
2496 DrawInsert(hwnd, hwndList, -1);
2497 return DL_STOPCURSOR;
2498 }
2499 case DL_DROPPED:
2500 {
2501 INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2502 INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2504 if ((nIndexTo >= 0) && (nIndexTo < nCount))
2505 {
2506 /* clear drag arrow */
2507 DrawInsert(hwnd, hwndList, -1);
2508 /* add item */
2509 TOOLBAR_Cust_AddButton(custInfo, hwnd, nIndexFrom, nIndexTo);
2510 }
2511 }
2512 case DL_CANCELDRAG:
2513 /* Clear drag arrow */
2514 DrawInsert(hwnd, hwndList, -1);
2515 break;
2516 }
2517 return 0;
2518}
static void TOOLBAR_Cust_AddButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexAvail, INT nIndexTo)
Definition: toolbar.c:2311
VOID WINAPI DrawInsert(HWND hwndParent, HWND hwndLB, INT nItem)
Definition: draglist.c:228
INT WINAPI LBItemFromPt(HWND hwndLB, POINT pt, BOOL bAutoScroll)
Definition: draglist.c:293
#define DL_BEGINDRAG
Definition: commctrl.h:2102
#define DL_CANCELDRAG
Definition: commctrl.h:2105
#define DL_COPYCURSOR
Definition: commctrl.h:2109
#define DL_DRAGGING
Definition: commctrl.h:2103
#define DL_STOPCURSOR
Definition: commctrl.h:2108
#define DL_DROPPED
Definition: commctrl.h:2104
UINT uNotification
Definition: commctrl.h:2097
HWND WINAPI ChildWindowFromPoint(_In_ HWND, _In_ POINT)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2042

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_InsertAvailButton()

static void TOOLBAR_Cust_InsertAvailButton ( HWND  hwnd,
PCUSTOMBUTTON  btnInfoNew 
)
static

Definition at line 2240 of file toolbar.c.

2241{
2242 int i;
2243 int count;
2244 PCUSTOMBUTTON btnInfo;
2245 HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2246
2247 TRACE("button %s, idCommand %d\n", debugstr_w(btnInfoNew->text), btnInfoNew->btn.idCommand);
2248
2249 count = SendMessageW(hwndAvail, LB_GETCOUNT, 0, 0);
2250
2251 /* position 0 is always separator */
2252 for (i = 1; i < count; i++)
2253 {
2254 btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndAvail, LB_GETITEMDATA, i, 0);
2255 if (btnInfoNew->btn.idCommand < btnInfo->btn.idCommand)
2256 {
2257 i = SendMessageW(hwndAvail, LB_INSERTSTRING, i, 0);
2258 SendMessageW(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
2259 return;
2260 }
2261 }
2262 /* id higher than all others add to end */
2263 i = SendMessageW(hwndAvail, LB_ADDSTRING, 0, 0);
2264 SendMessageW(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
2265}
WCHAR text[64]
Definition: toolbar.c:192
int idCommand
Definition: commctrl.h:950
#define LB_ADDSTRING
Definition: winuser.h:2034

Referenced by TOOLBAR_Cust_RemoveButton(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_MoveButton()

static void TOOLBAR_Cust_MoveButton ( const CUSTDLG_INFO custInfo,
HWND  hwnd,
INT  nIndexFrom,
INT  nIndexTo 
)
static

Definition at line 2267 of file toolbar.c.

2268{
2269 NMTOOLBARW nmtb;
2270
2271 TRACE("index from %d, index to %d\n", nIndexFrom, nIndexTo);
2272
2273 if (nIndexFrom == nIndexTo)
2274 return;
2275
2276 /* MSDN states that iItem is the index of the button, rather than the
2277 * command ID as used by every other NMTOOLBAR notification */
2278 nmtb.iItem = nIndexFrom;
2279 if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
2280 {
2281 PCUSTOMBUTTON btnInfo;
2282 NMHDR hdr;
2284 int count = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2285
2286 btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndList, LB_GETITEMDATA, nIndexFrom, 0);
2287
2288 SendMessageW(hwndList, LB_DELETESTRING, nIndexFrom, 0);
2289 SendMessageW(hwndList, LB_INSERTSTRING, nIndexTo, 0);
2290 SendMessageW(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
2291 SendMessageW(hwndList, LB_SETCURSEL, nIndexTo, 0);
2292
2293 if (nIndexTo <= 0)
2295 else
2297
2298 /* last item is always separator, so -2 instead of -1 */
2299 if (nIndexTo >= (count - 2))
2301 else
2303
2304 SendMessageW(custInfo->tbHwnd, TB_DELETEBUTTON, nIndexFrom, 0);
2305 SendMessageW(custInfo->tbHwnd, TB_INSERTBUTTONW, nIndexTo, (LPARAM)&(btnInfo->btn));
2306
2308 }
2309}
#define IDC_MOVEDN_BTN
Definition: comctl32.h:72
#define IDC_MOVEUP_BTN
Definition: comctl32.h:71
#define TB_DELETEBUTTON
Definition: commctrl.h:1108
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by TOOLBAR_Cust_ToolbarDragListNotification(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_RemoveButton()

static void TOOLBAR_Cust_RemoveButton ( const CUSTDLG_INFO custInfo,
HWND  hwnd,
INT  index 
)
static

Definition at line 2359 of file toolbar.c.

2360{
2361 PCUSTOMBUTTON btnInfo;
2363
2364 TRACE("Remove: index %d\n", index);
2365
2366 btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndList, LB_GETITEMDATA, index, 0);
2367
2368 /* send TBN_QUERYDELETE notification */
2369 if (TOOLBAR_IsButtonRemovable(custInfo->tbInfo, index, btnInfo))
2370 {
2371 NMHDR hdr;
2372
2373 SendMessageW(hwndList, LB_DELETESTRING, index, 0);
2374 SendMessageW(hwndList, LB_SETCURSEL, index , 0);
2375
2376 SendMessageW(custInfo->tbHwnd, TB_DELETEBUTTON, index, 0);
2377
2378 /* insert into 'available button' list */
2379 if (!(btnInfo->btn.fsStyle & BTNS_SEP))
2381 else
2382 Free(btnInfo);
2383
2385 }
2386}
static BOOL TOOLBAR_IsButtonRemovable(const TOOLBAR_INFO *infoPtr, int iItem, const CUSTOMBUTTON *btnInfo)
Definition: toolbar.c:7453
static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew)
Definition: toolbar.c:2240
GLuint index
Definition: glext.h:6031
#define BTNS_SEP
Definition: commctrl.h:999
BYTE fsStyle
Definition: commctrl.h:952

Referenced by TOOLBAR_Cust_ToolbarDragListNotification(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_ToolbarDragListNotification()

static LRESULT TOOLBAR_Cust_ToolbarDragListNotification ( const CUSTDLG_INFO custInfo,
HWND  hwnd,
const DRAGLISTINFO pDLI 
)
static

Definition at line 2389 of file toolbar.c.

2391{
2393 switch (pDLI->uNotification)
2394 {
2395 case DL_BEGINDRAG:
2396 {
2397 INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2398 INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2399 /* no dragging for last item (separator) */
2400 if (nCurrentItem >= (nCount - 1)) return FALSE;
2401 return TRUE;
2402 }
2403 case DL_DRAGGING:
2404 {
2405 INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2406 INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2407 /* no dragging past last item (separator) */
2408 if ((nCurrentItem >= 0) && (nCurrentItem < (nCount - 1)))
2409 {
2410 DrawInsert(hwnd, hwndList, nCurrentItem);
2411 /* FIXME: native uses "move button" cursor */
2412 return DL_COPYCURSOR;
2413 }
2414
2415 /* not over toolbar buttons list */
2416 if (nCurrentItem < 0)
2417 {
2418 POINT ptWindow = pDLI->ptCursor;
2419 HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2420 MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2421 /* over available buttons list? */
2422 if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2423 /* FIXME: native uses "move button" cursor */
2424 return DL_COPYCURSOR;
2425 }
2426 /* clear drag arrow */
2427 DrawInsert(hwnd, hwndList, -1);
2428 return DL_STOPCURSOR;
2429 }
2430 case DL_DROPPED:
2431 {
2432 INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2433 INT nIndexFrom = SendMessageW(hwndList, LB_GETCURSEL, 0, 0);
2434 INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2435 if ((nIndexTo >= 0) && (nIndexTo < (nCount - 1)))
2436 {
2437 /* clear drag arrow */
2438 DrawInsert(hwnd, hwndList, -1);
2439 /* move item */
2440 TOOLBAR_Cust_MoveButton(custInfo, hwnd, nIndexFrom, nIndexTo);
2441 }
2442 /* not over toolbar buttons list */
2443 if (nIndexTo < 0)
2444 {
2445 POINT ptWindow = pDLI->ptCursor;
2446 HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2447 MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2448 /* over available buttons list? */
2449 if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2450 TOOLBAR_Cust_RemoveButton(custInfo, hwnd, nIndexFrom);
2451 }
2452 break;
2453 }
2454 case DL_CANCELDRAG:
2455 /* Clear drag arrow */
2456 DrawInsert(hwnd, hwndList, -1);
2457 break;
2458 }
2459
2460 return 0;
2461}
static void TOOLBAR_Cust_MoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo)
Definition: toolbar.c:2267
static void TOOLBAR_Cust_RemoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT index)
Definition: toolbar.c:2359

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Customize()

static LRESULT TOOLBAR_Customize ( TOOLBAR_INFO infoPtr)
static

Definition at line 3394 of file toolbar.c.

3395{
3396 CUSTDLG_INFO custInfo;
3397 LRESULT ret;
3398 NMHDR nmhdr;
3399
3400 custInfo.tbInfo = infoPtr;
3401 custInfo.tbHwnd = infoPtr->hwndSelf;
3402
3403 /* send TBN_BEGINADJUST notification */
3404 TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_BEGINADJUST);
3405
3407 infoPtr->hwndSelf, TOOLBAR_CustomizeDialogProc, (LPARAM)&custInfo);
3408
3409 /* send TBN_ENDADJUST notification */
3410 TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_ENDADJUST);
3411
3412 return ret;
3413}
#define IDD_TBCUSTOMIZE
Definition: comctl32.h:64
static INT_PTR CALLBACK TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:2527
#define TBN_ENDADJUST
Definition: commctrl.h:1310
#define TBN_BEGINADJUST
Definition: commctrl.h:1309
int ret
LONG_PTR LRESULT
Definition: windef.h:209
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by TOOLBAR_LButtonDblClk(), and ToolbarWindowProc().

◆ TOOLBAR_CustomizeDialogProc()

static INT_PTR CALLBACK TOOLBAR_CustomizeDialogProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2527 of file toolbar.c.

2528{
2530 PCUSTOMBUTTON btnInfo;
2531 NMTOOLBARA nmtb;
2532 TOOLBAR_INFO *infoPtr = custInfo ? custInfo->tbInfo : NULL;
2533
2534 switch (uMsg)
2535 {
2536 case WM_INITDIALOG:
2537 custInfo = (PCUSTDLG_INFO)lParam;
2539
2540 if (custInfo)
2541 {
2542 WCHAR Buffer[256];
2543 int i = 0;
2544 int index;
2545 NMTBINITCUSTOMIZE nmtbic;
2546
2547 infoPtr = custInfo->tbInfo;
2548
2549 /* send TBN_QUERYINSERT notification */
2550 nmtb.iItem = custInfo->tbInfo->nNumButtons;
2551
2552 if (!TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT))
2553 return FALSE;
2554
2555 nmtbic.hwndDialog = hwnd;
2556 /* Send TBN_INITCUSTOMIZE notification */
2557 if (TOOLBAR_SendNotify (&nmtbic.hdr, infoPtr, TBN_INITCUSTOMIZE) ==
2559 {
2560 TRACE("TBNRF_HIDEHELP requested\n");
2562 }
2563
2564 /* add items to 'toolbar buttons' list and check if removable */
2565 for (i = 0; i < custInfo->tbInfo->nNumButtons; i++)
2566 {
2567 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2568 memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2569 btnInfo->btn.fsStyle = BTNS_SEP;
2570 btnInfo->bVirtual = FALSE;
2572
2573 /* send TBN_QUERYDELETE notification */
2574 btnInfo->bRemovable = TOOLBAR_IsButtonRemovable(infoPtr, i, btnInfo);
2575
2578 }
2579
2581
2582 /* insert separator button into 'available buttons' list */
2583 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2584 memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2585 btnInfo->btn.fsStyle = BTNS_SEP;
2586 btnInfo->bVirtual = FALSE;
2587 btnInfo->bRemovable = TRUE;
2591
2592 /* insert all buttons into dsa */
2593 for (i = 0;; i++)
2594 {
2595 /* send TBN_GETBUTTONINFO notification */
2596 NMTOOLBARW nmtb;
2597 nmtb.iItem = i;
2598 nmtb.pszText = Buffer;
2599 nmtb.cchText = 256;
2600
2601 /* Clear previous button's text */
2602 ZeroMemory(nmtb.pszText, nmtb.cchText * sizeof(WCHAR));
2603
2604 if (!TOOLBAR_GetButtonInfo(infoPtr, &nmtb))
2605 break;
2606
2607 TRACE("WM_INITDIALOG style: %x iItem(%d) idCommand(%d) iString(%ld) %s\n",
2608 nmtb.tbButton.fsStyle, i,
2609 nmtb.tbButton.idCommand,
2610 nmtb.tbButton.iString,
2611 nmtb.tbButton.iString >= 0 ? debugstr_w(infoPtr->strings[nmtb.tbButton.iString])
2612 : "");
2613
2614 /* insert button into the appropriate list */
2616 if (index == -1)
2617 {
2618 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2619 btnInfo->bVirtual = FALSE;
2620 btnInfo->bRemovable = TRUE;
2621 }
2622 else
2623 {
2626 }
2627
2628 btnInfo->btn = nmtb.tbButton;
2629 if (!(nmtb.tbButton.fsStyle & BTNS_SEP))
2630 {
2631 if (*nmtb.pszText)
2632 lstrcpyW(btnInfo->text, nmtb.pszText);
2633 else if (nmtb.tbButton.iString >= 0 &&
2634 nmtb.tbButton.iString < infoPtr->nNumStrings)
2635 {
2636 lstrcpyW(btnInfo->text,
2637 infoPtr->strings[nmtb.tbButton.iString]);
2638 }
2639 }
2640
2641 if (index == -1)
2643 }
2644
2646
2647 /* select first item in the 'available' list */
2649
2650 /* append 'virtual' separator button to the 'toolbar buttons' list */
2651 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2652 memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2653 btnInfo->btn.fsStyle = BTNS_SEP;
2654 btnInfo->bVirtual = TRUE;
2655 btnInfo->bRemovable = FALSE;
2659
2660 /* select last item in the 'toolbar' list */
2663
2666
2667 /* set focus and disable buttons */
2668 PostMessageW (hwnd, WM_USER, 0, 0);
2669 }
2670 return TRUE;
2671
2672 case WM_USER:
2677 return TRUE;
2678
2679 case WM_CLOSE:
2681 return TRUE;
2682
2683 case WM_COMMAND:
2684 switch (LOWORD(wParam))
2685 {
2687 if (HIWORD(wParam) == LBN_SELCHANGE)
2688 {
2689 PCUSTOMBUTTON btnInfo;
2690 NMTOOLBARA nmtb;
2691 int count;
2692 int index;
2693
2696
2697 /* send TBN_QUERYINSERT notification */
2698 nmtb.iItem = index;
2699 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT);
2700
2701 /* get list box item */
2703
2704 if (index == (count - 1))
2705 {
2706 /* last item (virtual separator) */
2709 }
2710 else if (index == (count - 2))
2711 {
2712 /* second last item (last non-virtual item) */
2715 }
2716 else if (index == 0)
2717 {
2718 /* first item */
2721 }
2722 else
2723 {
2726 }
2727
2729 }
2730 break;
2731
2732 case IDC_MOVEUP_BTN:
2733 {
2735 TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index-1);
2736 }
2737 break;
2738
2739 case IDC_MOVEDN_BTN: /* move down */
2740 {
2742 TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index+1);
2743 }
2744 break;
2745
2746 case IDC_REMOVE_BTN: /* remove button */
2747 {
2749
2750 if (LB_ERR == index)
2751 break;
2752
2754 }
2755 break;
2756 case IDC_HELP_BTN:
2757 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_CUSTHELP);
2758 break;
2759 case IDC_RESET_BTN:
2760 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_RESET);
2761 break;
2762
2763 case IDOK: /* Add button */
2764 {
2765 int index;
2766 int indexto;
2767
2770
2771 TOOLBAR_Cust_AddButton(custInfo, hwnd, index, indexto);
2772 }
2773 break;
2774
2775 case IDCANCEL:
2777 break;
2778 }
2779 return TRUE;
2780
2781 case WM_DESTROY:
2782 {
2783 int count;
2784 int i;
2785
2786 /* delete items from 'toolbar buttons' listbox*/
2788 for (i = 0; i < count; i++)
2789 {
2791 Free(btnInfo);
2793 }
2795
2796
2797 /* delete items from 'available buttons' listbox*/
2799 for (i = 0; i < count; i++)
2800 {
2802 Free(btnInfo);
2804 }
2806 }
2807 return TRUE;
2808
2809 case WM_DRAWITEM:
2811 {
2813 RECT rcButton;
2814 RECT rcText;
2815 HPEN hPen, hOldPen;
2816 HBRUSH hOldBrush;
2817 COLORREF oldText = 0;
2818 COLORREF oldBk = 0;
2819
2820 /* get item data */
2822 if (btnInfo == NULL)
2823 {
2824 FIXME("btnInfo invalid\n");
2825 return TRUE;
2826 }
2827
2828 /* set colors and select objects */
2830 if (btnInfo->bVirtual)
2831 oldText = SetTextColor (lpdis->hDC, comctl32_color.clrGrayText);
2832 else
2834 hPen = CreatePen( PS_SOLID, 1,
2836 hOldPen = SelectObject (lpdis->hDC, hPen );
2838
2839 /* fill background rectangle */
2840 Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
2841 lpdis->rcItem.right, lpdis->rcItem.bottom);
2842
2843 /* calculate button and text rectangles */
2844 rcButton = lpdis->rcItem;
2845 InflateRect (&rcButton, -1, -1);
2846 rcText = rcButton;
2847 rcButton.right = rcButton.left + custInfo->tbInfo->nBitmapWidth + 6;
2848 rcText.left = rcButton.right + 2;
2849
2850 /* draw focus rectangle */
2851 if (lpdis->itemState & ODS_FOCUS)
2852 DrawFocusRect (lpdis->hDC, &lpdis->rcItem);
2853
2854 /* draw button */
2855 if (!(infoPtr->dwStyle & TBSTYLE_FLAT))
2856 DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT);
2857
2858 /* draw image and text */
2859 if ((btnInfo->btn.fsStyle & BTNS_SEP) == 0) {
2860 HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr,
2861 btnInfo->btn.iBitmap));
2862 ImageList_Draw (himl, GETIBITMAP(infoPtr, btnInfo->btn.iBitmap),
2863 lpdis->hDC, rcButton.left+3, rcButton.top+3, ILD_NORMAL);
2864 }
2865 DrawTextW (lpdis->hDC, btnInfo->text, -1, &rcText,
2867
2868 /* delete objects and reset colors */
2869 SelectObject (lpdis->hDC, hOldBrush);
2870 SelectObject (lpdis->hDC, hOldPen);
2871 SetBkColor (lpdis->hDC, oldBk);
2872 SetTextColor (lpdis->hDC, oldText);
2873 DeleteObject( hPen );
2874 return TRUE;
2875 }
2876 return FALSE;
2877
2878 case WM_MEASUREITEM:
2880 {
2882
2883 lpmis->itemHeight = 15 + 8; /* default height */
2884
2885 return TRUE;
2886 }
2887 return FALSE;
2888
2889 default:
2890 if (uDragListMessage && (uMsg == uDragListMessage))
2891 {
2893 {
2895 custInfo, hwnd, (DRAGLISTINFO *)lParam);
2897 return TRUE;
2898 }
2899 else if (wParam == IDC_AVAILBTN_LBOX)
2900 {
2902 custInfo, hwnd, (DRAGLISTINFO *)lParam);
2904 return TRUE;
2905 }
2906 }
2907 return FALSE;
2908 }
2909}
#define index(s, c)
Definition: various.h:29
HIMAGELIST himl
Definition: bufpool.h:45
WPARAM wParam
Definition: combotst.c:138
#define IDC_RESET_BTN
Definition: comctl32.h:67
#define IDC_REMOVE_BTN
Definition: comctl32.h:69
#define IDC_HELP_BTN
Definition: comctl32.h:70
#define IDS_SEPARATOR
Definition: comctl32.h:74
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
static BOOL TOOLBAR_GetButtonInfo(const TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
Definition: toolbar.c:7422
struct CUSTDLG_INFO * PCUSTDLG_INFO
#define GETHIMLID(infoPtr, i)
Definition: toolbar.c:245
static LRESULT TOOLBAR_Cust_AvailDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2464
#define GETIBITMAP(infoPtr, i)
Definition: toolbar.c:244
static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2389
#define lstrcpyW
Definition: compat.h:749
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
UINT uDragListMessage
Definition: draglist.c:73
BOOL WINAPI MakeDragList(HWND hwndLB)
Definition: draglist.c:208
GLuint res
Definition: glext.h:9613
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define ILD_NORMAL
Definition: commctrl.h:417
#define TBN_RESET
Definition: commctrl.h:1311
#define TBNRF_HIDEHELP
Definition: commctrl.h:1352
#define TBN_INITCUSTOMIZE
Definition: commctrl.h:1346
#define TBN_CUSTHELP
Definition: commctrl.h:1315
#define memset(x, y, z)
Definition: compat.h:39
COLORREF clrHighlightText
Definition: comctl32.h:176
COLORREF clrWindow
Definition: comctl32.h:182
COLORREF clrGrayText
Definition: comctl32.h:184
COLORREF clrWindowText
Definition: comctl32.h:183
COLORREF clrHighlight
Definition: comctl32.h:175
BOOL bRemovable
Definition: toolbar.c:191
BOOL bVirtual
Definition: toolbar.c:190
INT_PTR iString
Definition: commctrl.h:959
int iBitmap
Definition: commctrl.h:949
LPWSTR pszText
Definition: commctrl.h:1452
TBBUTTON tbButton
Definition: commctrl.h:1450
#define ZeroMemory
Definition: winbase.h:1712
DWORD COLORREF
Definition: windef.h:300
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586
#define LB_ERR
Definition: winuser.h:2435
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define ODS_SELECTED
Definition: winuser.h:2548
#define SW_HIDE
Definition: winuser.h:771
#define WM_CLOSE
Definition: winuser.h:1624
#define DWLP_USER
Definition: winuser.h:875
#define COLOR_WINDOW
Definition: winuser.h:921
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:834
#define LB_SETTOPINDEX
Definition: winuser.h:2073
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_HIGHLIGHT
Definition: winuser.h:929
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1743
#define BF_MIDDLE
Definition: winuser.h:468
#define WM_INITDIALOG
Definition: winuser.h:1742
#define IDOK
Definition: winuser.h:833
#define WM_DRAWITEM
Definition: winuser.h:1648
#define LB_SETITEMHEIGHT
Definition: winuser.h:2069
#define DT_LEFT
Definition: winuser.h:534
#define LB_RESETCONTENT
Definition: winuser.h:2058
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_MEASUREITEM
Definition: winuser.h:1649
#define DT_VCENTER
Definition: winuser.h:543
#define LBN_SELCHANGE
Definition: winuser.h:2078
#define DWLP_MSGRESULT
Definition: winuser.h:873
#define WM_USER
Definition: winuser.h:1898
#define WM_DESTROY
Definition: winuser.h:1612
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define BF_SOFT
Definition: winuser.h:469
#define SetWindowLongPtrW
Definition: winuser.h:5358
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define BF_RECT
Definition: winuser.h:462
#define EDGE_RAISED
Definition: winuser.h:450
#define ODS_FOCUS
Definition: winuser.h:2552
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by TOOLBAR_Customize().

◆ TOOLBAR_DeleteAllButtons()

static void TOOLBAR_DeleteAllButtons ( TOOLBAR_INFO infoPtr)
static

Definition at line 4363 of file toolbar.c.

4364{
4365 INT i;
4366
4367 for (i = 0; i < infoPtr->nNumButtons; i++)
4368 {
4369 free_string( infoPtr->buttons + i );
4370 TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[i]);
4371 }
4372
4373 Free(infoPtr->buttons);
4374 infoPtr->buttons = NULL;
4375 infoPtr->nNumButtons = 0;
4376}
static void free_string(TBUTTON_INFO *btn)
Definition: toolbar.c:386
static void TOOLBAR_TooltipDelTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
Definition: toolbar.c:2184

Referenced by TOOLBAR_Restore().

◆ TOOLBAR_DeleteButton()

static LRESULT TOOLBAR_DeleteButton ( TOOLBAR_INFO infoPtr,
INT  nIndex 
)
static

Definition at line 3417 of file toolbar.c.

3418{
3419 NMTOOLBARW nmtb;
3420 TBUTTON_INFO *btnPtr = &infoPtr->buttons[nIndex];
3421
3422 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
3423 return FALSE;
3424
3425 memset(&nmtb, 0, sizeof(nmtb));
3426 nmtb.iItem = btnPtr->idCommand;
3427 nmtb.tbButton.iBitmap = btnPtr->iBitmap;
3428 nmtb.tbButton.idCommand = btnPtr->idCommand;
3429 nmtb.tbButton.fsState = btnPtr->fsState;
3430 nmtb.tbButton.fsStyle = btnPtr->fsStyle;
3431 nmtb.tbButton.dwData = btnPtr->dwData;
3432 nmtb.tbButton.iString = btnPtr->iString;
3433 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_DELETINGBUTTON);
3434
3435 TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[nIndex]);
3436
3437 infoPtr->nHotItem = -1;
3438 if (infoPtr->nNumButtons == 1) {
3439 TRACE(" simple delete\n");
3440 free_string( infoPtr->buttons );
3441 Free (infoPtr->buttons);
3442 infoPtr->buttons = NULL;
3443 infoPtr->nNumButtons = 0;
3444 }
3445 else {
3446 TBUTTON_INFO *oldButtons = infoPtr->buttons;
3447 TRACE("complex delete [nIndex=%d]\n", nIndex);
3448
3449 infoPtr->nNumButtons--;
3450 infoPtr->buttons = Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons);
3451 if (nIndex > 0) {
3452 memcpy (&infoPtr->buttons[0], &oldButtons[0],
3453 nIndex * sizeof(TBUTTON_INFO));
3454 }
3455
3456 if (nIndex < infoPtr->nNumButtons) {
3457 memcpy (&infoPtr->buttons[nIndex], &oldButtons[nIndex+1],
3458 (infoPtr->nNumButtons - nIndex) * sizeof(TBUTTON_INFO));
3459 }
3460
3461 free_string( oldButtons + nIndex );
3462 Free (oldButtons);
3463 }
3464
3465 TOOLBAR_LayoutToolbar(infoPtr);
3466
3467 InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
3468
3469 return TRUE;
3470}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TBN_DELETINGBUTTON
Definition: commctrl.h:1338
INT idCommand
Definition: toolbar.c:91
DWORD_PTR dwData
Definition: toolbar.c:96
INT nHotItem
Definition: toolbar.c:137
BYTE fsState
Definition: commctrl.h:951
DWORD_PTR dwData
Definition: commctrl.h:958

Referenced by TOOLBAR_LButtonUp(), TOOLBAR_Restore(), and ToolbarWindowProc().

◆ TOOLBAR_DeleteImageList()

static VOID TOOLBAR_DeleteImageList ( PIMLENTRY **  pies,
INT cies 
)
static

Definition at line 7374 of file toolbar.c.

7375{
7376 int i;
7377
7378 for (i = 0; i < *cies; i++)
7379 Free((*pies)[i]);
7380
7381 Free(*pies);
7382
7383 *cies = 0;
7384 *pies = NULL;
7385}

Referenced by TOOLBAR_Destroy().

◆ TOOLBAR_Destroy()

static LRESULT TOOLBAR_Destroy ( TOOLBAR_INFO infoPtr)
static

Definition at line 5587 of file toolbar.c.

5588{
5589 INT i;
5590
5591 /* delete tooltip control */
5592 if (infoPtr->hwndToolTip)
5593 DestroyWindow (infoPtr->hwndToolTip);
5594
5595 /* delete temporary buffer for tooltip text */
5596 Free (infoPtr->pszTooltipText);
5597 Free (infoPtr->bitmaps); /* bitmaps list */
5598
5599 /* delete button data */
5600 for (i = 0; i < infoPtr->nNumButtons; i++)
5601 free_string( infoPtr->buttons + i );
5602 Free (infoPtr->buttons);
5603
5604 /* delete strings */
5605 if (infoPtr->strings) {
5606 for (i = 0; i < infoPtr->nNumStrings; i++)
5607 Free (infoPtr->strings[i]);
5608
5609 Free (infoPtr->strings);
5610 }
5611
5612 /* destroy internal image list */
5613 if (infoPtr->himlInt)
5614 ImageList_Destroy (infoPtr->himlInt);
5615
5616 TOOLBAR_DeleteImageList(&infoPtr->himlDef, &infoPtr->cimlDef);
5617 TOOLBAR_DeleteImageList(&infoPtr->himlDis, &infoPtr->cimlDis);
5618 TOOLBAR_DeleteImageList(&infoPtr->himlHot, &infoPtr->cimlHot);
5619
5620 /* delete default font */
5621 DeleteObject (infoPtr->hDefaultFont);
5622
5624
5625 /* free toolbar info data */
5626 SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
5627 Free (infoPtr);
5628
5629 return 0;
5630}
static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies)
Definition: toolbar.c:7374
PIMLENTRY * himlDis
Definition: toolbar.c:153
INT cimlHot
Definition: toolbar.c:152
INT cimlDis
Definition: toolbar.c:154
PIMLENTRY * himlHot
Definition: toolbar.c:151
LPWSTR pszTooltipText
Definition: toolbar.c:171
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by ToolbarWindowProc().

◆ TOOLBAR_DrawArrow()

static void TOOLBAR_DrawArrow ( HDC  hdc,
INT  left,
INT  top,
COLORREF  clr 
)
static

Definition at line 608 of file toolbar.c.

609{
610 INT x, y;
611 HPEN hPen, hOldPen;
612
613 if (!(hPen = CreatePen( PS_SOLID, 1, clr))) return;
614 hOldPen = SelectObject ( hdc, hPen );
615 x = left + 2;
616 y = top;
617 MoveToEx (hdc, x, y, NULL);
618 LineTo (hdc, x+5, y++); x++;
619 MoveToEx (hdc, x, y, NULL);
620 LineTo (hdc, x+3, y++); x++;
621 MoveToEx (hdc, x, y, NULL);
622 LineTo (hdc, x+1, y);
623 SelectObject( hdc, hOldPen );
624 DeleteObject( hPen );
625}
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)

Referenced by TOOLBAR_DrawButton(), and TOOLBAR_DrawSepDDArrow().

◆ TOOLBAR_DrawButton()

static void TOOLBAR_DrawButton ( const TOOLBAR_INFO infoPtr,
TBUTTON_INFO btnPtr,
HDC  hdc,
DWORD  dwBaseCustDraw 
)
static

Definition at line 974 of file toolbar.c.

975{
976 DWORD dwStyle = infoPtr->dwStyle;
977 BOOL hasDropDownArrow = button_has_ddarrow( infoPtr, btnPtr );
978 BOOL drawSepDropDownArrow = hasDropDownArrow &&
979 (~btnPtr->fsStyle & BTNS_WHOLEDROPDOWN);
980 RECT rc, rcArrow, rcBitmap, rcText;
981 LPWSTR lpText = NULL;
982 NMTBCUSTOMDRAW tbcd;
983 DWORD ntfret;
984 INT offset;
985 INT oldBkMode;
986 DWORD dwItemCustDraw;
987 DWORD dwItemCDFlag;
988 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
989
990 rc = btnPtr->rect;
991 rcArrow = rc;
992
993 /* separator - doesn't send NM_CUSTOMDRAW */
994 if (btnPtr->fsStyle & BTNS_SEP) {
995 if (theme)
996 {
997 DrawThemeBackground (theme, hdc,
998 (dwStyle & CCS_VERT) ? TP_SEPARATORVERT : TP_SEPARATOR, 0,
999 &rc, NULL);
1000 }
1001 else
1002 /* with the FLAT style, iBitmap is the width and has already */
1003 /* been taken into consideration in calculating the width */
1004 /* so now we need to draw the vertical separator */
1005 /* empirical tests show that iBitmap can/will be non-zero */
1006 /* when drawing the vertical bar... */
1007 if ((dwStyle & TBSTYLE_FLAT) /* && (btnPtr->iBitmap == 0) */) {
1008 if (dwStyle & CCS_VERT) {
1009 RECT rcsep = rc;
1010 InflateRect(&rcsep, -infoPtr->szPadding.cx, -infoPtr->szPadding.cy);
1011 TOOLBAR_DrawFlatHorizontalSeparator (&rcsep, hdc, infoPtr);
1012 }
1013 else {
1014 TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr);
1015 }
1016 }
1017 else if (btnPtr->fsStyle != BTNS_SEP) {
1018 FIXME("Draw some kind of separator: fsStyle=%x\n",
1019 btnPtr->fsStyle);
1020 }
1021 return;
1022 }
1023
1024 /* get a pointer to the text */
1025 lpText = TOOLBAR_GetText(infoPtr, btnPtr);
1026
1027 if (hasDropDownArrow)
1028 {
1029 int right;
1030
1031 if (dwStyle & TBSTYLE_FLAT)
1032 right = max(rc.left, rc.right - DDARROW_WIDTH);
1033 else
1034 right = max(rc.left, rc.right - DDARROW_WIDTH - 2);
1035
1036 if (drawSepDropDownArrow)
1037 rc.right = right;
1038
1039 rcArrow.left = right;
1040 }
1041
1042 /* copy text & bitmap rects after adjusting for drop-down arrow
1043 * so that text & bitmap is centered in the rectangle not containing
1044 * the arrow */
1045 rcText = rc;
1046 rcBitmap = rc;
1047
1048 /* Center the bitmap horizontally and vertically */
1049 if (dwStyle & TBSTYLE_LIST)
1050 {
1051 if (lpText &&
1052 infoPtr->nMaxTextRows > 0 &&
1053 (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
1054 (btnPtr->fsStyle & BTNS_SHOWTEXT)) )
1055 rcBitmap.left += GetSystemMetrics(SM_CXEDGE) + infoPtr->szPadding.cx / 2;
1056 else
1057 rcBitmap.left += GetSystemMetrics(SM_CXEDGE) + infoPtr->iListGap / 2;
1058 }
1059 else
1060 rcBitmap.left += ((rc.right - rc.left) - infoPtr->nBitmapWidth) / 2;
1061
1062 rcBitmap.top += infoPtr->szPadding.cy / 2;
1063#ifdef __REACTOS__
1064 rcBitmap.top += infoPtr->themeMargins.cyTopHeight;
1065#endif
1066
1067 TRACE("iBitmap=%d, start=(%d,%d) w=%d, h=%d\n",
1068 btnPtr->iBitmap, rcBitmap.left, rcBitmap.top,
1069 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
1070 TRACE("Text=%s\n", debugstr_w(lpText));
1071 TRACE("iListGap=%d, padding = { %d, %d }\n", infoPtr->iListGap, infoPtr->szPadding.cx, infoPtr->szPadding.cy);
1072
1073 /* calculate text position */
1074 if (lpText)
1075 {
1076 InflateRect(&rcText, -GetSystemMetrics(SM_CXEDGE), 0);
1077 if (dwStyle & TBSTYLE_LIST)
1078 {
1079 rcText.left += infoPtr->nBitmapWidth + infoPtr->iListGap + 2;
1080 }
1081 else
1082 {
1083 if (ImageList_GetImageCount(GETDEFIMAGELIST(infoPtr, 0)) > 0)
1084 rcText.top += infoPtr->szPadding.cy/2 + infoPtr->nBitmapHeight + 1;
1085 else
1086 rcText.top += infoPtr->szPadding.cy/2 + 2;
1087 }
1088 }
1089
1090 /* Initialize fields in all cases, because we use these later
1091 * NOTE: applications can and do alter these to customize their
1092 * toolbars */
1093 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
1099 tbcd.clrHighlightHotTrack = 0;
1101 tbcd.nHLStringBkMode = OPAQUE;
1102 tbcd.rcText.left = 0;
1103 tbcd.rcText.top = 0;
1104 tbcd.rcText.right = rcText.right - rc.left;
1105 tbcd.rcText.bottom = rcText.bottom - rc.top;
1106 tbcd.nmcd.uItemState = TOOLBAR_TranslateState(btnPtr, infoPtr->bCaptured);
1107 tbcd.nmcd.hdc = hdc;
1108 tbcd.nmcd.rc = btnPtr->rect;
1110
1111 /* FIXME: what are these used for? */
1112 tbcd.hbrLines = 0;
1113 tbcd.hpenLines = 0;
1114
1115 /* Issue Item Prepaint notify */
1116 dwItemCustDraw = 0;
1117 dwItemCDFlag = 0;
1118 if (dwBaseCustDraw & CDRF_NOTIFYITEMDRAW)
1119 {
1121 tbcd.nmcd.dwItemSpec = btnPtr->idCommand;
1122 tbcd.nmcd.lItemlParam = btnPtr->dwData;
1123 ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
1124 /* reset these fields so the user can't alter the behaviour like native */
1125 tbcd.nmcd.hdc = hdc;
1126 tbcd.nmcd.rc = btnPtr->rect;
1127
1128 dwItemCustDraw = ntfret & 0xffff;
1129 dwItemCDFlag = ntfret & 0xffff0000;
1130 if (dwItemCustDraw & CDRF_SKIPDEFAULT)
1131 return;
1132 /* save the only part of the rect that the user can change */
1133 rcText.right = tbcd.rcText.right + rc.left;
1134 rcText.bottom = tbcd.rcText.bottom + rc.top;
1135 }
1136
1137 if (!(dwItemCDFlag & TBCDRF_NOOFFSET) &&
1138 (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED)))
1139 OffsetRect(&rcText, 1, 1);
1140
1141 if (!(tbcd.nmcd.uItemState & CDIS_HOT) &&
1143 TOOLBAR_DrawPattern (&rc, &tbcd);
1144
1145 if (((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf))
1146 && (tbcd.nmcd.uItemState & CDIS_HOT))
1147 {
1148 if ( dwItemCDFlag & TBCDRF_HILITEHOTTRACK )
1149 {
1150 COLORREF oldclr;
1151
1152 oldclr = SetBkColor(hdc, tbcd.clrHighlightHotTrack);
1153 ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0);
1154 if (hasDropDownArrow)
1155 ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0);
1156 SetBkColor(hdc, oldclr);
1157 }
1158 }
1159
1160#ifdef __REACTOS__
1161 if (theme && !(dwItemCDFlag & TBCDRF_NOBACKGROUND))
1162#else
1163 if (theme)
1164#endif
1165 {
1166 int partId = drawSepDropDownArrow ? TP_SPLITBUTTON : TP_BUTTON;
1167 int stateId = TS_NORMAL;
1168
1169 if (tbcd.nmcd.uItemState & CDIS_DISABLED)
1170 stateId = TS_DISABLED;
1171 else if (tbcd.nmcd.uItemState & CDIS_SELECTED)
1172 stateId = TS_PRESSED;
1173 else if (tbcd.nmcd.uItemState & CDIS_CHECKED)
1174#ifdef __REACTOS__
1175 stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_CHECKED;
1176#else
1177 stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_HOT;
1178#endif
1179 else if ((tbcd.nmcd.uItemState & CDIS_HOT)
1180 || (drawSepDropDownArrow && btnPtr->bDropDownPressed))
1181 stateId = TS_HOT;
1182
1183 DrawThemeBackground (theme, hdc, partId, stateId, &rc, NULL);
1184 }
1185
1186#ifdef __REACTOS__
1187 if (!theme)
1188#else
1189 else
1190#endif
1191 TOOLBAR_DrawFrame(infoPtr, &tbcd, &rc, dwItemCDFlag);
1192
1193 if (drawSepDropDownArrow)
1194 {
1195 if (theme)
1196 {
1197 int stateId = TS_NORMAL;
1198
1199 if (tbcd.nmcd.uItemState & CDIS_DISABLED)
1200 stateId = TS_DISABLED;
1201 else if (btnPtr->bDropDownPressed || (tbcd.nmcd.uItemState & CDIS_SELECTED))
1202 stateId = TS_PRESSED;
1203 else if (tbcd.nmcd.uItemState & CDIS_CHECKED)
1204#ifdef __REACTOS__
1205 stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_CHECKED;
1206#else
1207 stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_HOT;
1208#endif
1209 else if (tbcd.nmcd.uItemState & CDIS_HOT)
1210 stateId = TS_HOT;
1211
1212 DrawThemeBackground (theme, hdc, TP_DROPDOWNBUTTON, stateId, &rcArrow, NULL);
1213 DrawThemeBackground (theme, hdc, TP_SPLITBUTTONDROPDOWN, stateId, &rcArrow, NULL);
1214 }
1215 else
1216 TOOLBAR_DrawSepDDArrow(infoPtr, &tbcd, &rcArrow, btnPtr->bDropDownPressed, dwItemCDFlag);
1217 }
1218
1219 oldBkMode = SetBkMode (hdc, tbcd.nStringBkMode);
1220 if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
1221#ifdef __REACTOS__
1222 TOOLBAR_DrawString(infoPtr, &rcText, lpText, btnPtr, &tbcd, dwItemCDFlag);
1223#else
1224 TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd, dwItemCDFlag);
1225#endif
1226 SetBkMode (hdc, oldBkMode);
1227
1228 TOOLBAR_DrawImage(infoPtr, btnPtr, rcBitmap.left, rcBitmap.top, &tbcd, dwItemCDFlag);
1229
1230 if (hasDropDownArrow && !drawSepDropDownArrow)
1231 {
1233 {
1234 TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1 + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnHighlight);
1235 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clr3dShadow);
1236 }
1237#ifndef __REACTOS__
1238 else if (tbcd.nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED))
1239 {
1240 offset = (dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
1241 TOOLBAR_DrawArrow(hdc, rcArrow.left + offset, rcArrow.top + offset + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnText);
1242 }
1243 else
1244 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnText);
1245#else
1246 else
1247 {
1249 if (theme)
1251
1253 {
1254 offset = (dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
1255 TOOLBAR_DrawArrow(hdc, rcArrow.left + offset, rcArrow.top + offset + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, clr);
1256 }
1257 else
1258 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, clr);
1259 }
1260#endif
1261 }
1262
1263 if (dwItemCustDraw & CDRF_NOTIFYPOSTPAINT)
1264 {
1266 TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
1267 }
1268
1269}
HBRUSH COMCTL32_hPattern55AABrush
Definition: commctrl.c:81
static void TOOLBAR_DrawImage(const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top, const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
Definition: toolbar.c:804
static void TOOLBAR_DrawPattern(const RECT *lpRect, const NMTBCUSTOMDRAW *tbcd)
Definition: toolbar.c:725
static BOOL button_has_ddarrow(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
Definition: toolbar.c:282
#define DDARROW_WIDTH
Definition: toolbar.c:205
static void TOOLBAR_DrawFlatSeparator(const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:536
#define ARROW_HEIGHT
Definition: toolbar.c:206
static void TOOLBAR_DrawSepDDArrow(const TOOLBAR_INFO *infoPtr, const NMTBCUSTOMDRAW *tbcd, RECT *rcArrow, BOOL bDropDownPressed, DWORD dwItemCDFlag)
Definition: toolbar.c:935
static void TOOLBAR_DrawFlatHorizontalSeparator(const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:575
static void TOOLBAR_DrawFrame(const TOOLBAR_INFO *infoPtr, const NMTBCUSTOMDRAW *tbcd, const RECT *rect, DWORD dwItemCDFlag)
Definition: toolbar.c:901
static void TOOLBAR_DrawArrow(HDC hdc, INT left, INT top, COLORREF clr)
Definition: toolbar.c:608
static UINT TOOLBAR_TranslateState(const TBUTTON_INFO *btnPtr, BOOL captured)
Definition: toolbar.c:788
static void TOOLBAR_DrawString(const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText, const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
Definition: toolbar.c:634
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId, int iPropId, COLORREF *pColor)
Definition: property.c:45
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble GLdouble right
Definition: glext.h:10859
GLintptr offset
Definition: glext.h:5920
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:286
#define CDIS_DISABLED
Definition: commctrl.h:293
#define BTNS_SHOWTEXT
Definition: commctrl.h:1006
#define TBSTATE_PRESSED
Definition: commctrl.h:973
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define CDIS_INDETERMINATE
Definition: commctrl.h:299
#define TBSTYLE_LIST
Definition: commctrl.h:993
#define TBCDRF_NOOFFSET
Definition: commctrl.h:1035
#define CDIS_SELECTED
Definition: commctrl.h:291
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define TBCDRF_NOBACKGROUND
Definition: commctrl.h:1040
#define CDIS_CHECKED
Definition: commctrl.h:294
#define TBCDRF_HILITEHOTTRACK
Definition: commctrl.h:1034
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:270
#define CDIS_HOT
Definition: commctrl.h:297
COLORREF clrBtnText
Definition: comctl32.h:173
COLORREF clrBtnHighlight
Definition: comctl32.h:171
COLORREF clr3dShadow
Definition: comctl32.h:179
BOOL bDropDownPressed
Definition: toolbar.c:95
SIZE szPadding
Definition: toolbar.c:138
INT iListGap
Definition: toolbar.c:145
NMCUSTOMDRAW nmcd
Definition: commctrl.h:1017
HBRUSH hbrLines
Definition: commctrl.h:1019
COLORREF clrBtnFace
Definition: commctrl.h:1024
HBRUSH hbrMonoDither
Definition: commctrl.h:1018
COLORREF clrText
Definition: commctrl.h:1021
COLORREF clrMark
Definition: commctrl.h:1022
COLORREF clrBtnHighlight
Definition: commctrl.h:1025
COLORREF clrTextHighlight
Definition: commctrl.h:1023
COLORREF clrHighlightHotTrack
Definition: commctrl.h:1026
DWORD_PTR dwItemSpec
Definition: commctrl.h:307
#define max(a, b)
Definition: svc.c:63
@ TP_SPLITBUTTON
Definition: vsstyle.h:1396
@ TP_SEPARATORVERT
Definition: vsstyle.h:1399
@ TP_SPLITBUTTONDROPDOWN
Definition: vsstyle.h:1397
@ TP_SEPARATOR
Definition: vsstyle.h:1398
@ TP_DROPDOWNBUTTON
Definition: vsstyle.h:1395
@ TS_PRESSED
Definition: vsstyle.h:1407
@ TS_DISABLED
Definition: vsstyle.h:1408
@ TS_CHECKED
Definition: vsstyle.h:1409
@ TS_HOT
Definition: vsstyle.h:1406
@ TS_HOTCHECKED
Definition: vsstyle.h:1410
#define TMT_TEXTCOLOR
Definition: vssym32.h:328
#define TRANSPARENT
Definition: wingdi.h:950
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
#define OPAQUE
Definition: wingdi.h:949
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define SM_CXEDGE
Definition: winuser.h:1011
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)

Referenced by TOOLBAR_Refresh().

◆ TOOLBAR_DrawFlatHorizontalSeparator()

static void TOOLBAR_DrawFlatHorizontalSeparator ( const RECT lpRect,
HDC  hdc,
const TOOLBAR_INFO infoPtr 
)
static

Definition at line 575 of file toolbar.c.

577{
578 RECT myrect;
579 COLORREF oldcolor, newcolor;
580
581 myrect.left = lpRect->left;
582 myrect.right = lpRect->right;
583 myrect.top = lpRect->top + (lpRect->bottom - lpRect->top - 2)/2;
584 myrect.bottom = myrect.top + 1;
585
586 InflateRect (&myrect, -2, 0);
587
588 TRACE("rect=(%s)\n", wine_dbgstr_rect(&myrect));
589
590 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
592 oldcolor = SetBkColor (hdc, newcolor);
593 ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
594
595 myrect.top = myrect.bottom;
596 myrect.bottom = myrect.top + 1;
597
598 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
600 SetBkColor (hdc, newcolor);
601 ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
602
603 SetBkColor (hdc, oldcolor);
604}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define CLR_DEFAULT
Definition: commctrl.h:320
COLORREF clrBtnShadow
Definition: comctl32.h:172
COLORREF clrBtnShadow
Definition: toolbar.c:169
COLORREF clrBtnHighlight
Definition: toolbar.c:168

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawFlatSeparator()

static void TOOLBAR_DrawFlatSeparator ( const RECT lpRect,
HDC  hdc,
const TOOLBAR_INFO infoPtr 
)
static

Definition at line 536 of file toolbar.c.

537{
538 RECT myrect;
539 COLORREF oldcolor, newcolor;
540
541 myrect.left = (lpRect->left + lpRect->right) / 2 - 1;
542 myrect.right = myrect.left + 1;
543 myrect.top = lpRect->top + 2;
544 myrect.bottom = lpRect->bottom - 2;
545
546 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
548 oldcolor = SetBkColor (hdc, newcolor);
549 ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
550
551 myrect.left = myrect.right;
552 myrect.right = myrect.left + 1;
553
554 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
556 SetBkColor (hdc, newcolor);
557 ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
558
559 SetBkColor (hdc, oldcolor);
560}

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawFrame()

static void TOOLBAR_DrawFrame ( const TOOLBAR_INFO infoPtr,
const NMTBCUSTOMDRAW tbcd,
const RECT rect,
DWORD  dwItemCDFlag 
)
static

Definition at line 901 of file toolbar.c.

902{
903 HDC hdc = tbcd->nmcd.hdc;
904 RECT rc = *rect;
905 /* if the state is disabled or indeterminate then the button
906 * cannot have an interactive look like pressed or hot */
907 BOOL non_interactive_state = (tbcd->nmcd.uItemState & CDIS_DISABLED) ||
909 BOOL pressed_look = !non_interactive_state &&
910 ((tbcd->nmcd.uItemState & CDIS_SELECTED) ||
911 (tbcd->nmcd.uItemState & CDIS_CHECKED));
912
913 /* app don't want us to draw any edges */
914 if (dwItemCDFlag & TBCDRF_NOEDGES)
915 return;
916
917 if (infoPtr->dwStyle & TBSTYLE_FLAT)
918 {
919 if (pressed_look)
921 else if ((tbcd->nmcd.uItemState & CDIS_HOT) && !non_interactive_state)
923 }
924 else
925 {
926 if (pressed_look)
928 else
929 DrawEdge (hdc, &rc, EDGE_RAISED,
931 }
932}
#define TBCDRF_NOEDGES
Definition: commctrl.h:1033
& rect
Definition: startmenu.cpp:1413
#define BDR_SUNKENOUTER
Definition: winuser.h:443
#define EDGE_SUNKEN
Definition: winuser.h:451
#define BDR_RAISEDINNER
Definition: winuser.h:444

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawImage()

static void TOOLBAR_DrawImage ( const TOOLBAR_INFO infoPtr,
TBUTTON_INFO btnPtr,
INT  left,
INT  top,
const NMTBCUSTOMDRAW tbcd,
DWORD  dwItemCDFlag 
)
static

Definition at line 804 of file toolbar.c.

806{
808 BOOL draw_masked = FALSE, draw_desaturated = FALSE;
809 INT index;
810 INT offset = 0;
811 UINT draw_flags = ILD_TRANSPARENT;
812#ifdef __REACTOS__
813 IMAGEINFO info = {0};
814 BITMAP bm = {0};
815#endif
816
818 {
820 if (!himl)
821 {
823
824#ifdef __REACTOS__
826 GetObjectW(info.hbmImage, sizeof(bm), &bm);
827
828 if (bm.bmBitsPixel == 32)
829 {
830 draw_desaturated = TRUE;
831 }
832 else
833 {
834 draw_masked = TRUE;
835 }
836#else
837 draw_masked = TRUE;
838#endif
839 }
840 }
841 else if (tbcd->nmcd.uItemState & CDIS_CHECKED ||
842 ((tbcd->nmcd.uItemState & CDIS_HOT)
843 && ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf))))
844 {
845 /* if hot, attempt to draw with hot image list, if fails,
846 use default image list */
848 if (!himl)
850 }
851 else
853
854 if (!himl)
855 return;
856
857 if (!(dwItemCDFlag & TBCDRF_NOOFFSET) &&
859 offset = 1;
860
861 if (!(dwItemCDFlag & TBCDRF_NOMARK) &&
862 (tbcd->nmcd.uItemState & CDIS_MARKED))
863 draw_flags |= ILD_BLEND50;
864
865 TRACE("drawing index=%d, himl=%p, left=%d, top=%d, offset=%d\n",
866 index, himl, left, top, offset);
867
868 if (draw_masked)
869 {
870 /* code path for drawing flat disabled icons without alpha channel */
871 TOOLBAR_DrawMasked (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
872 }
873 else if (draw_desaturated)
874 {
875 /* code path for drawing disabled, alpha-blended (32bpp) icons */
876 IMAGELISTDRAWPARAMS imldp = {0};
877
878 imldp.cbSize = sizeof(imldp);
879 imldp.himl = himl;
880 imldp.i = index;
881 imldp.hdcDst = tbcd->nmcd.hdc,
882 imldp.x = offset + left;
883 imldp.y = offset + top;
884 imldp.rgbBk = CLR_NONE;
885 imldp.rgbFg = CLR_DEFAULT;
886 imldp.fStyle = ILD_TRANSPARENT;
887 imldp.fState = ILS_ALPHA | ILS_SATURATE;
888 imldp.Frame = 192;
889
890 ImageList_DrawIndirect (&imldp);
891 }
892 else
893 {
894 /* code path for drawing standard icons as-is */
895 ImageList_Draw (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
896 }
897}
BOOL WINAPI ImageList_GetImageInfo(HIMAGELIST himl, INT i, IMAGEINFO *pImageInfo)
Definition: imagelist.c:2088
BOOL WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *pimldp)
Definition: imagelist.c:1525
static void TOOLBAR_DrawMasked(HIMAGELIST himl, int index, HDC hdc, INT x, INT y, UINT draw_flags)
Definition: toolbar.c:745
static HIMAGELIST TOOLBAR_GetImageListForDrawing(const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMAGE_LIST_TYPE imagelist, INT *index)
Definition: toolbar.c:492
#define CLR_NONE
Definition: commctrl.h:319
#define ILS_ALPHA
Definition: commctrl.h:439
#define ILD_TRANSPARENT
Definition: commctrl.h:418
#define CDIS_MARKED
Definition: commctrl.h:298
#define ILS_SATURATE
Definition: commctrl.h:438
#define ILD_BLEND50
Definition: commctrl.h:423
#define TBCDRF_NOMARK
Definition: commctrl.h:1036
Definition: bl.h:1331
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawMasked()

static void TOOLBAR_DrawMasked ( HIMAGELIST  himl,
int  index,
HDC  hdc,
INT  x,
INT  y,
UINT  draw_flags 
)
static

Definition at line 745 of file toolbar.c.

746{
747 INT cx, cy;
748 HBITMAP hbmMask, hbmImage;
749 HDC hdcMask, hdcImage;
750
752
753 /* Create src image */
754 hdcImage = CreateCompatibleDC(hdc);
755 hbmImage = CreateCompatibleBitmap(hdc, cx, cy);
756 SelectObject(hdcImage, hbmImage);
757 ImageList_DrawEx(himl, index, hdcImage, 0, 0, cx, cy,
758 RGB(0xff, 0xff, 0xff), RGB(0,0,0), draw_flags);
759
760 /* Create Mask */
761 hdcMask = CreateCompatibleDC(0);
762 hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
763 SelectObject(hdcMask, hbmMask);
764
765 /* Remove the background and all white pixels */
766 ImageList_DrawEx(himl, index, hdcMask, 0, 0, cx, cy,
767 RGB(0xff, 0xff, 0xff), RGB(0,0,0), ILD_MASK);
768 SetBkColor(hdcImage, RGB(0xff, 0xff, 0xff));
769 BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, NOTSRCERASE);
770
771 /* draw the new mask 'etched' to hdc */
772 SetBkColor(hdc, RGB(255, 255, 255));
774 /* E20746 op code is (Dst ^ (Src & (Pat ^ Dst))) */
775 BitBlt(hdc, x + 1, y + 1, cx, cy, hdcMask, 0, 0, 0xE20746);
777 BitBlt(hdc, x, y, cx, cy, hdcMask, 0, 0, 0xE20746);
778
779 /* Cleanup */
780 DeleteObject(hbmImage);
781 DeleteDC(hdcImage);
782 DeleteObject (hbmMask);
783 DeleteDC(hdcMask);
784}
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1264
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 RGB(r, g, b)
Definition: precomp.h:71
#define ILD_MASK
Definition: commctrl.h:419
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DeleteDC(_In_ HDC)
#define NOTSRCERASE
Definition: wingdi.h:324
#define COLOR_3DSHADOW
Definition: winuser.h:934
#define COLOR_3DHILIGHT
Definition: winuser.h:940

Referenced by TOOLBAR_DrawImage().

◆ TOOLBAR_DrawPattern()

static void TOOLBAR_DrawPattern ( const RECT lpRect,
const NMTBCUSTOMDRAW tbcd 
)
static

Definition at line 725 of file toolbar.c.

726{
727 HDC hdc = tbcd->nmcd.hdc;
728 HBRUSH hbr = SelectObject (hdc, tbcd->hbrMonoDither);
729 COLORREF clrTextOld;
730 COLORREF clrBkOld;
731 INT cx = lpRect->right - lpRect->left;
732 INT cy = lpRect->bottom - lpRect->top;
735 clrTextOld = SetTextColor(hdc, tbcd->clrBtnHighlight);
736 clrBkOld = SetBkColor(hdc, tbcd->clrBtnFace);
737 PatBlt (hdc, lpRect->left + cxEdge, lpRect->top + cyEdge,
738 cx - (2 * cxEdge), cy - (2 * cyEdge), PATCOPY);
739 SetBkColor(hdc, clrBkOld);
740 SetTextColor(hdc, clrTextOld);
741 SelectObject (hdc, hbr);
742}
#define PATCOPY
Definition: wingdi.h:335
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawSepDDArrow()

static void TOOLBAR_DrawSepDDArrow ( const TOOLBAR_INFO infoPtr,
const NMTBCUSTOMDRAW tbcd,
RECT rcArrow,
BOOL  bDropDownPressed,
DWORD  dwItemCDFlag 
)
static

Definition at line 935 of file toolbar.c.

936{
937 HDC hdc = tbcd->nmcd.hdc;
938 int offset = 0;
939 BOOL pressed = bDropDownPressed ||
941
942 if (infoPtr->dwStyle & TBSTYLE_FLAT)
943 {
944 if (pressed)
945 DrawEdge (hdc, rcArrow, BDR_SUNKENOUTER, BF_RECT);
946 else if ( (tbcd->nmcd.uItemState & CDIS_HOT) &&
947 !(tbcd->nmcd.uItemState & CDIS_DISABLED) &&
949 DrawEdge (hdc, rcArrow, BDR_RAISEDINNER, BF_RECT);
950 }
951 else
952 {
953 if (pressed)
955 else
956 DrawEdge (hdc, rcArrow, EDGE_RAISED,
958 }
959
960 if (pressed)
961 offset = (dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
962
964 {
965 TOOLBAR_DrawArrow(hdc, rcArrow->left+1, rcArrow->top+1 + (rcArrow->bottom - rcArrow->top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnHighlight);
966 TOOLBAR_DrawArrow(hdc, rcArrow->left, rcArrow->top + (rcArrow->bottom - rcArrow->top - ARROW_HEIGHT) / 2, comctl32_color.clr3dShadow);
967 }
968 else
969 TOOLBAR_DrawArrow(hdc, rcArrow->left + offset, rcArrow->top + offset + (rcArrow->bottom - rcArrow->top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnText);
970}

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawString()

static void TOOLBAR_DrawString ( const TOOLBAR_INFO infoPtr,
RECT rcText,
LPCWSTR  lpText,
const NMTBCUSTOMDRAW tbcd,
DWORD  dwItemCDFlag 
)
static

Definition at line 634 of file toolbar.c.

639{
640 HDC hdc = tbcd->nmcd.hdc;
641 HFONT hOldFont = 0;
642 COLORREF clrOld = 0;
643 COLORREF clrOldBk = 0;
644 int oldBkMode = 0;
645 UINT state = tbcd->nmcd.uItemState;
646#ifdef __REACTOS__
647 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
648 DWORD dwDTFlags = TOOLBAR_GetButtonDTFlags(infoPtr, btnPtr);
649#endif
650
651 /* draw text */
652 if (lpText && infoPtr->nMaxTextRows > 0) {
653 TRACE("string=%s rect=(%s)\n", debugstr_w(lpText),
654 wine_dbgstr_rect(rcText));
655
656 hOldFont = SelectObject (hdc, infoPtr->hFont);
657#ifdef __REACTOS__
658 if (theme)
659 {
660 DWORD dwDTFlags2 = 0;
661 int partId = TP_BUTTON;
662 int stateId = TS_NORMAL;
663
664 if (state & CDIS_DISABLED)
665 {
666 stateId = TS_DISABLED;
667 dwDTFlags2 = DTT_GRAYED;
668 }
669 else if (state & CDIS_SELECTED)
670 stateId = TS_PRESSED;
671 else if (state & CDIS_CHECKED)
672 stateId = (state & CDIS_HOT) ? TS_HOTCHECKED : TS_HOT;
673 else if (state & CDIS_HOT)
674 stateId = TS_HOT;
675
676 DrawThemeText(theme, hdc, partId, stateId, lpText, -1, dwDTFlags, dwDTFlags2, rcText);
677 SelectObject (hdc, hOldFont);
678 return;
679 }
680#endif
681
682 if ((state & CDIS_HOT) && (dwItemCDFlag & TBCDRF_HILITEHOTTRACK )) {
683 clrOld = SetTextColor (hdc, tbcd->clrTextHighlight);
684 }
685 else if (state & CDIS_DISABLED) {
686 clrOld = SetTextColor (hdc, tbcd->clrBtnHighlight);
687 OffsetRect (rcText, 1, 1);
688#ifdef __REACTOS__
689 DrawTextW (hdc, lpText, -1, rcText, dwDTFlags);
690#else
691 DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
692#endif
694 OffsetRect (rcText, -1, -1);
695 }
696 else if (state & CDIS_INDETERMINATE) {
698 }
699 else if ((state & CDIS_MARKED) && !(dwItemCDFlag & TBCDRF_NOMARK)) {
700 clrOld = SetTextColor (hdc, tbcd->clrTextHighlight);
701 clrOldBk = SetBkColor (hdc, tbcd->clrMark);
702 oldBkMode = SetBkMode (hdc, tbcd->nHLStringBkMode);
703 }
704 else {
705 clrOld = SetTextColor (hdc, tbcd->clrText);
706 }
707
708#ifdef __REACTOS__
709 DrawTextW (hdc, lpText, -1, rcText, dwDTFlags);
710#else
711 DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
712#endif
713 SetTextColor (hdc, clrOld);
714 if ((state & CDIS_MARKED) && !(dwItemCDFlag & TBCDRF_NOMARK))
715 {
716 SetBkColor (hdc, clrOldBk);
717 SetBkMode (hdc, oldBkMode);
718 }
719 SelectObject (hdc, hOldFont);
720 }
721}
static int state
Definition: maze.c:121
HRESULT WINAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect)
Definition: draw.c:1377
DWORD dwDTFlags
Definition: toolbar.c:165

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DumpButton()

static void TOOLBAR_DumpButton ( const TOOLBAR_INFO infoPtr,
const TBUTTON_INFO bP,
INT  btn_num 
)
static

Definition at line 321 of file toolbar.c.

322{
323 if (TRACE_ON(toolbar)){
324 TRACE("button %d id %d, bitmap=%d, state=%02x, style=%02x, data=%08lx, stringid=0x%08lx\n",
325 btn_num, bP->idCommand, GETIBITMAP(infoPtr, bP->iBitmap),
326 bP->fsState, bP->fsStyle, bP->dwData, bP->iString);
327 TRACE("string %s\n", debugstr_w(TOOLBAR_GetText(infoPtr,bP)));
328 TRACE("button %d id %d, hot=%s, row=%d, rect=(%s)\n",
329 btn_num, bP->idCommand, (bP->bHot) ? "TRUE":"FALSE", bP->nRow,
330 wine_dbgstr_rect(&bP->rect));
331 }
332}
#define TRACE_ON(x)
Definition: compat.h:75
INT nRow
Definition: toolbar.c:98
BOOL bHot
Definition: toolbar.c:94

Referenced by TOOLBAR_DumpToolbar().

◆ TOOLBAR_DumpTBButton()

static void TOOLBAR_DumpTBButton ( const TBBUTTON tbb,
BOOL  fUnicode 
)
static

Definition at line 313 of file toolbar.c.

314{
315 TRACE("TBBUTTON: id %d, bitmap=%d, state=%02x, style=%02x, data=%p, stringid=%p (%s)\n", tbb->idCommand,
316 tbb->iBitmap, tbb->fsState, tbb->fsStyle, (void *)tbb->dwData, (void *)tbb->iString,
317 tbb->iString != -1 ? (fUnicode ? debugstr_w((LPWSTR)tbb->iString) : debugstr_a((LPSTR)tbb->iString)) : "");
318}
#define debugstr_a
Definition: kernel32.h:31

Referenced by TOOLBAR_InternalInsertButtonsT().

◆ TOOLBAR_DumpToolbar()

static void TOOLBAR_DumpToolbar ( const TOOLBAR_INFO iP,
INT  line 
)
static

Definition at line 336 of file toolbar.c.

337{
338 if (TRACE_ON(toolbar)) {
339 INT i;
340
341 TRACE("toolbar %p at line %d, exStyle=%08x, buttons=%d, bitmaps=%d, strings=%d, style=%08x\n",
342 iP->hwndSelf, line,
343 iP->dwExStyle, iP->nNumButtons, iP->nNumBitmaps,
344 iP->nNumStrings, iP->dwStyle);
345 TRACE("toolbar %p at line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n",
346 iP->hwndSelf, line,
347 iP->himlInt, iP->himlDef, iP->himlHot, iP->himlDis,
348 (iP->bDoRedraw) ? "TRUE" : "FALSE");
349 for(i=0; i<iP->nNumButtons; i++) {
350 TOOLBAR_DumpButton(iP, &iP->buttons[i], i);
351 }
352 }
353}
static void TOOLBAR_DumpButton(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *bP, INT btn_num)
Definition: toolbar.c:321
Definition: