ReactOS  0.4.15-dev-1070-ge1a01de
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 "wine/unicode.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)
 
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 207 of file toolbar.c.

◆ BOTTOM_BORDER

#define BOTTOM_BORDER   2

Definition at line 205 of file toolbar.c.

◆ COMMON_STYLES

#define COMMON_STYLES
Value:
#define CCS_ADJUSTABLE
Definition: commctrl.h:2243
#define CCS_VERT
Definition: commctrl.h:2245
#define CCS_NODIVIDER
Definition: commctrl.h:2244
#define CCS_TOP
Definition: commctrl.h:2238
#define CCS_BOTTOM
Definition: commctrl.h:2240
#define CCS_NORESIZE
Definition: commctrl.h:2241
#define CCS_NOMOVEY
Definition: commctrl.h:2239

Definition at line 242 of file toolbar.c.

◆ DDARROW_WIDTH

#define DDARROW_WIDTH   11

Definition at line 206 of file toolbar.c.

◆ DEFLISTGAP

#define DEFLISTGAP   4

Definition at line 220 of file toolbar.c.

◆ DEFPAD_CX

#define DEFPAD_CX   7

Definition at line 211 of file toolbar.c.

◆ DEFPAD_CY

#define DEFPAD_CY   6

Definition at line 212 of file toolbar.c.

◆ GETDEFIMAGELIST

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

Definition at line 247 of file toolbar.c.

◆ GETDISIMAGELIST

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

Definition at line 249 of file toolbar.c.

◆ GETHIMLID

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

Definition at line 246 of file toolbar.c.

◆ GETHOTIMAGELIST

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

Definition at line 248 of file toolbar.c.

◆ GETIBITMAP

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

Definition at line 245 of file toolbar.c.

◆ INSERTMARK_WIDTH

#define INSERTMARK_WIDTH   2

Definition at line 208 of file toolbar.c.

◆ LISTPAD_CY

#define LISTPAD_CY   9

Definition at line 226 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 230 of file toolbar.c.

◆ SEPARATOR_WIDTH

#define SEPARATOR_WIDTH   8

Definition at line 203 of file toolbar.c.

◆ TBSTYLE_EX_ALL

#define TBSTYLE_EX_ALL
Value:
TBSTYLE_EX_VERTICAL | \
TBSTYLE_EX_MIXEDBUTTONS | \
TBSTYLE_EX_DOUBLEBUFFER | \
TBSTYLE_EX_HIDECLIPPEDBUTTONS)
#define TBSTYLE_EX_DRAWDDARROWS
Definition: commctrl.h:1005

Definition at line 235 of file toolbar.c.

◆ TOOLBAR_NOWHERE

#define TOOLBAR_NOWHERE   (-1)

Definition at line 232 of file toolbar.c.

◆ TOP_BORDER

#define TOP_BORDER   2

Definition at line 204 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 196 of file toolbar.c.

Function Documentation

◆ button_has_ddarrow()

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

Definition at line 283 of file toolbar.c.

284 {
285  return (TOOLBAR_HasDropDownArrows( infoPtr->dwExStyle ) && (btnPtr->fsStyle & BTNS_DROPDOWN)) ||
286  (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN);
287 }
#define BTNS_WHOLEDROPDOWN
Definition: commctrl.h:1003
#define BTNS_DROPDOWN
Definition: commctrl.h:999
BYTE fsStyle
Definition: toolbar.c:94
DWORD dwExStyle
Definition: toolbar.c:165
static BOOL TOOLBAR_HasDropDownArrows(DWORD exStyle)
Definition: toolbar.c:278

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 269 of file toolbar.c.

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

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

◆ free_string()

static void free_string ( TBUTTON_INFO btn)
static

Definition at line 377 of file toolbar.c.

378 {
379  set_string_index( btn, 0, TRUE );
380 
381 }
#define TRUE
Definition: types.h:120
static void set_string_index(TBUTTON_INFO *btn, INT_PTR str, BOOL unicode)
Definition: toolbar.c:352

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 352 of file toolbar.c.

353 {
354  if (!IS_INTRESOURCE( str ) && str != -1)
355  {
356  if (!TOOLBAR_ButtonHasString( btn )) btn->iString = 0;
357 
358  if (unicode)
359  Str_SetPtrW( (WCHAR **)&btn->iString, (WCHAR *)str );
360  else
361  Str_SetPtrAtoW( (WCHAR **)&btn->iString, (char *)str );
362  }
363  else
364  {
365  if (TOOLBAR_ButtonHasString( btn )) Free( (WCHAR *)btn->iString );
366 
367  btn->iString = str;
368  }
369 }
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:236
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
const WCHAR * str
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL Str_SetPtrAtoW(LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN
INT_PTR iString
Definition: toolbar.c:98
static BOOL TOOLBAR_ButtonHasString(const TBUTTON_INFO *btnPtr)
Definition: toolbar.c:347

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 371 of file toolbar.c.

372 {
373  if (IS_INTRESOURCE( (DWORD_PTR)str ) || (DWORD_PTR)str == -1) return;
374  set_string_index( btn, (DWORD_PTR)str, unicode );
375 }
static void set_string_index(TBUTTON_INFO *btn, INT_PTR str, BOOL unicode)
Definition: toolbar.c:352
const WCHAR * str
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by TOOLBAR_SetButtonInfo().

◆ theme_changed()

static LRESULT theme_changed ( HWND  hwnd)
static

Definition at line 6754 of file toolbar.c.

6755 {
6756  HTHEME theme = GetWindowTheme (hwnd);
6757  CloseThemeData (theme);
6759  return 0;
6760 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
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 const WCHAR themeClass[]
Definition: toolbar.c:251

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddBitmap()

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

Definition at line 2965 of file toolbar.c.

2966 {
2968  INT iSumButtons, i;
2969  HIMAGELIST himlDef;
2970 
2971  TRACE("hwnd=%p count=%d lpAddBmp=%p\n", infoPtr->hwndSelf, count, lpAddBmp);
2972  if (!lpAddBmp)
2973  return -1;
2974 
2975  if (lpAddBmp->hInst == HINST_COMMCTRL)
2976  {
2977  info.hInst = COMCTL32_hModule;
2978  switch (lpAddBmp->nID)
2979  {
2980  case IDB_STD_SMALL_COLOR:
2981  case 2:
2982  info.nButtons = 15;
2983  info.nID = IDB_STD_SMALL;
2984  break;
2985  case IDB_STD_LARGE_COLOR:
2986  case 3:
2987  info.nButtons = 15;
2988  info.nID = IDB_STD_LARGE;
2989  break;
2990  case IDB_VIEW_SMALL_COLOR:
2991  case 6:
2992  info.nButtons = 12;
2993  info.nID = IDB_VIEW_SMALL;
2994  break;
2995  case IDB_VIEW_LARGE_COLOR:
2996  case 7:
2997  info.nButtons = 12;
2998  info.nID = IDB_VIEW_LARGE;
2999  break;
3000  case IDB_HIST_SMALL_COLOR:
3001  info.nButtons = 5;
3002  info.nID = IDB_HIST_SMALL;
3003  break;
3004  case IDB_HIST_LARGE_COLOR:
3005  info.nButtons = 5;
3006  info.nID = IDB_HIST_LARGE;
3007  break;
3008  default:
3009  WARN("unknown bitmap id, %ld\n", lpAddBmp->nID);
3010  return -1;
3011  }
3012 
3013  TRACE ("adding %d internal bitmaps\n", info.nButtons);
3014 
3015  /* Windows resize all the buttons to the size of a newly added standard image */
3016  if (lpAddBmp->nID & 1)
3017  {
3018  /* large icons: 24x24. Will make the button 31x30 */
3019  SendMessageW (infoPtr->hwndSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(24, 24));
3020  }
3021  else
3022  {
3023  /* small icons: 16x16. Will make the buttons 23x22 */
3024  SendMessageW (infoPtr->hwndSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
3025  }
3026 
3027  TOOLBAR_CalcToolbar (infoPtr);
3028  }
3029  else
3030  {
3031  info.nButtons = count;
3032  info.hInst = lpAddBmp->hInst;
3033  info.nID = lpAddBmp->nID;
3034  TRACE("adding %d bitmaps\n", info.nButtons);
3035  }
3036 
3037  /* check if the bitmap is already loaded and compute iSumButtons */
3038  iSumButtons = 0;
3039  for (i = 0; i < infoPtr->nNumBitmapInfos; i++)
3040  {
3041  if (infoPtr->bitmaps[i].hInst == info.hInst &&
3042  infoPtr->bitmaps[i].nID == info.nID)
3043  return iSumButtons;
3044  iSumButtons += infoPtr->bitmaps[i].nButtons;
3045  }
3046 
3047  if (!infoPtr->cimlDef) {
3048  /* create new default image list */
3049  TRACE ("creating default image list\n");
3050 
3051  himlDef = ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
3052  ILC_COLOR32 | ILC_MASK, info.nButtons, 2);
3053  TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlDef, 0);
3054  infoPtr->himlInt = himlDef;
3055  }
3056  else {
3057  himlDef = GETDEFIMAGELIST(infoPtr, 0);
3058  }
3059 
3060  if (!himlDef) {
3061  WARN("No default image list available\n");
3062  return -1;
3063  }
3064 
3065  if (!TOOLBAR_AddBitmapToImageList(infoPtr, himlDef, &info))
3066  return -1;
3067 
3068  TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
3069  infoPtr->bitmaps = ReAlloc(infoPtr->bitmaps, (infoPtr->nNumBitmapInfos + 1) * sizeof(TBITMAP_INFO));
3070  infoPtr->bitmaps[infoPtr->nNumBitmapInfos] = info;
3071  infoPtr->nNumBitmapInfos++;
3072  TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
3073 
3074  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
3075  return iSumButtons;
3076 }
#define IDB_HIST_LARGE
Definition: comctl32.h:75
#define IDB_VIEW_LARGE
Definition: comctl32.h:73
#define IDB_VIEW_SMALL
Definition: comctl32.h:72
UINT nID
Definition: toolbar.c:108
UINT nButtons
Definition: toolbar.c:106
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
HIMAGELIST himlInt
Definition: toolbar.c:149
INT nBitmapWidth
Definition: toolbar.c:125
#define WARN(fmt,...)
Definition: debug.h:112
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
#define IDB_STD_SMALL_COLOR
Definition: commctrl.h:1060
HINSTANCE hInst
Definition: commctrl.h:1055
#define IDB_HIST_LARGE_COLOR
Definition: commctrl.h:1065
INT nBitmapHeight
Definition: toolbar.c:124
int32_t INT
Definition: typedefs.h:58
struct _test_info info[]
Definition: SetCursorPos.c:19
#define ILC_COLOR32
Definition: commctrl.h:354
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
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define IDB_STD_SMALL
Definition: comctl32.h:70
TBITMAP_INFO * bitmaps
Definition: toolbar.c:177
smooth NULL
Definition: ftsmooth.c:416
#define IDB_VIEW_SMALL_COLOR
Definition: commctrl.h:1062
#define TRACE(s)
Definition: solgame.cpp:4
#define IDB_HIST_SMALL
Definition: comctl32.h:74
PIMLENTRY * himlDef
Definition: toolbar.c:150
PVOID ReAlloc(IN DWORD dwFlags, IN PVOID lpMem, IN SIZE_T dwBytes)
Definition: main.c:76
HWND hwndSelf
Definition: toolbar.c:158
#define IDB_VIEW_LARGE_COLOR
Definition: commctrl.h:1063
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static void TOOLBAR_CalcToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1784
#define ILC_MASK
Definition: commctrl.h:347
#define TB_SETBITMAPSIZE
Definition: commctrl.h:1132
#define IDB_STD_LARGE_COLOR
Definition: commctrl.h:1061
INT cimlDef
Definition: toolbar.c:151
#define GETDEFIMAGELIST(infoPtr, id)
Definition: toolbar.c:247
INT nNumBitmapInfos
Definition: toolbar.c:134
static BOOL TOOLBAR_AddBitmapToImageList(TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TBITMAP_INFO *bitmap)
Definition: toolbar.c:2887
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id)
Definition: toolbar.c:7246
#define HINST_COMMCTRL
Definition: commctrl.h:1059
HINSTANCE hInst
Definition: toolbar.c:107
#define IDB_STD_LARGE
Definition: comctl32.h:71
#define IDB_HIST_SMALL_COLOR
Definition: commctrl.h:1064
UINT_PTR nID
Definition: commctrl.h:1056

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 2887 of file toolbar.c.

2888 {
2889  HBITMAP hbmLoad;
2890  INT nCountBefore = ImageList_GetImageCount(himlDef);
2891  INT nCountAfter;
2892  INT cxIcon, cyIcon;
2893  INT nAdded;
2894  INT nIndex;
2895 
2896  TRACE("adding hInst=%p nID=%d nButtons=%d\n", bitmap->hInst, bitmap->nID, bitmap->nButtons);
2897  /* Add bitmaps to the default image list */
2898  if (bitmap->hInst == NULL) /* a handle was passed */
2899  hbmLoad = CopyImage(ULongToHandle(bitmap->nID), IMAGE_BITMAP, 0, 0, 0);
2900  else if (bitmap->hInst == COMCTL32_hModule)
2901  hbmLoad = LoadImageW( bitmap->hInst, MAKEINTRESOURCEW(bitmap->nID),
2903  else
2904  hbmLoad = CreateMappedBitmap(bitmap->hInst, bitmap->nID, 0, NULL, 0);
2905 
2906  /* enlarge the bitmap if needed */
2907  ImageList_GetIconSize(himlDef, &cxIcon, &cyIcon);
2908  if (bitmap->hInst != COMCTL32_hModule)
2909  COMCTL32_EnsureBitmapSize(&hbmLoad, cxIcon*(INT)bitmap->nButtons, cyIcon, comctl32_color.clrBtnFace);
2910 
2911  nIndex = ImageList_AddMasked(himlDef, hbmLoad, comctl32_color.clrBtnFace);
2912  DeleteObject(hbmLoad);
2913  if (nIndex == -1)
2914  return FALSE;
2915 
2916  nCountAfter = ImageList_GetImageCount(himlDef);
2917  nAdded = nCountAfter - nCountBefore;
2918  if (bitmap->nButtons == 0) /* wParam == 0 is special and means add only one image */
2919  {
2920  ImageList_SetImageCount(himlDef, nCountBefore + 1);
2921  } else if (nAdded > (INT)bitmap->nButtons) {
2922  TRACE("Added more images than wParam: Previous image number %i added %i while wParam %i. Images in list %i\n",
2923  nCountBefore, nAdded, bitmap->nButtons, nCountAfter);
2924  }
2925 
2926  infoPtr->nNumBitmaps += nAdded;
2927  return TRUE;
2928 }
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2063
#define ULongToHandle(h)
Definition: basetsd.h:81
#define TRUE
Definition: types.h:120
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight, COLORREF crBackground) DECLSPEC_HIDDEN
Definition: commctrl.c:1678
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
smooth NULL
Definition: ftsmooth.c:416
HBITMAP WINAPI CreateMappedBitmap(HINSTANCE hInstance, INT_PTR idBitmap, UINT wFlags, LPCOLORMAP lpColorMap, INT iNumMaps)
Definition: commctrl.c:998
Definition: uimain.c:88
#define TRACE(s)
Definition: solgame.cpp:4
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
INT nNumBitmaps
Definition: toolbar.c:132
COLORREF clrBtnFace
Definition: comctl32.h:161
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
#define LR_CREATEDIBSECTION
Definition: winuser.h:1088
#define IMAGE_BITMAP
Definition: winuser.h:211
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
BOOL WINAPI ImageList_SetImageCount(HIMAGELIST himl, UINT iImageCount)
Definition: imagelist.c:3089
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
static HBITMAP
Definition: button.c:44
#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 3080 of file toolbar.c.

3081 {
3082  TRACE("adding %d buttons (unicode=%d)\n", nAddButtons, fUnicode);
3083 
3084  return TOOLBAR_InternalInsertButtonsT(infoPtr, -1, nAddButtons, lpTbb, fUnicode);
3085 }
static BOOL TOOLBAR_InternalInsertButtonsT(TOOLBAR_INFO *infoPtr, INT iIndex, UINT nAddButtons, const TBBUTTON *lpTbb, BOOL fUnicode)
Definition: toolbar.c:2000
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringA()

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

Definition at line 3170 of file toolbar.c.

3171 {
3172  BOOL fFirstString = (infoPtr->nNumStrings == 0);
3173  LPSTR p;
3174  INT nIndex;
3175  INT len;
3176 
3177  TRACE("%p, %lx\n", hInstance, lParam);
3178 
3179  if (IS_INTRESOURCE(lParam)) /* load from resources */
3180  return TOOLBAR_AddStringW(infoPtr, hInstance, lParam);
3181 
3182  p = (LPSTR)lParam;
3183  if (p == NULL)
3184  return -1;
3185 
3186  TRACE("adding string(s) from array\n");
3187  nIndex = infoPtr->nNumStrings;
3188  while (*p) {
3189  len = strlen (p);
3190  TRACE("len=%d \"%s\"\n", len, p);
3191 
3192  infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3193  Str_SetPtrAtoW(&infoPtr->strings[infoPtr->nNumStrings], p);
3194  infoPtr->nNumStrings++;
3195 
3196  p += (len+1);
3197  }
3198 
3199  if (fFirstString)
3200  TOOLBAR_CalcToolbar(infoPtr);
3201  return nIndex;
3202 }
LPWSTR * strings
Definition: toolbar.c:176
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:58
HINSTANCE hInstance
Definition: charmap.c:20
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static LRESULT TOOLBAR_AddStringW(TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
Definition: toolbar.c:3089
#define TRACE(s)
Definition: solgame.cpp:4
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
PVOID ReAlloc(IN DWORD dwFlags, IN PVOID lpMem, IN SIZE_T dwBytes)
Definition: main.c:76
INT nNumStrings
Definition: toolbar.c:133
static void TOOLBAR_CalcToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1784
GLenum GLsizei len
Definition: glext.h:6722
BOOL Str_SetPtrAtoW(LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringW()

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

Definition at line 3089 of file toolbar.c.

3090 {
3091 #define MAX_RESOURCE_STRING_LENGTH 512
3092  BOOL fFirstString = (infoPtr->nNumStrings == 0);
3093  INT nIndex = infoPtr->nNumStrings;
3094 
3095  TRACE("%p, %lx\n", hInstance, lParam);
3096 
3097  if (IS_INTRESOURCE(lParam)) {
3099  WCHAR delimiter;
3100  WCHAR *next_delim;
3101  HRSRC hrsrc;
3102  WCHAR *p;
3103  INT len;
3104 
3105  TRACE("adding string from resource\n");
3106 
3107  if (!hInstance) return -1;
3108 
3109  hrsrc = FindResourceW( hInstance, MAKEINTRESOURCEW((LOWORD(lParam) >> 4) + 1),
3110  (LPWSTR)RT_STRING );
3111  if (!hrsrc)
3112  {
3113  TRACE("string not found in resources\n");
3114  return -1;
3115  }
3116 
3118  szString, MAX_RESOURCE_STRING_LENGTH);
3119 
3120  TRACE("len=%d %s\n", len, debugstr_w(szString));
3121  if (len == 0 || len == 1)
3122  return nIndex;
3123 
3124  TRACE("delimiter: 0x%x\n", *szString);
3125  delimiter = *szString;
3126  p = szString + 1;
3127 
3128  while ((next_delim = strchrW(p, delimiter)) != NULL) {
3129  *next_delim = 0;
3130  if (next_delim + 1 >= szString + len)
3131  {
3132  /* this may happen if delimiter == '\0' or if the last char is a
3133  * delimiter (then it is ignored like the native does) */
3134  break;
3135  }
3136 
3137  infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3138  Str_SetPtrW(&infoPtr->strings[infoPtr->nNumStrings], p);
3139  infoPtr->nNumStrings++;
3140 
3141  p = next_delim + 1;
3142  }
3143  }
3144  else {
3145  LPWSTR p = (LPWSTR)lParam;
3146  INT len;
3147 
3148  if (p == NULL)
3149  return -1;
3150  TRACE("adding string(s) from array\n");
3151  while (*p) {
3152  len = strlenW (p);
3153 
3154  TRACE("len=%d %s\n", len, debugstr_w(p));
3155  infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3156  Str_SetPtrW (&infoPtr->strings[infoPtr->nNumStrings], p);
3157  infoPtr->nNumStrings++;
3158 
3159  p += (len+1);
3160  }
3161  }
3162 
3163  if (fFirstString)
3164  TOOLBAR_CalcToolbar(infoPtr);
3165  return nIndex;
3166 }
LPWSTR * strings
Definition: toolbar.c:176
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:236
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HINSTANCE hInstance
Definition: charmap.c:20
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
const char * delimiter
Definition: string.c:1566
#define TRACE(s)
Definition: solgame.cpp:4
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
PVOID ReAlloc(IN DWORD dwFlags, IN PVOID lpMem, IN SIZE_T dwBytes)
Definition: main.c:76
__wchar_t WCHAR
Definition: xmlstorage.h:180
INT nNumStrings
Definition: toolbar.c:133
static void TOOLBAR_CalcToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1784
GLenum GLsizei len
Definition: glext.h:6722
#define RT_STRING
Definition: pedump.c:368
#define MAX_RESOURCE_STRING_LENGTH
unsigned int UINT
Definition: ndis.h:50
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by TOOLBAR_AddStringA(), and ToolbarWindowProc().

◆ TOOLBAR_AutoSize()

static LRESULT TOOLBAR_AutoSize ( TOOLBAR_INFO infoPtr)
static

Definition at line 3206 of file toolbar.c.

3207 {
3208  TRACE("auto sizing, style=%#x\n", infoPtr->dwStyle);
3209  TRACE("nRows: %d, infoPtr->nButtonHeight: %d\n", infoPtr->nRows, infoPtr->nButtonHeight);
3210 
3211 #ifdef __REACTOS__ /* workaround CORE-16169 part 2 of 2 */
3212  if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL))
3213  {
3214  TOOLBAR_LayoutToolbar(infoPtr);
3215  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
3216  }
3217 #endif
3218 
3219  if (!(infoPtr->dwStyle & CCS_NORESIZE))
3220  {
3221  RECT window_rect, parent_rect;
3222  UINT uPosFlags = SWP_NOZORDER | SWP_NOACTIVATE;
3223  HWND parent;
3224  INT x, y, cx, cy;
3225 
3226  parent = GetParent (infoPtr->hwndSelf);
3227 
3228  if (!parent || !infoPtr->bDoRedraw)
3229  return 0;
3230 
3231  GetClientRect(parent, &parent_rect);
3232 
3233  x = parent_rect.left;
3234  y = parent_rect.top;
3235 
3236  cy = TOP_BORDER + infoPtr->nRows * infoPtr->nButtonHeight + BOTTOM_BORDER;
3237  cx = parent_rect.right - parent_rect.left;
3238 
3239  if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_NOMOVEY)
3240  {
3241  GetWindowRect(infoPtr->hwndSelf, &window_rect);
3242  MapWindowPoints( 0, parent, (POINT *)&window_rect, 2 );
3243  y = window_rect.top;
3244  }
3245  if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_BOTTOM)
3246  {
3247  GetWindowRect(infoPtr->hwndSelf, &window_rect);
3248  y = parent_rect.bottom - ( window_rect.bottom - window_rect.top);
3249  }
3250 
3251  if (infoPtr->dwStyle & CCS_NOPARENTALIGN)
3252  uPosFlags |= SWP_NOMOVE;
3253 
3254  if (!(infoPtr->dwStyle & CCS_NODIVIDER))
3256 
3257  if (infoPtr->dwStyle & WS_BORDER)
3258  {
3261  }
3262 
3263  SetWindowPos(infoPtr->hwndSelf, NULL, x, y, cx, cy, uPosFlags);
3264  }
3265 
3266  if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL))
3267  {
3268  TOOLBAR_LayoutToolbar(infoPtr);
3269  InvalidateRect( infoPtr->hwndSelf, NULL, TRUE );
3270  }
3271 
3272  return 0;
3273 }
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define BOTTOM_BORDER
Definition: toolbar.c:205
#define TRUE
Definition: types.h:120
DWORD dwStyle
Definition: toolbar.c:164
LONG top
Definition: windef.h:307
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
BOOL bDoRedraw
Definition: toolbar.c:160
#define CCS_NODIVIDER
Definition: commctrl.h:2244
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
#define SM_CYEDGE
Definition: winuser.h:999
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2242
#define CCS_BOTTOM
Definition: commctrl.h:2240
#define TRACE(s)
Definition: solgame.cpp:4
r parent
Definition: btrfs.c:2944
HWND hwndSelf
Definition: toolbar.c:158
#define SWP_NOACTIVATE
Definition: winuser.h:1227
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
int WINAPI GetSystemMetrics(_In_ int)
INT nButtonHeight
Definition: toolbar.c:122
static void TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1809
#define CCS_NORESIZE
Definition: commctrl.h:2241
#define SM_CYBORDER
Definition: winuser.h:955
#define SM_CXBORDER
Definition: winuser.h:954
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
#define TOP_BORDER
Definition: toolbar.c:204
#define WS_BORDER
Definition: pedump.c:625
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int * cx
Definition: commctrl.h:581
#define CCS_NOMOVEY
Definition: commctrl.h:2239
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:986
LONG bottom
Definition: windef.h:309
DWORD dwExStyle
Definition: toolbar.c:165
#define SWP_NOMOVE
Definition: winuser.h:1229
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 TBSTYLE_EX_VERTICAL
Definition: commctrl.h:1007

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 3277 of file toolbar.c.

3278 {
3279  return infoPtr->nNumButtons;
3280 }
INT nNumButtons
Definition: toolbar.c:131

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ButtonHasString()

static BOOL TOOLBAR_ButtonHasString ( const TBUTTON_INFO btnPtr)
inlinestatic

Definition at line 347 of file toolbar.c.

348 {
349  return HIWORD(btnPtr->iString) && btnPtr->iString != -1;
350 }
INT_PTR iString
Definition: toolbar.c:98
#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 3284 of file toolbar.c.

3285 {
3286  infoPtr->dwStructSize = Size;
3287 
3288  return 0;
3289 }
DWORD dwStructSize
Definition: toolbar.c:119
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CalcStrings()

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

Definition at line 1385 of file toolbar.c.

1386 {
1387  TBUTTON_INFO *btnPtr;
1388  INT i;
1389  SIZE sz;
1390  HDC hdc;
1391  HFONT hOldFont;
1392 
1393  lpSize->cx = 0;
1394  lpSize->cy = 0;
1395 
1396  if (infoPtr->nMaxTextRows == 0)
1397  return;
1398 
1399  hdc = GetDC (infoPtr->hwndSelf);
1400  hOldFont = SelectObject (hdc, infoPtr->hFont);
1401 
1402  if (infoPtr->nNumButtons == 0 && infoPtr->nNumStrings > 0)
1403  {
1404  TEXTMETRICW tm;
1405 
1406  GetTextMetricsW(hdc, &tm);
1407  lpSize->cy = tm.tmHeight;
1408  }
1409 
1410  btnPtr = infoPtr->buttons;
1411  for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) {
1412  if(TOOLBAR_GetText(infoPtr, btnPtr))
1413  {
1414  TOOLBAR_MeasureString(infoPtr, btnPtr, hdc, &sz);
1415  if (sz.cx > lpSize->cx)
1416  lpSize->cx = sz.cx;
1417  if (sz.cy > lpSize->cy)
1418  lpSize->cy = sz.cy;
1419  }
1420  }
1421 
1422  SelectObject (hdc, hOldFont);
1423  ReleaseDC (infoPtr->hwndSelf, hdc);
1424 
1425  TRACE("max string size %d x %d\n", lpSize->cx, lpSize->cy);
1426 }
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
TBUTTON_INFO * buttons
Definition: toolbar.c:175
static void TOOLBAR_MeasureString(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr, HDC hdc, LPSIZE lpSize)
Definition: toolbar.c:1342
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
INT nNumButtons
Definition: toolbar.c:131
int32_t INT
Definition: typedefs.h:58
INT nMaxTextRows
Definition: toolbar.c:128
HFONT hFont
Definition: toolbar.c:148
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
static LPWSTR TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
Definition: toolbar.c:290
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LONG cx
Definition: windef.h:334
#define TRACE(s)
Definition: solgame.cpp:4
HWND hwndSelf
Definition: toolbar.c:158
INT nNumStrings
Definition: toolbar.c:133
HDC hdc
Definition: main.c:9
Definition: time.h:76
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG cy
Definition: windef.h:335

Referenced by TOOLBAR_CalcToolbar().

◆ TOOLBAR_CalcToolbar()

static void TOOLBAR_CalcToolbar ( TOOLBAR_INFO infoPtr)
static

Definition at line 1784 of file toolbar.c.

1785 {
1786  SIZE sizeString, sizeButton;
1787  BOOL validImageList = FALSE;
1788 
1789  TOOLBAR_CalcStrings (infoPtr, &sizeString);
1790 
1791  TOOLBAR_DumpToolbar (infoPtr, __LINE__);
1792 
1793  if (TOOLBAR_IsValidImageList(infoPtr, 0))
1794  validImageList = TRUE;
1795  sizeButton = TOOLBAR_MeasureButton(infoPtr, sizeString, TRUE, validImageList);
1796  infoPtr->nButtonWidth = sizeButton.cx;
1797  infoPtr->nButtonHeight = sizeButton.cy;
1798  infoPtr->iTopMargin = default_top_margin(infoPtr);
1799 
1800  if ( infoPtr->cxMin >= 0 && infoPtr->nButtonWidth < infoPtr->cxMin )
1801  infoPtr->nButtonWidth = infoPtr->cxMin;
1802  if ( infoPtr->cxMax > 0 && infoPtr->nButtonWidth > infoPtr->cxMax )
1803  infoPtr->nButtonWidth = infoPtr->cxMax;
1804 
1805  TOOLBAR_LayoutToolbar(infoPtr);
1806 }
#define TRUE
Definition: types.h:120
INT nButtonWidth
Definition: toolbar.c:123
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG cx
Definition: windef.h:334
static SIZE TOOLBAR_MeasureButton(const TOOLBAR_INFO *infoPtr, SIZE sizeString, BOOL bHasBitmap, BOOL bValidImageList)
Definition: toolbar.c:1708
static void TOOLBAR_CalcStrings(const TOOLBAR_INFO *infoPtr, LPSIZE lpSize)
Definition: toolbar.c:1385
INT nButtonHeight
Definition: toolbar.c:122
static void TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1809
static void TOOLBAR_DumpToolbar(const TOOLBAR_INFO *iP, INT line)
Definition: toolbar.c:327
INT iTopMargin
Definition: toolbar.c:145
static int default_top_margin(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:269
LONG cy
Definition: windef.h:335
static BOOL TOOLBAR_IsValidImageList(const TOOLBAR_INFO *infoPtr, INT index)
Definition: toolbar.c:469

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 6117 of file toolbar.c.

6118 {
6119  TBUTTON_INFO *btnPtr;
6120 
6121  infoPtr->bCaptured = FALSE;
6122 
6123  if (infoPtr->nButtonDown >= 0)
6124  {
6125  btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
6126  btnPtr->fsState &= ~TBSTATE_PRESSED;
6127 
6128  infoPtr->nOldHit = -1;
6129 
6130  if (btnPtr->fsState & TBSTATE_ENABLED)
6131  InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
6132  }
6133  return 0;
6134 }
INT nButtonDown
Definition: toolbar.c:135
TBUTTON_INFO * buttons
Definition: toolbar.c:175
#define TRUE
Definition: types.h:120
BYTE fsState
Definition: toolbar.c:93
BOOL bCaptured
Definition: toolbar.c:163
#define FALSE
Definition: types.h:117
#define TBSTATE_PRESSED
Definition: commctrl.h:969
RECT rect
Definition: toolbar.c:100
HWND hwndSelf
Definition: toolbar.c:158
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
INT nOldHit
Definition: toolbar.c:137
#define TBSTATE_ENABLED
Definition: commctrl.h:970

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ChangeBitmap()

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

Definition at line 3293 of file toolbar.c.

3294 {
3295  TBUTTON_INFO *btnPtr;
3296  INT nIndex;
3297 
3298  TRACE("button %d, iBitmap now %d\n", Id, Index);
3299 
3300  nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3301  if (nIndex == -1)
3302  return FALSE;
3303 
3304  btnPtr = &infoPtr->buttons[nIndex];
3305  btnPtr->iBitmap = Index;
3306 
3307  /* we HAVE to erase the background, the new bitmap could be */
3308  /* transparent */
3309  InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3310 
3311  return TRUE;
3312 }
TBUTTON_INFO * buttons
Definition: toolbar.c:175
#define TRUE
Definition: types.h:120
int32_t INT
Definition: typedefs.h:58
static INT TOOLBAR_GetButtonIndex(const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
Definition: toolbar.c:2054
DWORD Id
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
RECT rect
Definition: toolbar.c:100
HWND hwndSelf
Definition: toolbar.c:158
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static const UCHAR Index[8]
Definition: usbohci.c:18
INT iBitmap
Definition: toolbar.c:91

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CheckButton()

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

Definition at line 3316 of file toolbar.c.

3317 {
3318  TBUTTON_INFO *btnPtr;
3319  INT nIndex;
3320  INT nOldIndex = -1;
3321  BOOL bChecked = FALSE;
3322 
3323  nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3324 
3325  TRACE("hwnd=%p, btn index=%d, lParam=0x%08lx\n", infoPtr->hwndSelf, nIndex, lParam);
3326 
3327  if (nIndex == -1)
3328  return FALSE;
3329 
3330  btnPtr = &infoPtr->buttons[nIndex];
3331 
3332  bChecked = (btnPtr->fsState & TBSTATE_CHECKED) != 0;
3333 
3334  if (!LOWORD(lParam))
3335  btnPtr->fsState &= ~TBSTATE_CHECKED;
3336  else {
3337  if (btnPtr->fsStyle & BTNS_GROUP) {
3338  nOldIndex =
3339  TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex);
3340  if (nOldIndex == nIndex)
3341  return 0;
3342  if (nOldIndex != -1)
3343  infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;
3344  }
3345  btnPtr->fsState |= TBSTATE_CHECKED;
3346  }
3347 
3348  if( bChecked != LOWORD(lParam) )
3349  {
3350  if (nOldIndex != -1)
3351  InvalidateRect(infoPtr->hwndSelf, &infoPtr->buttons[nOldIndex].rect, TRUE);
3352  InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3353  }
3354 
3355  /* FIXME: Send a WM_NOTIFY?? */
3356 
3357  return TRUE;
3358 }
TBUTTON_INFO * buttons
Definition: toolbar.c:175
#define TRUE
Definition: types.h:120
#define BTNS_GROUP
Definition: commctrl.h:997
BYTE fsState
Definition: toolbar.c:93
int32_t INT
Definition: typedefs.h:58
static INT TOOLBAR_GetButtonIndex(const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
Definition: toolbar.c:2054
DWORD Id
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static INT TOOLBAR_GetCheckedGroupButtonIndex(const TOOLBAR_INFO *infoPtr, INT nIndex)
Definition: toolbar.c:2077
#define TRACE(s)
Definition: solgame.cpp:4
RECT rect
Definition: toolbar.c:100
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND hwndSelf
Definition: toolbar.c:158
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define TBSTATE_CHECKED
Definition: commctrl.h:968
BYTE fsStyle
Definition: toolbar.c:94
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CheckImageListIconSize()

static void TOOLBAR_CheckImageListIconSize ( TOOLBAR_INFO infoPtr)
static

Definition at line 2931 of file toolbar.c.

2932 {
2933  HIMAGELIST himlDef;
2934  HIMAGELIST himlNew;
2935  INT cx, cy;
2936  INT i;
2937 
2938  himlDef = GETDEFIMAGELIST(infoPtr, 0);
2939  if (himlDef == NULL || himlDef != infoPtr->himlInt)
2940  return;
2941  if (!ImageList_GetIconSize(himlDef, &cx, &cy))
2942  return;
2943  if (cx == infoPtr->nBitmapWidth && cy == infoPtr->nBitmapHeight)
2944  return;
2945 
2946  TRACE("Update icon size: %dx%d -> %dx%d\n",
2947  cx, cy, infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
2948 
2949  himlNew = ImageList_Create(infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
2950  ILC_COLOR32|ILC_MASK, 8, 2);
2951  for (i = 0; i < infoPtr->nNumBitmapInfos; i++)
2952  TOOLBAR_AddBitmapToImageList(infoPtr, himlNew, &infoPtr->bitmaps[i]);
2953  TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlNew, 0);
2954  infoPtr->himlInt = himlNew;
2955 
2956  infoPtr->nNumBitmaps -= ImageList_GetImageCount(himlDef);
2957  ImageList_Destroy(himlDef);
2958 }
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2063
HIMAGELIST himlInt
Definition: toolbar.c:149
INT nBitmapWidth
Definition: toolbar.c:125
INT nBitmapHeight
Definition: toolbar.c:124
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define ILC_COLOR32
Definition: commctrl.h:354
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
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
TBITMAP_INFO * bitmaps
Definition: toolbar.c:177
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
PIMLENTRY * himlDef
Definition: toolbar.c:150
INT nNumBitmaps
Definition: toolbar.c:132
#define ILC_MASK
Definition: commctrl.h:347
INT cimlDef
Definition: toolbar.c:151
#define GETDEFIMAGELIST(infoPtr, id)
Definition: toolbar.c:247
INT nNumBitmapInfos
Definition: toolbar.c:134
static BOOL TOOLBAR_AddBitmapToImageList(TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TBITMAP_INFO *bitmap)
Definition: toolbar.c:2887
static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id)
Definition: toolbar.c:7246
_Out_opt_ int * cx
Definition: commctrl.h:581
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037

Referenced by TOOLBAR_Refresh().

◆ TOOLBAR_CheckStyle()

static void TOOLBAR_CheckStyle ( const TOOLBAR_INFO infoPtr)
static

Definition at line 391 of file toolbar.c.

392 {
393  if (infoPtr->dwStyle & TBSTYLE_REGISTERDROP)
394  FIXME("[%p] TBSTYLE_REGISTERDROP not implemented\n", infoPtr->hwndSelf);
395 }
DWORD dwStyle
Definition: toolbar.c:164
#define TBSTYLE_REGISTERDROP
Definition: commctrl.h:991
#define FIXME(fmt,...)
Definition: debug.h:111
HWND hwndSelf
Definition: toolbar.c:158

Referenced by TOOLBAR_Create(), and TOOLBAR_SetStyle().

◆ TOOLBAR_CommandToIndex()

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

Definition at line 3362 of file toolbar.c.

3363 {
3364  return TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3365 }
static INT TOOLBAR_GetButtonIndex(const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
Definition: toolbar.c:2054
DWORD Id
#define FALSE
Definition: types.h:117

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Create()

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

Definition at line 5529 of file toolbar.c.

5530 {
5531  TOOLBAR_INFO *infoPtr = (TOOLBAR_INFO *)GetWindowLongPtrW(hwnd, 0);
5532  LOGFONTW logFont;
5533 
5534  TRACE("hwnd = %p, style=0x%08x\n", hwnd, lpcs->style);
5535 
5536  infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
5537  GetClientRect(hwnd, &infoPtr->client_rect);
5538  infoPtr->bUnicode = infoPtr->hwndNotify &&
5539  (NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_REQUERY));
5540  infoPtr->hwndToolTip = NULL; /* if needed the tooltip control will be created after a WM_MOUSEMOVE */
5541 
5543  infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont);
5544 
5545 #ifdef __REACTOS__
5546  {
5547  HTHEME theme = OpenThemeData (hwnd, themeClass);
5548  if (theme)
5549  GetThemeMargins(theme, NULL, TP_BUTTON, TS_NORMAL, TMT_CONTENTMARGINS, NULL, &infoPtr->themeMargins);
5550  }
5551 #else
5553 #endif
5554 
5555  TOOLBAR_CheckStyle (infoPtr);
5556 
5557  return 0;
5558 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND hwndToolTip
Definition: toolbar.c:156
DWORD dwStyle
Definition: toolbar.c:164
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
static void TOOLBAR_CheckStyle(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:391
HFONT hDefaultFont
Definition: toolbar.c:147
HFONT hFont
Definition: toolbar.c:148
#define TMT_CONTENTMARGINS
Definition: vssym32.h:324
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
RECT client_rect
Definition: toolbar.c:120
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
HWND hwndNotify
Definition: toolbar.c:157
#define NFR_UNICODE
Definition: winuser.h:2434
#define NF_REQUERY
Definition: winuser.h:2436
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, RECT *prc, MARGINS *pMargins)
Definition: property.c:216
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
static const WCHAR themeClass[]
Definition: toolbar.c:251
BOOL bUnicode
Definition: toolbar.c:162

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 2286 of file toolbar.c.

2287 {
2288  NMTOOLBARW nmtb;
2289 
2290  TRACE("Add: nIndexAvail %d, nIndexTo %d\n", nIndexAvail, nIndexTo);
2291 
2292  /* MSDN states that iItem is the index of the button, rather than the
2293  * command ID as used by every other NMTOOLBAR notification */
2294  nmtb.iItem = nIndexAvail;
2295  if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
2296  {
2297  PCUSTOMBUTTON btnInfo;
2298  NMHDR hdr;
2299  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2300  HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2301  int count = SendMessageW(hwndAvail, LB_GETCOUNT, 0, 0);
2302 
2303  btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndAvail, LB_GETITEMDATA, nIndexAvail, 0);
2304 
2305  if (nIndexAvail != 0) /* index == 0 indicates separator */
2306  {
2307  /* remove from 'available buttons' list */
2308  SendMessageW(hwndAvail, LB_DELETESTRING, nIndexAvail, 0);
2309  if (nIndexAvail == count-1)
2310  SendMessageW(hwndAvail, LB_SETCURSEL, nIndexAvail-1 , 0);
2311  else
2312  SendMessageW(hwndAvail, LB_SETCURSEL, nIndexAvail , 0);
2313  }
2314  else
2315  {
2316  PCUSTOMBUTTON btnNew;
2317 
2318  /* duplicate 'separator' button */
2319  btnNew = Alloc(sizeof(CUSTOMBUTTON));
2320  *btnNew = *btnInfo;
2321  btnInfo = btnNew;
2322  }
2323 
2324  /* insert into 'toolbar button' list */
2325  SendMessageW(hwndList, LB_INSERTSTRING, nIndexTo, 0);
2326  SendMessageW(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
2327 
2328  SendMessageW(custInfo->tbHwnd, TB_INSERTBUTTONW, nIndexTo, (LPARAM)&(btnInfo->btn));
2329 
2331  }
2332 }
#define LB_SETCURSEL
Definition: winuser.h:2045
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND tbHwnd
Definition: toolbar.c:185
char hdr[14]
Definition: iptest.cpp:33
#define LB_GETITEMDATA
Definition: winuser.h:2023
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TBN_TOOLBARCHANGE
Definition: commctrl.h:1310
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:59
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:61
LONG_PTR LPARAM
Definition: windef.h:208
static INT TOOLBAR_SendNotify(NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
Definition: toolbar.c:399
#define LB_GETCOUNT
Definition: winuser.h:2020
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
PTOOLBAR_INFO tbInfo
Definition: toolbar.c:184
#define LB_SETITEMDATA
Definition: winuser.h:2047
struct CUSTOMBUTTON * PCUSTOMBUTTON
#define TB_INSERTBUTTONW
Definition: commctrl.h:1261
#define TBN_QUERYINSERT
Definition: commctrl.h:1308
TBBUTTON btn
Definition: toolbar.c:190
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_DELETESTRING
Definition: winuser.h:2014
#define LB_INSERTSTRING
Definition: winuser.h:2035

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 2439 of file toolbar.c.

2441 {
2442  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2443  switch (pDLI->uNotification)
2444  {
2445  case DL_BEGINDRAG:
2446  return TRUE;
2447  case DL_DRAGGING:
2448  {
2449  INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2450  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2451  /* no dragging past last item (separator) */
2452  if ((nCurrentItem >= 0) && (nCurrentItem < nCount))
2453  {
2454  DrawInsert(hwnd, hwndList, nCurrentItem);
2455  /* FIXME: native uses "move button" cursor */
2456  return DL_COPYCURSOR;
2457  }
2458 
2459  /* not over toolbar buttons list */
2460  if (nCurrentItem < 0)
2461  {
2462  POINT ptWindow = pDLI->ptCursor;
2463  HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2464  MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2465  /* over available buttons list? */
2466  if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2467  /* FIXME: native uses "move button" cursor */
2468  return DL_COPYCURSOR;
2469  }
2470  /* clear drag arrow */
2471  DrawInsert(hwnd, hwndList, -1);
2472  return DL_STOPCURSOR;
2473  }
2474  case DL_DROPPED:
2475  {
2476  INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2477  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2479  if ((nIndexTo >= 0) && (nIndexTo < nCount))
2480  {
2481  /* clear drag arrow */
2482  DrawInsert(hwnd, hwndList, -1);
2483  /* add item */
2484  TOOLBAR_Cust_AddButton(custInfo, hwnd, nIndexFrom, nIndexTo);
2485  }
2486  }
2487  case DL_CANCELDRAG:
2488  /* Clear drag arrow */
2489  DrawInsert(hwnd, hwndList, -1);
2490  break;
2491  }
2492  return 0;
2493 }
#define DL_CANCELDRAG
Definition: commctrl.h:2096
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DL_BEGINDRAG
Definition: commctrl.h:2093
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
INT WINAPI LBItemFromPt(HWND hwndLB, POINT pt, BOOL bAutoScroll)
Definition: draglist.c:289
#define TRUE
Definition: types.h:120
#define DL_STOPCURSOR
Definition: commctrl.h:2099
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:59
#define DL_DRAGGING
Definition: commctrl.h:2094
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:61
int32_t INT
Definition: typedefs.h:58
UINT uNotification
Definition: commctrl.h:2088
smooth NULL
Definition: ftsmooth.c:416
#define DL_DROPPED
Definition: commctrl.h:2095
#define LB_GETCOUNT
Definition: winuser.h:2020
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DL_COPYCURSOR
Definition: commctrl.h:2100
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
HWND WINAPI ChildWindowFromPoint(_In_ HWND, _In_ POINT)
static void TOOLBAR_Cust_AddButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexAvail, INT nIndexTo)
Definition: toolbar.c:2286
VOID WINAPI DrawInsert(HWND hwndParent, HWND hwndLB, INT nItem)
Definition: draglist.c:224

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_InsertAvailButton()

static void TOOLBAR_Cust_InsertAvailButton ( HWND  hwnd,
PCUSTOMBUTTON  btnInfoNew 
)
static

Definition at line 2215 of file toolbar.c.

2216 {
2217  int i;
2218  int count;
2219  PCUSTOMBUTTON btnInfo;
2220  HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2221 
2222  TRACE("button %s, idCommand %d\n", debugstr_w(btnInfoNew->text), btnInfoNew->btn.idCommand);
2223 
2224  count = SendMessageW(hwndAvail, LB_GETCOUNT, 0, 0);
2225 
2226  /* position 0 is always separator */
2227  for (i = 1; i < count; i++)
2228  {
2229  btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndAvail, LB_GETITEMDATA, i, 0);
2230  if (btnInfoNew->btn.idCommand < btnInfo->btn.idCommand)
2231  {
2232  i = SendMessageW(hwndAvail, LB_INSERTSTRING, i, 0);
2233  SendMessageW(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
2234  return;
2235  }
2236  }
2237  /* id higher than all others add to end */
2238  i = SendMessageW(hwndAvail, LB_ADDSTRING, 0, 0);
2239  SendMessageW(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
2240 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define LB_ADDSTRING
Definition: winuser.h:2013
#define LB_GETITEMDATA
Definition: winuser.h:2023
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:59
WCHAR text[64]
Definition: toolbar.c:193
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 debugstr_w
Definition: kernel32.h:32
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETCOUNT
Definition: winuser.h:2020
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define LB_SETITEMDATA
Definition: winuser.h:2047
int idCommand
Definition: commctrl.h:946
struct CUSTOMBUTTON * PCUSTOMBUTTON
TBBUTTON btn
Definition: toolbar.c:190
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_INSERTSTRING
Definition: winuser.h:2035

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 2242 of file toolbar.c.

2243 {
2244  NMTOOLBARW nmtb;
2245 
2246  TRACE("index from %d, index to %d\n", nIndexFrom, nIndexTo);
2247 
2248  if (nIndexFrom == nIndexTo)
2249  return;
2250 
2251  /* MSDN states that iItem is the index of the button, rather than the
2252  * command ID as used by every other NMTOOLBAR notification */
2253  nmtb.iItem = nIndexFrom;
2254  if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
2255  {
2256  PCUSTOMBUTTON btnInfo;
2257  NMHDR hdr;
2258  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2259  int count = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2260 
2261  btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndList, LB_GETITEMDATA, nIndexFrom, 0);
2262 
2263  SendMessageW(hwndList, LB_DELETESTRING, nIndexFrom, 0);
2264  SendMessageW(hwndList, LB_INSERTSTRING, nIndexTo, 0);
2265  SendMessageW(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
2266  SendMessageW(hwndList, LB_SETCURSEL, nIndexTo, 0);
2267 
2268  if (nIndexTo <= 0)
2270  else
2272 
2273  /* last item is always separator, so -2 instead of -1 */
2274  if (nIndexTo >= (count - 2))
2276  else
2278 
2279  SendMessageW(custInfo->tbHwnd, TB_DELETEBUTTON, nIndexFrom, 0);
2280  SendMessageW(custInfo->tbHwnd, TB_INSERTBUTTONW, nIndexTo, (LPARAM)&(btnInfo->btn));
2281 
2283  }
2284 }
#define LB_SETCURSEL
Definition: winuser.h:2045
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND tbHwnd
Definition: toolbar.c:185
char hdr[14]
Definition: iptest.cpp:33
#define TRUE
Definition: types.h:120
#define LB_GETITEMDATA
Definition: winuser.h:2023
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TBN_TOOLBARCHANGE
Definition: commctrl.h:1310
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:61
#define FALSE
Definition: types.h:117
LONG_PTR LPARAM
Definition: windef.h:208
static INT TOOLBAR_SendNotify(NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
Definition: toolbar.c:399
#define LB_GETCOUNT
Definition: winuser.h:2020
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
PTOOLBAR_INFO tbInfo
Definition: toolbar.c:184
#define LB_SETITEMDATA
Definition: winuser.h:2047
#define IDC_MOVEUP_BTN
Definition: comctl32.h:64
struct CUSTOMBUTTON * PCUSTOMBUTTON
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define TB_INSERTBUTTONW
Definition: commctrl.h:1261
#define TBN_QUERYINSERT
Definition: commctrl.h:1308
TBBUTTON btn
Definition: toolbar.c:190
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_DELETESTRING
Definition: winuser.h:2014
#define LB_INSERTSTRING
Definition: winuser.h:2035
#define TB_DELETEBUTTON
Definition: commctrl.h:1104
#define IDC_MOVEDN_BTN
Definition: comctl32.h:65

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 2334 of file toolbar.c.

2335 {
2336  PCUSTOMBUTTON btnInfo;
2337  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2338 
2339  TRACE("Remove: index %d\n", index);
2340 
2341  btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndList, LB_GETITEMDATA, index, 0);
2342 
2343  /* send TBN_QUERYDELETE notification */
2344  if (TOOLBAR_IsButtonRemovable(custInfo->tbInfo, index, btnInfo))
2345  {
2346  NMHDR hdr;
2347 
2348  SendMessageW(hwndList, LB_DELETESTRING, index, 0);
2349  SendMessageW(hwndList, LB_SETCURSEL, index , 0);
2350 
2351  SendMessageW(custInfo->tbHwnd, TB_DELETEBUTTON, index, 0);
2352 
2353  /* insert into 'available button' list */
2354  if (!(btnInfo->btn.fsStyle & BTNS_SEP))
2356  else
2357  Free(btnInfo);
2358 
2360  }
2361 }
#define LB_SETCURSEL
Definition: winuser.h:2045
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND tbHwnd
Definition: toolbar.c:185
char hdr[14]
Definition: iptest.cpp:33
#define LB_GETITEMDATA
Definition: winuser.h:2023
#define TBN_TOOLBARCHANGE
Definition: commctrl.h:1310
BYTE fsStyle
Definition: commctrl.h:948
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:61
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew)
Definition: toolbar.c:2215
GLuint index
Definition: glext.h:6031
static INT TOOLBAR_SendNotify(NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
Definition: toolbar.c:399
static BOOL TOOLBAR_IsButtonRemovable(const TOOLBAR_INFO *infoPtr, int iItem, const CUSTOMBUTTON *btnInfo)
Definition: toolbar.c:7361
#define TRACE(s)
Definition: solgame.cpp:4
#define BTNS_SEP
Definition: commctrl.h:995
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
PTOOLBAR_INFO tbInfo
Definition: toolbar.c:184
struct CUSTOMBUTTON * PCUSTOMBUTTON
TBBUTTON btn
Definition: toolbar.c:190
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_DELETESTRING
Definition: winuser.h:2014
#define TB_DELETEBUTTON
Definition: commctrl.h:1104

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 2364 of file toolbar.c.

2366 {
2367  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2368  switch (pDLI->uNotification)
2369  {
2370  case DL_BEGINDRAG:
2371  {
2372  INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2373  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2374  /* no dragging for last item (separator) */
2375  if (nCurrentItem >= (nCount - 1)) return FALSE;
2376  return TRUE;
2377  }
2378  case DL_DRAGGING:
2379  {
2380  INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2381  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2382  /* no dragging past last item (separator) */
2383  if ((nCurrentItem >= 0) && (nCurrentItem < (nCount - 1)))
2384  {
2385  DrawInsert(hwnd, hwndList, nCurrentItem);
2386  /* FIXME: native uses "move button" cursor */
2387  return DL_COPYCURSOR;
2388  }
2389 
2390  /* not over toolbar buttons list */
2391  if (nCurrentItem < 0)
2392  {
2393  POINT ptWindow = pDLI->ptCursor;
2394  HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2395  MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2396  /* over available buttons list? */
2397  if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2398  /* FIXME: native uses "move button" cursor */
2399  return DL_COPYCURSOR;
2400  }
2401  /* clear drag arrow */
2402  DrawInsert(hwnd, hwndList, -1);
2403  return DL_STOPCURSOR;
2404  }
2405  case DL_DROPPED:
2406  {
2407  INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2408  INT nIndexFrom = SendMessageW(hwndList, LB_GETCURSEL, 0, 0);
2409  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2410  if ((nIndexTo >= 0) && (nIndexTo < (nCount - 1)))
2411  {
2412  /* clear drag arrow */
2413  DrawInsert(hwnd, hwndList, -1);
2414  /* move item */
2415  TOOLBAR_Cust_MoveButton(custInfo, hwnd, nIndexFrom, nIndexTo);
2416  }
2417  /* not over toolbar buttons list */
2418  if (nIndexTo < 0)
2419  {
2420  POINT ptWindow = pDLI->ptCursor;
2421  HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2422  MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2423  /* over available buttons list? */
2424  if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2425  TOOLBAR_Cust_RemoveButton(custInfo, hwnd, nIndexFrom);
2426  }
2427  break;
2428  }
2429  case DL_CANCELDRAG:
2430  /* Clear drag arrow */
2431  DrawInsert(hwnd, hwndList, -1);
2432  break;
2433  }
2434 
2435  return 0;
2436 }
#define DL_CANCELDRAG
Definition: commctrl.h:2096
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DL_BEGINDRAG
Definition: commctrl.h:2093
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
INT WINAPI LBItemFromPt(HWND hwndLB, POINT pt, BOOL bAutoScroll)
Definition: draglist.c:289
#define TRUE
Definition: types.h:120
#define DL_STOPCURSOR
Definition: commctrl.h:2099
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:59
#define DL_DRAGGING
Definition: commctrl.h:2094
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:61
int32_t INT
Definition: typedefs.h:58
UINT uNotification
Definition: commctrl.h:2088
#define FALSE
Definition: types.h:117
static void TOOLBAR_Cust_RemoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT index)
Definition: toolbar.c:2334
smooth NULL
Definition: ftsmooth.c:416
#define DL_DROPPED
Definition: commctrl.h:2095
#define LB_GETCOUNT
Definition: winuser.h:2020
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DL_COPYCURSOR
Definition: commctrl.h:2100
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
static void TOOLBAR_Cust_MoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo)
Definition: toolbar.c:2242
HWND WINAPI ChildWindowFromPoint(_In_ HWND, _In_ POINT)
VOID WINAPI DrawInsert(HWND hwndParent, HWND hwndLB, INT nItem)
Definition: draglist.c:224

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Customize()

static LRESULT TOOLBAR_Customize ( TOOLBAR_INFO infoPtr)
static

Definition at line 3369 of file toolbar.c.

3370 {
3371  CUSTDLG_INFO custInfo;
3372  LRESULT ret;
3373  NMHDR nmhdr;
3374 
3375  custInfo.tbInfo = infoPtr;
3376  custInfo.tbHwnd = infoPtr->hwndSelf;
3377 
3378  /* send TBN_BEGINADJUST notification */
3379  TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_BEGINADJUST);
3380 
3382  infoPtr->hwndSelf, TOOLBAR_CustomizeDialogProc, (LPARAM)&custInfo);
3383 
3384  /* send TBN_ENDADJUST notification */
3385  TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_ENDADJUST);
3386 
3387  return ret;
3388 }
HWND tbHwnd
Definition: toolbar.c:185
#define TBN_ENDADJUST
Definition: commctrl.h:1306
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
static INT_PTR CALLBACK TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:2502
#define TBN_BEGINADJUST
Definition: commctrl.h:1305
#define IDD_TBCUSTOMIZE
Definition: comctl32.h:57
LONG_PTR LPARAM
Definition: windef.h:208
static INT TOOLBAR_SendNotify(NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
Definition: toolbar.c:399
HWND hwndSelf
Definition: toolbar.c:158
PTOOLBAR_INFO tbInfo
Definition: toolbar.c:184
int ret
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LONG_PTR LRESULT
Definition: windef.h:209

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 2502 of file toolbar.c.

2503 {
2505  PCUSTOMBUTTON btnInfo;
2506  NMTOOLBARA nmtb;
2507  TOOLBAR_INFO *infoPtr = custInfo ? custInfo->tbInfo : NULL;
2508 
2509  switch (uMsg)
2510  {
2511  case WM_INITDIALOG:
2512  custInfo = (PCUSTDLG_INFO)lParam;
2513  SetWindowLongPtrW (hwnd, DWLP_USER, (LONG_PTR)custInfo);
2514 
2515  if (custInfo)
2516  {
2517  WCHAR Buffer[256];
2518  int i = 0;
2519  int index;
2520  NMTBINITCUSTOMIZE nmtbic;
2521 
2522  infoPtr = custInfo->tbInfo;
2523 
2524  /* send TBN_QUERYINSERT notification */
2525  nmtb.iItem = custInfo->tbInfo->nNumButtons;
2526 
2527  if (!TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT))
2528  return FALSE;
2529 
2530  nmtbic.hwndDialog = hwnd;
2531  /* Send TBN_INITCUSTOMIZE notification */
2532  if (TOOLBAR_SendNotify (&nmtbic.hdr, infoPtr, TBN_INITCUSTOMIZE) ==
2534  {
2535  TRACE("TBNRF_HIDEHELP requested\n");
2537  }
2538 
2539  /* add items to 'toolbar buttons' list and check if removable */
2540  for (i = 0; i < custInfo->tbInfo->nNumButtons; i++)
2541  {
2542  btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2543  memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2544  btnInfo->btn.fsStyle = BTNS_SEP;
2545  btnInfo->bVirtual = FALSE;
2547 
2548  /* send TBN_QUERYDELETE notification */
2549  btnInfo->bRemovable = TOOLBAR_IsButtonRemovable(infoPtr, i, btnInfo);
2550 
2553  }
2554 
2556 
2557  /* insert separator button into 'available buttons' list */
2558  btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2559  memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2560  btnInfo->btn.fsStyle = BTNS_SEP;
2561  btnInfo->bVirtual = FALSE;
2562  btnInfo->bRemovable = TRUE;
2566 
2567  /* insert all buttons into dsa */
2568  for (i = 0;; i++)
2569  {
2570  /* send TBN_GETBUTTONINFO notification */
2571  NMTOOLBARW nmtb;
2572  nmtb.iItem = i;
2573  nmtb.pszText = Buffer;
2574  nmtb.cchText = 256;
2575 
2576  /* Clear previous button's text */
2577  ZeroMemory(nmtb.pszText, nmtb.cchText * sizeof(WCHAR));
2578 
2579  if (!TOOLBAR_GetButtonInfo(infoPtr, &nmtb))
2580  break;
2581 
2582  TRACE("WM_INITDIALOG style: %x iItem(%d) idCommand(%d) iString(%ld) %s\n",
2583  nmtb.tbButton.fsStyle, i,
2584  nmtb.tbButton.idCommand,
2585  nmtb.tbButton.iString,
2586  nmtb.tbButton.iString >= 0 ? debugstr_w(infoPtr->strings[nmtb.tbButton.iString])
2587  : "");
2588 
2589  /* insert button into the appropriate list */
2591  if (index == -1)
2592  {
2593  btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2594  btnInfo->bVirtual = FALSE;
2595  btnInfo->bRemovable = TRUE;
2596  }
2597  else
2598  {
2599  btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageW (hwnd,
2601  }
2602 
2603  btnInfo->btn = nmtb.tbButton;
2604  if (!(nmtb.tbButton.fsStyle & BTNS_SEP))
2605  {
2606  if (lstrlenW(nmtb.pszText))
2607  lstrcpyW(btnInfo->text, nmtb.pszText);
2608  else if (nmtb.tbButton.iString >= 0 &&
2609  nmtb.tbButton.iString < infoPtr->nNumStrings)
2610  {
2611  lstrcpyW(btnInfo->text,
2612  infoPtr->strings[nmtb.tbButton.iString]);
2613  }
2614  }
2615 
2616  if (index == -1)
2618  }
2619 
2621 
2622  /* select first item in the 'available' list */
2624 
2625  /* append 'virtual' separator button to the 'toolbar buttons' list */
2626  btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2627  memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2628  btnInfo->btn.fsStyle = BTNS_SEP;
2629  btnInfo->bVirtual = TRUE;
2630  btnInfo->bRemovable = FALSE;
2634 
2635  /* select last item in the 'toolbar' list */
2638 
2641 
2642  /* set focus and disable buttons */
2643  PostMessageW (hwnd, WM_USER, 0, 0);
2644  }
2645  return TRUE;
2646 
2647  case WM_USER:
2652  return TRUE;
2653 
2654  case WM_CLOSE:
2655  EndDialog(hwnd, FALSE);
2656  return TRUE;
2657 
2658  case WM_COMMAND:
2659  switch (LOWORD(wParam))
2660  {
2661  case IDC_TOOLBARBTN_LBOX:
2662  if (HIWORD(wParam) == LBN_SELCHANGE)
2663  {
2664  PCUSTOMBUTTON btnInfo;
2665  NMTOOLBARA nmtb;
2666  int count;
2667  int index;
2668 
2671 
2672  /* send TBN_QUERYINSERT notification */
2673  nmtb.iItem = index;
2674  TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT);
2675 
2676  /* get list box item */
2678 
2679  if (index == (count - 1))
2680  {
2681  /* last item (virtual separator) */
2684  }
2685  else if (index == (count - 2))
2686  {
2687  /* second last item (last non-virtual item) */
2690  }
2691  else if (index == 0)
2692  {
2693  /* first item */
2696  }
2697  else
2698  {
2701  }
2702 
2704  }
2705  break;
2706 
2707  case IDC_MOVEUP_BTN:
2708  {
2710  TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index-1);
2711  }
2712  break;
2713 
2714  case IDC_MOVEDN_BTN: /* move down */
2715  {
2717  TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index+1);
2718  }
2719  break;
2720 
2721  case IDC_REMOVE_BTN: /* remove button */
2722  {
2724 
2725  if (LB_ERR == index)
2726  break;
2727 
2728  TOOLBAR_Cust_RemoveButton(custInfo, hwnd, index);
2729  }
2730  break;
2731  case IDC_HELP_BTN:
2732  TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_CUSTHELP);
2733  break;
2734  case IDC_RESET_BTN:
2735  TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_RESET);
2736  break;
2737 
2738  case IDOK: /* Add button */
2739  {
2740  int index;
2741  int indexto;
2742 
2745 
2746  TOOLBAR_Cust_AddButton(custInfo, hwnd, index, indexto);
2747  }
2748  break;
2749 
2750  case IDCANCEL:
2751  EndDialog(hwnd, FALSE);
2752  break;
2753  }
2754  return TRUE;
2755 
2756  case WM_DESTROY:
2757  {
2758  int count;
2759  int i;
2760 
2761  /* delete items from 'toolbar buttons' listbox*/
2763  for (i = 0; i < count; i++)
2764  {
2766  Free(btnInfo);
2768  }
2770 
2771 
2772  /* delete items from 'available buttons' listbox*/
2774  for (i = 0; i < count; i++)
2775  {
2777  Free(btnInfo);
2779  }
2781  }
2782  return TRUE;
2783 
2784  case WM_DRAWITEM:
2786  {
2788  RECT rcButton;
2789  RECT rcText;
2790  HPEN hPen, hOldPen;
2791  HBRUSH hOldBrush;
2792  COLORREF oldText = 0;
2793  COLORREF oldBk = 0;
2794 
2795  /* get item data */
2797  if (btnInfo == NULL)
2798  {
2799  FIXME("btnInfo invalid\n");
2800  return TRUE;
2801  }
2802 
2803  /* set colors and select objects */
2805  if (btnInfo->bVirtual)
2806  oldText = SetTextColor (lpdis->hDC, comctl32_color.clrGrayText);
2807  else
2809  hPen = CreatePen( PS_SOLID, 1,
2811  hOldPen = SelectObject (lpdis->hDC, hPen );
2813 
2814  /* fill background rectangle */
2815  Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
2816  lpdis->rcItem.right, lpdis->rcItem.bottom);
2817 
2818  /* calculate button and text rectangles */
2819  rcButton = lpdis->rcItem;
2820  InflateRect (&rcButton, -1, -1);
2821  rcText = rcButton;
2822  rcButton.right = rcButton.left + custInfo->tbInfo->nBitmapWidth + 6;
2823  rcText.left = rcButton.right + 2;
2824 
2825  /* draw focus rectangle */
2826  if (lpdis->itemState & ODS_FOCUS)
2827  DrawFocusRect (lpdis->hDC, &lpdis->rcItem);
2828 
2829  /* draw button */
2830  if (!(infoPtr->dwStyle & TBSTYLE_FLAT))
2831  DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT);
2832 
2833  /* draw image and text */
2834  if ((btnInfo->btn.fsStyle & BTNS_SEP) == 0) {
2835  HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr,
2836  btnInfo->btn.iBitmap));
2837  ImageList_Draw (himl, GETIBITMAP(infoPtr, btnInfo->btn.iBitmap),
2838  lpdis->hDC, rcButton.left+3, rcButton.top+3, ILD_NORMAL);
2839  }
2840  DrawTextW (lpdis->hDC, btnInfo->text, -1, &rcText,
2842 
2843  /* delete objects and reset colors */
2844  SelectObject (lpdis->hDC, hOldBrush);
2845  SelectObject (lpdis->hDC, hOldPen);
2846  SetBkColor (lpdis->hDC, oldBk);
2847  SetTextColor (lpdis->hDC, oldText);
2848  DeleteObject( hPen );
2849  return TRUE;
2850  }
2851  return FALSE;
2852 
2853  case WM_MEASUREITEM:
2855  {
2857 
2858  lpmis->itemHeight = 15 + 8; /* default height */
2859 
2860  return TRUE;
2861  }
2862  return FALSE;
2863 
2864  default:
2865  if (uDragListMessage && (uMsg == uDragListMessage))
2866  {
2867  if (wParam == IDC_TOOLBARBTN_LBOX)
2868  {
2870  custInfo, hwnd, (DRAGLISTINFO *)lParam);
2872  return TRUE;
2873  }
2874  else if (wParam == IDC_AVAILBTN_LBOX)
2875  {
2877  custInfo, hwnd, (DRAGLISTINFO *)lParam);
2879  return TRUE;
2880  }
2881  }
2882  return FALSE;
2883  }
2884 }
#define LB_SETCURSEL
Definition: winuser.h:2045
struct CUSTDLG_INFO * PCUSTDLG_INFO
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define BF_MIDDLE
Definition: winuser.h:468
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
LPWSTR * strings
Definition: toolbar.c:176
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define IDOK
Definition: winuser.h:824
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
#define TBN_CUSTHELP
Definition: commctrl.h:1311
#define LB_ADDSTRING
Definition: winuser.h:2013
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
static LRESULT TOOLBAR_Cust_AvailDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2439
#define GETIBITMAP(infoPtr, i)
Definition: toolbar.c:245
#define LB_GETITEMDATA
Definition: winuser.h:2023
GLuint GLuint GLsizei count
Definition: gl.h:1545
INT nBitmapWidth
Definition: toolbar.c:125
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
DWORD dwStyle
Definition: toolbar.c:164
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
#define ODS_FOCUS
Definition: winuser.h:2524
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:59
#define ZeroMemory
Definition: winbase.h:1648
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
INT nNumButtons
Definition: toolbar.c:131
HWND WINAPI SetFocus(_In_opt_ HWND)
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define GETHIMLID(infoPtr, i)
Definition: toolbar.c:246
BYTE fsStyle
Definition: commctrl.h:948
INT nBitmapHeight
Definition: toolbar.c:124
LONG right
Definition: windef.h:308
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:61
#define lstrlenW
Definition: compat.h:498
HIMAGELIST himl
#define LBN_SELCHANGE
Definition: winuser.h:2057
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define COLOR_WINDOW
Definition: winuser.h:908
static INT TOOLBAR_GetButtonIndex(const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
Definition: toolbar.c:2054
#define TBN_RESET
Definition: commctrl.h:1307
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define DWLP_MSGRESULT
Definition: winuser.h:864
static int int *static int
Definition: toolbar.c:45
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
#define LB_SETITEMHEIGHT
Definition: winuser.h:2048
WCHAR text[64]
Definition: toolbar.c:193
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:977
COLORREF clrWindowText
Definition: comctl32.h:170
BOOL bRemovable
Definition: toolbar.c:192
#define BF_RECT
Definition: winuser.h:462
#define PS_SOLID
Definition: wingdi.h:585
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 LB_RESETCONTENT
Definition: winuser.h:2037
static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew)
Definition: toolbar.c:2215
BOOL WINAPI MakeDragList(HWND hwndLB)
Definition: draglist.c:204
#define FALSE
Definition: types.h:117
#define DT_LEFT
Definition: winuser.h:534
#define LB_ERR
Definition: winuser.h:2407
#define IDC_RESET_BTN
Definition: comctl32.h:60
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
static void TOOLBAR_Cust_RemoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT index)
Definition: toolbar.c:2334
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
static BOOL TOOLBAR_GetButtonInfo(const TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
Definition: toolbar.c:7330
smooth NULL
Definition: ftsmooth.c:416
COLORREF clrHighlightText
Definition: comctl32.h:163
BOOL bVirtual
Definition: toolbar.c:191
LONG_PTR LPARAM
Definition: windef.h:208
Definition: bufpool.h:45
GLuint index
Definition: glext.h:6031
#define DT_VCENTER
Definition: winuser.h:543
INT_PTR iString
Definition: commctrl.h:955
static INT TOOLBAR_SendNotify(NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
Definition: toolbar.c:399
#define LB_GETCOUNT
Definition: winuser.h:2020
#define WM_DESTROY
Definition: winuser.h:1591
int iBitmap
Definition: commctrl.h:945
static BOOL TOOLBAR_IsButtonRemovable(const TOOLBAR_INFO *infoPtr, int iItem, const CUSTOMBUTTON *btnInfo)
Definition: toolbar.c:7361
static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2364
TBBUTTON tbButton
Definition: commctrl.h:1446
#define TRACE(s)
Definition: solgame.cpp:4
#define BTNS_SEP
Definition: commctrl.h:995
#define LB_SETTOPINDEX
Definition: winuser.h:2052
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD COLORREF
Definition: windef.h:300
#define WM_CLOSE
Definition: winuser.h:1603
#define IDC_HELP_BTN
Definition: comctl32.h:63
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
PTOOLBAR_INFO tbInfo
Definition: toolbar.c:184
#define WM_MEASUREITEM
Definition: winuser.h:1628
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPWSTR pszText
Definition: commctrl.h:1448
#define LB_SETITEMDATA
Definition: winuser.h:2047
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
INT nNumStrings
Definition: toolbar.c:133
#define TBNRF_HIDEHELP
Definition: commctrl.h:1348
#define IDS_SEPARATOR
Definition: comctl32.h:67
#define index(s, c)
Definition: various.h:29
#define IDC_MOVEUP_BTN
Definition: comctl32.h:64
#define DWLP_USER
Definition: winuser.h:866
int idCommand
Definition: commctrl.h:946
#define WM_COMMAND
Definition: winuser.h:1722
struct CUSTOMBUTTON * PCUSTOMBUTTON
#define WM_USER
Definition: winuser.h:1877
#define IDC_REMOVE_BTN
Definition: comctl32.h:62
#define TBN_INITCUSTOMIZE
Definition: commctrl.h:1342
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define EDGE_RAISED
Definition: winuser.h:450
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define DT_SINGLELINE
Definition: winuser.h:540
#define GETDEFIMAGELIST(infoPtr, id)
Definition: toolbar.c:247
COLORREF clrGrayText
Definition: comctl32.h:171
#define TBN_QUERYINSERT
Definition: commctrl.h:1308
#define lstrcpyW
Definition: compat.h:497
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
#define BF_SOFT
Definition: winuser.h:469
TBBUTTON btn
Definition: toolbar.c:190
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LB_GETCURSEL
Definition: winuser.h:2021
COLORREF clrHighlight
Definition: comctl32.h:162
static void TOOLBAR_Cust_MoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo)
Definition: toolbar.c:2242
#define WM_DRAWITEM
Definition: winuser.h:1627
UINT uDragListMessage
Definition: draglist.c:73
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ODS_SELECTED
Definition: winuser.h:2520
GLuint res
Definition: glext.h:9613
#define HIWORD(l)
Definition: typedefs.h:247
LONG bottom
Definition: windef.h:309
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define ILD_NORMAL
Definition: commctrl.h:413
#define IDCANCEL
Definition: winuser.h:825
LONG_PTR LRESULT
Definition: windef.h:209
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
COLORREF clrWindow
Definition: comctl32.h:169
HBRUSH WINAPI GetSysColorBrush(_In_ int)
static void TOOLBAR_Cust_AddButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexAvail, INT nIndexTo)
Definition: toolbar.c:2286
#define memset(x, y, z)
Definition: compat.h:39
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define TBSTYLE_FLAT
Definition: commctrl.h:988
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
#define IDC_MOVEDN_BTN
Definition: comctl32.h:65

Referenced by TOOLBAR_Customize().

◆ TOOLBAR_DeleteAllButtons()

static void TOOLBAR_DeleteAllButtons ( TOOLBAR_INFO infoPtr)
static

Definition at line 4338 of file toolbar.c.

4339 {
4340  INT i;
4341 
4342  for (i = 0; i < infoPtr->nNumButtons; i++)
4343  {
4344  free_string( infoPtr->buttons + i );
4345  TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[i]);
4346  }
4347 
4348  Free(infoPtr->buttons);
4349  infoPtr->buttons = NULL;
4350  infoPtr->nNumButtons = 0;
4351 }
TBUTTON_INFO * buttons
Definition: toolbar.c:175
INT nNumButtons
Definition: toolbar.c:131
int32_t INT
Definition: typedefs.h:58
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
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
smooth NULL
Definition: ftsmooth.c:416
static void free_string(TBUTTON_INFO *btn)
Definition: toolbar.c:377
static void TOOLBAR_TooltipDelTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
Definition: toolbar.c:2159

Referenced by TOOLBAR_Restore().

◆ TOOLBAR_DeleteButton()

static LRESULT TOOLBAR_DeleteButton ( TOOLBAR_INFO infoPtr,
INT  nIndex 
)
static

Definition at line 3392 of file toolbar.c.

3393 {
3394  NMTOOLBARW nmtb;
3395  TBUTTON_INFO *btnPtr = &infoPtr->buttons[nIndex];
3396 
3397  if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
3398  return FALSE;
3399 
3400  memset(&nmtb, 0, sizeof(nmtb));
3401  nmtb.iItem = btnPtr->idCommand;
3402  nmtb.tbButton.iBitmap = btnPtr->iBitmap;
3403  nmtb.tbButton.idCommand = btnPtr->idCommand;
3404  nmtb.tbButton.fsState = btnPtr->fsState;
3405  nmtb.tbButton.fsStyle = btnPtr->fsStyle;
3406  nmtb.tbButton.dwData = btnPtr->dwData;
3407  nmtb.tbButton.iString = btnPtr->iString;
3408  TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_DELETINGBUTTON);
3409 
3410  TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[nIndex]);
3411 
3412  infoPtr->nHotItem = -1;
3413  if (infoPtr->nNumButtons == 1) {
3414  TRACE(" simple delete\n");
3415  free_string( infoPtr->buttons );
3416  Free (infoPtr->buttons);
3417  infoPtr->buttons = NULL;
3418  infoPtr->nNumButtons = 0;
3419  }
3420  else {
3421  TBUTTON_INFO *oldButtons = infoPtr->buttons;
3422  TRACE("complex delete [nIndex=%d]\n", nIndex);
3423 
3424  infoPtr->nNumButtons--;
3425  infoPtr->buttons = Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons);
3426  if (nIndex > 0) {
3427  memcpy (&infoPtr->buttons[0], &oldButtons[0],
3428  nIndex * sizeof(TBUTTON_INFO));
3429  }
3430 
3431  if (nIndex < infoPtr->nNumButtons) {
3432  memcpy (&infoPtr->buttons[nIndex], &oldButtons[nIndex+1],
3433  (infoPtr->nNumButtons - nIndex) * sizeof(TBUTTON_INFO));
3434  }
3435 
3436  free_string( oldButtons + nIndex );
3437  Free (oldButtons);
3438  }
3439 
3440  TOOLBAR_LayoutToolbar(infoPtr);
3441 
3442  InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
3443 
3444  return TRUE;
3445 }
TBUTTON_INFO * buttons
Definition: toolbar.c:175
#define TRUE
Definition: types.h:120
BYTE fsState
Definition: toolbar.c:93
INT nNumButtons
Definition: toolbar.c:131
INT nHotItem
Definition: toolbar.c:138
BYTE fsStyle
Definition: commctrl.h:948
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
#define FALSE
Definition: types.h:117
INT idCommand
Definition: toolbar.c:92
smooth NULL
Definition: ftsmooth.c:416
INT_PTR iString
Definition: commctrl.h:955
static INT TOOLBAR_SendNotify(NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
Definition: toolbar.c:399
DWORD_PTR dwData
Definition: commctrl.h:954
int iBitmap
Definition: commctrl.h:945
TBBUTTON tbButton
Definition: commctrl.h:1446
#define TRACE(s)
Definition: solgame.cpp:4
HWND hwndSelf
Definition: toolbar.c:158
static void free_string(TBUTTON_INFO *btn)
Definition: toolbar.c:377
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
static void TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1809
int idCommand
Definition: commctrl.h:946
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void TOOLBAR_TooltipDelTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
Definition: toolbar.c:2159
INT_PTR iString
Definition: toolbar.c:98
INT iBitmap
Definition: toolbar.c:91
BYTE fsStyle
Definition: toolbar.c:94
DWORD_PTR dwData
Definition: toolbar.c:97
BYTE fsState
Definition: commctrl.h:947
#define memset(x, y, z)
Definition: compat.h:39
#define TBN_DELETINGBUTTON
Definition: commctrl.h:1334

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

◆ TOOLBAR_DeleteImageList()

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

Definition at line 7282 of file toolbar.c.

7283 {
7284  int i;
7285 
7286  for (i = 0; i < *cies; i++)
7287  Free((*pies)[i]);
7288 
7289  Free(*pies);
7290 
7291  *cies = 0;
7292  *pies = NULL;
7293 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
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
smooth NULL
Definition: ftsmooth.c:416

Referenced by TOOLBAR_Destroy().

◆ TOOLBAR_Destroy()

static LRESULT TOOLBAR_Destroy ( TOOLBAR_INFO infoPtr)
static

Definition at line 5562 of file toolbar.c.

5563 {
5564  INT i;
5565 
5566  /* delete tooltip control */
5567  if (infoPtr->hwndToolTip)
5568  DestroyWindow (infoPtr->hwndToolTip);
5569 
5570  /* delete temporary buffer for tooltip text */
5571  Free (infoPtr->pszTooltipText);
5572  Free (infoPtr->bitmaps); /* bitmaps list */
5573 
5574  /* delete button data */
5575  for (i = 0; i < infoPtr->nNumButtons; i++)
5576  free_string( infoPtr->buttons + i );
5577  Free (infoPtr->buttons);
5578 
5579  /* delete strings */
5580  if (infoPtr->strings) {
5581  for (i = 0; i < infoPtr->nNumStrings; i++)
5582  Free (infoPtr->strings[i]);
5583 
5584  Free (infoPtr->strings);
5585  }
5586 
5587  /* destroy internal image list */
5588  if (infoPtr->himlInt)
5589  ImageList_Destroy (infoPtr->himlInt);
5590 
5591  TOOLBAR_DeleteImageList(&infoPtr->himlDef, &infoPtr->cimlDef);
5592  TOOLBAR_DeleteImageList(&infoPtr->himlDis, &infoPtr->cimlDis);
5593  TOOLBAR_DeleteImageList(&infoPtr->himlHot, &infoPtr->cimlHot);
5594 
5595  /* delete default font */
5596  DeleteObject (infoPtr->hDefaultFont);
5597 
5598  CloseThemeData (GetWindowTheme (infoPtr->hwndSelf));
5599 
5600  /* free toolbar info data */
5601  SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
5602  Free (infoPtr);
5603 
5604  return 0;
5605 }
LPWSTR * strings
Definition: toolbar.c:176
TBUTTON_INFO * buttons
Definition: toolbar.c:175
LPWSTR pszTooltipText
Definition: toolbar.c:172
HWND hwndToolTip
Definition: toolbar.c:156
HIMAGELIST himlInt
Definition: toolbar.c:149
PIMLENTRY * himlDis
Definition: toolbar.c:154
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
INT nNumButtons
Definition: toolbar.c:131
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:58
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
HFONT hDefaultFont
Definition: toolbar.c:147
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
TBITMAP_INFO * bitmaps
Definition: toolbar.c:177
PIMLENTRY * himlDef
Definition: toolbar.c:150
HWND hwndSelf
Definition: toolbar.c:158
static void free_string(TBUTTON_INFO *btn)
Definition: toolbar.c:377
INT nNumStrings
Definition: toolbar.c:133
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
PIMLENTRY * himlHot
Definition: toolbar.c:152
static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies)
Definition: toolbar.c:7282
INT cimlDef
Definition: toolbar.c:151
INT cimlDis
Definition: toolbar.c:155
#define SetWindowLongPtrW
Definition: winuser.h:5321
INT cimlHot
Definition: toolbar.c:153
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950

Referenced by ToolbarWindowProc().

◆ TOOLBAR_DrawArrow()

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

Definition at line 599 of file toolbar.c.

600 {
601  INT x, y;
602  HPEN hPen, hOldPen;
603 
604  if (!(hPen = CreatePen( PS_SOLID, 1, clr))) return;
605  hOldPen = SelectObject ( hdc, hPen );
606  x = left + 2;
607  y = top;
608  MoveToEx (hdc, x, y, NULL);
609  LineTo (hdc, x+5, y++); x++;
610  MoveToEx (hdc, x, y, NULL);
611  LineTo (hdc, x+3, y++); x++;
612  MoveToEx (hdc, x, y, NULL);
613  LineTo (hdc, x+1, y);
614  SelectObject( hdc, hOldPen );
615  DeleteObject( hPen );
616 }
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:585
smooth NULL
Definition: ftsmooth.c:416
GLint left
Definition: glext.h:7726
HDC hdc
Definition: main.c:9
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

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 953 of file toolbar.c.

954 {
955  DWORD dwStyle = infoPtr->dwStyle;
956  BOOL hasDropDownArrow = button_has_ddarrow( infoPtr, btnPtr );
957  BOOL drawSepDropDownArrow = hasDropDownArrow &&
958  (~btnPtr->fsStyle & BTNS_WHOLEDROPDOWN);
959  RECT rc, rcArrow, rcBitmap, rcText;
960  LPWSTR lpText = NULL;
961  NMTBCUSTOMDRAW tbcd;
962  DWORD ntfret;
963  INT offset;
964  INT oldBkMode;
965  DWORD dwItemCustDraw;
966  DWORD dwItemCDFlag;
967  HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
968 
969  rc = btnPtr->rect;
970  rcArrow = rc;
971 
972  /* separator - doesn't send NM_CUSTOMDRAW */
973  if (btnPtr->fsStyle & BTNS_SEP) {
974  if (theme)
975  {
976  DrawThemeBackground (theme, hdc,
977  (dwStyle & CCS_VERT) ? TP_SEPARATORVERT : TP_SEPARATOR, 0,
978  &rc, NULL);
979  }
980  else
981  /* with the FLAT style, iBitmap is the width and has already */
982  /* been taken into consideration in calculating the width */
983  /* so now we need to draw the vertical separator */
984  /* empirical tests show that iBitmap can/will be non-zero */
985  /* when drawing the vertical bar... */
986  if ((dwStyle & TBSTYLE_FLAT) /* && (btnPtr->iBitmap == 0) */) {
987  if (dwStyle & CCS_VERT) {
988  RECT rcsep = rc;
989  InflateRect(&rcsep, -infoPtr->szPadding.cx, -infoPtr->szPadding.cy);
990  TOOLBAR_DrawFlatHorizontalSeparator (&rcsep, hdc, infoPtr);
991  }
992  else {
993  TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr);
994  }
995  }
996  else if (btnPtr->fsStyle != BTNS_SEP) {
997  FIXME("Draw some kind of separator: fsStyle=%x\n",
998  btnPtr->fsStyle);
999  }
1000  return;
1001  }
1002 
1003  /* get a pointer to the text */
1004  lpText = TOOLBAR_GetText(infoPtr, btnPtr);
1005 
1006  if (hasDropDownArrow)
1007  {
1008  int right;
1009 
1010  if (dwStyle & TBSTYLE_FLAT)
1011  right = max(rc.left, rc.right - DDARROW_WIDTH);
1012  else
1013  right = max(rc.left, rc.right - DDARROW_WIDTH - 2);
1014 
1015  if (drawSepDropDownArrow)
1016  rc.right = right;
1017 
1018  rcArrow.left = right;
1019  }
1020 
1021  /* copy text & bitmap rects after adjusting for drop-down arrow
1022  * so that text & bitmap is centered in the rectangle not containing
1023  * the arrow */
1024  rcText = rc;
1025  rcBitmap = rc;
1026 
1027  /* Center the bitmap horizontally and vertically */
1028  if (dwStyle & TBSTYLE_LIST)
1029  {
1030  if (lpText &&
1031  infoPtr->nMaxTextRows > 0 &&
1032  (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
1033  (btnPtr->fsStyle & BTNS_SHOWTEXT)) )
1034  rcBitmap.left += GetSystemMetrics(SM_CXEDGE) + infoPtr->szPadding.cx / 2;
1035  else
1036  rcBitmap.left += GetSystemMetrics(SM_CXEDGE) + infoPtr->iListGap / 2;
1037  }
1038  else
1039  rcBitmap.left += ((rc.right - rc.left) - infoPtr->nBitmapWidth) / 2;
1040 
1041  rcBitmap.top += infoPtr->szPadding.cy / 2;
1042 #ifdef __REACTOS__
1043  rcBitmap.top += infoPtr->themeMargins.cyTopHeight;
1044 #endif
1045 
1046  TRACE("iBitmap=%d, start=(%d,%d) w=%d, h=%d\n",
1047  btnPtr->iBitmap, rcBitmap.left, rcBitmap.top,
1048  infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
1049  TRACE("Text=%s\n", debugstr_w(lpText));
1050  TRACE("iListGap=%d, padding = { %d, %d }\n", infoPtr->iListGap, infoPtr->szPadding.cx, infoPtr->szPadding.cy);
1051 
1052  /* calculate text position */
1053  if (lpText)
1054  {
1055  InflateRect(&rcText, -GetSystemMetrics(SM_CXEDGE), 0);
1056  if (dwStyle & TBSTYLE_LIST)
1057  {
1058  rcText.left += infoPtr->nBitmapWidth + infoPtr->iListGap + 2;
1059  }
1060  else
1061  {
1062  if (ImageList_GetImageCount(GETDEFIMAGELIST(infoPtr, 0)) > 0)
1063  rcText.top += infoPtr->szPadding.cy/2 + infoPtr->nBitmapHeight + 1;
1064  else
1065  rcText.top += infoPtr->szPadding.cy/2 + 2;
1066  }
1067  }
1068 
1069  /* Initialize fields in all cases, because we use these later
1070  * NOTE: applications can and do alter these to customize their
1071  * toolbars */
1072  ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
1078  tbcd.clrHighlightHotTrack = 0;
1079  tbcd.nStringBkMode = TRANSPARENT;
1080  tbcd.nHLStringBkMode = OPAQUE;
1081  tbcd.rcText.left = 0;
1082  tbcd.rcText.top = 0;
1083  tbcd.rcText.right = rcText.right - rc.left;
1084  tbcd.rcText.bottom = rcText.bottom - rc.top;
1085  tbcd.nmcd.uItemState = TOOLBAR_TranslateState(btnPtr);
1086  tbcd.nmcd.hdc = hdc;
1087  tbcd.nmcd.rc = btnPtr->rect;
1089 
1090  /* FIXME: what are these used for? */
1091  tbcd.hbrLines = 0;
1092  tbcd.hpenLines = 0;
1093 
1094  /* Issue Item Prepaint notify */
1095  dwItemCustDraw = 0;
1096  dwItemCDFlag = 0;
1097  if (dwBaseCustDraw & CDRF_NOTIFYITEMDRAW)
1098  {
1100  tbcd.nmcd.dwItemSpec = btnPtr->idCommand;
1101  tbcd.nmcd.lItemlParam = btnPtr->dwData;
1102  ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
1103  /* reset these fields so the user can't alter the behaviour like native */
1104  tbcd.nmcd.hdc = hdc;
1105  tbcd.nmcd.rc = btnPtr->rect;
1106 
1107  dwItemCustDraw = ntfret & 0xffff;
1108  dwItemCDFlag = ntfret & 0xffff0000;
1109  if (dwItemCustDraw & CDRF_SKIPDEFAULT)
1110  return;
1111  /* save the only part of the rect that the user can change */
1112  rcText.right = tbcd.rcText.right + rc.left;
1113  rcText.bottom = tbcd.rcText.bottom + rc.top;
1114  }
1115 
1116  if (!(dwItemCDFlag & TBCDRF_NOOFFSET) &&
1117  (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED)))
1118  OffsetRect(&rcText, 1, 1);
1119 
1120  if (!(tbcd.nmcd.uItemState & CDIS_HOT) &&
1122  TOOLBAR_DrawPattern (&rc, &tbcd);
1123 
1124  if (((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf))
1125  && (tbcd.nmcd.uItemState & CDIS_HOT))
1126  {
1127  if ( dwItemCDFlag & TBCDRF_HILITEHOTTRACK )
1128  {
1129  COLORREF oldclr;
1130 
1131  oldclr = SetBkColor(hdc, tbcd.clrHighlightHotTrack);
1132  ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0);
1133  if (hasDropDownArrow)
1134  ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0);
1135  SetBkColor(hdc, oldclr);
1136  }
1137  }
1138 
1139 #ifdef __REACTOS__
1140  if (theme && !(dwItemCDFlag & TBCDRF_NOBACKGROUND))
1141 #else
1142  if (theme)
1143 #endif
1144  {
1145  int partId = drawSepDropDownArrow ? TP_SPLITBUTTON : TP_BUTTON;
1146  int stateId = TS_NORMAL;
1147 
1148  if (tbcd.nmcd.uItemState & CDIS_DISABLED)
1149  stateId = TS_DISABLED;
1150  else if (tbcd.nmcd.uItemState & CDIS_SELECTED)
1151  stateId = TS_PRESSED;
1152  else if (tbcd.nmcd.uItemState & CDIS_CHECKED)
1153 #ifdef __REACTOS__
1154  stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_CHECKED;
1155 #else
1156  stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_HOT;
1157 #endif
1158  else if ((tbcd.nmcd.uItemState & CDIS_HOT)
1159  || (drawSepDropDownArrow && btnPtr->bDropDownPressed))
1160  stateId = TS_HOT;
1161 
1162  DrawThemeBackground (theme, hdc, partId, stateId, &rc, NULL);
1163  }
1164 
1165 #ifdef __REACTOS__
1166  if (!theme)
1167 #else
1168  else
1169 #endif
1170  TOOLBAR_DrawFrame(infoPtr, &tbcd, &rc, dwItemCDFlag);
1171 
1172  if (drawSepDropDownArrow)
1173  {
1174  if (theme)
1175  {
1176  int stateId = TS_NORMAL;
1177 
1178  if (tbcd.nmcd.uItemState & CDIS_DISABLED)
1179  stateId = TS_DISABLED;
1180  else if (btnPtr->bDropDownPressed || (tbcd.nmcd.uItemState & CDIS_SELECTED))
1181  stateId = TS_PRESSED;
1182  else if (tbcd.nmcd.uItemState & CDIS_CHECKED)
1183 #ifdef __REACTOS__
1184  stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_CHECKED;
1185 #else
1186  stateId = (tbcd.nmcd.uItemState & CDIS_HOT) ? TS_HOTCHECKED : TS_HOT;
1187 #endif
1188  else if (tbcd.nmcd.uItemState & CDIS_HOT)
1189  stateId = TS_HOT;
1190 
1191  DrawThemeBackground (theme, hdc, TP_DROPDOWNBUTTON, stateId, &rcArrow, NULL);
1192  DrawThemeBackground (theme, hdc, TP_SPLITBUTTONDROPDOWN, stateId, &rcArrow, NULL);
1193  }
1194  else
1195  TOOLBAR_DrawSepDDArrow(infoPtr, &tbcd, &rcArrow, btnPtr->bDropDownPressed, dwItemCDFlag);
1196  }
1197 
1198  oldBkMode = SetBkMode (hdc, tbcd.nStringBkMode);
1199  if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
1200  TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd, dwItemCDFlag);
1201  SetBkMode (hdc, oldBkMode);
1202 
1203  TOOLBAR_DrawImage(infoPtr, btnPtr, rcBitmap.left, rcBitmap.top, &tbcd, dwItemCDFlag);
1204 
1205  if (hasDropDownArrow && !drawSepDropDownArrow)
1206  {
1208  {
1209  TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1 + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnHighlight);
1210  TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clr3dShadow);
1211  }
1212 #ifndef __REACTOS__
1213  else if (tbcd.nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED))
1214  {
1215  offset = (dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
1216  TOOLBAR_DrawArrow(hdc, rcArrow.left + offset, rcArrow.top + offset + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnText);
1217  }
1218  else
1219  TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnText);
1220 #else
1221  else
1222  {
1224  if (theme)
1226 
1227  if (tbcd.nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED))
1228  {
1229  offset = (dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
1230  TOOLBAR_DrawArrow(hdc, rcArrow.left + offset, rcArrow.top + offset + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, clr);
1231  }
1232  else
1233  TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, clr);
1234  }
1235 #endif
1236  }
1237 
1238  if (dwItemCustDraw & CDRF_NOTIFYPOSTPAINT)
1239  {
1241  TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
1242  }
1243 
1244 }
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2063
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)
HBRUSH COMCTL32_hPattern55AABrush
Definition: commctrl.c:81
#define max(a, b)
Definition: svc.c:63
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
COLORREF clrBtnHighlight
Definition: commctrl.h:1021
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define BTNS_WHOLEDROPDOWN
Definition: commctrl.h:1003
COLORREF clr3dShadow
Definition: comctl32.h:166
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:270
BYTE fsState
Definition: toolbar.c:93
INT nBitmapWidth
Definition: toolbar.c:125
#define TBCDRF_NOOFFSET
Definition: commctrl.h:1031
GLintptr offset
Definition: glext.h:5920
DWORD dwStyle
Definition: toolbar.c:164
LONG top
Definition: windef.h:307
COLORREF clrBtnHighlight
Definition: comctl32.h:158
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:281
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define ZeroMemory
Definition: winbase.h:1648
#define SM_CXEDGE
Definition: winuser.h:998
COLORREF clrBtnText
Definition: comctl32.h:160
LONG left
Definition: windef.h:306
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:266
INT nBitmapHeight
Definition: toolbar.c:124
LONG right
Definition: windef.h:308
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
int32_t INT
Definition: typedefs.h:58
#define CCS_VERT
Definition: commctrl.h:2245