ReactOS  0.4.14-dev-50-g13bb5e2
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:2219
#define CCS_VERT
Definition: commctrl.h:2221
#define CCS_NODIVIDER
Definition: commctrl.h:2220
#define CCS_TOP
Definition: commctrl.h:2214
#define CCS_BOTTOM
Definition: commctrl.h:2216
#define CCS_NORESIZE
Definition: commctrl.h:2217
#define CCS_NOMOVEY
Definition: commctrl.h:2215

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:981

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:979
#define BTNS_DROPDOWN
Definition: commctrl.h:975
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:964

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:656
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:63

Referenced by TOOLBAR_SetButtonInfo().

◆ theme_changed()

static LRESULT theme_changed ( HWND  hwnd)
static

Definition at line 6741 of file toolbar.c.

6742 {
6743  HTHEME theme = GetWindowTheme (hwnd);
6744  CloseThemeData (theme);
6746  return 0;
6747 }
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 2960 of file toolbar.c.

2961 {
2963  INT iSumButtons, i;
2964  HIMAGELIST himlDef;
2965 
2966  TRACE("hwnd=%p count=%d lpAddBmp=%p\n", infoPtr->hwndSelf, count, lpAddBmp);
2967  if (!lpAddBmp)
2968  return -1;
2969 
2970  if (lpAddBmp->hInst == HINST_COMMCTRL)
2971  {
2972  info.hInst = COMCTL32_hModule;
2973  switch (lpAddBmp->nID)
2974  {
2975  case IDB_STD_SMALL_COLOR:
2976  case 2:
2977  info.nButtons = 15;
2978  info.nID = IDB_STD_SMALL;
2979  break;
2980  case IDB_STD_LARGE_COLOR:
2981  case 3:
2982  info.nButtons = 15;
2983  info.nID = IDB_STD_LARGE;
2984  break;
2985  case IDB_VIEW_SMALL_COLOR:
2986  case 6:
2987  info.nButtons = 12;
2988  info.nID = IDB_VIEW_SMALL;
2989  break;
2990  case IDB_VIEW_LARGE_COLOR:
2991  case 7:
2992  info.nButtons = 12;
2993  info.nID = IDB_VIEW_LARGE;
2994  break;
2995  case IDB_HIST_SMALL_COLOR:
2996  info.nButtons = 5;
2997  info.nID = IDB_HIST_SMALL;
2998  break;
2999  case IDB_HIST_LARGE_COLOR:
3000  info.nButtons = 5;
3001  info.nID = IDB_HIST_LARGE;
3002  break;
3003  default:
3004  WARN("unknown bitmap id, %ld\n", lpAddBmp->nID);
3005  return -1;
3006  }
3007 
3008  TRACE ("adding %d internal bitmaps\n", info.nButtons);
3009 
3010  /* Windows resize all the buttons to the size of a newly added standard image */
3011  if (lpAddBmp->nID & 1)
3012  {
3013  /* large icons: 24x24. Will make the button 31x30 */
3014  SendMessageW (infoPtr->hwndSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(24, 24));
3015  }
3016  else
3017  {
3018  /* small icons: 16x16. Will make the buttons 23x22 */
3019  SendMessageW (infoPtr->hwndSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
3020  }
3021 
3022  TOOLBAR_CalcToolbar (infoPtr);
3023  }
3024  else
3025  {
3026  info.nButtons = count;
3027  info.hInst = lpAddBmp->hInst;
3028  info.nID = lpAddBmp->nID;
3029  TRACE("adding %d bitmaps\n", info.nButtons);
3030  }
3031 
3032  /* check if the bitmap is already loaded and compute iSumButtons */
3033  iSumButtons = 0;
3034  for (i = 0; i < infoPtr->nNumBitmapInfos; i++)
3035  {
3036  if (infoPtr->bitmaps[i].hInst == info.hInst &&
3037  infoPtr->bitmaps[i].nID == info.nID)
3038  return iSumButtons;
3039  iSumButtons += infoPtr->bitmaps[i].nButtons;
3040  }
3041 
3042  if (!infoPtr->cimlDef) {
3043  /* create new default image list */
3044  TRACE ("creating default image list\n");
3045 
3046  himlDef = ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
3047  ILC_COLOR32 | ILC_MASK, info.nButtons, 2);
3048  TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlDef, 0);
3049  infoPtr->himlInt = himlDef;
3050  }
3051  else {
3052  himlDef = GETDEFIMAGELIST(infoPtr, 0);
3053  }
3054 
3055  if (!himlDef) {
3056  WARN("No default image list available\n");
3057  return -1;
3058  }
3059 
3060  if (!TOOLBAR_AddBitmapToImageList(infoPtr, himlDef, &info))
3061  return -1;
3062 
3063  TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
3064  infoPtr->bitmaps = ReAlloc(infoPtr->bitmaps, (infoPtr->nNumBitmapInfos + 1) * sizeof(TBITMAP_INFO));
3065  infoPtr->bitmaps[infoPtr->nNumBitmapInfos] = info;
3066  infoPtr->nNumBitmapInfos++;
3067  TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
3068 
3069  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
3070  return iSumButtons;
3071 }
#define IDB_HIST_LARGE
Definition: comctl32.h:74
#define IDB_VIEW_LARGE
Definition: comctl32.h:72
#define TRUE
Definition: types.h:120
#define IDB_VIEW_SMALL
Definition: comctl32.h:71
UINT nID
Definition: toolbar.c:108
UINT nButtons
Definition: toolbar.c:106
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:111
#define MAKELPARAM(l, h)
Definition: winuser.h:3947
#define IDB_STD_SMALL_COLOR
Definition: commctrl.h:1036
HINSTANCE hInst
Definition: commctrl.h:1031
#define IDB_HIST_LARGE_COLOR
Definition: commctrl.h:1041
INT nBitmapHeight
Definition: toolbar.c:124
int32_t INT
Definition: typedefs.h:56
struct _test_info info[]
Definition: SetCursorPos.c:19
#define ILC_COLOR32
Definition: commctrl.h:343
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:69
TBITMAP_INFO * bitmaps
Definition: toolbar.c:177
smooth NULL
Definition: ftsmooth.c:416
#define IDB_VIEW_SMALL_COLOR
Definition: commctrl.h:1038
#define TRACE(s)
Definition: solgame.cpp:4
#define IDB_HIST_SMALL
Definition: comctl32.h:73
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:1039
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static void TOOLBAR_CalcToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1779
#define ILC_MASK
Definition: commctrl.h:336
#define TB_SETBITMAPSIZE
Definition: commctrl.h:1108
#define IDB_STD_LARGE_COLOR
Definition: commctrl.h:1037
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:2882
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:7233
#define HINST_COMMCTRL
Definition: commctrl.h:1035
HINSTANCE hInst
Definition: toolbar.c:107
#define IDB_STD_LARGE
Definition: comctl32.h:70
#define IDB_HIST_SMALL_COLOR
Definition: commctrl.h:1040
UINT_PTR nID
Definition: commctrl.h:1032

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

2883 {
2884  HBITMAP hbmLoad;
2885  INT nCountBefore = ImageList_GetImageCount(himlDef);
2886  INT nCountAfter;
2887  INT cxIcon, cyIcon;
2888  INT nAdded;
2889  INT nIndex;
2890 
2891  TRACE("adding hInst=%p nID=%d nButtons=%d\n", bitmap->hInst, bitmap->nID, bitmap->nButtons);
2892  /* Add bitmaps to the default image list */
2893  if (bitmap->hInst == NULL) /* a handle was passed */
2894  hbmLoad = CopyImage(ULongToHandle(bitmap->nID), IMAGE_BITMAP, 0, 0, 0);
2895  else if (bitmap->hInst == COMCTL32_hModule)
2896  hbmLoad = LoadImageW( bitmap->hInst, MAKEINTRESOURCEW(bitmap->nID),
2898  else
2899  hbmLoad = CreateMappedBitmap(bitmap->hInst, bitmap->nID, 0, NULL, 0);
2900 
2901  /* enlarge the bitmap if needed */
2902  ImageList_GetIconSize(himlDef, &cxIcon, &cyIcon);
2903  if (bitmap->hInst != COMCTL32_hModule)
2904  COMCTL32_EnsureBitmapSize(&hbmLoad, cxIcon*(INT)bitmap->nButtons, cyIcon, comctl32_color.clrBtnFace);
2905 
2906  nIndex = ImageList_AddMasked(himlDef, hbmLoad, comctl32_color.clrBtnFace);
2907  DeleteObject(hbmLoad);
2908  if (nIndex == -1)
2909  return FALSE;
2910 
2911  nCountAfter = ImageList_GetImageCount(himlDef);
2912  nAdded = nCountAfter - nCountBefore;
2913  if (bitmap->nButtons == 0) /* wParam == 0 is special and means add only one image */
2914  {
2915  ImageList_SetImageCount(himlDef, nCountBefore + 1);
2916  } else if (nAdded > (INT)bitmap->nButtons) {
2917  TRACE("Added more images than wParam: Previous image number %i added %i while wParam %i. Images in list %i\n",
2918  nCountBefore, nAdded, bitmap->nButtons, nCountAfter);
2919  }
2920 
2921  infoPtr->nNumBitmaps += nAdded;
2922  return TRUE;
2923 }
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:56
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:160
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 3075 of file toolbar.c.

3076 {
3077  TRACE("adding %d buttons (unicode=%d)\n", nAddButtons, fUnicode);
3078 
3079  return TOOLBAR_InternalInsertButtonsT(infoPtr, -1, nAddButtons, lpTbb, fUnicode);
3080 }
static BOOL TOOLBAR_InternalInsertButtonsT(TOOLBAR_INFO *infoPtr, INT iIndex, UINT nAddButtons, const TBBUTTON *lpTbb, BOOL fUnicode)
Definition: toolbar.c:1995
#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 3165 of file toolbar.c.

3166 {
3167  BOOL fFirstString = (infoPtr->nNumStrings == 0);
3168  LPSTR p;
3169  INT nIndex;
3170  INT len;
3171 
3172  TRACE("%p, %lx\n", hInstance, lParam);
3173 
3174  if (IS_INTRESOURCE(lParam)) /* load from resources */
3175  return TOOLBAR_AddStringW(infoPtr, hInstance, lParam);
3176 
3177  p = (LPSTR)lParam;
3178  if (p == NULL)
3179  return -1;
3180 
3181  TRACE("adding string(s) from array\n");
3182  nIndex = infoPtr->nNumStrings;
3183  while (*p) {
3184  len = strlen (p);
3185  TRACE("len=%d \"%s\"\n", len, p);
3186 
3187  infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3188  Str_SetPtrAtoW(&infoPtr->strings[infoPtr->nNumStrings], p);
3189  infoPtr->nNumStrings++;
3190 
3191  p += (len+1);
3192  }
3193 
3194  if (fFirstString)
3195  TOOLBAR_CalcToolbar(infoPtr);
3196  return nIndex;
3197 }
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:56
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:3084
#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:1779
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 3084 of file toolbar.c.

3085 {
3086 #define MAX_RESOURCE_STRING_LENGTH 512
3087  BOOL fFirstString = (infoPtr->nNumStrings == 0);
3088  INT nIndex = infoPtr->nNumStrings;
3089 
3090  TRACE("%p, %lx\n", hInstance, lParam);
3091 
3092  if (IS_INTRESOURCE(lParam)) {
3094  WCHAR delimiter;
3095  WCHAR *next_delim;
3096  HRSRC hrsrc;
3097  WCHAR *p;
3098  INT len;
3099 
3100  TRACE("adding string from resource\n");
3101 
3102  if (!hInstance) return -1;
3103 
3104  hrsrc = FindResourceW( hInstance, MAKEINTRESOURCEW((LOWORD(lParam) >> 4) + 1),
3105  (LPWSTR)RT_STRING );
3106  if (!hrsrc)
3107  {
3108  TRACE("string not found in resources\n");
3109  return -1;
3110  }
3111 
3113  szString, MAX_RESOURCE_STRING_LENGTH);
3114 
3115  TRACE("len=%d %s\n", len, debugstr_w(szString));
3116  if (len == 0 || len == 1)
3117  return nIndex;
3118 
3119  TRACE("delimiter: 0x%x\n", *szString);
3120  delimiter = *szString;
3121  p = szString + 1;
3122 
3123  while ((next_delim = strchrW(p, delimiter)) != NULL) {
3124  *next_delim = 0;
3125  if (next_delim + 1 >= szString + len)
3126  {
3127  /* this may happen if delimiter == '\0' or if the last char is a
3128  * delimiter (then it is ignored like the native does) */
3129  break;
3130  }
3131 
3132  infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3133  Str_SetPtrW(&infoPtr->strings[infoPtr->nNumStrings], p);
3134  infoPtr->nNumStrings++;
3135 
3136  p = next_delim + 1;
3137  }
3138  }
3139  else {
3140  LPWSTR p = (LPWSTR)lParam;
3141  INT len;
3142 
3143  if (p == NULL)
3144  return -1;
3145  TRACE("adding string(s) from array\n");
3146  while (*p) {
3147  len = strlenW (p);
3148 
3149  TRACE("len=%d %s\n", len, debugstr_w(p));
3150  infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3151  Str_SetPtrW (&infoPtr->strings[infoPtr->nNumStrings], p);
3152  infoPtr->nNumStrings++;
3153 
3154  p += (len+1);
3155  }
3156  }
3157 
3158  if (fFirstString)
3159  TOOLBAR_CalcToolbar(infoPtr);
3160  return nIndex;
3161 }
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:56
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:1523
#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:1779
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 3201 of file toolbar.c.

3202 {
3203  TRACE("auto sizing, style=%#x\n", infoPtr->dwStyle);
3204  TRACE("nRows: %d, infoPtr->nButtonHeight: %d\n", infoPtr->nRows, infoPtr->nButtonHeight);
3205 
3206  if (!(infoPtr->dwStyle & CCS_NORESIZE))
3207  {
3208  RECT window_rect, parent_rect;
3209  UINT uPosFlags = SWP_NOZORDER | SWP_NOACTIVATE;
3210  HWND parent;
3211  INT x, y, cx, cy;
3212 
3213  parent = GetParent (infoPtr->hwndSelf);
3214 
3215  if (!parent || !infoPtr->bDoRedraw)
3216  return 0;
3217 
3218  GetClientRect(parent, &parent_rect);
3219 
3220  x = parent_rect.left;
3221  y = parent_rect.top;
3222 
3223  cy = TOP_BORDER + infoPtr->nRows * infoPtr->nButtonHeight + BOTTOM_BORDER;
3224  cx = parent_rect.right - parent_rect.left;
3225 
3226  if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_NOMOVEY)
3227  {
3228  GetWindowRect(infoPtr->hwndSelf, &window_rect);
3229  MapWindowPoints( 0, parent, (POINT *)&window_rect, 2 );
3230  y = window_rect.top;
3231  }
3232  if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_BOTTOM)
3233  {
3234  GetWindowRect(infoPtr->hwndSelf, &window_rect);
3235  y = parent_rect.bottom - ( window_rect.bottom - window_rect.top);
3236  }
3237 
3238  if (infoPtr->dwStyle & CCS_NOPARENTALIGN)
3239  uPosFlags |= SWP_NOMOVE;
3240 
3241  if (!(infoPtr->dwStyle & CCS_NODIVIDER))
3243 
3244  if (infoPtr->dwStyle & WS_BORDER)
3245  {
3248  }
3249 
3250  SetWindowPos(infoPtr->hwndSelf, NULL, x, y, cx, cy, uPosFlags);
3251  }
3252 
3253  if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL))
3254  {
3255  TOOLBAR_LayoutToolbar(infoPtr);
3256  InvalidateRect( infoPtr->hwndSelf, NULL, TRUE );
3257  }
3258 
3259  return 0;
3260 }
#define TRUE
Definition: types.h:120
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
DWORD dwStyle
Definition: toolbar.c:164
LONG top
Definition: windef.h:292
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
BOOL bDoRedraw
Definition: toolbar.c:160
#define CCS_NODIVIDER
Definition: commctrl.h:2220
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
smooth NULL
Definition: ftsmooth.c:416
#define SM_CYEDGE
Definition: winuser.h:999
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2218
#define CCS_BOTTOM
Definition: commctrl.h:2216
#define TRACE(s)
Definition: solgame.cpp:4
r parent
Definition: btrfs.c:2897
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:1804
#define CCS_NORESIZE
Definition: commctrl.h:2217
#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:570
#define CCS_NOMOVEY
Definition: commctrl.h:2215
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:962
LONG bottom
Definition: windef.h:294
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:983

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

3265 {
3266  return infoPtr->nNumButtons;
3267 }
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:246

Referenced by set_string_index(), and TOOLBAR_InternalInsertButtonsT().

◆ TOOLBAR_ButtonStructSize()

static LRESULT TOOLBAR_ButtonStructSize ( TOOLBAR_INFO infoPtr,
DWORD  Size 
)
inlinestatic

Definition at line 3271 of file toolbar.c.

3272 {
3273  infoPtr->dwStructSize = Size;
3274 
3275  return 0;
3276 }
DWORD dwStructSize
Definition: toolbar.c:119
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359

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:1497
INT nNumButtons
Definition: toolbar.c:131
int32_t INT
Definition: typedefs.h:56
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:319
#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:320

Referenced by TOOLBAR_CalcToolbar().

◆ TOOLBAR_CalcToolbar()

static void TOOLBAR_CalcToolbar ( TOOLBAR_INFO infoPtr)
static

Definition at line 1779 of file toolbar.c.

1780 {
1781  SIZE sizeString, sizeButton;
1782  BOOL validImageList = FALSE;
1783 
1784  TOOLBAR_CalcStrings (infoPtr, &sizeString);
1785 
1786  TOOLBAR_DumpToolbar (infoPtr, __LINE__);
1787 
1788  if (TOOLBAR_IsValidImageList(infoPtr, 0))
1789  validImageList = TRUE;
1790  sizeButton = TOOLBAR_MeasureButton(infoPtr, sizeString, TRUE, validImageList);
1791  infoPtr->nButtonWidth = sizeButton.cx;
1792  infoPtr->nButtonHeight = sizeButton.cy;
1793  infoPtr->iTopMargin = default_top_margin(infoPtr);
1794 
1795  if ( infoPtr->cxMin >= 0 && infoPtr->nButtonWidth < infoPtr->cxMin )
1796  infoPtr->nButtonWidth = infoPtr->cxMin;
1797  if ( infoPtr->cxMax > 0 && infoPtr->nButtonWidth > infoPtr->cxMax )
1798  infoPtr->nButtonWidth = infoPtr->cxMax;
1799 
1800  TOOLBAR_LayoutToolbar(infoPtr);
1801 }
#define TRUE
Definition: types.h:120
INT nButtonWidth
Definition: toolbar.c:123
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG cx
Definition: windef.h:319
static SIZE TOOLBAR_MeasureButton(const TOOLBAR_INFO *infoPtr, SIZE sizeString, BOOL bHasBitmap, BOOL bValidImageList)
Definition: toolbar.c:1703
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:1804
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:320
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 6104 of file toolbar.c.

6105 {
6106  TBUTTON_INFO *btnPtr;
6107 
6108  infoPtr->bCaptured = FALSE;
6109 
6110  if (infoPtr->nButtonDown >= 0)
6111  {
6112  btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
6113  btnPtr->fsState &= ~TBSTATE_PRESSED;
6114 
6115  infoPtr->nOldHit = -1;
6116 
6117  if (btnPtr->fsState & TBSTATE_ENABLED)
6118  InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
6119  }
6120  return 0;
6121 }
INT nButtonDown
Definition: toolbar.c:135
#define TRUE
Definition: types.h:120
TBUTTON_INFO * buttons
Definition: toolbar.c:175
BYTE fsState
Definition: toolbar.c:93
BOOL bCaptured
Definition: toolbar.c:163
#define TBSTATE_PRESSED
Definition: commctrl.h:945
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:946

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ChangeBitmap()

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

Definition at line 3280 of file toolbar.c.

3281 {
3282  TBUTTON_INFO *btnPtr;
3283  INT nIndex;
3284 
3285  TRACE("button %d, iBitmap now %d\n", Id, Index);
3286 
3287  nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3288  if (nIndex == -1)
3289  return FALSE;
3290 
3291  btnPtr = &infoPtr->buttons[nIndex];
3292  btnPtr->iBitmap = Index;
3293 
3294  /* we HAVE to erase the background, the new bitmap could be */
3295  /* transparent */
3296  InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3297 
3298  return TRUE;
3299 }
#define TRUE
Definition: types.h:120
TBUTTON_INFO * buttons
Definition: toolbar.c:175
int32_t INT
Definition: typedefs.h:56
static INT TOOLBAR_GetButtonIndex(const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
Definition: toolbar.c:2049
DWORD Id
#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 3303 of file toolbar.c.

3304 {
3305  TBUTTON_INFO *btnPtr;
3306  INT nIndex;
3307  INT nOldIndex = -1;
3308  BOOL bChecked = FALSE;
3309 
3310  nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3311 
3312  TRACE("hwnd=%p, btn index=%d, lParam=0x%08lx\n", infoPtr->hwndSelf, nIndex, lParam);
3313 
3314  if (nIndex == -1)
3315  return FALSE;
3316 
3317  btnPtr = &infoPtr->buttons[nIndex];
3318 
3319  bChecked = (btnPtr->fsState & TBSTATE_CHECKED) != 0;
3320 
3321  if (!LOWORD(lParam))
3322  btnPtr->fsState &= ~TBSTATE_CHECKED;
3323  else {
3324  if (btnPtr->fsStyle & BTNS_GROUP) {
3325  nOldIndex =
3326  TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex);
3327  if (nOldIndex == nIndex)
3328  return 0;
3329  if (nOldIndex != -1)
3330  infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;
3331  }
3332  btnPtr->fsState |= TBSTATE_CHECKED;
3333  }
3334 
3335  if( bChecked != LOWORD(lParam) )
3336  {
3337  if (nOldIndex != -1)
3338  InvalidateRect(infoPtr->hwndSelf, &infoPtr->buttons[nOldIndex].rect, TRUE);
3339  InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3340  }
3341 
3342  /* FIXME: Send a WM_NOTIFY?? */
3343 
3344  return TRUE;
3345 }
#define TRUE
Definition: types.h:120
TBUTTON_INFO * buttons
Definition: toolbar.c:175
#define BTNS_GROUP
Definition: commctrl.h:973
BYTE fsState
Definition: toolbar.c:93
int32_t INT
Definition: typedefs.h:56
static INT TOOLBAR_GetButtonIndex(const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
Definition: toolbar.c:2049
DWORD Id
unsigned int BOOL
Definition: ntddk_ex.h:94
static INT TOOLBAR_GetCheckedGroupButtonIndex(const TOOLBAR_INFO *infoPtr, INT nIndex)
Definition: toolbar.c:2072
#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:944
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 2926 of file toolbar.c.

2927 {
2928  HIMAGELIST himlDef;
2929  HIMAGELIST himlNew;
2930  INT cx, cy;
2931  INT i;
2932 
2933  himlDef = GETDEFIMAGELIST(infoPtr, 0);
2934  if (himlDef == NULL || himlDef != infoPtr->himlInt)
2935  return;
2936  if (!ImageList_GetIconSize(himlDef, &cx, &cy))
2937  return;
2938  if (cx == infoPtr->nBitmapWidth && cy == infoPtr->nBitmapHeight)
2939  return;
2940 
2941  TRACE("Update icon size: %dx%d -> %dx%d\n",
2942  cx, cy, infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
2943 
2944  himlNew = ImageList_Create(infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
2945  ILC_COLOR32|ILC_MASK, 8, 2);
2946  for (i = 0; i < infoPtr->nNumBitmapInfos; i++)
2947  TOOLBAR_AddBitmapToImageList(infoPtr, himlNew, &infoPtr->bitmaps[i]);
2948  TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlNew, 0);
2949  infoPtr->himlInt = himlNew;
2950 
2951  infoPtr->nNumBitmaps -= ImageList_GetImageCount(himlDef);
2952  ImageList_Destroy(himlDef);
2953 }
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:56
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define ILC_COLOR32
Definition: commctrl.h:343
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:570
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:336
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:2882
static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id)
Definition: toolbar.c:7233
_Out_opt_ int * cx
Definition: commctrl.h:570
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:967
#define FIXME(fmt,...)
Definition: debug.h:110
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 3349 of file toolbar.c.

3350 {
3351  return TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3352 }
static INT TOOLBAR_GetButtonIndex(const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
Definition: toolbar.c:2049
DWORD Id

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Create()

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

Definition at line 5516 of file toolbar.c.

5517 {
5518  TOOLBAR_INFO *infoPtr = (TOOLBAR_INFO *)GetWindowLongPtrW(hwnd, 0);
5519  LOGFONTW logFont;
5520 
5521  TRACE("hwnd = %p, style=0x%08x\n", hwnd, lpcs->style);
5522 
5523  infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
5524  GetClientRect(hwnd, &infoPtr->client_rect);
5525  infoPtr->bUnicode = infoPtr->hwndNotify &&
5526  (NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_REQUERY));
5527  infoPtr->hwndToolTip = NULL; /* if needed the tooltip control will be created after a WM_MOUSEMOVE */
5528 
5530  infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont);
5531 
5532 #ifdef __REACTOS__
5533  {
5534  HTHEME theme = OpenThemeData (hwnd, themeClass);
5535  if (theme)
5536  GetThemeMargins(theme, NULL, TP_BUTTON, TS_NORMAL, TMT_CONTENTMARGINS, NULL, &infoPtr->themeMargins);
5537  }
5538 #else
5540 #endif
5541 
5542  TOOLBAR_CheckStyle (infoPtr);
5543 
5544  return 0;
5545 }
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:4730
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 2281 of file toolbar.c.

2282 {
2283  NMTOOLBARW nmtb;
2284 
2285  TRACE("Add: nIndexAvail %d, nIndexTo %d\n", nIndexAvail, nIndexTo);
2286 
2287  /* MSDN states that iItem is the index of the button, rather than the
2288  * command ID as used by every other NMTOOLBAR notification */
2289  nmtb.iItem = nIndexAvail;
2290  if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
2291  {
2292  PCUSTOMBUTTON btnInfo;
2293  NMHDR hdr;
2294  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2295  HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2296  int count = SendMessageW(hwndAvail, LB_GETCOUNT, 0, 0);
2297 
2298  btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndAvail, LB_GETITEMDATA, nIndexAvail, 0);
2299 
2300  if (nIndexAvail != 0) /* index == 0 indicates separator */
2301  {
2302  /* remove from 'available buttons' list */
2303  SendMessageW(hwndAvail, LB_DELETESTRING, nIndexAvail, 0);
2304  if (nIndexAvail == count-1)
2305  SendMessageW(hwndAvail, LB_SETCURSEL, nIndexAvail-1 , 0);
2306  else
2307  SendMessageW(hwndAvail, LB_SETCURSEL, nIndexAvail , 0);
2308  }
2309  else
2310  {
2311  PCUSTOMBUTTON btnNew;
2312 
2313  /* duplicate 'separator' button */
2314  btnNew = Alloc(sizeof(CUSTOMBUTTON));
2315  *btnNew = *btnInfo;
2316  btnInfo = btnNew;
2317  }
2318 
2319  /* insert into 'toolbar button' list */
2320  SendMessageW(hwndList, LB_INSERTSTRING, nIndexTo, 0);
2321  SendMessageW(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
2322 
2323  SendMessageW(custInfo->tbHwnd, TB_INSERTBUTTONW, nIndexTo, (LPARAM)&(btnInfo->btn));
2324 
2326  }
2327 }
#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:1286
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:58
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:60
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:1237
#define TBN_QUERYINSERT
Definition: commctrl.h:1284
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 2434 of file toolbar.c.

2436 {
2437  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2438  switch (pDLI->uNotification)
2439  {
2440  case DL_BEGINDRAG:
2441  return TRUE;
2442  case DL_DRAGGING:
2443  {
2444  INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2445  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2446  /* no dragging past last item (separator) */
2447  if ((nCurrentItem >= 0) && (nCurrentItem < nCount))
2448  {
2449  DrawInsert(hwnd, hwndList, nCurrentItem);
2450  /* FIXME: native uses "move button" cursor */
2451  return DL_COPYCURSOR;
2452  }
2453 
2454  /* not over toolbar buttons list */
2455  if (nCurrentItem < 0)
2456  {
2457  POINT ptWindow = pDLI->ptCursor;
2458  HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2459  MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2460  /* over available buttons list? */
2461  if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2462  /* FIXME: native uses "move button" cursor */
2463  return DL_COPYCURSOR;
2464  }
2465  /* clear drag arrow */
2466  DrawInsert(hwnd, hwndList, -1);
2467  return DL_STOPCURSOR;
2468  }
2469  case DL_DROPPED:
2470  {
2471  INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2472  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2474  if ((nIndexTo >= 0) && (nIndexTo < nCount))
2475  {
2476  /* clear drag arrow */
2477  DrawInsert(hwnd, hwndList, -1);
2478  /* add item */
2479  TOOLBAR_Cust_AddButton(custInfo, hwnd, nIndexFrom, nIndexTo);
2480  }
2481  }
2482  case DL_CANCELDRAG:
2483  /* Clear drag arrow */
2484  DrawInsert(hwnd, hwndList, -1);
2485  break;
2486  }
2487  return 0;
2488 }
#define DL_CANCELDRAG
Definition: commctrl.h:2072
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DL_BEGINDRAG
Definition: commctrl.h:2069
#define TRUE
Definition: types.h:120
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 DL_STOPCURSOR
Definition: commctrl.h:2075
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:58
#define DL_DRAGGING
Definition: commctrl.h:2070
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:60
int32_t INT
Definition: typedefs.h:56
UINT uNotification
Definition: commctrl.h:2064
smooth NULL
Definition: ftsmooth.c:416
#define DL_DROPPED
Definition: commctrl.h:2071
#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:2076
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:2281
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 2210 of file toolbar.c.

2211 {
2212  int i;
2213  int count;
2214  PCUSTOMBUTTON btnInfo;
2215  HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2216 
2217  TRACE("button %s, idCommand %d\n", debugstr_w(btnInfoNew->text), btnInfoNew->btn.idCommand);
2218 
2219  count = SendMessageW(hwndAvail, LB_GETCOUNT, 0, 0);
2220 
2221  /* position 0 is always separator */
2222  for (i = 1; i < count; i++)
2223  {
2224  btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndAvail, LB_GETITEMDATA, i, 0);
2225  if (btnInfoNew->btn.idCommand < btnInfo->btn.idCommand)
2226  {
2227  i = SendMessageW(hwndAvail, LB_INSERTSTRING, i, 0);
2228  SendMessageW(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
2229  return;
2230  }
2231  }
2232  /* id higher than all others add to end */
2233  i = SendMessageW(hwndAvail, LB_ADDSTRING, 0, 0);
2234  SendMessageW(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
2235 }
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:58
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:922
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 2237 of file toolbar.c.

2238 {
2239  NMTOOLBARW nmtb;
2240 
2241  TRACE("index from %d, index to %d\n", nIndexFrom, nIndexTo);
2242 
2243  if (nIndexFrom == nIndexTo)
2244  return;
2245 
2246  /* MSDN states that iItem is the index of the button, rather than the
2247  * command ID as used by every other NMTOOLBAR notification */
2248  nmtb.iItem = nIndexFrom;
2249  if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
2250  {
2251  PCUSTOMBUTTON btnInfo;
2252  NMHDR hdr;
2253  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2254  int count = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2255 
2256  btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndList, LB_GETITEMDATA, nIndexFrom, 0);
2257 
2258  SendMessageW(hwndList, LB_DELETESTRING, nIndexFrom, 0);
2259  SendMessageW(hwndList, LB_INSERTSTRING, nIndexTo, 0);
2260  SendMessageW(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
2261  SendMessageW(hwndList, LB_SETCURSEL, nIndexTo, 0);
2262 
2263  if (nIndexTo <= 0)
2265  else
2267 
2268  /* last item is always separator, so -2 instead of -1 */
2269  if (nIndexTo >= (count - 2))
2271  else
2273 
2274  SendMessageW(custInfo->tbHwnd, TB_DELETEBUTTON, nIndexFrom, 0);
2275  SendMessageW(custInfo->tbHwnd, TB_INSERTBUTTONW, nIndexTo, (LPARAM)&(btnInfo->btn));
2276 
2278  }
2279 }
#define LB_SETCURSEL
Definition: winuser.h:2045
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND tbHwnd
Definition: toolbar.c:185
#define TRUE
Definition: types.h:120
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:1286
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:60
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:63
struct CUSTOMBUTTON * PCUSTOMBUTTON
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define TB_INSERTBUTTONW
Definition: commctrl.h:1237
#define TBN_QUERYINSERT
Definition: commctrl.h:1284
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:1080
#define IDC_MOVEDN_BTN
Definition: comctl32.h:64

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

2330 {
2331  PCUSTOMBUTTON btnInfo;
2332  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2333 
2334  TRACE("Remove: index %d\n", index);
2335 
2336  btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndList, LB_GETITEMDATA, index, 0);
2337 
2338  /* send TBN_QUERYDELETE notification */
2339  if (TOOLBAR_IsButtonRemovable(custInfo->tbInfo, index, btnInfo))
2340  {
2341  NMHDR hdr;
2342 
2343  SendMessageW(hwndList, LB_DELETESTRING, index, 0);
2344  SendMessageW(hwndList, LB_SETCURSEL, index , 0);
2345 
2346  SendMessageW(custInfo->tbHwnd, TB_DELETEBUTTON, index, 0);
2347 
2348  /* insert into 'available button' list */
2349  if (!(btnInfo->btn.fsStyle & BTNS_SEP))
2351  else
2352  Free(btnInfo);
2353 
2355  }
2356 }
#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:1286
BYTE fsStyle
Definition: commctrl.h:924
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:60
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:656
static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew)
Definition: toolbar.c:2210
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:7348
#define TRACE(s)
Definition: solgame.cpp:4
#define BTNS_SEP
Definition: commctrl.h:971
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:1080

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

2361 {
2362  HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
2363  switch (pDLI->uNotification)
2364  {
2365  case DL_BEGINDRAG:
2366  {
2367  INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2368  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2369  /* no dragging for last item (separator) */
2370  if (nCurrentItem >= (nCount - 1)) return FALSE;
2371  return TRUE;
2372  }
2373  case DL_DRAGGING:
2374  {
2375  INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2376  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2377  /* no dragging past last item (separator) */
2378  if ((nCurrentItem >= 0) && (nCurrentItem < (nCount - 1)))
2379  {
2380  DrawInsert(hwnd, hwndList, nCurrentItem);
2381  /* FIXME: native uses "move button" cursor */
2382  return DL_COPYCURSOR;
2383  }
2384 
2385  /* not over toolbar buttons list */
2386  if (nCurrentItem < 0)
2387  {
2388  POINT ptWindow = pDLI->ptCursor;
2389  HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2390  MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2391  /* over available buttons list? */
2392  if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2393  /* FIXME: native uses "move button" cursor */
2394  return DL_COPYCURSOR;
2395  }
2396  /* clear drag arrow */
2397  DrawInsert(hwnd, hwndList, -1);
2398  return DL_STOPCURSOR;
2399  }
2400  case DL_DROPPED:
2401  {
2402  INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2403  INT nIndexFrom = SendMessageW(hwndList, LB_GETCURSEL, 0, 0);
2404  INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2405  if ((nIndexTo >= 0) && (nIndexTo < (nCount - 1)))
2406  {
2407  /* clear drag arrow */
2408  DrawInsert(hwnd, hwndList, -1);
2409  /* move item */
2410  TOOLBAR_Cust_MoveButton(custInfo, hwnd, nIndexFrom, nIndexTo);
2411  }
2412  /* not over toolbar buttons list */
2413  if (nIndexTo < 0)
2414  {
2415  POINT ptWindow = pDLI->ptCursor;
2416  HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2417  MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2418  /* over available buttons list? */
2419  if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2420  TOOLBAR_Cust_RemoveButton(custInfo, hwnd, nIndexFrom);
2421  }
2422  break;
2423  }
2424  case DL_CANCELDRAG:
2425  /* Clear drag arrow */
2426  DrawInsert(hwnd, hwndList, -1);
2427  break;
2428  }
2429 
2430  return 0;
2431 }
#define DL_CANCELDRAG
Definition: commctrl.h:2072
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DL_BEGINDRAG
Definition: commctrl.h:2069
#define TRUE
Definition: types.h:120
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 DL_STOPCURSOR
Definition: commctrl.h:2075
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:58
#define DL_DRAGGING
Definition: commctrl.h:2070
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:60
int32_t INT
Definition: typedefs.h:56
UINT uNotification
Definition: commctrl.h:2064
static void TOOLBAR_Cust_RemoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT index)
Definition: toolbar.c:2329
smooth NULL
Definition: ftsmooth.c:416
#define DL_DROPPED
Definition: commctrl.h:2071
#define LB_GETCOUNT
Definition: winuser.h:2020
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DL_COPYCURSOR
Definition: commctrl.h:2076
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:2237
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 3356 of file toolbar.c.

3357 {
3358  CUSTDLG_INFO custInfo;
3359  LRESULT ret;
3360  NMHDR nmhdr;
3361 
3362  custInfo.tbInfo = infoPtr;
3363  custInfo.tbHwnd = infoPtr->hwndSelf;
3364 
3365  /* send TBN_BEGINADJUST notification */
3366  TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_BEGINADJUST);
3367 
3369  infoPtr->hwndSelf, TOOLBAR_CustomizeDialogProc, (LPARAM)&custInfo);
3370 
3371  /* send TBN_ENDADJUST notification */
3372  TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_ENDADJUST);
3373 
3374  return ret;
3375 }
HWND tbHwnd
Definition: toolbar.c:185
#define TBN_ENDADJUST
Definition: commctrl.h:1282
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:2497
#define TBN_BEGINADJUST
Definition: commctrl.h:1281
#define IDD_TBCUSTOMIZE
Definition: comctl32.h:56
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 2497 of file toolbar.c.

2498 {
2500  PCUSTOMBUTTON btnInfo;
2501  NMTOOLBARA nmtb;
2502  TOOLBAR_INFO *infoPtr = custInfo ? custInfo->tbInfo : NULL;
2503 
2504  switch (uMsg)
2505  {
2506  case WM_INITDIALOG:
2507  custInfo = (PCUSTDLG_INFO)lParam;
2508  SetWindowLongPtrW (hwnd, DWLP_USER, (LONG_PTR)custInfo);
2509 
2510  if (custInfo)
2511  {
2512  WCHAR Buffer[256];
2513  int i = 0;
2514  int index;
2515  NMTBINITCUSTOMIZE nmtbic;
2516 
2517  infoPtr = custInfo->tbInfo;
2518 
2519  /* send TBN_QUERYINSERT notification */
2520  nmtb.iItem = custInfo->tbInfo->nNumButtons;
2521 
2522  if (!TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT))
2523  return FALSE;
2524 
2525  nmtbic.hwndDialog = hwnd;
2526  /* Send TBN_INITCUSTOMIZE notification */
2527  if (TOOLBAR_SendNotify (&nmtbic.hdr, infoPtr, TBN_INITCUSTOMIZE) ==
2529  {
2530  TRACE("TBNRF_HIDEHELP requested\n");
2532  }
2533 
2534  /* add items to 'toolbar buttons' list and check if removable */
2535  for (i = 0; i < custInfo->tbInfo->nNumButtons; i++)
2536  {
2537  btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2538  memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2539  btnInfo->btn.fsStyle = BTNS_SEP;
2540  btnInfo->bVirtual = FALSE;
2542 
2543  /* send TBN_QUERYDELETE notification */
2544  btnInfo->bRemovable = TOOLBAR_IsButtonRemovable(infoPtr, i, btnInfo);
2545 
2548  }
2549 
2551 
2552  /* insert separator button into 'available buttons' list */
2553  btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2554  memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2555  btnInfo->btn.fsStyle = BTNS_SEP;
2556  btnInfo->bVirtual = FALSE;
2557  btnInfo->bRemovable = TRUE;
2561 
2562  /* insert all buttons into dsa */
2563  for (i = 0;; i++)
2564  {
2565  /* send TBN_GETBUTTONINFO notification */
2566  NMTOOLBARW nmtb;
2567  nmtb.iItem = i;
2568  nmtb.pszText = Buffer;
2569  nmtb.cchText = 256;
2570 
2571  /* Clear previous button's text */
2572  ZeroMemory(nmtb.pszText, nmtb.cchText * sizeof(WCHAR));
2573 
2574  if (!TOOLBAR_GetButtonInfo(infoPtr, &nmtb))
2575  break;
2576 
2577  TRACE("WM_INITDIALOG style: %x iItem(%d) idCommand(%d) iString(%ld) %s\n",
2578  nmtb.tbButton.fsStyle, i,
2579  nmtb.tbButton.idCommand,
2580  nmtb.tbButton.iString,
2581  nmtb.tbButton.iString >= 0 ? debugstr_w(infoPtr->strings[nmtb.tbButton.iString])
2582  : "");
2583 
2584  /* insert button into the appropriate list */
2586  if (index == -1)
2587  {
2588  btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2589  btnInfo->bVirtual = FALSE;
2590  btnInfo->bRemovable = TRUE;
2591  }
2592  else
2593  {
2594  btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageW (hwnd,
2596  }
2597 
2598  btnInfo->btn = nmtb.tbButton;
2599  if (!(nmtb.tbButton.fsStyle & BTNS_SEP))
2600  {
2601  if (lstrlenW(nmtb.pszText))
2602  lstrcpyW(btnInfo->text, nmtb.pszText);
2603  else if (nmtb.tbButton.iString >= 0 &&
2604  nmtb.tbButton.iString < infoPtr->nNumStrings)
2605  {
2606  lstrcpyW(btnInfo->text,
2607  infoPtr->strings[nmtb.tbButton.iString]);
2608  }
2609  }
2610 
2611  if (index == -1)
2613  }
2614 
2616 
2617  /* select first item in the 'available' list */
2619 
2620  /* append 'virtual' separator button to the 'toolbar buttons' list */
2621  btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2622  memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2623  btnInfo->btn.fsStyle = BTNS_SEP;
2624  btnInfo->bVirtual = TRUE;
2625  btnInfo->bRemovable = FALSE;
2629 
2630  /* select last item in the 'toolbar' list */
2633 
2636 
2637  /* set focus and disable buttons */
2638  PostMessageW (hwnd, WM_USER, 0, 0);
2639  }
2640  return TRUE;
2641 
2642  case WM_USER:
2647  return TRUE;
2648 
2649  case WM_CLOSE:
2650  EndDialog(hwnd, FALSE);
2651  return TRUE;
2652 
2653  case WM_COMMAND:
2654  switch (LOWORD(wParam))
2655  {
2656  case IDC_TOOLBARBTN_LBOX:
2657  if (HIWORD(wParam) == LBN_SELCHANGE)
2658  {
2659  PCUSTOMBUTTON btnInfo;
2660  NMTOOLBARA nmtb;
2661  int count;
2662  int index;
2663 
2666 
2667  /* send TBN_QUERYINSERT notification */
2668  nmtb.iItem = index;
2669  TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT);
2670 
2671  /* get list box item */
2673 
2674  if (index == (count - 1))
2675  {
2676  /* last item (virtual separator) */
2679  }
2680  else if (index == (count - 2))
2681  {
2682  /* second last item (last non-virtual item) */
2685  }
2686  else if (index == 0)
2687  {
2688  /* first item */
2691  }
2692  else
2693  {
2696  }
2697 
2699  }
2700  break;
2701 
2702  case IDC_MOVEUP_BTN:
2703  {
2705  TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index-1);
2706  }
2707  break;
2708 
2709  case IDC_MOVEDN_BTN: /* move down */
2710  {
2712  TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index+1);
2713  }
2714  break;
2715 
2716  case IDC_REMOVE_BTN: /* remove button */
2717  {
2719 
2720  if (LB_ERR == index)
2721  break;
2722 
2723  TOOLBAR_Cust_RemoveButton(custInfo, hwnd, index);
2724  }
2725  break;
2726  case IDC_HELP_BTN:
2727  TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_CUSTHELP);
2728  break;
2729  case IDC_RESET_BTN:
2730  TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_RESET);
2731  break;
2732 
2733  case IDOK: /* Add button */
2734  {
2735  int index;
2736  int indexto;
2737 
2740 
2741  TOOLBAR_Cust_AddButton(custInfo, hwnd, index, indexto);
2742  }
2743  break;
2744 
2745  case IDCANCEL:
2746  EndDialog(hwnd, FALSE);
2747  break;
2748  }
2749  return TRUE;
2750 
2751  case WM_DESTROY:
2752  {
2753  int count;
2754  int i;
2755 
2756  /* delete items from 'toolbar buttons' listbox*/
2758  for (i = 0; i < count; i++)
2759  {
2761  Free(btnInfo);
2763  }
2765 
2766 
2767  /* delete items from 'available buttons' listbox*/
2769  for (i = 0; i < count; i++)
2770  {
2772  Free(btnInfo);
2774  }
2776  }
2777  return TRUE;
2778 
2779  case WM_DRAWITEM:
2781  {
2783  RECT rcButton;
2784  RECT rcText;
2785  HPEN hPen, hOldPen;
2786  HBRUSH hOldBrush;
2787  COLORREF oldText = 0;
2788  COLORREF oldBk = 0;
2789 
2790  /* get item data */
2792  if (btnInfo == NULL)
2793  {
2794  FIXME("btnInfo invalid\n");
2795  return TRUE;
2796  }
2797 
2798  /* set colors and select objects */
2800  if (btnInfo->bVirtual)
2801  oldText = SetTextColor (lpdis->hDC, comctl32_color.clrGrayText);
2802  else
2804  hPen = CreatePen( PS_SOLID, 1,
2806  hOldPen = SelectObject (lpdis->hDC, hPen );
2808 
2809  /* fill background rectangle */
2810  Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
2811  lpdis->rcItem.right, lpdis->rcItem.bottom);
2812 
2813  /* calculate button and text rectangles */
2814  rcButton = lpdis->rcItem;
2815  InflateRect (&rcButton, -1, -1);
2816  rcText = rcButton;
2817  rcButton.right = rcButton.left + custInfo->tbInfo->nBitmapWidth + 6;
2818  rcText.left = rcButton.right + 2;
2819 
2820  /* draw focus rectangle */
2821  if (lpdis->itemState & ODS_FOCUS)
2822  DrawFocusRect (lpdis->hDC, &lpdis->rcItem);
2823 
2824  /* draw button */
2825  if (!(infoPtr->dwStyle & TBSTYLE_FLAT))
2826  DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT);
2827 
2828  /* draw image and text */
2829  if ((btnInfo->btn.fsStyle & BTNS_SEP) == 0) {
2830  HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr,
2831  btnInfo->btn.iBitmap));
2832  ImageList_Draw (himl, GETIBITMAP(infoPtr, btnInfo->btn.iBitmap),
2833  lpdis->hDC, rcButton.left+3, rcButton.top+3, ILD_NORMAL);
2834  }
2835  DrawTextW (lpdis->hDC, btnInfo->text, -1, &rcText,
2837 
2838  /* delete objects and reset colors */
2839  SelectObject (lpdis->hDC, hOldBrush);
2840  SelectObject (lpdis->hDC, hOldPen);
2841  SetBkColor (lpdis->hDC, oldBk);
2842  SetTextColor (lpdis->hDC, oldText);
2843  DeleteObject( hPen );
2844  return TRUE;
2845  }
2846  return FALSE;
2847 
2848  case WM_MEASUREITEM:
2850  {
2852 
2853  lpmis->itemHeight = 15 + 8; /* default height */
2854 
2855  return TRUE;
2856  }
2857  return FALSE;
2858 
2859  default:
2860  if (uDragListMessage && (uMsg == uDragListMessage))
2861  {
2862  if (wParam == IDC_TOOLBARBTN_LBOX)
2863  {
2865  custInfo, hwnd, (DRAGLISTINFO *)lParam);
2867  return TRUE;
2868  }
2869  else if (wParam == IDC_AVAILBTN_LBOX)
2870  {
2872  custInfo, hwnd, (DRAGLISTINFO *)lParam);
2874  return TRUE;
2875  }
2876  }
2877  return FALSE;
2878  }
2879 }
#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
#define TRUE
Definition: types.h:120
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:1287
#define LB_ADDSTRING
Definition: winuser.h:2013
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define SW_HIDE
Definition: winuser.h:762
static LRESULT TOOLBAR_Cust_AvailDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2434
#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:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ODS_FOCUS
Definition: winuser.h:2524
#define IDC_AVAILBTN_LBOX
Definition: comctl32.h:58
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
INT nNumButtons
Definition: toolbar.c:131
HWND WINAPI SetFocus(_In_opt_ HWND)
#define GetWindowLongPtrW
Definition: winuser.h:4730
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:291
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define GETHIMLID(infoPtr, i)
Definition: toolbar.c:246
BYTE fsStyle
Definition: commctrl.h:924
INT nBitmapHeight
Definition: toolbar.c:124
LONG right
Definition: windef.h:293
#define IDC_TOOLBARBTN_LBOX
Definition: comctl32.h:60
#define lstrlenW
Definition: compat.h:407
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:2049
#define TBN_RESET
Definition: commctrl.h:1283
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:656
#define LB_SETITEMHEIGHT
Definition: winuser.h:2048
WCHAR text[64]
Definition: toolbar.c:193
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
COLORREF clrWindowText
Definition: comctl32.h:169
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:2210
BOOL WINAPI MakeDragList(HWND hwndLB)
Definition: draglist.c:204
#define DT_LEFT
Definition: winuser.h:534
#define LB_ERR
Definition: winuser.h:2407
#define IDC_RESET_BTN
Definition: comctl32.h:59
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:2329
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static BOOL TOOLBAR_GetButtonInfo(const TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
Definition: toolbar.c:7317
smooth NULL
Definition: ftsmooth.c:416
COLORREF clrHighlightText
Definition: comctl32.h:162
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:931
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:921
static BOOL TOOLBAR_IsButtonRemovable(const TOOLBAR_INFO *infoPtr, int iItem, const CUSTOMBUTTON *btnInfo)
Definition: toolbar.c:7348
static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2359
TBBUTTON tbButton
Definition: commctrl.h:1422
#define TRACE(s)
Definition: solgame.cpp:4
#define BTNS_SEP
Definition: commctrl.h:971
#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:285
#define WM_CLOSE
Definition: winuser.h:1603
#define IDC_HELP_BTN
Definition: comctl32.h:62
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:1424
#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:1324
#define IDS_SEPARATOR
Definition: comctl32.h:66
#define index(s, c)
Definition: various.h:29
#define IDC_MOVEUP_BTN
Definition: comctl32.h:63
#define DWLP_USER
Definition: winuser.h:866
int idCommand
Definition: commctrl.h:922
#define WM_COMMAND
Definition: winuser.h:1722
struct CUSTOMBUTTON * PCUSTOMBUTTON
#define WM_USER
Definition: winuser.h:1877
#define IDC_REMOVE_BTN
Definition: comctl32.h:61
#define TBN_INITCUSTOMIZE
Definition: commctrl.h:1318
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:170
#define TBN_QUERYINSERT
Definition: commctrl.h:1284
#define lstrcpyW
Definition: compat.h:406
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:161
static void TOOLBAR_Cust_MoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo)
Definition: toolbar.c:2237
#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:246
LONG bottom
Definition: windef.h:294
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define ILD_NORMAL
Definition: commctrl.h:402
#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:168
HBRUSH WINAPI GetSysColorBrush(_In_ int)
static void TOOLBAR_Cust_AddButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexAvail, INT nIndexTo)
Definition: toolbar.c:2281
#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:964
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
#define IDC_MOVEDN_BTN
Definition: comctl32.h:64

Referenced by TOOLBAR_Customize().

◆ TOOLBAR_DeleteAllButtons()

static void TOOLBAR_DeleteAllButtons ( TOOLBAR_INFO infoPtr)
static

Definition at line 4325 of file toolbar.c.

4326 {
4327  INT i;
4328 
4329  for (i = 0; i < infoPtr->nNumButtons; i++)
4330  {
4331  free_string( infoPtr->buttons + i );
4332  TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[i]);
4333  }
4334 
4335  Free(infoPtr->buttons);
4336  infoPtr->buttons = NULL;
4337  infoPtr->nNumButtons = 0;
4338 }
TBUTTON_INFO * buttons
Definition: toolbar.c:175
INT nNumButtons
Definition: toolbar.c:131
int32_t INT
Definition: typedefs.h:56
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:656
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:2154

Referenced by TOOLBAR_Restore().

◆ TOOLBAR_DeleteButton()

static LRESULT TOOLBAR_DeleteButton ( TOOLBAR_INFO infoPtr,
INT  nIndex 
)
static

Definition at line 3379 of file toolbar.c.

3380 {
3381  NMTOOLBARW nmtb;
3382  TBUTTON_INFO *btnPtr = &infoPtr->buttons[nIndex];
3383 
3384  if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
3385  return FALSE;
3386 
3387  memset(&nmtb, 0, sizeof(nmtb));
3388  nmtb.iItem = btnPtr->idCommand;
3389  nmtb.tbButton.iBitmap = btnPtr->iBitmap;
3390  nmtb.tbButton.idCommand = btnPtr->idCommand;
3391  nmtb.tbButton.fsState = btnPtr->fsState;
3392  nmtb.tbButton.fsStyle = btnPtr->fsStyle;
3393  nmtb.tbButton.dwData = btnPtr->dwData;
3394  nmtb.tbButton.iString = btnPtr->iString;
3395  TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_DELETINGBUTTON);
3396 
3397  TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[nIndex]);
3398 
3399  infoPtr->nHotItem = -1;
3400  if (infoPtr->nNumButtons == 1) {
3401  TRACE(" simple delete\n");
3402  free_string( infoPtr->buttons );
3403  Free (infoPtr->buttons);
3404  infoPtr->buttons = NULL;
3405  infoPtr->nNumButtons = 0;
3406  }
3407  else {
3408  TBUTTON_INFO *oldButtons = infoPtr->buttons;
3409  TRACE("complex delete [nIndex=%d]\n", nIndex);
3410 
3411  infoPtr->nNumButtons--;
3412  infoPtr->buttons = Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons);
3413  if (nIndex > 0) {
3414  memcpy (&infoPtr->buttons[0], &oldButtons[0],
3415  nIndex * sizeof(TBUTTON_INFO));
3416  }
3417 
3418  if (nIndex < infoPtr->nNumButtons) {
3419  memcpy (&infoPtr->buttons[nIndex], &oldButtons[nIndex+1],
3420  (infoPtr->nNumButtons - nIndex) * sizeof(TBUTTON_INFO));
3421  }
3422 
3423  free_string( oldButtons + nIndex );
3424  Free (oldButtons);
3425  }
3426 
3427  TOOLBAR_LayoutToolbar(infoPtr);
3428 
3429  InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
3430 
3431  return TRUE;
3432 }
#define TRUE
Definition: types.h:120
TBUTTON_INFO * buttons
Definition: toolbar.c:175
BYTE fsState
Definition: toolbar.c:93
INT nNumButtons
Definition: toolbar.c:131
INT nHotItem
Definition: toolbar.c:138
BYTE fsStyle
Definition: commctrl.h:924
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:656
INT idCommand
Definition: toolbar.c:92
smooth NULL
Definition: ftsmooth.c:416
INT_PTR iString
Definition: commctrl.h:931
static INT TOOLBAR_SendNotify(NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
Definition: toolbar.c:399
DWORD_PTR dwData
Definition: commctrl.h:930
int iBitmap
Definition: commctrl.h:921
TBBUTTON tbButton
Definition: commctrl.h:1422
#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:1804
int idCommand
Definition: commctrl.h:922
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void TOOLBAR_TooltipDelTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
Definition: toolbar.c:2154
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:923
#define memset(x, y, z)
Definition: compat.h:39
#define TBN_DELETINGBUTTON
Definition: commctrl.h:1310

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

◆ TOOLBAR_DeleteImageList()

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

Definition at line 7269 of file toolbar.c.

7270 {
7271  int i;
7272 
7273  for (i = 0; i < *cies; i++)
7274  Free((*pies)[i]);
7275 
7276  Free(*pies);
7277 
7278  *cies = 0;
7279  *pies = NULL;
7280 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:656
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 5549 of file toolbar.c.

5550 {
5551  INT i;
5552 
5553  /* delete tooltip control */
5554  if (infoPtr->hwndToolTip)
5555  DestroyWindow (infoPtr->hwndToolTip);
5556 
5557  /* delete temporary buffer for tooltip text */
5558  Free (infoPtr->pszTooltipText);
5559  Free (infoPtr->bitmaps); /* bitmaps list */
5560 
5561  /* delete button data */
5562  for (i = 0; i < infoPtr->nNumButtons; i++)
5563  free_string( infoPtr->buttons + i );
5564  Free (infoPtr->buttons);
5565 
5566  /* delete strings */
5567  if (infoPtr->strings) {
5568  for (i = 0; i < infoPtr->nNumStrings; i++)
5569  Free (infoPtr->strings[i]);
5570 
5571  Free (infoPtr->strings);
5572  }
5573 
5574  /* destroy internal image list */
5575  if (infoPtr->himlInt)
5576  ImageList_Destroy (infoPtr->himlInt);
5577 
5578  TOOLBAR_DeleteImageList(&infoPtr->himlDef, &infoPtr->cimlDef);
5579  TOOLBAR_DeleteImageList(&infoPtr->himlDis, &infoPtr->cimlDis);
5580  TOOLBAR_DeleteImageList(&infoPtr->himlHot, &infoPtr->cimlHot);
5581 
5582  /* delete default font */
5583  DeleteObject (infoPtr->hDefaultFont);
5584 
5585  CloseThemeData (GetWindowTheme (infoPtr->hwndSelf));
5586 
5587  /* free toolbar info data */
5588  SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
5589  Free (infoPtr);
5590 
5591  return 0;
5592 }
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:56
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:656
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:7269
INT cimlDef
Definition: toolbar.c:151
INT cimlDis
Definition: toolbar.c:155
#define SetWindowLongPtrW
Definition: winuser.h:5247
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:1497
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:56
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:997
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define BTNS_WHOLEDROPDOWN
Definition: commctrl.h:979
COLORREF clr3dShadow
Definition: comctl32.h:165
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:259
BYTE fsState
Definition: toolbar.c:93
INT nBitmapWidth
Definition: toolbar.c:125
#define TBCDRF_NOOFFSET
Definition: commctrl.h:1007
GLintptr offset
Definition: glext.h:5920
DWORD dwStyle
Definition: toolbar.c:164
LONG top
Definition: windef.h:292
COLORREF clrBtnHighlight
Definition: comctl32.h:157
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:270
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define ZeroMemory
Definition: winbase.h:1635
#define SM_CXEDGE
Definition: winuser.h:998
COLORREF clrBtnText
Definition: comctl32.h:159
LONG left
Definition: windef.h:291
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:255
INT nBitmapHeight
Definition: toolbar.c:124
LONG right
Definition: windef.h:293
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:56
#define CCS_VERT
Definition: commctrl.h:2221
INT nMaxTextRows
Definition: toolbar.c:128
static UINT TOOLBAR_TranslateState(const TBUTTON_INFO *btnPtr)
Definition: toolbar.c:767
static void TOOLBAR_DrawImage(const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top, const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
Definition: toolbar.c:783
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
static LPWSTR TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
Definition: toolbar.c:290