ReactOS 0.4.15-dev-8434-g155a7c7
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_BOTTOM
Definition: commctrl.h:2244
#define CCS_ADJUSTABLE
Definition: commctrl.h:2247
#define CCS_VERT
Definition: commctrl.h:2249
#define CCS_NODIVIDER
Definition: commctrl.h:2248
#define CCS_TOP
Definition: commctrl.h:2242
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2246
#define CCS_NORESIZE
Definition: commctrl.h:2245
#define CCS_NOMOVEY
Definition: commctrl.h:2243

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:
#define TBSTYLE_EX_DRAWDDARROWS
Definition: commctrl.h:1009
#define TBSTYLE_EX_MIXEDBUTTONS
Definition: commctrl.h:1012
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:1013
#define TBSTYLE_EX_DOUBLEBUFFER
Definition: commctrl.h:1014
#define TBSTYLE_EX_VERTICAL
Definition: commctrl.h:1011

Definition at line 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.

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

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}
static BOOL TOOLBAR_HasDropDownArrows(DWORD exStyle)
Definition: toolbar.c:278
#define BTNS_DROPDOWN
Definition: commctrl.h:1003
#define BTNS_WHOLEDROPDOWN
Definition: commctrl.h:1007
BYTE fsStyle
Definition: toolbar.c:94
DWORD dwExStyle
Definition: toolbar.c:165

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}
#define TOP_BORDER
Definition: toolbar.c:204
#define TBSTYLE_FLAT
Definition: commctrl.h:992
INT iVersion
Definition: toolbar.c:171
DWORD dwStyle
Definition: toolbar.c:164

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

◆ free_string()

static void free_string ( TBUTTON_INFO btn)
static

Definition at line 387 of file toolbar.c.

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

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

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

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

◆ set_stringT()

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

Definition at line 381 of file toolbar.c.

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

Referenced by TOOLBAR_SetButtonInfo().

◆ theme_changed()

static LRESULT theme_changed ( HWND  hwnd)
static

Definition at line 6784 of file toolbar.c.

6785{
6786 HTHEME theme = GetWindowTheme (hwnd);
6787 CloseThemeData (theme);
6789 return 0;
6790}
static const WCHAR themeClass[]
Definition: toolbar.c:251
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddBitmap()

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

Definition at line 2991 of file toolbar.c.

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

Referenced by TOOLBAR_LoadImages(), and ToolbarWindowProc().

◆ TOOLBAR_AddBitmapToImageList()

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

Definition at line 2913 of file toolbar.c.

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

Referenced by TOOLBAR_AddBitmap(), and TOOLBAR_CheckImageListIconSize().

◆ TOOLBAR_AddButtonsT()

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

Definition at line 3106 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringA()

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

Definition at line 3196 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringW()

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

Definition at line 3115 of file toolbar.c.

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

Referenced by TOOLBAR_AddStringA(), and ToolbarWindowProc().

◆ TOOLBAR_AutoSize()

static LRESULT TOOLBAR_AutoSize ( TOOLBAR_INFO infoPtr)
static

Definition at line 3232 of file toolbar.c.

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

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

◆ TOOLBAR_ButtonCount()

static LRESULT TOOLBAR_ButtonCount ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3303 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ButtonHasString()

static BOOL TOOLBAR_ButtonHasString ( const TBUTTON_INFO btnPtr)
inlinestatic

Definition at line 357 of file toolbar.c.

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

Referenced by set_string_index(), and TOOLBAR_InternalInsertButtonsT().

◆ TOOLBAR_ButtonStructSize()

static LRESULT TOOLBAR_ButtonStructSize ( TOOLBAR_INFO infoPtr,
DWORD  Size 
)
inlinestatic

Definition at line 3310 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CalcStrings()

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

Definition at line 1411 of file toolbar.c.

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

Referenced by TOOLBAR_CalcToolbar().

◆ TOOLBAR_CalcToolbar()

static void TOOLBAR_CalcToolbar ( TOOLBAR_INFO infoPtr)
static

Definition at line 1810 of file toolbar.c.

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

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

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ChangeBitmap()

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

Definition at line 3319 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CheckButton()

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

Definition at line 3342 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CheckImageListIconSize()

static void TOOLBAR_CheckImageListIconSize ( TOOLBAR_INFO infoPtr)
static

Definition at line 2957 of file toolbar.c.

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

Referenced by TOOLBAR_Refresh().

◆ TOOLBAR_CheckStyle()

static void TOOLBAR_CheckStyle ( const TOOLBAR_INFO infoPtr)
static

Definition at line 401 of file toolbar.c.

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

Referenced by TOOLBAR_Create(), and TOOLBAR_SetStyle().

◆ TOOLBAR_CommandToIndex()

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

Definition at line 3388 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Create()

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

Definition at line 5555 of file toolbar.c.

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

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

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

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

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

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_InsertAvailButton()

static void TOOLBAR_Cust_InsertAvailButton ( HWND  hwnd,
PCUSTOMBUTTON  btnInfoNew 
)
static

Definition at line 2241 of file toolbar.c.

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

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

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

Referenced by TOOLBAR_Cust_ToolbarDragListNotification(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_RemoveButton()

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

Definition at line 2360 of file toolbar.c.

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

Referenced by TOOLBAR_Cust_ToolbarDragListNotification(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_ToolbarDragListNotification()

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

Definition at line 2390 of file toolbar.c.

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

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Customize()

static LRESULT TOOLBAR_Customize ( TOOLBAR_INFO infoPtr)
static

Definition at line 3395 of file toolbar.c.

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

Referenced by TOOLBAR_LButtonDblClk(), and ToolbarWindowProc().

◆ TOOLBAR_CustomizeDialogProc()

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

Definition at line 2528 of file toolbar.c.

2529{
2531 PCUSTOMBUTTON btnInfo;
2532 NMTOOLBARA nmtb;
2533 TOOLBAR_INFO *infoPtr = custInfo ? custInfo->tbInfo : NULL;
2534
2535 switch (uMsg)
2536 {
2537 case WM_INITDIALOG:
2538 custInfo = (PCUSTDLG_INFO)lParam;
2540
2541 if (custInfo)
2542 {
2543 WCHAR Buffer[256];
2544 int i = 0;
2545 int index;
2546 NMTBINITCUSTOMIZE nmtbic;
2547
2548 infoPtr = custInfo->tbInfo;
2549
2550 /* send TBN_QUERYINSERT notification */
2551 nmtb.iItem = custInfo->tbInfo->nNumButtons;
2552
2553 if (!TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT))
2554 return FALSE;
2555
2556 nmtbic.hwndDialog = hwnd;
2557 /* Send TBN_INITCUSTOMIZE notification */
2558 if (TOOLBAR_SendNotify (&nmtbic.hdr, infoPtr, TBN_INITCUSTOMIZE) ==
2560 {
2561 TRACE("TBNRF_HIDEHELP requested\n");
2563 }
2564
2565 /* add items to 'toolbar buttons' list and check if removable */
2566 for (i = 0; i < custInfo->tbInfo->nNumButtons; i++)
2567 {
2568 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2569 memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2570 btnInfo->btn.fsStyle = BTNS_SEP;
2571 btnInfo->bVirtual = FALSE;
2573
2574 /* send TBN_QUERYDELETE notification */
2575 btnInfo->bRemovable = TOOLBAR_IsButtonRemovable(infoPtr, i, btnInfo);
2576
2579 }
2580
2582
2583 /* insert separator button into 'available buttons' list */
2584 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2585 memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2586 btnInfo->btn.fsStyle = BTNS_SEP;
2587 btnInfo->bVirtual = FALSE;
2588 btnInfo->bRemovable = TRUE;
2592
2593 /* insert all buttons into dsa */
2594 for (i = 0;; i++)
2595 {
2596 /* send TBN_GETBUTTONINFO notification */
2597 NMTOOLBARW nmtb;
2598 nmtb.iItem = i;
2599 nmtb.pszText = Buffer;
2600 nmtb.cchText = 256;
2601
2602 /* Clear previous button's text */
2603 ZeroMemory(nmtb.pszText, nmtb.cchText * sizeof(WCHAR));
2604
2605 if (!TOOLBAR_GetButtonInfo(infoPtr, &nmtb))
2606 break;
2607
2608 TRACE("WM_INITDIALOG style: %x iItem(%d) idCommand(%d) iString(%ld) %s\n",
2609 nmtb.tbButton.fsStyle, i,
2610 nmtb.tbButton.idCommand,
2611 nmtb.tbButton.iString,
2612 nmtb.tbButton.iString >= 0 ? debugstr_w(infoPtr->strings[nmtb.tbButton.iString])
2613 : "");
2614
2615 /* insert button into the appropriate list */
2617 if (index == -1)
2618 {
2619 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2620 btnInfo->bVirtual = FALSE;
2621 btnInfo->bRemovable = TRUE;
2622 }
2623 else
2624 {
2627 }
2628
2629 btnInfo->btn = nmtb.tbButton;
2630 if (!(nmtb.tbButton.fsStyle & BTNS_SEP))
2631 {
2632 if (lstrlenW(nmtb.pszText))
2633 lstrcpyW(btnInfo->text, nmtb.pszText);
2634 else if (nmtb.tbButton.iString >= 0 &&
2635 nmtb.tbButton.iString < infoPtr->nNumStrings)
2636 {
2637 lstrcpyW(btnInfo->text,
2638 infoPtr->strings[nmtb.tbButton.iString]);
2639 }
2640 }
2641
2642 if (index == -1)
2644 }
2645
2647
2648 /* select first item in the 'available' list */
2650
2651 /* append 'virtual' separator button to the 'toolbar buttons' list */
2652 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2653 memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2654 btnInfo->btn.fsStyle = BTNS_SEP;
2655 btnInfo->bVirtual = TRUE;
2656 btnInfo->bRemovable = FALSE;
2660
2661 /* select last item in the 'toolbar' list */
2664
2667
2668 /* set focus and disable buttons */
2669 PostMessageW (hwnd, WM_USER, 0, 0);
2670 }
2671 return TRUE;
2672
2673 case WM_USER:
2678 return TRUE;
2679
2680 case WM_CLOSE:
2682 return TRUE;
2683
2684 case WM_COMMAND:
2685 switch (LOWORD(wParam))
2686 {
2688 if (HIWORD(wParam) == LBN_SELCHANGE)
2689 {
2690 PCUSTOMBUTTON btnInfo;
2691 NMTOOLBARA nmtb;
2692 int count;
2693 int index;
2694
2697
2698 /* send TBN_QUERYINSERT notification */
2699 nmtb.iItem = index;
2700 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT);
2701
2702 /* get list box item */
2704
2705 if (index == (count - 1))
2706 {
2707 /* last item (virtual separator) */
2710 }
2711 else if (index == (count - 2))
2712 {
2713 /* second last item (last non-virtual item) */
2716 }
2717 else if (index == 0)
2718 {
2719 /* first item */
2722 }
2723 else
2724 {
2727 }
2728
2730 }
2731 break;
2732
2733 case IDC_MOVEUP_BTN:
2734 {
2736 TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index-1);
2737 }
2738 break;
2739
2740 case IDC_MOVEDN_BTN: /* move down */
2741 {
2743 TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index+1);
2744 }
2745 break;
2746
2747 case IDC_REMOVE_BTN: /* remove button */
2748 {
2750
2751 if (LB_ERR == index)
2752 break;
2753
2755 }
2756 break;
2757 case IDC_HELP_BTN:
2758 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_CUSTHELP);
2759 break;
2760 case IDC_RESET_BTN:
2761 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_RESET);
2762 break;
2763
2764 case IDOK: /* Add button */
2765 {
2766 int index;
2767 int indexto;
2768
2771
2772 TOOLBAR_Cust_AddButton(custInfo, hwnd, index, indexto);
2773 }
2774 break;
2775
2776 case IDCANCEL:
2778 break;
2779 }
2780 return TRUE;
2781
2782 case WM_DESTROY:
2783 {
2784 int count;
2785 int i;
2786
2787 /* delete items from 'toolbar buttons' listbox*/
2789 for (i = 0; i < count; i++)
2790 {
2792 Free(btnInfo);
2794 }
2796
2797
2798 /* delete items from 'available buttons' listbox*/
2800 for (i = 0; i < count; i++)
2801 {
2803 Free(btnInfo);
2805 }
2807 }
2808 return TRUE;
2809
2810 case WM_DRAWITEM:
2812 {
2814 RECT rcButton;
2815 RECT rcText;
2816 HPEN hPen, hOldPen;
2817 HBRUSH hOldBrush;
2818 COLORREF oldText = 0;
2819 COLORREF oldBk = 0;
2820
2821 /* get item data */
2823 if (btnInfo == NULL)
2824 {
2825 FIXME("btnInfo invalid\n");
2826 return TRUE;
2827 }
2828
2829 /* set colors and select objects */
2831 if (btnInfo->bVirtual)
2832 oldText = SetTextColor (lpdis->hDC, comctl32_color.clrGrayText);
2833 else
2835 hPen = CreatePen( PS_SOLID, 1,
2837 hOldPen = SelectObject (lpdis->hDC, hPen );
2839
2840 /* fill background rectangle */
2841 Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
2842 lpdis->rcItem.right, lpdis->rcItem.bottom);
2843
2844 /* calculate button and text rectangles */
2845 rcButton = lpdis->rcItem;
2846 InflateRect (&rcButton, -1, -1);
2847 rcText = rcButton;
2848 rcButton.right = rcButton.left + custInfo->tbInfo->nBitmapWidth + 6;
2849 rcText.left = rcButton.right + 2;
2850
2851 /* draw focus rectangle */
2852 if (lpdis->itemState & ODS_FOCUS)
2853 DrawFocusRect (lpdis->hDC, &lpdis->rcItem);
2854
2855 /* draw button */
2856 if (!(infoPtr->dwStyle & TBSTYLE_FLAT))
2857 DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT);
2858
2859 /* draw image and text */
2860 if ((btnInfo->btn.fsStyle & BTNS_SEP) == 0) {
2861 HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr,
2862 btnInfo->btn.iBitmap));
2863 ImageList_Draw (himl, GETIBITMAP(infoPtr, btnInfo->btn.iBitmap),
2864 lpdis->hDC, rcButton.left+3, rcButton.top+3, ILD_NORMAL);
2865 }
2866 DrawTextW (lpdis->hDC, btnInfo->text, -1, &rcText,
2868
2869 /* delete objects and reset colors */
2870 SelectObject (lpdis->hDC, hOldBrush);
2871 SelectObject (lpdis->hDC, hOldPen);
2872 SetBkColor (lpdis->hDC, oldBk);
2873 SetTextColor (lpdis->hDC, oldText);
2874 DeleteObject( hPen );
2875 return TRUE;
2876 }
2877 return FALSE;
2878
2879 case WM_MEASUREITEM:
2881 {
2883
2884 lpmis->itemHeight = 15 + 8; /* default height */
2885
2886 return TRUE;
2887 }
2888 return FALSE;
2889
2890 default:
2891 if (uDragListMessage && (uMsg == uDragListMessage))
2892 {
2894 {
2896 custInfo, hwnd, (DRAGLISTINFO *)lParam);
2898 return TRUE;
2899 }
2900 else if (wParam == IDC_AVAILBTN_LBOX)
2901 {
2903 custInfo, hwnd, (DRAGLISTINFO *)lParam);
2905 return TRUE;
2906 }
2907 }
2908 return FALSE;
2909 }
2910}
#define index(s, c)
Definition: various.h:29
HIMAGELIST himl
Definition: bufpool.h:45
WPARAM wParam
Definition: combotst.c:138
#define IDC_RESET_BTN
Definition: comctl32.h:67
#define IDC_REMOVE_BTN
Definition: comctl32.h:69
#define IDC_HELP_BTN
Definition: comctl32.h:70
#define IDS_SEPARATOR
Definition: comctl32.h:74
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
static BOOL TOOLBAR_GetButtonInfo(const TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
Definition: toolbar.c:7360
struct CUSTDLG_INFO * PCUSTDLG_INFO
#define GETHIMLID(infoPtr, i)
Definition: toolbar.c:246
static LRESULT TOOLBAR_Cust_AvailDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2465
#define GETIBITMAP(infoPtr, i)
Definition: toolbar.c:245
static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2390
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
UINT uDragListMessage
Definition: draglist.c:73
BOOL WINAPI MakeDragList(HWND hwndLB)
Definition: draglist.c:208
GLuint res
Definition: glext.h:9613
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define ILD_NORMAL
Definition: commctrl.h:417
#define TBN_RESET
Definition: commctrl.h:1311
#define TBNRF_HIDEHELP
Definition: commctrl.h:1352
#define TBN_INITCUSTOMIZE
Definition: commctrl.h:1346
#define TBN_CUSTHELP
Definition: commctrl.h:1315
#define memset(x, y, z)
Definition: compat.h:39
COLORREF clrHighlightText
Definition: comctl32.h:170
COLORREF clrWindow
Definition: comctl32.h:176
COLORREF clrGrayText
Definition: comctl32.h:178
COLORREF clrWindowText
Definition: comctl32.h:177
COLORREF clrHighlight
Definition: comctl32.h:169
BOOL bRemovable
Definition: toolbar.c:192
BOOL bVirtual
Definition: toolbar.c:191
INT_PTR iString
Definition: commctrl.h:959
int iBitmap
Definition: commctrl.h:949
LPWSTR pszText
Definition: commctrl.h:1452
TBBUTTON tbButton
Definition: commctrl.h:1450
#define ZeroMemory
Definition: winbase.h:1712
DWORD COLORREF
Definition: windef.h:300
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586
#define LB_ERR
Definition: winuser.h:2432
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define ODS_SELECTED
Definition: winuser.h:2545
#define SW_HIDE
Definition: winuser.h:768
#define WM_CLOSE
Definition: winuser.h:1621
#define DWLP_USER
Definition: winuser.h:872
#define COLOR_WINDOW
Definition: winuser.h:918
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:831
#define LB_SETTOPINDEX
Definition: winuser.h:2070
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_HIGHLIGHT
Definition: winuser.h:926
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1740
#define BF_MIDDLE
Definition: winuser.h:468
#define WM_INITDIALOG
Definition: winuser.h:1739
#define IDOK
Definition: winuser.h:830
#define WM_DRAWITEM
Definition: winuser.h:1645
#define LB_SETITEMHEIGHT
Definition: winuser.h:2066
#define DT_LEFT
Definition: winuser.h:534
#define LB_RESETCONTENT
Definition: winuser.h:2055
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_MEASUREITEM
Definition: winuser.h:1646
#define DT_VCENTER
Definition: winuser.h:543
#define LBN_SELCHANGE
Definition: winuser.h:2075
#define DWLP_MSGRESULT
Definition: winuser.h:870
#define WM_USER
Definition: winuser.h:1895
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define BF_SOFT
Definition: winuser.h:469
#define SetWindowLongPtrW
Definition: winuser.h:5355
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define BF_RECT
Definition: winuser.h:462
#define EDGE_RAISED
Definition: winuser.h:450
#define ODS_FOCUS
Definition: winuser.h:2549
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by TOOLBAR_Customize().

◆ TOOLBAR_DeleteAllButtons()

static void TOOLBAR_DeleteAllButtons ( TOOLBAR_INFO infoPtr)
static

Definition at line 4364 of file toolbar.c.

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

Referenced by TOOLBAR_Restore().

◆ TOOLBAR_DeleteButton()

static LRESULT TOOLBAR_DeleteButton ( TOOLBAR_INFO infoPtr,
INT  nIndex 
)
static

Definition at line 3418 of file toolbar.c.

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

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

◆ TOOLBAR_DeleteImageList()

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

Definition at line 7312 of file toolbar.c.

7313{
7314 int i;
7315
7316 for (i = 0; i < *cies; i++)
7317 Free((*pies)[i]);
7318
7319 Free(*pies);
7320
7321 *cies = 0;
7322 *pies = NULL;
7323}

Referenced by TOOLBAR_Destroy().

◆ TOOLBAR_Destroy()

static LRESULT TOOLBAR_Destroy ( TOOLBAR_INFO infoPtr)
static

Definition at line 5588 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_DrawArrow()

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

Definition at line 609 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton(), and TOOLBAR_DrawSepDDArrow().

◆ TOOLBAR_DrawButton()

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

Definition at line 975 of file toolbar.c.

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

Referenced by TOOLBAR_Refresh().

◆ TOOLBAR_DrawFlatHorizontalSeparator()

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

Definition at line 576 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawFlatSeparator()

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

Definition at line 537 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawFrame()

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

Definition at line 902 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawImage()

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

Definition at line 805 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawMasked()

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

Definition at line 746 of file toolbar.c.

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

Referenced by TOOLBAR_DrawImage().

◆ TOOLBAR_DrawPattern()

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

Definition at line 726 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawSepDDArrow()

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

Definition at line 936 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawString()

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

Definition at line 635 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DumpButton()

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

Definition at line 322 of file toolbar.c.

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

Referenced by TOOLBAR_DumpToolbar().

◆ TOOLBAR_DumpTBButton()

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

Definition at line 314 of file toolbar.c.

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

Referenced by TOOLBAR_InternalInsertButtonsT().

◆ TOOLBAR_DumpToolbar()

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

Definition at line 337 of file toolbar.c.

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

Referenced by TOOLBAR_CalcToolbar(), TOOLBAR_InternalInsertButtonsT(), and TOOLBAR_Refresh().

◆ TOOLBAR_EnableButton()

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

Definition at line 3475 of file toolbar.c.

3476{
3477 TBUTTON_INFO *btnPtr;
3478 INT nIndex;
3479 DWORD bState;
3480
3481 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3482
3483 TRACE("hwnd=%p, btn id=%d, lParam=0x%08lx\n", infoPtr->hwndSelf, Id, lParam);
3484
3485 if (nIndex == -1)
3486 return FALSE;
3487
3488 btnPtr = &infoPtr->buttons[nIndex];
3489
3490 bState = btnPtr->fsState & TBSTATE_ENABLED;
3491
3492 /* update the toolbar button state */
3493 if(!LOWORD(lParam)) {
3494 btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED);
3495 } else {
3496 btnPtr->fsState |= TBSTATE_ENABLED;
3497 }
3498
3499 /* redraw the button only if the state of the button changed */
3500 if(bState != (btnPtr->fsState & TBSTATE_ENABLED))
3501 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3502
3503 return TRUE;
3504}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_EraseBackground()

static LRESULT TOOLBAR_EraseBackground ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 5635 of file toolbar.c.

5636{
5637 NMTBCUSTOMDRAW tbcd;
5638 INT ret = FALSE;
5639 DWORD ntfret;
5640 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
5641 DWORD dwEraseCustDraw = 0;
5642
5643 /* the app has told us not to redraw the toolbar */
5644 if (!infoPtr->bDoRedraw)
5645 return FALSE;
5646
5647 if (infoPtr->dwStyle & TBSTYLE_CUSTOMERASE) {
5648 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
5650 tbcd.nmcd.hdc = (HDC)wParam;
5651 ntfret = TOOLBAR_SendNotify (&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
5652 dwEraseCustDraw = ntfret & 0xffff;
5653
5654 /* FIXME: in general the return flags *can* be or'ed together */
5655 switch (dwEraseCustDraw)
5656 {
5657 case CDRF_DODEFAULT:
5658 break;
5659 case CDRF_SKIPDEFAULT:
5660 return TRUE;
5661 default:
5662 FIXME("[%p] response %d not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",
5663 infoPtr->hwndSelf, ntfret);
5664 }
5665 }
5666
5667 /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up
5668 * to my parent for processing.
5669 */
5670 if (theme || (infoPtr->dwStyle & TBSTYLE_TRANSPARENT)) {
5671 POINT pt, ptorig;
5672 HDC hdc = (HDC)wParam;
5673 HWND parent;
5674
5675 pt.x = 0;
5676 pt.y = 0;
5677 parent = GetParent(infoPtr->hwndSelf);
5678 MapWindowPoints(infoPtr->hwndSelf, parent, &pt, 1);
5679 OffsetWindowOrgEx (hdc, pt.x, pt.y, &ptorig);
5681 SetWindowOrgEx (hdc, ptorig.x, ptorig.y, 0);
5682 }
5683 if (!ret)
5685
5686 if (dwEraseCustDraw & CDRF_NOTIFYPOSTERASE) {
5687 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
5689 tbcd.nmcd.hdc = (HDC)wParam;
5690 ntfret = TOOLBAR_SendNotify (&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
5691 dwEraseCustDraw = ntfret & 0xffff;
5692 switch (dwEraseCustDraw)
5693 {
5694 case CDRF_DODEFAULT:
5695 break;
5696 case CDRF_SKIPDEFAULT:
5697 return TRUE;
5698 default:
5699 FIXME("[%p] response %d not handled to NM_CUSTOMDRAW (CDDS_POSTERASE)\n",
5700 infoPtr->hwndSelf, ntfret);
5701 }
5702 }
5703 return ret;
5704}
#define pt(x, y)
Definition: drawing.c:79
#define CDRF_NOTIFYPOSTERASE
Definition: commctrl.h:277
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define CDDS_POSTERASE
Definition: commctrl.h:283
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:996
#define TBSTYLE_CUSTOMERASE
Definition: commctrl.h:994
#define CDDS_PREERASE
Definition: commctrl.h:282
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
BOOL WINAPI OffsetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:912
#define WM_ERASEBKGND
Definition: winuser.h:1625
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetAnchorHighlight()

static LRESULT TOOLBAR_GetAnchorHighlight ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3508 of file toolbar.c.

3509{
3510 return infoPtr->bAnchor;
3511}
BOOL bAnchor
Definition: toolbar.c:159

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetBitmap()

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

Definition at line 3515 of file toolbar.c.

3516{
3517 INT nIndex;
3518
3519 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3520 if (nIndex == -1)
3521 return -1;
3522
3523 return infoPtr->buttons[nIndex].iBitmap;
3524}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetBitmapFlags()

static LRESULT TOOLBAR_GetBitmapFlags ( void  )
inlinestatic

Definition at line 3528 of file toolbar.c.

3529{
3530 return (GetDeviceCaps (0, LOGPIXELSX) >= 120) ? TBBF_LARGE : 0;
3531}
#define TBBF_LARGE
Definition: commctrl.h:1215
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSX
Definition: wingdi.h:718

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetBitmapIndex()

static INT TOOLBAR_GetBitmapIndex ( const TOOLBAR_INFO infoPtr,
TBUTTON_INFO btnPtr 
)
static

Definition at line 432 of file toolbar.c.

433{
434 INT ret = btnPtr->iBitmap;
435
436 if (ret == I_IMAGECALLBACK)
437 {
438 /* issue TBN_GETDISPINFO */
439 NMTBDISPINFOW nmgd;
440
441 memset(&nmgd, 0, sizeof(nmgd));
442 nmgd.idCommand = btnPtr->idCommand;
443 nmgd.lParam = btnPtr->dwData;
444 nmgd.dwMask = TBNF_IMAGE;
445 nmgd.iImage = -1;
446 /* Windows also send TBN_GETDISPINFOW even if the control is ANSI */
447 TOOLBAR_SendNotify(&nmgd.hdr, infoPtr, TBN_GETDISPINFOW);
448 if (nmgd.dwMask & TBNF_DI_SETITEM)
449 btnPtr->iBitmap = nmgd.iImage;
450 ret = nmgd.iImage;
451 TRACE("TBN_GETDISPINFO returned bitmap id %d, mask=%08x, nNumBitmaps=%d\n",
452 ret, nmgd.dwMask, infoPtr->nNumBitmaps);
453 }
454
455 if (ret != I_IMAGENONE)
456 ret = GETIBITMAP(infoPtr, ret);
457
458 return ret;
459}
#define I_IMAGECALLBACK
Definition: commctrl.h:2385
#define TBNF_IMAGE
Definition: commctrl.h:1396
#define TBN_GETDISPINFOW
Definition: commctrl.h:1340
#define TBNF_DI_SETITEM
Definition: commctrl.h:1398
#define I_IMAGENONE
Definition: commctrl.h:2386
DWORD_PTR lParam
Definition: commctrl.h:1414
DWORD dwMask
Definition: commctrl.h:1412

Referenced by TOOLBAR_GetImageListForDrawing().

◆ TOOLBAR_GetButton()

static LRESULT TOOLBAR_GetButton ( const TOOLBAR_INFO infoPtr,
INT  nIndex,
TBBUTTON lpTbb 
)
static

Definition at line 3535 of file toolbar.c.

3536{
3537 TBUTTON_INFO *btnPtr;
3538
3539 if (lpTbb == NULL)
3540 return FALSE;
3541
3542 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
3543 return FALSE;
3544
3545 btnPtr = &infoPtr->buttons[nIndex];
3546 lpTbb->iBitmap = btnPtr->iBitmap;
3547 lpTbb->idCommand = btnPtr->idCommand;
3548 lpTbb->fsState = btnPtr->fsState;
3549 lpTbb->fsStyle = btnPtr->fsStyle;
3550 lpTbb->bReserved[0] = 0;
3551 lpTbb->bReserved[1] = 0;
3552 lpTbb->dwData = btnPtr->dwData;
3553 lpTbb->iString = btnPtr->iString;
3554
3555 return TRUE;
3556}
BYTE bReserved[2]
Definition: commctrl.h:956

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetButtonIndex()

static INT TOOLBAR_GetButtonIndex ( const TOOLBAR_INFO infoPtr,
INT  idCommand,
BOOL  CommandIsIndex 
)
static

Definition at line 2080 of file toolbar.c.

2081{
2082 TBUTTON_INFO *btnPtr;
2083 INT i;
2084
2085 if (CommandIsIndex) {
2086 TRACE("command is really index command=%d\n", idCommand);
2087 if (idCommand >= infoPtr->nNumButtons) return -1;
2088 return idCommand;
2089 }
2090 btnPtr = infoPtr->buttons;
2091 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) {
2092 if (btnPtr->idCommand == idCommand) {
2093 TRACE("command=%d index=%d\n", idCommand, i);
2094 return i;
2095 }
2096 }
2097 TRACE("no index found for command=%d\n", idCommand);
2098 return -1;
2099}

Referenced by TOOLBAR_ChangeBitmap(), TOOLBAR_CheckButton(), TOOLBAR_CommandToIndex(), TOOLBAR_CustomizeDialogProc(), TOOLBAR_EnableButton(), TOOLBAR_GetBitmap(), TOOLBAR_GetButtonInfoT(), TOOLBAR_GetButtonText(), TOOLBAR_GetRect(), TOOLBAR_GetState(), TOOLBAR_HideButton(), TOOLBAR_Indeterminate(), TOOLBAR_IsButtonChecked(), TOOLBAR_IsButtonEnabled(), TOOLBAR_IsButtonHidden(), TOOLBAR_IsButtonHighlighted(), TOOLBAR_IsButtonIndeterminate(), TOOLBAR_IsButtonPressed(), TOOLBAR_MarkButton(), TOOLBAR_MoveButton(), TOOLBAR_PressButton(), TOOLBAR_Restore(), TOOLBAR_SetButtonInfo(), TOOLBAR_SetState(), and TOOLBAR_TTGetDispInfo().

◆ TOOLBAR_GetButtonInfo()

static BOOL TOOLBAR_GetButtonInfo ( const TOOLBAR_INFO infoPtr,
NMTOOLBARW nmtb 
)
static

Definition at line 7360 of file toolbar.c.

7361{
7362 if (infoPtr->bUnicode)
7363 return TOOLBAR_SendNotify(&nmtb->hdr, infoPtr, TBN_GETBUTTONINFOW);
7364 else
7365 {
7366 CHAR Buffer[256];
7367 NMTOOLBARA nmtba;
7368 BOOL bRet = FALSE;
7369
7370 nmtba.iItem = nmtb->iItem;
7371 nmtba.pszText = Buffer;
7372 nmtba.cchText = 256;
7373 ZeroMemory(nmtba.pszText, nmtba.cchText);
7374
7375 if (TOOLBAR_SendNotify(&nmtba.hdr, infoPtr, TBN_GETBUTTONINFOA))
7376 {
7377 int ccht = strlen(nmtba.pszText);
7378 if (ccht)
7379 MultiByteToWideChar(CP_ACP, 0, nmtba.pszText, -1,
7380 nmtb->pszText, nmtb->cchText);
7381
7382 nmtb->tbButton = nmtba.tbButton;
7383 bRet = TRUE;
7384 }
7385
7386 return bRet;
7387 }
7388}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define TBN_GETBUTTONINFOW
Definition: commctrl.h:1343
#define TBN_GETBUTTONINFOA
Definition: commctrl.h:1306
TBBUTTON tbButton
Definition: commctrl.h:1441
LPSTR pszText
Definition: commctrl.h:1443
char CHAR
Definition: xmlstorage.h:175

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_GetButtonInfoT()

static LRESULT TOOLBAR_GetButtonInfoT ( const TOOLBAR_INFO infoPtr,
INT  Id,
LPTBBUTTONINFOW  lpTbInfo,
BOOL  bUnicode 
)
static

Definition at line 3560 of file toolbar.c.

3561{
3562 /* TBBUTTONINFOW and TBBUTTONINFOA have the same layout*/
3563 TBUTTON_INFO *btnPtr;
3564 INT nIndex;
3565
3566 if (lpTbInfo == NULL)
3567 return -1;
3568
3569 /* MSDN documents an iImageLabel field added in Vista but it is not present in
3570 * the headers and tests shows that even with comctl 6 Vista accepts only the
3571 * original TBBUTTONINFO size
3572 */
3573 if (lpTbInfo->cbSize != sizeof(TBBUTTONINFOW))
3574 {
3575 WARN("Invalid button size\n");
3576 return -1;
3577 }
3578
3579 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, lpTbInfo->dwMask & TBIF_BYINDEX);
3580 if (nIndex == -1)
3581 return -1;
3582
3583 btnPtr = &infoPtr->buttons[nIndex];
3584 if (lpTbInfo->dwMask & TBIF_COMMAND)
3585 lpTbInfo->idCommand = btnPtr->idCommand;
3586 if (lpTbInfo->dwMask & TBIF_IMAGE)
3587 lpTbInfo->iImage = btnPtr->iBitmap;
3588 if (lpTbInfo->dwMask & TBIF_LPARAM)
3589 lpTbInfo->lParam = btnPtr->dwData;
3590 if (lpTbInfo->dwMask & TBIF_SIZE)
3591 /* tests show that for separators TBIF_SIZE returns not calculated width,
3592 but cx property, that differs from 0 only if application have
3593 specifically set it */
3594 lpTbInfo->cx = (btnPtr->fsStyle & BTNS_SEP)
3595 ? btnPtr->cx : (WORD)(btnPtr->rect.right - btnPtr->rect.left);
3596 if (lpTbInfo->dwMask & TBIF_STATE)
3597 lpTbInfo->fsState = btnPtr->fsState;
3598 if (lpTbInfo->dwMask & TBIF_STYLE)
3599 lpTbInfo->fsStyle = btnPtr->fsStyle;
3600 if (lpTbInfo->dwMask & TBIF_TEXT) {
3601 /* TB_GETBUTTONINFO doesn't retrieve text from the string list, so we
3602 can't use TOOLBAR_GetText here */
3603 if (!IS_INTRESOURCE(btnPtr->iString) && (btnPtr->iString != -1)) {
3604 LPWSTR lpText = (LPWSTR)btnPtr->iString;
3605 if (bUnicode)
3606 Str_GetPtrW(lpText, lpTbInfo->pszText, lpTbInfo->cchText);
3607 else
3608 Str_GetPtrWtoA(lpText, (LPSTR)lpTbInfo->pszText, lpTbInfo->cchText);
3609 } else if (!bUnicode || lpTbInfo->pszText)
3610 lpTbInfo->pszText[0] = '\0';
3611 }
3612 return nIndex;
3613}
INT Str_GetPtrWtoA(LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen) DECLSPEC_HIDDEN
INT WINAPI Str_GetPtrW(LPCWSTR, LPWSTR, INT)
Definition: string.c:204
unsigned short WORD
Definition: ntddk_ex.h:93
#define TBIF_SIZE
Definition: commctrl.h:1225
#define TBIF_IMAGE
Definition: commctrl.h:1219
#define TBIF_LPARAM
Definition: commctrl.h:1223
#define TBIF_STYLE
Definition: commctrl.h:1222
#define TBIF_BYINDEX
Definition: commctrl.h:1226
#define TBIF_TEXT
Definition: commctrl.h:1220
#define TBIF_COMMAND
Definition: commctrl.h:1224
#define TBIF_STATE
Definition: commctrl.h:1221
DWORD dwMask
Definition: commctrl.h:1243
LPWSTR pszText
Definition: commctrl.h:1250
DWORD_PTR lParam
Definition: commctrl.h:1249

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetButtonSize()

static LRESULT TOOLBAR_GetButtonSize ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3617 of file toolbar.c.

3618{
3619 return MAKELONG((WORD)infoPtr->nButtonWidth,
3620 (WORD)infoPtr->nButtonHeight);
3621}
#define MAKELONG(a, b)
Definition: typedefs.h:249

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetButtonText()

static LRESULT TOOLBAR_GetButtonText ( const TOOLBAR_INFO infoPtr,
INT  Id,
LPWSTR  lpStr,
BOOL  isW 
)
static

Definition at line 3625 of file toolbar.c.

3626{
3627 INT nIndex;
3628 LPWSTR lpText;
3629 LRESULT ret = 0;
3630
3631 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3632 if (nIndex == -1)
3633 return -1;
3634
3635 lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]);
3636
3637 if (isW)
3638 {
3639 if (lpText)
3640 {
3641 ret = strlenW (lpText);
3642 if (lpStr) strcpyW (lpStr, lpText);
3643 }
3644 }
3645 else
3646 ret = WideCharToMultiByte( CP_ACP, 0, lpText, -1,
3647 (LPSTR)lpStr, lpStr ? 0x7fffffff : 0, NULL, NULL ) - 1;
3648 return ret;
3649}
#define WideCharToMultiByte
Definition: compat.h:111
#define strcpyW(d, s)
Definition: unicode.h:35
static const WCHAR isW[]
Definition: lex.c:62

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetCheckedGroupButtonIndex()

static INT TOOLBAR_GetCheckedGroupButtonIndex ( const TOOLBAR_INFO infoPtr,
INT  nIndex 
)
static

Definition at line 2103 of file toolbar.c.

2104{
2105 TBUTTON_INFO *btnPtr;
2106 INT nRunIndex;
2107
2108 if ((nIndex < 0) || (nIndex > infoPtr->nNumButtons))
2109 return -1;
2110
2111 /* check index button */
2112 btnPtr = &infoPtr->buttons[nIndex];
2113 if ((btnPtr->fsStyle & BTNS_CHECKGROUP) == BTNS_CHECKGROUP) {
2114 if (btnPtr->fsState & TBSTATE_CHECKED)
2115 return nIndex;
2116 }
2117
2118 /* check previous buttons */
2119 nRunIndex = nIndex - 1;
2120 while (nRunIndex >= 0) {
2121 btnPtr = &infoPtr->buttons[nRunIndex];
2122 if ((btnPtr->fsStyle & BTNS_GROUP) == BTNS_GROUP) {
2123 if (btnPtr->fsState & TBSTATE_CHECKED)
2124 return nRunIndex;
2125 }
2126 else
2127 break;
2128 nRunIndex--;
2129 }
2130
2131 /* check next buttons */
2132 nRunIndex = nIndex + 1;
2133 while (nRunIndex < infoPtr->nNumButtons) {
2134 btnPtr = &infoPtr->buttons[nRunIndex];
2135 if ((btnPtr->fsStyle & BTNS_GROUP) == BTNS_GROUP) {
2136 if (btnPtr->fsState & TBSTATE_CHECKED)
2137 return nRunIndex;
2138 }
2139 else
2140 break;
2141 nRunIndex++;
2142 }
2143
2144 return -1;
2145}
#define BTNS_CHECKGROUP
Definition: commctrl.h:1002

Referenced by TOOLBAR_CheckButton(), and TOOLBAR_LButtonUp().

◆ TOOLBAR_GetColorScheme()

static LRESULT TOOLBAR_GetColorScheme ( const TOOLBAR_INFO infoPtr,
LPCOLORSCHEME  lParam 
)
static

Definition at line 5344 of file toolbar.c.

5345{
5346 lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
5348 infoPtr->clrBtnHighlight;
5349 lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
5351 return 1;
5352}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetDefImageList()

static LRESULT TOOLBAR_GetDefImageList ( const TOOLBAR_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 3693 of file toolbar.c.

3694{
3695 TRACE("hwnd=%p, wParam=%ld\n", infoPtr->hwndSelf, wParam);
3696 /* UNDOCUMENTED: wParam is actually the ID of the image list to return */
3697 return (LRESULT) GETDEFIMAGELIST(infoPtr, wParam);
3698}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetDisabledImageList()

static LRESULT TOOLBAR_GetDisabledImageList ( const TOOLBAR_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 3653 of file toolbar.c.

3654{
3655 TRACE("hwnd=%p, wParam=%ld\n", infoPtr->hwndSelf, wParam);
3656 /* UNDOCUMENTED: wParam is actually the ID of the image list to return */
3657 return (LRESULT)GETDISIMAGELIST(infoPtr, wParam);
3658}
#define GETDISIMAGELIST(infoPtr, id)
Definition: toolbar.c:249

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetExtendedStyle()

static LRESULT TOOLBAR_GetExtendedStyle ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3662 of file toolbar.c.

3663{
3664 TRACE("\n");
3665
3666 return infoPtr->dwExStyle;
3667}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetFont()

static LRESULT TOOLBAR_GetFont ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 5708 of file toolbar.c.

5709{
5710 return (LRESULT)infoPtr->hFont;
5711}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetHotImageList()

static LRESULT TOOLBAR_GetHotImageList ( const TOOLBAR_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 3671 of file toolbar.c.

3672{
3673 TRACE("hwnd=%p, wParam=%ld\n", infoPtr->hwndSelf, wParam);
3674 /* UNDOCUMENTED: wParam is actually the ID of the image list to return */
3675 return (LRESULT)GETHOTIMAGELIST(infoPtr, wParam);
3676}
#define GETHOTIMAGELIST(infoPtr, id)
Definition: toolbar.c:248

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetHotItem()

static LRESULT TOOLBAR_GetHotItem ( const TOOLBAR_INFO infoPtr)
static

Definition at line 3680 of file toolbar.c.

3681{
3682 if (!((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf)))
3683 return -1;
3684
3685 if (infoPtr->nHotItem < 0)
3686 return -1;
3687
3688 return (LRESULT)infoPtr->nHotItem;
3689}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetIdealSize()

static LRESULT TOOLBAR_GetIdealSize ( const TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 5497 of file toolbar.c.

5498{
5499 LPSIZE lpsize = (LPSIZE)lParam;
5500
5501 if (lpsize == NULL)
5502 return FALSE;
5503
5504 /*
5505 * Testing shows the following:
5506 * wParam = 0 adjust cx value
5507 * = 1 set cy value to max size.
5508 * lParam pointer to SIZE structure
5509 *
5510 */
5511 TRACE("wParam %ld, lParam 0x%08lx -> 0x%08x 0x%08x\n",
5512 wParam, lParam, lpsize->cx, lpsize->cy);
5513
5514 switch(wParam) {
5515 case 0:
5516 if (lpsize->cx == -1) {
5517 lpsize->cx = infoPtr->rcBound.right - infoPtr->rcBound.left;
5518 }
5519 else if(HIWORD(lpsize->cx)) {
5520 RECT rc;
5521 HWND hwndParent = GetParent(infoPtr->hwndSelf);
5522
5523 GetWindowRect(infoPtr->hwndSelf, &rc);
5524 MapWindowPoints(0, hwndParent, (LPPOINT)&rc, 2);
5525 TRACE("mapped to (%s)\n", wine_dbgstr_rect(&rc));
5526 lpsize->cx = max(rc.right-rc.left,
5527 infoPtr->rcBound.right - infoPtr->rcBound.left);
5528 }
5529 else {
5530 lpsize->cx = infoPtr->rcBound.right - infoPtr->rcBound.left;
5531 }
5532 break;
5533 case 1:
5534 lpsize->cy = infoPtr->rcBound.bottom - infoPtr->rcBound.top;
5535 break;
5536 default:
5537 FIXME("Unknown wParam %ld\n", wParam);
5538 return 0;
5539 }
5540 TRACE("set to -> 0x%08x 0x%08x\n",
5541 lpsize->cx, lpsize->cy);
5542 return 1;
5543}
static HWND hwndParent
Definition: cryptui.c:300
RECT rcBound
Definition: toolbar.c:121
struct tagSIZE * LPSIZE

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetImageList()

static HIMAGELIST TOOLBAR_GetImageList ( const PIMLENTRY pies,
INT  cies,
INT  id 
)
static

Definition at line 7348 of file toolbar.c.

7349{
7350 HIMAGELIST himlDef = 0;
7351 PIMLENTRY pie = TOOLBAR_GetImageListEntry(pies, cies, id);
7352
7353 if (pie)
7354 himlDef = pie->himl;
7355
7356 return himlDef;
7357}
static PIMLENTRY TOOLBAR_GetImageListEntry(const PIMLENTRY *pies, INT cies, INT id)
Definition: toolbar.c:7326
HIMAGELIST himl
Definition: toolbar.c:113

◆ TOOLBAR_GetImageListCount()

static LRESULT TOOLBAR_GetImageListCount ( const TOOLBAR_INFO infoPtr)
static

Definition at line 5489 of file toolbar.c.

5490{
5491 TRACE("hwnd=%p\n", infoPtr->hwndSelf);
5492
5493 return max(infoPtr->cimlDef, max(infoPtr->cimlHot, infoPtr->cimlDis));
5494}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetImageListEntry()

static PIMLENTRY TOOLBAR_GetImageListEntry ( const PIMLENTRY pies,
INT  cies,
INT  id 
)
static

Definition at line 7326 of file toolbar.c.

7327{
7328 PIMLENTRY c = NULL;
7329
7330 if (pies != NULL)
7331 {
7332 int i;
7333
7334 for (i = 0; i < cies; i++)
7335 {
7336 if (pies[i]->id == id)
7337 {
7338 c = pies[i];
7339 break;
7340 }
7341 }
7342 }
7343
7344 return c;
7345}
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80

Referenced by TOOLBAR_GetImageList(), and TOOLBAR_InsertImageList().

◆ TOOLBAR_GetImageListForDrawing()

static HIMAGELIST TOOLBAR_GetImageListForDrawing ( const TOOLBAR_INFO infoPtr,
TBUTTON_INFO btnPtr,
IMAGE_LIST_TYPE  imagelist,
INT index 
)
static

Definition at line 493 of file toolbar.c.

495{
497
498 if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
499 if (btnPtr->iBitmap == I_IMAGENONE) return NULL;
500 WARN("bitmap for ID %d, index %d is not valid, number of bitmaps in imagelist: %d\n",
501 HIWORD(btnPtr->iBitmap), LOWORD(btnPtr->iBitmap), infoPtr->nNumBitmaps);
502 return NULL;
503 }
504
505 if ((*index = TOOLBAR_GetBitmapIndex(infoPtr, btnPtr)) < 0) {
506 if ((*index == I_IMAGECALLBACK) ||
507 (*index == I_IMAGENONE)) return NULL;
508 ERR("TBN_GETDISPINFO returned invalid index %d\n",
509 *index);
510 return NULL;
511 }
512
513 switch(imagelist)
514 {
516 himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
517 break;
518 case IMAGE_LIST_HOT:
519 himl = GETHOTIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
520 break;
522 himl = GETDISIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
523 break;
524 default:
525 himl = NULL;
526 FIXME("Shouldn't reach here\n");
527 }
528
529 if (!himl)
530 TRACE("no image list\n");
531
532 return himl;
533}
#define ERR(fmt,...)
Definition: precomp.h:57
static BOOL TOOLBAR_IsValidBitmapIndex(const TOOLBAR_INFO *infoPtr, INT index)
Definition: toolbar.c:463
static INT TOOLBAR_GetBitmapIndex(const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
Definition: toolbar.c:432

Referenced by TOOLBAR_DrawImage().

◆ TOOLBAR_GetInsertMark()

static LRESULT TOOLBAR_GetInsertMark ( const TOOLBAR_INFO infoPtr,
TBINSERTMARK lptbim 
)
static

Definition at line 3702 of file toolbar.c.

3703{
3704 TRACE("hwnd = %p, lptbim = %p\n", infoPtr->hwndSelf, lptbim);
3705
3706 *lptbim = infoPtr->tbim;
3707
3708 return 0;
3709}
TBINSERTMARK tbim
Definition: toolbar.c:174

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetInsertMarkColor()

static LRESULT TOOLBAR_GetInsertMarkColor ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3713 of file toolbar.c.

3714{
3715 TRACE("hwnd = %p\n", infoPtr->hwndSelf);
3716
3717 return (LRESULT)infoPtr->clrInsertMark;
3718}
COLORREF clrInsertMark
Definition: toolbar.c:168

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetItemRect()

static LRESULT TOOLBAR_GetItemRect ( const TOOLBAR_INFO infoPtr,
INT  nIndex,
LPRECT  lpRect 
)
static

Definition at line 3722 of file toolbar.c.

3723{
3724 TBUTTON_INFO *btnPtr;
3725
3726 btnPtr = &infoPtr->buttons[nIndex];
3727 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
3728 return FALSE;
3729
3730 if (lpRect == NULL)
3731 return FALSE;
3732 if (btnPtr->fsState & TBSTATE_HIDDEN)
3733 return FALSE;
3734
3735 lpRect->left = btnPtr->rect.left;
3736 lpRect->right = btnPtr->rect.right;
3737 lpRect->bottom = btnPtr->rect.bottom;
3738 lpRect->top = btnPtr->rect.top;
3739
3740 return TRUE;
3741}
#define TBSTATE_HIDDEN
Definition: commctrl.h:975

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetMaxSize()

static LRESULT TOOLBAR_GetMaxSize ( const TOOLBAR_INFO infoPtr,
LPSIZE  lpSize 
)
static

Definition at line 3745 of file toolbar.c.

3746{
3747 if (lpSize == NULL)
3748 return FALSE;
3749
3750 lpSize->cx = infoPtr->rcBound.right - infoPtr->rcBound.left;
3751 lpSize->cy = infoPtr->rcBound.bottom - infoPtr->rcBound.top;
3752
3753 TRACE("maximum size %d x %d\n",
3754 infoPtr->rcBound.right - infoPtr->rcBound.left,
3755 infoPtr->rcBound.bottom - infoPtr->rcBound.top);
3756
3757 return TRUE;
3758}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetPadding()

static LRESULT TOOLBAR_GetPadding ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3793 of file toolbar.c.

3794{
3795 return MAKELONG(infoPtr->szPadding.cx, infoPtr->szPadding.cy);
3796}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetRect()

static LRESULT TOOLBAR_GetRect ( const TOOLBAR_INFO infoPtr,
INT  Id,
LPRECT  lpRect 
)
static

Definition at line 3800 of file toolbar.c.

3801{
3802 TBUTTON_INFO *btnPtr;
3803 INT nIndex;
3804
3805 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3806 btnPtr = &infoPtr->buttons[nIndex];
3807 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
3808 return FALSE;
3809
3810 if (lpRect == NULL)
3811 return FALSE;
3812
3813 lpRect->left = btnPtr->rect.left;
3814 lpRect->right = btnPtr->rect.right;
3815 lpRect->bottom = btnPtr->rect.bottom;
3816 lpRect->top = btnPtr->rect.top;
3817
3818 return TRUE;
3819}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetRows()

static LRESULT TOOLBAR_GetRows ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3823 of file toolbar.c.

3824{
3825 return infoPtr->nRows;
3826}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetState()

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

Definition at line 3830 of file toolbar.c.

3831{
3832 INT nIndex;
3833
3834 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3835 if (nIndex == -1)
3836 return -1;
3837
3838 return infoPtr->buttons[nIndex].fsState;
3839}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetStringA()

static LRESULT TOOLBAR_GetStringA ( const TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPSTR  str 
)
static

Definition at line 5394 of file toolbar.c.

5395{
5396 WORD iString = HIWORD(wParam);
5397 WORD buffersize = LOWORD(wParam);
5398 LRESULT ret = -1;
5399
5400 TRACE("hwnd=%p, iString=%d, buffersize=%d, string=%p\n", infoPtr->hwndSelf, iString, buffersize, str);
5401
5402 if (iString < infoPtr->nNumStrings)
5403 {
5404 ret = WideCharToMultiByte(CP_ACP, 0, infoPtr->strings[iString], -1, str, buffersize, NULL, NULL);
5405 ret--;
5406
5407 TRACE("returning %s\n", debugstr_a(str));
5408 }
5409 else
5410 WARN("String index %d out of range (largest is %d)\n", iString, infoPtr->nNumStrings - 1);
5411
5412 return ret;
5413}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetStringW()

static LRESULT TOOLBAR_GetStringW ( const TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPWSTR  str 
)
static

Definition at line 5417 of file toolbar.c.

5418{
5419 WORD iString = HIWORD(wParam);
5420 WORD len = LOWORD(wParam)/sizeof(WCHAR) - 1;
5421 LRESULT ret = -1;
5422
5423 TRACE("hwnd=%p, iString=%d, buffersize=%d, string=%p\n", infoPtr->hwndSelf, iString, LOWORD(wParam), str);
5424
5425 if (iString < infoPtr->nNumStrings)
5426 {
5427 len = min(len, strlenW(infoPtr->strings[iString]));
5428 ret = (len+1)*sizeof(WCHAR);
5429 if (str)
5430 {
5431 memcpy(str, infoPtr->strings[iString], ret);
5432 str[len] = '\0';
5433 }
5434 ret = len;
5435
5436 TRACE("returning %s\n", debugstr_w(str));
5437 }
5438 else
5439 WARN("String index %d out of range (largest is %d)\n", iString, infoPtr->nNumStrings - 1);
5440
5441 return ret;
5442}
#define min(a, b)
Definition: monoChain.cc:55

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetStyle()

static LRESULT TOOLBAR_GetStyle ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3843 of file toolbar.c.

3844{
3845 return infoPtr->dwStyle;
3846}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetText()

static LPWSTR TOOLBAR_GetText ( const TOOLBAR_INFO infoPtr,
const TBUTTON_INFO btnPtr 
)
static

Definition at line 300 of file toolbar.c.

301{
302 LPWSTR lpText = NULL;
303
304 /* NOTE: iString == -1 is undocumented */
305 if (!IS_INTRESOURCE(btnPtr->iString) && (btnPtr->iString != -1))
306 lpText = (LPWSTR)btnPtr->iString;
307 else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings))
308 lpText = infoPtr->strings[btnPtr->iString];
309
310 return lpText;
311}

Referenced by TOOLBAR_CalcStrings(), TOOLBAR_DrawButton(), TOOLBAR_DumpButton(), TOOLBAR_GetButtonText(), TOOLBAR_MapAccelerator(), TOOLBAR_MeasureString(), and TOOLBAR_TTGetDispInfo().

◆ TOOLBAR_GetTextRows()

static LRESULT TOOLBAR_GetTextRows ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3850 of file toolbar.c.

3851{
3852 return infoPtr->nMaxTextRows;
3853}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetToolTips()

static LRESULT TOOLBAR_GetToolTips ( TOOLBAR_INFO infoPtr)
static

Definition at line 3857 of file toolbar.c.

3858{
3859 if ((infoPtr->dwStyle & TBSTYLE_TOOLTIPS) && (infoPtr->hwndToolTip == NULL))
3861 return (LRESULT)infoPtr->hwndToolTip;
3862}
static void TOOLBAR_TooltipCreateControl(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:2217
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetUnicodeFormat()

static LRESULT TOOLBAR_GetUnicodeFormat ( const TOOLBAR_INFO infoPtr)
static

Definition at line 3866 of file toolbar.c.

3867{
3868 TRACE("%s hwnd=%p\n",
3869 infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);
3870
3871 return infoPtr->bUnicode;
3872}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetVersion()

static LRESULT TOOLBAR_GetVersion ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3876 of file toolbar.c.

3877{
3878 return infoPtr->iVersion;
3879}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_HasDropDownArrows()

static BOOL TOOLBAR_HasDropDownArrows ( DWORD  exStyle)
inlinestatic

Definition at line 278 of file toolbar.c.

279{
280 return (exStyle & TBSTYLE_EX_DRAWDDARROWS) != 0;
281}

Referenced by button_has_ddarrow(), and TOOLBAR_LButtonDown().

◆ TOOLBAR_HideButton()

static LRESULT TOOLBAR_HideButton ( TOOLBAR_INFO infoPtr,
INT  Id,
BOOL  fHide 
)
static

Definition at line 3883 of file toolbar.c.

3884{
3885 TBUTTON_INFO *btnPtr;
3886 BYTE oldState;
3887 INT nIndex;
3888
3889 TRACE("\n");
3890
3891 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3892 if (nIndex == -1)
3893 return FALSE;
3894
3895 btnPtr = &infoPtr->buttons[nIndex];
3896 oldState = btnPtr->fsState;
3897
3898 if (fHide)
3899 btnPtr->fsState |= TBSTATE_HIDDEN;
3900 else
3901 btnPtr->fsState &= ~TBSTATE_HIDDEN;
3902
3903 if (oldState != btnPtr->fsState) {
3904 TOOLBAR_LayoutToolbar (infoPtr);
3905 InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
3906 }
3907
3908 return TRUE;
3909}
unsigned char BYTE
Definition: xxhash.c:193

Referenced by ToolbarWindowProc().

◆ TOOLBAR_HitTest()

static LRESULT TOOLBAR_HitTest ( const TOOLBAR_INFO infoPtr,
const POINT lpPt 
)
inlinestatic

Definition at line 3913 of file toolbar.c.

3914{
3915 return TOOLBAR_InternalHitTest (infoPtr, lpPt, NULL);
3916}
static INT TOOLBAR_InternalHitTest(const TOOLBAR_INFO *infoPtr, const POINT *lpPt, BOOL *button)
Definition: toolbar.c:1990

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Indeterminate()

static LRESULT TOOLBAR_Indeterminate ( const TOOLBAR_INFO infoPtr,
INT  Id,
BOOL  fIndeterminate 
)
static

Definition at line 3920 of file toolbar.c.

3921{
3922 TBUTTON_INFO *btnPtr;
3923 INT nIndex;
3924 DWORD oldState;
3925
3926 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3927 if (nIndex == -1)
3928 return FALSE;
3929
3930 btnPtr = &infoPtr->buttons[nIndex];
3931 oldState = btnPtr->fsState;
3932
3933 if (fIndeterminate)
3934 btnPtr->fsState |= TBSTATE_INDETERMINATE;
3935 else
3936 btnPtr->fsState &= ~TBSTATE_INDETERMINATE;
3937
3938 if(oldState != btnPtr->fsState)
3939 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3940
3941 return TRUE;
3942}
#define TBSTATE_INDETERMINATE
Definition: commctrl.h:976

Referenced by ToolbarWindowProc().

◆ TOOLBAR_InsertButtonT()

static LRESULT TOOLBAR_InsertButtonT ( TOOLBAR_INFO infoPtr,
INT  nIndex,
const TBBUTTON lpTbb,
BOOL  fUnicode 
)
static

Definition at line 3946 of file toolbar.c.

3947{
3948 if (lpTbb == NULL)
3949 return FALSE;
3950
3951 if (nIndex == -1) {
3952 /* EPP: this seems to be an undocumented call (from my IE4)
3953 * I assume in that case that:
3954 * - index of insertion is at the end of existing buttons
3955 * I only see this happen with nIndex == -1, but it could have a special
3956 * meaning (like -nIndex (or ~nIndex) to get the real position of insertion).
3957 */
3958 nIndex = infoPtr->nNumButtons;
3959
3960 } else if (nIndex < 0)
3961 return FALSE;
3962
3963 TRACE("inserting button index=%d\n", nIndex);
3964 if (nIndex > infoPtr->nNumButtons) {
3965 nIndex = infoPtr->nNumButtons;
3966 TRACE("adjust index=%d\n", nIndex);
3967 }
3968
3969 return TOOLBAR_InternalInsertButtonsT(infoPtr, nIndex, 1, lpTbb, fUnicode);
3970}

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

◆ TOOLBAR_InsertImageList()

static HIMAGELIST TOOLBAR_InsertImageList ( PIMLENTRY **  pies,
INT cies,
HIMAGELIST  himl,
INT  id 
)
static

Definition at line 7276 of file toolbar.c.

7277{
7278 HIMAGELIST himlold;
7279 PIMLENTRY c = NULL;
7280
7281 /* Check if the entry already exists */
7282 c = TOOLBAR_GetImageListEntry(*pies, *cies, id);
7283
7284 /* Don't add new entry for NULL imagelist */
7285 if (!c && !himl)
7286 return NULL;
7287
7288 /* If this is a new entry we must create it and insert into the array */
7289 if (!c)
7290 {
7291 PIMLENTRY *pnies;
7292
7293 c = Alloc(sizeof(IMLENTRY));
7294 c->id = id;
7295
7296 pnies = Alloc((*cies + 1) * sizeof(PIMLENTRY));
7297 memcpy(pnies, *pies, ((*cies) * sizeof(PIMLENTRY)));
7298 pnies[*cies] = c;
7299 (*cies)++;
7300
7301 Free(*pies);
7302 *pies = pnies;
7303 }
7304
7305 himlold = c->himl;
7306 c->himl = himl;
7307
7308 return himlold;
7309}
GLuint id
Definition: glext.h:5910

Referenced by TOOLBAR_AddBitmap(), TOOLBAR_CheckImageListIconSize(), TOOLBAR_SetDisabledImageList(), TOOLBAR_SetHotImageList(), and TOOLBAR_SetImageList().

◆ TOOLBAR_InternalHitTest()

static INT TOOLBAR_InternalHitTest ( const TOOLBAR_INFO infoPtr,
const POINT lpPt,
BOOL button 
)
static

Definition at line 1990 of file toolbar.c.

1991{
1992 TBUTTON_INFO *btnPtr;
1993 INT i;
1994
1995 if (button)
1996 *button = FALSE;
1997
1998 btnPtr = infoPtr->buttons;
1999 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) {
2000 if (btnPtr->fsState & TBSTATE_HIDDEN)
2001 continue;
2002
2003 if (btnPtr->fsStyle & BTNS_SEP) {
2004 if (PtInRect (&btnPtr->rect, *lpPt)) {
2005 TRACE(" ON SEPARATOR %d\n", i);
2006 return -i;
2007 }
2008 }
2009 else {
2010 if (PtInRect (&btnPtr->rect, *lpPt)) {
2011 TRACE(" ON BUTTON %d\n", i);
2012 if (button)
2013 *button = TRUE;
2014 return i;
2015 }
2016 }
2017 }
2018
2019 TRACE(" NOWHERE\n");
2020 return TOOLBAR_NOWHERE;
2021}
#define TOOLBAR_NOWHERE
Definition: toolbar.c:232
DWORD button
Definition: button.c:166
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by TOOLBAR_HitTest(), TOOLBAR_LButtonDblClk(), TOOLBAR_LButtonDown(), TOOLBAR_LButtonUp(), TOOLBAR_MouseMove(), and TOOLBAR_RButtonUp().

◆ TOOLBAR_InternalInsertButtonsT()

static BOOL TOOLBAR_InternalInsertButtonsT ( TOOLBAR_INFO infoPtr,
INT  iIndex,
UINT  nAddButtons,
const TBBUTTON lpTbb,
BOOL  fUnicode 
)
static

Definition at line 2026 of file toolbar.c.

2027{
2028 INT nOldButtons, nNewButtons, iButton;
2029 BOOL fHasString = FALSE;
2030
2031 if (iIndex < 0) /* iIndex can be negative, what means adding at the end */
2032 iIndex = infoPtr->nNumButtons;
2033
2034 nOldButtons = infoPtr->nNumButtons;
2035 nNewButtons = nOldButtons + nAddButtons;
2036
2037 infoPtr->buttons = ReAlloc(infoPtr->buttons, sizeof(TBUTTON_INFO)*nNewButtons);
2038 memmove(&infoPtr->buttons[iIndex + nAddButtons], &infoPtr->buttons[iIndex],
2039 (nOldButtons - iIndex) * sizeof(TBUTTON_INFO));
2040 infoPtr->nNumButtons += nAddButtons;
2041
2042 /* insert new buttons data */
2043 for (iButton = 0; iButton < nAddButtons; iButton++) {
2044 TBUTTON_INFO *btnPtr = &infoPtr->buttons[iIndex + iButton];
2045 INT_PTR str;
2046
2047 TOOLBAR_DumpTBButton(lpTbb + iButton, fUnicode);
2048
2049 ZeroMemory(btnPtr, sizeof(*btnPtr));
2050
2051 btnPtr->iBitmap = lpTbb[iButton].iBitmap;
2052 btnPtr->idCommand = lpTbb[iButton].idCommand;
2053 btnPtr->fsState = lpTbb[iButton].fsState;
2054 btnPtr->fsStyle = lpTbb[iButton].fsStyle;
2055 btnPtr->dwData = lpTbb[iButton].dwData;
2056
2057 if (btnPtr->fsStyle & BTNS_SEP)
2058 str = -1;
2059 else
2060 str = lpTbb[iButton].iString;
2061 set_string_index( btnPtr, str, fUnicode );
2062 fHasString |= TOOLBAR_ButtonHasString( btnPtr );
2063
2064 TOOLBAR_TooltipAddTool(infoPtr, btnPtr);
2065 }
2066
2067 if (infoPtr->nNumStrings > 0 || fHasString)
2068 TOOLBAR_CalcToolbar(infoPtr);
2069 else
2070 TOOLBAR_LayoutToolbar(infoPtr);
2071 TOOLBAR_AutoSize(infoPtr);
2072
2073 TOOLBAR_DumpToolbar(infoPtr, __LINE__);
2074 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
2075 return TRUE;
2076}
static void TOOLBAR_DumpTBButton(const TBBUTTON *tbb, BOOL fUnicode)
Definition: toolbar.c:314
static void TOOLBAR_TooltipAddTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
Definition: toolbar.c:2166
static LRESULT TOOLBAR_AutoSize(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3232
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
int32_t INT_PTR
Definition: typedefs.h:64

Referenced by TOOLBAR_AddButtonsT(), and TOOLBAR_InsertButtonT().

◆ TOOLBAR_IsButtonChecked()

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

Definition at line 3976 of file toolbar.c.

3977{
3978 INT nIndex;
3979
3980 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3981 if (nIndex == -1)
3982 return -1;
3983
3984 return (infoPtr->buttons[nIndex].fsState & TBSTATE_CHECKED);
3985}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonEnabled()

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

Definition at line 3989 of file toolbar.c.

3990{
3991 INT nIndex;
3992
3993 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3994 if (nIndex == -1)
3995 return -1;
3996
3997 return (infoPtr->buttons[nIndex].fsState & TBSTATE_ENABLED);
3998}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonHidden()

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

Definition at line 4002 of file toolbar.c.

4003{
4004 INT nIndex;
4005
4006 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
4007 if (nIndex == -1)
4008 return -1;
4009
4010 return (infoPtr->buttons[nIndex].fsState & TBSTATE_HIDDEN);
4011}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonHighlighted()

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

Definition at line 4015 of file toolbar.c.

4016{
4017 INT nIndex;
4018
4019 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
4020 if (nIndex == -1)
4021 return -1;
4022
4023 return (infoPtr->buttons[nIndex].fsState & TBSTATE_MARKED);
4024}
#define TBSTATE_MARKED
Definition: commctrl.h:979

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonIndeterminate()

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

Definition at line 4028 of file toolbar.c.

4029{
4030 INT nIndex;
4031
4032 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
4033 if (nIndex == -1)
4034 return -1;
4035
4036 return (infoPtr->buttons[nIndex].fsState & TBSTATE_INDETERMINATE);
4037}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonPressed()

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

Definition at line 4041 of file toolbar.c.

4042{
4043 INT nIndex;
4044
4045 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
4046 if (nIndex == -1)
4047 return -1;
4048
4049 return (infoPtr->buttons[nIndex].fsState & TBSTATE_PRESSED);
4050}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonRemovable()

static BOOL TOOLBAR_IsButtonRemovable ( const TOOLBAR_INFO infoPtr,
int  iItem,
const CUSTOMBUTTON btnInfo 
)
static

Definition at line 7391 of file toolbar.c.

7392{
7393 NMTOOLBARW nmtb;
7394
7395 /* MSDN states that iItem is the index of the button, rather than the
7396 * command ID as used by every other NMTOOLBAR notification */
7397 nmtb.iItem = iItem;
7398 memcpy(&nmtb.tbButton, &btnInfo->btn, sizeof(TBBUTTON));
7399
7400 return TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYDELETE);
7401}
#define TBN_QUERYDELETE
Definition: commctrl.h:1313

Referenced by TOOLBAR_Cust_RemoveButton(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_IsValidBitmapIndex()

static BOOL TOOLBAR_IsValidBitmapIndex ( const TOOLBAR_INFO infoPtr,
INT  index 
)
static

Definition at line 463 of file toolbar.c.

464{
466 INT id = GETHIMLID(infoPtr, index);
467 INT iBitmap = GETIBITMAP(infoPtr, index);
468
469 if (((himl = GETDEFIMAGELIST(infoPtr, id)) &&
470 iBitmap >= 0 && iBitmap < ImageList_GetImageCount(himl)) ||
472 return TRUE;
473 else
474 return FALSE;
475}

Referenced by TOOLBAR_GetImageListForDrawing(), and TOOLBAR_LayoutToolbar().

◆ TOOLBAR_IsValidImageList()

static BOOL TOOLBAR_IsValidImageList ( const TOOLBAR_INFO infoPtr,
INT  index 
)
inlinestatic

Definition at line 479 of file toolbar.c.

480{
481 HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr, index));
482 return (himl != NULL) && (ImageList_GetImageCount(himl) > 0);
483}

Referenced by TOOLBAR_CalcToolbar(), and TOOLBAR_LayoutToolbar().

◆ TOOLBAR_KeyDown()

static LRESULT TOOLBAR_KeyDown ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 5748 of file toolbar.c.

5749{
5750 NMKEY nmkey;
5751
5752 nmkey.nVKey = (UINT)wParam;
5753 nmkey.uFlags = HIWORD(lParam);
5754
5755 if (TOOLBAR_SendNotify(&nmkey.hdr, infoPtr, NM_KEYDOWN))
5756 return DefWindowProcW(infoPtr->hwndSelf, WM_KEYDOWN, wParam, lParam);
5757
5758 switch ((UINT)wParam)
5759 {
5760 case VK_LEFT:
5761 case VK_UP:
5763 break;
5764 case VK_RIGHT:
5765 case VK_DOWN:
5767 break;
5768 case VK_SPACE:
5769 case VK_RETURN:
5770 if ((infoPtr->nHotItem >= 0) &&
5771 (infoPtr->buttons[infoPtr->nHotItem].fsState & TBSTATE_ENABLED))
5772 {
5774 MAKEWPARAM(infoPtr->buttons[infoPtr->nHotItem].idCommand, BN_CLICKED),
5775 (LPARAM)infoPtr->hwndSelf);
5776 }
5777 break;
5778 }
5779
5780 return 0;
5781}
static void TOOLBAR_SetRelativeHotItem(TOOLBAR_INFO *infoPtr, INT iDirection, DWORD dwReason)
Definition: toolbar.c:5715
#define NM_KEYDOWN
Definition: commctrl.h:140
#define HICF_ARROWKEYS
Definition: commctrl.h:1327
NMHDR hdr
Definition: commctrl.h:187
UINT uFlags
Definition: commctrl.h:189
UINT nVKey
Definition: commctrl.h:188
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
#define VK_SPACE
Definition: winuser.h:2219
#define VK_UP
Definition: winuser.h:2225
#define VK_RETURN
Definition: winuser.h:2201
#define VK_LEFT
Definition: winuser.h:2224
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DOWN
Definition: winuser.h:2227
#define BN_CLICKED
Definition: winuser.h:1925
#define WM_KEYDOWN
Definition: winuser.h:1715

Referenced by ToolbarWindowProc().

◆ TOOLBAR_LayoutToolbar()

static void TOOLBAR_LayoutToolbar ( TOOLBAR_INFO infoPtr)
static

Definition at line 1835 of file toolbar.c.

1836{
1837 TBUTTON_INFO *btnPtr;
1838 SIZE sizeButton;
1839 INT i, nRows, nSepRows;
1840 INT x, y, cx, cy;
1841 BOOL bWrap;
1842 BOOL validImageList = TOOLBAR_IsValidImageList(infoPtr, 0);
1843
1844 TOOLBAR_WrapToolbar(infoPtr);
1845
1846 x = infoPtr->nIndent;
1847 y = infoPtr->iTopMargin;
1848 cx = infoPtr->nButtonWidth;
1849 cy = infoPtr->nButtonHeight;
1850
1851 nRows = nSepRows = 0;
1852
1853 infoPtr->rcBound.top = y;
1854 infoPtr->rcBound.left = x;
1855 infoPtr->rcBound.bottom = y + cy;
1856 infoPtr->rcBound.right = x;
1857
1858 btnPtr = infoPtr->buttons;
1859
1860 TRACE("cy=%d\n", cy);
1861
1862 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++ )
1863 {
1864 bWrap = FALSE;
1865 if (btnPtr->fsState & TBSTATE_HIDDEN)
1866 {
1867 SetRectEmpty (&btnPtr->rect);
1868 TOOLBAR_TooltipSetRect(infoPtr, btnPtr);
1869 continue;
1870 }
1871
1872 cy = infoPtr->nButtonHeight;
1873
1874 if (btnPtr->fsStyle & BTNS_SEP) {
1875 if (infoPtr->dwStyle & CCS_VERT) {
1876 cy = (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH;
1877 cx = (btnPtr->cx > 0) ? btnPtr->cx : infoPtr->nButtonWidth;
1878 }
1879 else
1880 cx = (btnPtr->cx > 0) ? btnPtr->cx :
1881 (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH;
1882 }
1883 else
1884 {
1885 if (btnPtr->cx)
1886 cx = btnPtr->cx;
1887#ifdef __REACTOS__
1888 /* Revert Wine Commit 5b7b911 as it breaks Explorer Toolbar Buttons
1889 FIXME: Revisit this when the bug is fixed. CORE-9970 */
1890 else if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
1891 (btnPtr->fsStyle & BTNS_AUTOSIZE))
1892#else
1893 else if (btnPtr->fsStyle & BTNS_AUTOSIZE)
1894#endif
1895 {
1896 SIZE sz;
1897 HDC hdc;
1898 HFONT hOldFont;
1899
1900 hdc = GetDC (infoPtr->hwndSelf);
1901 hOldFont = SelectObject (hdc, infoPtr->hFont);
1902
1903 TOOLBAR_MeasureString(infoPtr, btnPtr, hdc, &sz);
1904
1905 SelectObject (hdc, hOldFont);
1906 ReleaseDC (infoPtr->hwndSelf, hdc);
1907
1908 sizeButton = TOOLBAR_MeasureButton(infoPtr, sz,
1909 TOOLBAR_IsValidBitmapIndex(infoPtr, infoPtr->buttons[i].iBitmap),
1910 validImageList);
1911 cx = sizeButton.cx;
1912 }
1913 else
1914 cx = infoPtr->nButtonWidth;
1915
1916 /* if size has been set manually then don't add on extra space
1917 * for the drop down arrow */
1918 if (!btnPtr->cx && button_has_ddarrow( infoPtr, btnPtr ))
1919 cx += DDARROW_WIDTH;
1920 }
1921 if (btnPtr->fsState & TBSTATE_WRAP)
1922 bWrap = TRUE;
1923
1924 SetRect (&btnPtr->rect, x, y, x + cx, y + cy);
1925
1926 if (infoPtr->rcBound.left > x)
1927 infoPtr->rcBound.left = x;
1928 if (infoPtr->rcBound.right < x + cx)
1929 infoPtr->rcBound.right = x + cx;
1930 if (infoPtr->rcBound.bottom < y + cy)
1931 infoPtr->rcBound.bottom = y + cy;
1932
1933 TOOLBAR_TooltipSetRect(infoPtr, btnPtr);
1934
1935 /* btnPtr->nRow is zero based. The space between the rows is */
1936 /* also considered as a row. */
1937 btnPtr->nRow = nRows + nSepRows;
1938
1939 TRACE("button %d style=%x, bWrap=%d, nRows=%d, nSepRows=%d, btnrow=%d, (%d,%d)-(%d,%d)\n",
1940 i, btnPtr->fsStyle, bWrap, nRows, nSepRows, btnPtr->nRow,
1941 x, y, x+cx, y+cy);
1942
1943 if( bWrap )
1944 {
1945 if ( !(btnPtr->fsStyle & BTNS_SEP) )
1946#ifdef __REACTOS__
1947 y += cy + infoPtr->szSpacing.cy;
1948#else
1949 y += cy;
1950#endif
1951 else
1952 {
1953 if ( !(infoPtr->dwStyle & CCS_VERT))
1954 y += cy + ( (btnPtr->cx > 0 ) ?
1955 btnPtr->cx : SEPARATOR_WIDTH) * 2 /3;
1956 else
1957#ifdef __REACTOS__
1958 y += cy + infoPtr->szSpacing.cy;
1959#else
1960 y += cy;
1961#endif
1962
1963 /* nSepRows is used to calculate the extra height following */
1964 /* the last row. */
1965 nSepRows++;
1966 }
1967 x = infoPtr->nIndent;
1968
1969 /* Increment row number unless this is the last button */
1970 /* and it has Wrap set. */
1971 if (i != infoPtr->nNumButtons-1)
1972 nRows++;
1973 }
1974 else
1975#ifdef __REACTOS__
1976 x += cx + infoPtr->szSpacing.cx;
1977#else
1978 x += cx;
1979#endif
1980 }
1981
1982 /* infoPtr->nRows is the number of rows on the toolbar */
1983 infoPtr->nRows = nRows + nSepRows + 1;
1984
1985 TRACE("toolbar button width %d\n", infoPtr->nButtonWidth);
1986}
int nRows
Definition: appswitch.c:56
#define SEPARATOR_WIDTH
Definition: toolbar.c:203
static void TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1470
static void TOOLBAR_TooltipSetRect(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
Definition: toolbar.c:2199
#define BTNS_AUTOSIZE
Definition: commctrl.h:1004
#define TBSTATE_WRAP
Definition: commctrl.h:977
INT nIndent
Definition: toolbar.c:126
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by TOOLBAR_AutoSize(), TOOLBAR_CalcToolbar(), TOOLBAR_DeleteButton(), TOOLBAR_HideButton(), TOOLBAR_InternalInsertButtonsT(), TOOLBAR_MoveButton(), TOOLBAR_SetButtonInfo(), TOOLBAR_SetButtonSize(), TOOLBAR_SetExtendedStyle(), and TOOLBAR_SetStyle().

◆ TOOLBAR_LButtonDblClk()

static LRESULT TOOLBAR_LButtonDblClk ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 5785 of file toolbar.c.

5786{
5787 POINT pt;
5788 BOOL button;
5789
5790 pt.x = (short)LOWORD(lParam);
5791 pt.y = (short)HIWORD(lParam);
5792 TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
5793
5794 if (button)
5795 TOOLBAR_LButtonDown (infoPtr, wParam, lParam);
5796 else if (infoPtr->dwStyle & CCS_ADJUSTABLE)
5797 TOOLBAR_Customize (infoPtr);
5798
5799 return 0;
5800}
static LRESULT TOOLBAR_LButtonDown(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5804
static LRESULT TOOLBAR_Customize(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3395
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94

Referenced by ToolbarWindowProc().

◆ TOOLBAR_LButtonDown()

static LRESULT TOOLBAR_LButtonDown ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 5804 of file toolbar.c.

5805{
5806 TBUTTON_INFO *btnPtr;
5807 POINT pt;
5808 INT nHit;
5809 NMTOOLBARA nmtb;
5810 NMMOUSE nmmouse;
5811 BOOL bDragKeyPressed;
5812 BOOL button;
5813
5814 TRACE("\n");
5815
5816 if (infoPtr->dwStyle & TBSTYLE_ALTDRAG)
5817 bDragKeyPressed = (GetKeyState(VK_MENU) < 0);
5818 else
5819 bDragKeyPressed = (wParam & MK_SHIFT);
5820
5821 if (infoPtr->hwndToolTip)
5822 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwndSelf,
5824
5825 pt.x = (short)LOWORD(lParam);
5826 pt.y = (short)HIWORD(lParam);
5827 nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
5828
5829 if (button)
5830 {
5831 btnPtr = &infoPtr->buttons[nHit];
5832
5833 if (bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE))
5834 {
5835 infoPtr->nButtonDrag = nHit;
5836 SetCapture (infoPtr->hwndSelf);
5837
5838 /* If drag cursor has not been loaded, load it.
5839 * Note: it doesn't need to be freed */
5840 if (!hCursorDrag)
5841#ifndef __REACTOS__
5843#else
5845#endif
5847 }
5848 else
5849 {
5850 RECT arrowRect;
5851 infoPtr->nOldHit = nHit;
5852
5853 arrowRect = btnPtr->rect;
5854 arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH);
5855
5856 /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */
5857 if ((btnPtr->fsState & TBSTATE_ENABLED) &&
5858 ((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) ||
5859 ((btnPtr->fsStyle & BTNS_DROPDOWN) &&
5860 ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) ||
5861 (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))))
5862 {
5863 LRESULT res;
5864
5865 /* draw in pressed state */
5866 if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
5867 btnPtr->fsState |= TBSTATE_PRESSED;
5868 else
5869 btnPtr->bDropDownPressed = TRUE;
5871
5872 memset(&nmtb, 0, sizeof(nmtb));
5873 nmtb.iItem = btnPtr->idCommand;
5874 nmtb.rcButton = btnPtr->rect;
5875 res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_DROPDOWN);
5876 TRACE("TBN_DROPDOWN responded with %ld\n", res);
5877
5879 {
5880 MSG msg;
5881
5882 /* redraw button in unpressed state */
5883 if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
5884 btnPtr->fsState &= ~TBSTATE_PRESSED;
5885 else
5886 btnPtr->bDropDownPressed = FALSE;
5887 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
5888
5889 /* find and set hot item */
5890 GetCursorPos(&pt);
5891 ScreenToClient(infoPtr->hwndSelf, &pt);
5892 nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button);
5893 if (!infoPtr->bAnchor || button)
5895
5896 /* remove any left mouse button down or double-click messages
5897 * so that we can get a toggle effect on the button */
5900 ;
5901
5902 return 0;
5903 }
5904 /* otherwise drop through and process as pushed */
5905 }
5906 infoPtr->bCaptured = TRUE;
5907 infoPtr->nButtonDown = nHit;
5908 infoPtr->bDragOutSent = FALSE;
5909
5910 btnPtr->fsState |= TBSTATE_PRESSED;
5911
5913
5914 if (btnPtr->fsState & TBSTATE_ENABLED)
5915 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
5916 UpdateWindow(infoPtr->hwndSelf);
5917 SetCapture (infoPtr->hwndSelf);
5918 }
5919
5920 memset(&nmtb, 0, sizeof(nmtb));
5921 nmtb.iItem = btnPtr->idCommand;
5922 TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
5923 }
5924
5925 nmmouse.dwHitInfo = nHit;
5926
5927 /* !!! Undocumented - sends NM_LDOWN with the NMMOUSE structure. */
5928 if (!button)
5929 nmmouse.dwItemSpec = -1;
5930 else
5931 {
5932 nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
5933 nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
5934 }
5935
5936 ClientToScreen(infoPtr->hwndSelf, &pt);
5937 nmmouse.pt = pt;
5938
5939 if (!TOOLBAR_SendNotify(&nmmouse.hdr, infoPtr, NM_LDOWN))
5941
5942 return 0;
5943}
#define msg(x)
Definition: auth_time.c:54
#define IDC_MOVEBUTTON
Definition: comctl32.h:93
static HCURSOR hCursorDrag
Definition: toolbar.c:87
static void TOOLBAR_SetHotItemEx(TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason)
Definition: toolbar.c:4864
static VOID TOOLBAR_RelayEvent(HWND hwndTip, HWND hwndMsg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:2149
#define HICF_MOUSE
Definition: commctrl.h:1326
#define NM_LDOWN
Definition: commctrl.h:145
#define TBSTYLE_ALTDRAG
Definition: commctrl.h:991
#define HICF_LMOUSE
Definition: commctrl.h:1333
#define TBN_BEGINDRAG
Definition: commctrl.h:1307
#define TBDDRET_TREATPRESSED
Definition: commctrl.h:1426
#define TBN_DROPDOWN
Definition: commctrl.h:1316
BOOL bDragOutSent
Definition: toolbar.c:161
INT nButtonDrag
Definition: toolbar.c:136
POINT pt
Definition: commctrl.h:166
DWORD_PTR dwItemData
Definition: commctrl.h:165
DWORD_PTR dwItemSpec
Definition: commctrl.h:164
NMHDR hdr
Definition: commctrl.h:163
LPARAM dwHitInfo
Definition: commctrl.h:167
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define MK_SHIFT
Definition: winuser.h:2369
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1778
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2714
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define RDW_UPDATENOW
Definition: winuser.h:1220
#define RDW_ERASE
Definition: winuser.h:1211
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2149
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1196
BOOL WINAPI UpdateWindow(_In_ HWND)
#define RDW_INVALIDATE
Definition: winuser.h:1214
SHORT WINAPI GetKeyState(_In_ int)
#define VK_MENU
Definition: winuser.h:2204
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by TOOLBAR_LButtonDblClk(), and ToolbarWindowProc().

◆ TOOLBAR_LButtonUp()

static LRESULT TOOLBAR_LButtonUp ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 5946 of file toolbar.c.

5947{
5948 TBUTTON_INFO *btnPtr;
5949 POINT pt;
5950 INT nHit;
5951 INT nOldIndex = -1;
5952 NMHDR hdr;
5953 NMMOUSE nmmouse;
5954 NMTOOLBARA nmtb;
5955 BOOL button;
5956
5957 if (infoPtr->hwndToolTip)
5958 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwndSelf,
5960
5961 pt.x = (short)LOWORD(lParam);
5962 pt.y = (short)HIWORD(lParam);
5963 nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
5964
5965 if (!infoPtr->bAnchor || button)
5967
5968 if (infoPtr->nButtonDrag >= 0) {
5969 RECT rcClient;
5970 NMHDR hdr;
5971
5972 btnPtr = &infoPtr->buttons[infoPtr->nButtonDrag];
5974 /* reset cursor */
5976
5977 GetClientRect(infoPtr->hwndSelf, &rcClient);
5978 if (PtInRect(&rcClient, pt))
5979 {
5980 INT nButton = -1;
5981 if (nHit >= 0)
5982 nButton = nHit;
5983 else if (nHit < -1)
5984 nButton = -nHit;
5985 else if ((nHit == -1) && PtInRect(&infoPtr->buttons[-nHit].rect, pt))
5986 nButton = -nHit;
5987
5988 if (nButton == infoPtr->nButtonDrag)
5989 {
5990 /* if the button is moved sightly left and we have a
5991 * separator there then remove it */
5992 if (pt.x < (btnPtr->rect.left + (btnPtr->rect.right - btnPtr->rect.left)/2))
5993 {
5994 if ((nButton > 0) && (infoPtr->buttons[nButton-1].fsStyle & BTNS_SEP))
5995 TOOLBAR_DeleteButton(infoPtr, nButton - 1);
5996 }
5997 else /* else insert a separator before the dragged button */
5998 {
5999 TBBUTTON tbb;
6000 memset(&tbb, 0, sizeof(tbb));
6001 tbb.fsStyle = BTNS_SEP;
6002 tbb.iString = -1;
6003 TOOLBAR_InsertButtonT(infoPtr, nButton, &tbb, TRUE);
6004 }
6005 }
6006 else
6007 {
6008 if (nButton == -1)
6009 {
6010 if ((infoPtr->nNumButtons > 0) && (pt.x < infoPtr->buttons[0].rect.left))
6011 TOOLBAR_MoveButton(infoPtr, infoPtr->nButtonDrag, 0);
6012 else
6013 TOOLBAR_MoveButton(infoPtr, infoPtr->nButtonDrag, infoPtr->nNumButtons);
6014 }
6015 else
6016 TOOLBAR_MoveButton(infoPtr, infoPtr->nButtonDrag, nButton);
6017 }
6018 }
6019 else
6020 {
6021 TRACE("button %d dragged out of toolbar\n", infoPtr->nButtonDrag);
6022 TOOLBAR_DeleteButton(infoPtr, infoPtr->nButtonDrag);
6023 }
6024
6025 /* button under cursor changed so need to re-set hot item */
6027 infoPtr->nButtonDrag = -1;
6028
6030 }
6031 else if (infoPtr->nButtonDown >= 0) {
6032 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
6033 btnPtr->fsState &= ~TBSTATE_PRESSED;
6034
6035 if (btnPtr->fsStyle & BTNS_CHECK) {
6036 if (btnPtr->fsStyle & BTNS_GROUP) {
6037 nOldIndex = TOOLBAR_GetCheckedGroupButtonIndex (infoPtr,
6038 nHit);
6039 if ((nOldIndex != nHit) &&
6040 (nOldIndex != -1))
6041 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;
6042 btnPtr->fsState |= TBSTATE_CHECKED;
6043 }
6044 else {
6045 if (btnPtr->fsState & TBSTATE_CHECKED)
6046 btnPtr->fsState &= ~TBSTATE_CHECKED;
6047 else
6048 btnPtr->fsState |= TBSTATE_CHECKED;
6049 }
6050 }
6051
6052 if (nOldIndex != -1)
6053 InvalidateRect(infoPtr->hwndSelf, &infoPtr->buttons[nOldIndex].rect, TRUE);
6054
6055 /*
6056 * now we can ReleaseCapture, which triggers CAPTURECHANGED msg,
6057 * that resets bCaptured and btn TBSTATE_PRESSED flags,
6058 * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged)
6059 */
6060 if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0))
6061 ReleaseCapture ();
6062 infoPtr->nButtonDown = -1;
6063
6064 /* Issue NM_RELEASEDCAPTURE to parent to let him know it is released */
6065 TOOLBAR_SendNotify (&hdr, infoPtr,
6067
6068 memset(&nmtb, 0, sizeof(nmtb));
6069 nmtb.iItem = btnPtr->idCommand;
6070 TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
6071 TBN_ENDDRAG);
6072
6073 if (btnPtr->fsState & TBSTATE_ENABLED)
6074 {
6076 MAKEWPARAM(infoPtr->buttons[nHit].idCommand, BN_CLICKED), (LPARAM)infoPtr->hwndSelf);
6077
6078 /* In case we have just been destroyed... */
6079 if(!IsWindow(infoPtr->hwndSelf))
6080 return 0;
6081 }
6082 }
6083
6084 /* !!! Undocumented - toolbar at 4.71 level and above sends
6085 * NM_CLICK with the NMMOUSE structure. */
6086 nmmouse.dwHitInfo = nHit;
6087
6088 if (!button)
6089 nmmouse.dwItemSpec = -1;
6090 else
6091 {
6092 nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
6093 nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
6094 }
6095
6096 ClientToScreen(infoPtr->hwndSelf, &pt);
6097 nmmouse.pt = pt;
6098
6099 if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_CLICK))
6100 return DefWindowProcW(infoPtr->hwndSelf, WM_LBUTTONUP, wParam, lParam);
6101
6102 return 0;
6103}
static LRESULT TOOLBAR_MoveButton(TOOLBAR_INFO *infoPtr, INT Id, INT nMoveIndex)
Definition: toolbar.c:4156
static LRESULT TOOLBAR_DeleteButton(TOOLBAR_INFO *infoPtr, INT nIndex)
Definition: toolbar.c:3418
static LRESULT TOOLBAR_InsertButtonT(TOOLBAR_INFO *infoPtr, INT nIndex, const TBBUTTON *lpTbb, BOOL fUnicode)
Definition: toolbar.c:3946
#define NM_RELEASEDCAPTURE
Definition: commctrl.h:141
#define TBN_ENDDRAG
Definition: commctrl.h:1308
#define NM_CLICK
Definition: commctrl.h:130
#define BTNS_CHECK
Definition: commctrl.h:1000
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define IDC_ARROW
Definition: winuser.h:687
#define WM_LBUTTONUP
Definition: winuser.h:1777

Referenced by ToolbarWindowProc().

◆ TOOLBAR_LoadImages()

static LRESULT TOOLBAR_LoadImages ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
HINSTANCE  hInstance 
)
static

Definition at line 4054 of file toolbar.c.

4055{
4056 TBADDBITMAP tbab;
4057 tbab.hInst = hInstance;
4058 tbab.nID = wParam;
4059
4060 TRACE("hwnd = %p, hInst = %p, nID = %lu\n", infoPtr->hwndSelf, tbab.hInst, tbab.nID);
4061
4062 return TOOLBAR_AddBitmap(infoPtr, 0, &tbab);
4063}
static LRESULT TOOLBAR_AddBitmap(TOOLBAR_INFO *infoPtr, INT count, const TBADDBITMAP *lpAddBmp)
Definition: toolbar.c:2991

Referenced by ToolbarWindowProc().

◆ TOOLBAR_MapAccelerator()

static LRESULT TOOLBAR_MapAccelerator ( const TOOLBAR_INFO infoPtr,
WCHAR  wAccel,
UINT pIDButton 
)
static

Definition at line 4067 of file toolbar.c.

4068{
4069 WCHAR wszAccel[] = {'&',wAccel,0};
4070 int i;
4071
4072 TRACE("hwnd = %p, wAccel = %x(%s), pIDButton = %p\n",
4073 infoPtr->hwndSelf, wAccel, debugstr_wn(&wAccel,1), pIDButton);
4074
4075 for (i = 0; i < infoPtr->nNumButtons; i++)
4076 {
4077 TBUTTON_INFO *btnPtr = infoPtr->buttons+i;
4078 if (!(btnPtr->fsStyle & BTNS_NOPREFIX) &&
4079 !(btnPtr->fsState & TBSTATE_HIDDEN))
4080 {
4081 int iLen = strlenW(wszAccel);
4082 LPCWSTR lpszStr = TOOLBAR_GetText(infoPtr, btnPtr);
4083
4084 if (!lpszStr)
4085 continue;
4086
4087 while (*lpszStr)
4088 {
4089 if ((lpszStr[0] == '&') && (lpszStr[1] == '&'))
4090 {
4091 lpszStr += 2;
4092 continue;
4093 }
4094 if (!strncmpiW(lpszStr, wszAccel, iLen))
4095 {
4096 *pIDButton = btnPtr->idCommand;
4097 return TRUE;
4098 }
4099 lpszStr++;
4100 }
4101 }
4102 }
4103 return FALSE;
4104}
#define debugstr_wn
Definition: kernel32.h:33
#define BTNS_NOPREFIX
Definition: commctrl.h:1005
#define strncmpiW(s1, s2, n)
Definition: unicode.h:46

Referenced by ToolbarWindowProc().

◆ TOOLBAR_MarkButton()

static LRESULT TOOLBAR_MarkButton ( const TOOLBAR_INFO infoPtr,
INT  Id,
BOOL  fMark 
)
static

Definition at line 4108 of file toolbar.c.

4109{
4110 INT nIndex;
4111 DWORD oldState;
4112 TBUTTON_INFO *btnPtr;
4113
4114 TRACE("hwnd = %p, Id = %d, fMark = 0%d\n", infoPtr->hwndSelf, Id, fMark);
4115
4116 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
4117 if (nIndex == -1)
4118 return FALSE;
4119
4120 btnPtr = &infoPtr->buttons[nIndex];
4121 oldState = btnPtr->fsState;
4122
4123 if (fMark)
4124 btnPtr->fsState |= TBSTATE_MARKED;
4125 else
4126 btnPtr->fsState &= ~TBSTATE_MARKED;
4127
4128 if(oldState != btnPtr->fsState)
4129 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
4130
4131 return TRUE;
4132}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_MeasureButton()

static SIZE TOOLBAR_MeasureButton ( const TOOLBAR_INFO infoPtr,
SIZE  sizeString,
BOOL  bHasBitmap,
BOOL  bValidImageList 
)
inlinestatic

Definition at line 1734 of file toolbar.c.

1736{
1737 SIZE sizeButton;
1738 if (infoPtr->dwStyle & TBSTYLE_LIST)
1739 {
1740 /* set button height from bitmap / text height... */
1741 sizeButton.cy = max((bHasBitmap ? infoPtr->nBitmapHeight : 0),
1742 sizeString.cy);
1743
1744 /* ... add on the necessary padding */
1745 if (bValidImageList)
1746 {
1747#ifdef __REACTOS__
1748 sizeButton.cy += infoPtr->szPadding.cy;
1749 if (!bHasBitmap)
1750#else
1751 if (bHasBitmap)
1752 sizeButton.cy += DEFPAD_CY;
1753 else
1754#endif
1755 sizeButton.cy += LISTPAD_CY;
1756 }
1757 else
1758 sizeButton.cy += infoPtr->szPadding.cy;
1759
1760 /* calculate button width */
1761 sizeButton.cx = 2*GetSystemMetrics(SM_CXEDGE) +
1762 infoPtr->nBitmapWidth + infoPtr->iListGap;
1763 if (sizeString.cx > 0)
1764 sizeButton.cx += sizeString.cx + infoPtr->szPadding.cx;
1765
1766 }
1767 else
1768 {
1769 if (bHasBitmap)
1770 {
1771#ifdef __REACTOS__
1772 sizeButton.cy = infoPtr->nBitmapHeight + infoPtr->szPadding.cy;
1773#else
1774 sizeButton.cy = infoPtr->nBitmapHeight + DEFPAD_CY;
1775#endif
1776 if (sizeString.cy > 0)
1777 sizeButton.cy += 1 + sizeString.cy;
1778 sizeButton.cx = infoPtr->szPadding.cx +
1779 max(sizeString.cx, infoPtr->nBitmapWidth);
1780 }
1781 else
1782 {
1783 sizeButton.cy = sizeString.cy + infoPtr->szPadding.cy +
1785 sizeButton.cx = infoPtr->szPadding.cx +
1786 max(2*GetSystemMetrics(SM_CXEDGE) + sizeString.cx, infoPtr->nBitmapWidth);
1787 }
1788 }
1789
1790#ifdef __REACTOS__
1791 sizeButton.cx += infoPtr->themeMargins.cxLeftWidth + infoPtr->themeMargins.cxRightWidth;
1792 sizeButton.cy += infoPtr->themeMargins.cyTopHeight + infoPtr->themeMargins.cyBottomHeight;
1793#endif
1794
1795 return sizeButton;
1796}
#define NONLIST_NOTEXT_OFFSET
Definition: toolbar.c:230
#define LISTPAD_CY
Definition: toolbar.c:226
#define DEFPAD_CY
Definition: toolbar.c:212

Referenced by TOOLBAR_CalcToolbar(), and TOOLBAR_LayoutToolbar().

◆ TOOLBAR_MeasureString()

static void TOOLBAR_MeasureString ( const TOOLBAR_INFO infoPtr,
const TBUTTON_INFO btnPtr,
HDC  hdc,
LPSIZE  lpSize 
)
static

Definition at line 1368 of file toolbar.c.

1370{
1371 RECT myrect;
1372
1373 lpSize->cx = 0;
1374 lpSize->cy = 0;
1375
1376 if (infoPtr->nMaxTextRows > 0 &&
1377 !(btnPtr->fsState & TBSTATE_HIDDEN) &&
1378 (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
1379 (btnPtr->fsStyle & BTNS_SHOWTEXT)) )
1380 {
1381 LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr);
1382
1383 if(lpText != NULL) {
1384 /* first get size of all the text */
1385 GetTextExtentPoint32W (hdc, lpText, strlenW (lpText), lpSize);
1386
1387 /* feed above size into the rectangle for DrawText */
1388 SetRect(&myrect, 0, 0, lpSize->cx, lpSize->cy);
1389
1390 /* Use DrawText to get true size as drawn (less pesky "&") */
1391 DrawTextW (hdc, lpText, -1, &myrect, DT_VCENTER | DT_SINGLELINE |
1392 DT_CALCRECT | ((btnPtr->fsStyle & BTNS_NOPREFIX) ?
1393 DT_NOPREFIX : 0));
1394
1395 /* feed back to caller */
1396 lpSize->cx = myrect.right;
1397 lpSize->cy = myrect.bottom;
1398 }
1399 }
1400
1401 TRACE("string size %d x %d!\n", lpSize->cx, lpSize->cy);
1402}
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define DT_NOPREFIX
Definition: winuser.h:537
#define DT_CALCRECT
Definition: winuser.h:526

Referenced by TOOLBAR_CalcStrings(), and TOOLBAR_LayoutToolbar().

◆ TOOLBAR_MouseLeave()

static LRESULT TOOLBAR_MouseLeave ( TOOLBAR_INFO infoPtr)
static

Definition at line 6167 of file toolbar.c.

6168{
6169 /* don't remove hot effects when in anchor highlighting mode or when a
6170 * drop-down button is pressed */
6171 if (infoPtr->nHotItem >= 0 && !infoPtr->bAnchor)
6172 {
6173 TBUTTON_INFO *hotBtnPtr = &infoPtr->buttons[infoPtr->nHotItem];
6174 if (!hotBtnPtr->bDropDownPressed)
6176 }
6177
6178 if (infoPtr->nOldHit < 0)
6179 return TRUE;
6180
6181 /* If the last button we were over is depressed then make it not */
6182 /* depressed and redraw it */
6183 if(infoPtr->nOldHit == infoPtr->nButtonDown)
6184 {
6185 TBUTTON_INFO *btnPtr;
6186 RECT rc1;
6187
6188 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
6189
6190 btnPtr->fsState &= ~TBSTATE_PRESSED;
6191
6192 rc1 = btnPtr->rect;
6193 InflateRect (&rc1, 1, 1);
6194 InvalidateRect (infoPtr->hwndSelf, &rc1, TRUE);
6195 }
6196
6197 if (infoPtr->bCaptured && !infoPtr->bDragOutSent)
6198 {
6199 NMTOOLBARW nmt;
6200 ZeroMemory(&nmt, sizeof(nmt));
6201 nmt.iItem = infoPtr->buttons[infoPtr->nButtonDown].idCommand;
6202 TOOLBAR_SendNotify(&nmt.hdr, infoPtr, TBN_DRAGOUT);
6203 infoPtr->bDragOutSent = TRUE;
6204 }
6205
6206 infoPtr->nOldHit = -1; /* reset the old hit index as we've left the toolbar */
6207
6208 return TRUE;
6209}
#define TBN_DRAGOUT
Definition: commctrl.h:1337

Referenced by ToolbarWindowProc().

◆ TOOLBAR_MouseMove()

static LRESULT TOOLBAR_MouseMove ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6212 of file toolbar.c.

6213{
6214 POINT pt;
6215 TRACKMOUSEEVENT trackinfo;
6216 INT nHit;
6217 TBUTTON_INFO *btnPtr;
6218 BOOL button;
6219
6220 if ((infoPtr->dwStyle & TBSTYLE_TOOLTIPS) && (infoPtr->hwndToolTip == NULL))
6222
6223 if ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf)) {
6224 /* fill in the TRACKMOUSEEVENT struct */
6225 trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
6226 trackinfo.dwFlags = TME_QUERY;
6227
6228 /* call _TrackMouseEvent to see if we are currently tracking for this hwnd */
6229 _TrackMouseEvent(&trackinfo);
6230
6231 /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */
6232 if(trackinfo.hwndTrack != infoPtr->hwndSelf || !(trackinfo.dwFlags & TME_LEAVE)) {
6233 trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
6234 trackinfo.hwndTrack = infoPtr->hwndSelf;
6235
6236 /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
6237 /* and can properly deactivate the hot toolbar button */
6238 _TrackMouseEvent(&trackinfo);
6239 }
6240 }
6241
6242 if (infoPtr->hwndToolTip)
6243 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwndSelf,
6245
6246 pt.x = (short)LOWORD(lParam);
6247 pt.y = (short)HIWORD(lParam);
6248
6249 nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
6250
6251 if (((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf))
6252 && (!infoPtr->bAnchor || button))
6254
6255 if (infoPtr->nOldHit != nHit)
6256 {
6257 if (infoPtr->bCaptured)
6258 {
6259 if (!infoPtr->bDragOutSent)
6260 {
6261 NMTOOLBARW nmt;
6262 ZeroMemory(&nmt, sizeof(nmt));
6263 nmt.iItem = infoPtr->buttons[infoPtr->nButtonDown].idCommand;
6264 TOOLBAR_SendNotify(&nmt.hdr, infoPtr, TBN_DRAGOUT);
6265 infoPtr->bDragOutSent = TRUE;
6266 }
6267
6268 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
6269 if (infoPtr->nOldHit == infoPtr->nButtonDown) {
6270 btnPtr->fsState &= ~TBSTATE_PRESSED;
6271 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
6272 }
6273 else if (nHit == infoPtr->nButtonDown) {
6274 btnPtr->fsState |= TBSTATE_PRESSED;
6275 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
6276 }
6277 infoPtr->nOldHit = nHit;
6278 }
6279 }
6280
6281 return 0;
6282}
BOOL WINAPI _TrackMouseEvent(TRACKMOUSEEVENT *ptme)
Definition: commctrl.c:1207
#define TME_LEAVE
Definition: commctrl.h:4981
struct tagTRACKMOUSEEVENT TRACKMOUSEEVENT
#define TME_QUERY
Definition: commctrl.h:4983
#define WM_MOUSEMOVE
Definition: winuser.h:1775

Referenced by ToolbarWindowProc().

◆ TOOLBAR_MoveButton()

static LRESULT TOOLBAR_MoveButton ( TOOLBAR_INFO infoPtr,
INT  Id,
INT  nMoveIndex 
)
static

Definition at line 4156 of file toolbar.c.

4157{
4158 INT nIndex;
4159 INT nCount;
4161
4162 TRACE("hwnd=%p, Id=%d, nMoveIndex=%d\n", infoPtr->hwndSelf, Id, nMoveIndex);
4163
4164 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, TRUE);
4165 if ((nIndex == -1) || (nMoveIndex < 0))
4166 return FALSE;
4167
4168 if (nMoveIndex > infoPtr->nNumButtons - 1)
4169 nMoveIndex = infoPtr->nNumButtons - 1;
4170
4171 button = infoPtr->buttons[nIndex];
4172
4173 /* move button right */
4174 if (nIndex < nMoveIndex)
4175 {
4176 nCount = nMoveIndex - nIndex;
4177 memmove(&infoPtr->buttons[nIndex], &infoPtr->buttons[nIndex+1], nCount*sizeof(TBUTTON_INFO));
4178 infoPtr->buttons[nMoveIndex] = button;
4179
4180 TOOLBAR_MoveFixupIndex(&infoPtr->nButtonDown, nIndex, nMoveIndex, TRUE);
4181 TOOLBAR_MoveFixupIndex(&infoPtr->nButtonDrag, nIndex, nMoveIndex, TRUE);
4182 TOOLBAR_MoveFixupIndex(&infoPtr->nOldHit, nIndex, nMoveIndex, TRUE);
4183 TOOLBAR_MoveFixupIndex(&infoPtr->nHotItem, nIndex, nMoveIndex, TRUE);
4184 }
4185 else if (nIndex > nMoveIndex) /* move button left */
4186 {
4187 nCount = nIndex - nMoveIndex;
4188 memmove(&infoPtr->buttons[nMoveIndex+1], &infoPtr->buttons[nMoveIndex], nCount*sizeof(TBUTTON_INFO));
4189 infoPtr->buttons[nMoveIndex] = button;
4190
4191 TOOLBAR_MoveFixupIndex(&infoPtr->nButtonDown, nIndex, nMoveIndex, FALSE);
4192 TOOLBAR_MoveFixupIndex(&infoPtr->nButtonDrag, nIndex, nMoveIndex, FALSE);
4193 TOOLBAR_MoveFixupIndex(&infoPtr->nOldHit, nIndex, nMoveIndex, FALSE);
4194 TOOLBAR_MoveFixupIndex(&infoPtr->nHotItem, nIndex, nMoveIndex, FALSE);
4195 }
4196
4197 TOOLBAR_LayoutToolbar(infoPtr);
4198 TOOLBAR_AutoSize(infoPtr);
4199 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
4200
4201 return TRUE;
4202}
static void TOOLBAR_MoveFixupIndex(INT *pIndex, INT nIndex, INT nMoveIndex, BOOL bMoveUp)
Definition: toolbar.c:4136

Referenced by TOOLBAR_LButtonUp(), and ToolbarWindowProc().

◆ TOOLBAR_MoveFixupIndex()

static void TOOLBAR_MoveFixupIndex ( INT pIndex,
INT  nIndex,
INT  nMoveIndex,
BOOL  bMoveUp 
)
inlinestatic

Definition at line 4136 of file toolbar.c.

4137{
4138 if (bMoveUp)
4139 {
4140 if (*pIndex > nIndex && *pIndex <= nMoveIndex)
4141 (*pIndex)--;
4142 else if (*pIndex == nIndex)
4143 *pIndex = nMoveIndex;
4144 }
4145 else
4146 {
4147 if (*pIndex >= nMoveIndex && *pIndex < nIndex)
4148 (*pIndex)++;
4149 else if (*pIndex == nIndex)
4150 *pIndex = nMoveIndex;
4151 }
4152}
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4565

Referenced by TOOLBAR_MoveButton().

◆ TOOLBAR_NCActivate()

static LRESULT TOOLBAR_NCActivate ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
inlinestatic

Definition at line 6286 of file toolbar.c.

6287{
6288/* if (wndPtr->dwStyle & CCS_NODIVIDER) */
6290/* else */
6291/* return TOOLBAR_NCPaint (wndPtr, wParam, lParam); */
6292}
#define WM_NCACTIVATE
Definition: winuser.h:1688

Referenced by ToolbarWindowProc().

◆ TOOLBAR_NCCalcSize()

static LRESULT TOOLBAR_NCCalcSize ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
inlinestatic

Definition at line 6296 of file toolbar.c.

6297{
6300
6302}
#define LPRECT
Definition: precomp.h:28
#define WM_NCCALCSIZE
Definition: winuser.h:1685

Referenced by ToolbarWindowProc().

◆ TOOLBAR_NCCreate()

static LRESULT TOOLBAR_NCCreate ( HWND  hwnd,
WPARAM  wParam,
const CREATESTRUCTW lpcs 
)
static

Definition at line 6309 of file toolbar.c.

6311{
6312 TOOLBAR_INFO *infoPtr;
6313 DWORD styleadd = 0;
6314
6315 /* allocate memory for info structure */
6316 infoPtr = Alloc (sizeof(TOOLBAR_INFO));
6317 SetWindowLongPtrW (hwnd, 0, (LONG_PTR)infoPtr);
6318
6319 /* paranoid!! */
6320 infoPtr->dwStructSize = sizeof(TBBUTTON);
6321 infoPtr->nRows = 1;
6322
6323 /* initialize info structure */
6324 infoPtr->nButtonWidth = 23;
6325 infoPtr->nButtonHeight = 22;
6326 infoPtr->nBitmapHeight = 16;
6327 infoPtr->nBitmapWidth = 16;
6328
6329 infoPtr->nMaxTextRows = 1;
6330 infoPtr->cxMin = -1;
6331 infoPtr->cxMax = -1;
6332 infoPtr->nNumBitmaps = 0;
6333 infoPtr->nNumStrings = 0;
6334
6335 infoPtr->bCaptured = FALSE;
6336 infoPtr->nButtonDown = -1;
6337 infoPtr->nButtonDrag = -1;
6338 infoPtr->nOldHit = -1;
6339 infoPtr->nHotItem = -1;
6340 infoPtr->hwndNotify = lpcs->hwndParent;
6342 infoPtr->bAnchor = FALSE; /* no anchor highlighting */
6343 infoPtr->bDragOutSent = FALSE;
6344#ifdef __REACTOS__
6345 infoPtr->iVersion = iVersion;
6346#else
6347 infoPtr->iVersion = 0;
6348#endif
6349 infoPtr->hwndSelf = hwnd;
6350 infoPtr->bDoRedraw = TRUE;
6351 infoPtr->clrBtnHighlight = CLR_DEFAULT;
6352 infoPtr->clrBtnShadow = CLR_DEFAULT;
6353 infoPtr->szPadding.cx = DEFPAD_CX;
6354 infoPtr->szPadding.cy = DEFPAD_CY;
6355#ifdef __REACTOS__
6356 infoPtr->szSpacing.cx = 0;
6357 infoPtr->szSpacing.cy = 0;
6358 memset(&infoPtr->themeMargins, 0 , sizeof(infoPtr->themeMargins));
6359#endif
6360 infoPtr->iListGap = DEFLISTGAP;
6361 infoPtr->iTopMargin = default_top_margin(infoPtr);
6362 infoPtr->dwStyle = lpcs->style;
6363 infoPtr->tbim.iButton = -1;
6364
6365 /* fix instance handle, if the toolbar was created by CreateToolbarEx() */
6369 }
6370
6371 /* I think the code below is a bug, but it is the way that the native
6372 * controls seem to work. The effect is that if the user of TBSTYLE_FLAT
6373 * forgets to specify TBSTYLE_TRANSPARENT but does specify either
6374 * CCS_TOP or CCS_BOTTOM (_NOMOVEY and _TOP), then the control
6375 * does *not* set TBSTYLE_TRANSPARENT even though it should!!!!
6376 * Somehow, the only cases of this seem to be MFC programs.
6377 *
6378 * Note also that the addition of _TRANSPARENT occurs *only* here. It
6379 * does not occur in the WM_STYLECHANGING routine.
6380 * (Guy Albertelli 9/2001)
6381 *
6382 */
6383 if (((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf))
6384 && !(lpcs->style & TBSTYLE_TRANSPARENT))
6385 styleadd |= TBSTYLE_TRANSPARENT;
6386 if (!(lpcs->style & (CCS_TOP | CCS_NOMOVEY))) {
6387 styleadd |= CCS_TOP; /* default to top */
6388 SetWindowLongW (hwnd, GWL_STYLE, lpcs->style | styleadd);
6389 }
6390
6391 return DefWindowProcW (hwnd, WM_NCCREATE, wParam, (LPARAM)lpcs);
6392}
#define DEFPAD_CX
Definition: toolbar.c:211
#define DEFLISTGAP
Definition: toolbar.c:220
HINSTANCE hInst
Definition: dxdiag.c:13
struct _TBBUTTON TBBUTTON
HANDLE HINSTANCE
Definition: typedefs.h:77
#define DT_CENTER
Definition: winuser.h:527
#define DT_END_ELLIPSIS
Definition: winuser.h:529
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define GWLP_HINSTANCE
Definition: winuser.h:856
#define WM_NCCREATE
Definition: winuser.h:1683

Referenced by ToolbarWindowProc().

◆ TOOLBAR_NCPaint()

static LRESULT TOOLBAR_NCPaint ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6396 of file toolbar.c.

6397{
6398 DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
6399 RECT rcWindow;
6400 HDC hdc;
6401
6402 if (dwStyle & WS_MINIMIZE)
6403 return 0; /* Nothing to do */
6404
6406
6407 if (!(hdc = GetDCEx (hwnd, 0, DCX_USESTYLE | DCX_WINDOW)))
6408 return 0;
6409
6410 if (!(dwStyle & CCS_NODIVIDER))
6411 {
6412 GetWindowRect (hwnd, &rcWindow);
6413 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
6414 if( dwStyle & WS_BORDER )
6415 InflateRect (&rcWindow, -1, -1);
6416 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP);
6417 }
6418
6419 ReleaseDC( hwnd, hdc );
6420
6421 return 0;
6422}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define WS_MINIMIZE
Definition: pedump.c:622
#define DCX_WINDOW
Definition: winuser.h:2113
#define EDGE_ETCHED
Definition: winuser.h:452
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define BF_TOP
Definition: winuser.h:455
#define WM_NCPAINT
Definition: winuser.h:1687

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Notify()

static LRESULT TOOLBAR_Notify ( TOOLBAR_INFO infoPtr,
LPNMHDR  lpnmh 
)
inlinestatic

Definition at line 6554 of file toolbar.c.

6555{
6556 switch (lpnmh->code)
6557 {
6558 case PGN_CALCSIZE:
6559 {
6560 LPNMPGCALCSIZE lppgc = (LPNMPGCALCSIZE)lpnmh;
6561
6562 if (lppgc->dwFlag == PGF_CALCWIDTH) {
6563 lppgc->iWidth = infoPtr->rcBound.right - infoPtr->rcBound.left;
6564 TRACE("processed PGN_CALCSIZE, returning horz size = %d\n",
6565 lppgc->iWidth);
6566 }
6567 else {
6568 lppgc->iHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top;
6569 TRACE("processed PGN_CALCSIZE, returning vert size = %d\n",
6570 lppgc->iHeight);
6571 }
6572 return 0;
6573 }
6574
6575 case PGN_SCROLL:
6576 {
6577 LPNMPGSCROLL lppgs = (LPNMPGSCROLL)lpnmh;
6578
6579 lppgs->iScroll = (lppgs->iDir & (PGF_SCROLLLEFT | PGF_SCROLLRIGHT)) ?
6580 infoPtr->nButtonWidth : infoPtr->nButtonHeight;
6581 TRACE("processed PGN_SCROLL, returning scroll=%d, dir=%d\n",
6582 lppgs->iScroll, lppgs->iDir);
6583 return 0;
6584 }
6585
6586 case TTN_GETDISPINFOW:
6587 return TOOLBAR_TTGetDispInfo(infoPtr, (LPNMTTDISPINFOW)lpnmh);
6588
6589 case TTN_GETDISPINFOA:
6590 FIXME("TTN_GETDISPINFOA - should not be received; please report\n");
6591 return 0;
6592
6593 default:
6594 return 0;
6595 }
6596}
static LRESULT TOOLBAR_TTGetDispInfo(TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnmtdi)
Definition: toolbar.c:6426
#define TTN_GETDISPINFOA
Definition: commctrl.h:1872
#define TTN_GETDISPINFOW
Definition: commctrl.h:1873
#define PGF_SCROLLRIGHT
Definition: commctrl.h:4560
#define PGN_CALCSIZE
Definition: commctrl.h:4580
#define PGF_SCROLLLEFT
Definition: commctrl.h:4559
struct NMPGSCROLL * LPNMPGSCROLL
#define PGF_CALCWIDTH
Definition: commctrl.h:4582
#define PGN_SCROLL
Definition: commctrl.h:4555
struct NMPGCALCSIZE * LPNMPGCALCSIZE
DWORD dwFlag
Definition: commctrl.h:4587
int iScroll
Definition: commctrl.h:4575
UINT code
Definition: winuser.h:3159

Referenced by ToolbarWindowProc().

◆ TOOLBAR_NotifyFormat()

static LRESULT TOOLBAR_NotifyFormat ( const TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6600 of file toolbar.c.

6601{
6603
6604 TRACE("wParam = 0x%lx, lParam = 0x%08lx\n", wParam, lParam);
6605
6606 if (lParam == NF_QUERY)
6607 return NFR_UNICODE;
6608
6609 if (lParam == NF_REQUERY) {
6610 format = SendMessageW(infoPtr->hwndNotify,
6611 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
6612 if ((format != NFR_ANSI) && (format != NFR_UNICODE)) {
6613 ERR("wrong response to WM_NOTIFYFORMAT (%ld), assuming ANSI\n",
6614 format);
6615 format = NFR_ANSI;
6616 }
6617 return format;
6618 }
6619 return 0;
6620}
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define NFR_ANSI
Definition: winuser.h:2458
#define NF_QUERY
Definition: winuser.h:2460

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Paint()

static LRESULT TOOLBAR_Paint ( TOOLBAR_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 6624 of file toolbar.c.

6625{
6626 HDC hdc;
6627 PAINTSTRUCT ps;
6628
6629 /* fill ps.rcPaint with a default rect */
6630 ps.rcPaint = infoPtr->rcBound;
6631
6632 hdc = wParam==0 ? BeginPaint(infoPtr->hwndSelf, &ps) : (HDC)wParam;
6633
6634 TRACE("psrect=(%s)\n", wine_dbgstr_rect(&ps.rcPaint));
6635
6636 TOOLBAR_Refresh (infoPtr, hdc, &ps);
6637 if (!wParam) EndPaint (infoPtr->hwndSelf, &ps);
6638
6639 return 0;
6640}
static void TOOLBAR_Refresh(TOOLBAR_INFO *infoPtr, HDC hdc, const PAINTSTRUCT *ps)
Definition: toolbar.c:1274
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by ToolbarWindowProc().

◆ TOOLBAR_PressButton()

static LRESULT TOOLBAR_PressButton ( const TOOLBAR_INFO infoPtr,
INT  Id,
BOOL  fPress 
)
static

Definition at line 4206 of file toolbar.c.

4207{
4208 TBUTTON_INFO *btnPtr;
4209 INT nIndex;
4210 DWORD oldState;
4211
4212 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
4213 if (nIndex == -1)
4214 return FALSE;
4215
4216 btnPtr = &infoPtr->buttons[nIndex];
4217 oldState = btnPtr->fsState;
4218
4219 if (fPress)
4220 btnPtr->fsState |= TBSTATE_PRESSED;
4221 else
4222 btnPtr->fsState &= ~TBSTATE_PRESSED;
4223
4224 if(oldState != btnPtr->fsState)
4225 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
4226
4227 return TRUE;
4228}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_RButtonDblClk()

static LRESULT TOOLBAR_RButtonDblClk ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6136 of file toolbar.c.

6137{
6138 NMHDR nmhdr;
6139
6140 if (!TOOLBAR_SendNotify(&nmhdr, infoPtr, NM_RDBLCLK))
6142
6143 return 0;
6144}
#define NM_RDBLCLK
Definition: commctrl.h:134
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1781

Referenced by ToolbarWindowProc().

◆ TOOLBAR_RButtonUp()

static LRESULT TOOLBAR_RButtonUp ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6106 of file toolbar.c.

6107{
6108 INT nHit;
6109 NMMOUSE nmmouse;
6110 POINT pt;
6111 BOOL button;
6112
6113 pt.x = (short)LOWORD(lParam);
6114 pt.y = (short)HIWORD(lParam);
6115
6116 nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button);
6117 nmmouse.dwHitInfo = nHit;
6118
6119 if (!button) {
6120 nmmouse.dwItemSpec = -1;
6121 } else {
6122 nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
6123 nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
6124 }
6125
6126 ClientToScreen(infoPtr->hwndSelf, &pt);
6127 nmmouse.pt = pt;
6128
6129 if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RCLICK))
6130 return DefWindowProcW(infoPtr->hwndSelf, WM_RBUTTONUP, wParam, lParam);
6131
6132 return 0;
6133}
#define NM_RCLICK
Definition: commctrl.h:133
#define WM_RBUTTONUP
Definition: winuser.h:1780

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Refresh()

static void TOOLBAR_Refresh ( TOOLBAR_INFO infoPtr,
HDC  hdc,
const PAINTSTRUCT ps 
)
static

Definition at line 1274 of file toolbar.c.

1275{
1276 TBUTTON_INFO *btnPtr;
1277 INT i;
1278 RECT rcTemp, rcClient;
1279 NMTBCUSTOMDRAW tbcd;
1280 DWORD ntfret;
1281 DWORD dwBaseCustDraw;
1282
1283 /* the app has told us not to redraw the toolbar */
1284 if (!infoPtr->bDoRedraw)
1285 return;
1286
1287 /* if imagelist belongs to the app, it can be changed
1288 by the app after setting it */
1289 if (GETDEFIMAGELIST(infoPtr, 0) != infoPtr->himlInt)
1290 {
1291 infoPtr->nNumBitmaps = 0;
1292 for (i = 0; i < infoPtr->cimlDef; i++)
1293 infoPtr->nNumBitmaps += ImageList_GetImageCount(infoPtr->himlDef[i]->himl);
1294 }
1295
1296 TOOLBAR_DumpToolbar (infoPtr, __LINE__);
1297
1298 /* change the imagelist icon size if we manage the list and it is necessary */
1300
1301 /* Send initial notify */
1302 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
1304 tbcd.nmcd.hdc = hdc;
1305 tbcd.nmcd.rc = ps->rcPaint;
1306 ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
1307 dwBaseCustDraw = ntfret & 0xffff;
1308
1309 GetClientRect(infoPtr->hwndSelf, &rcClient);
1310
1311 /* redraw necessary buttons */
1312 btnPtr = infoPtr->buttons;
1313 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++)
1314 {
1315 BOOL bDraw;
1316 if (!RectVisible(hdc, &btnPtr->rect))
1317 continue;
1319 {
1320 IntersectRect(&rcTemp, &rcClient, &btnPtr->rect);
1321 bDraw = EqualRect(&rcTemp, &btnPtr->rect);
1322 }
1323 else
1324 bDraw = TRUE;
1325 bDraw &= IntersectRect(&rcTemp, &(ps->rcPaint), &(btnPtr->rect));
1326 bDraw = (btnPtr->fsState & TBSTATE_HIDDEN) ? FALSE : bDraw;
1327 if (bDraw)
1328 TOOLBAR_DrawButton(infoPtr, btnPtr, hdc, dwBaseCustDraw);
1329 }
1330
1331 /* draw insert mark if required */
1332 if (infoPtr->tbim.iButton != -1)
1333 {
1334 RECT rcButton = infoPtr->buttons[infoPtr->tbim.iButton].rect;
1335 RECT rcInsertMark;
1336 rcInsertMark.top = rcButton.top;
1337 rcInsertMark.bottom = rcButton.bottom;
1338 if (infoPtr->tbim.dwFlags & TBIMHT_AFTER)
1339 rcInsertMark.left = rcInsertMark.right = rcButton.right;
1340 else
1341 rcInsertMark.left = rcInsertMark.right = rcButton.left - INSERTMARK_WIDTH;
1342 COMCTL32_DrawInsertMark(hdc, &rcInsertMark, infoPtr->clrInsertMark, FALSE);
1343 }
1344
1345 if (dwBaseCustDraw & CDRF_NOTIFYPOSTPAINT)
1346 {
1347 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
1349 tbcd.nmcd.hdc = hdc;
1350 tbcd.nmcd.rc = ps->rcPaint;
1351 TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
1352 }
1353}
void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal) DECLSPEC_HIDDEN
Definition: commctrl.c:1626
static void TOOLBAR_CheckImageListIconSize(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:2957
static void TOOLBAR_DrawButton(const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDraw)
Definition: toolbar.c:975
#define INSERTMARK_WIDTH
Definition: toolbar.c:208
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define TBIMHT_AFTER
Definition: commctrl.h:1182
#define CDDS_POSTPAINT
Definition: commctrl.h:281
DWORD dwFlags
Definition: commctrl.h:1180
BOOL WINAPI RectVisible(_In_ HDC, _In_ LPCRECT)
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)

Referenced by TOOLBAR_Paint().

◆ TOOLBAR_Register()

VOID TOOLBAR_Register ( void  )

Definition at line 7219 of file toolbar.c.

7220{
7221 WNDCLASSW wndClass;
7222
7223 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
7224 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
7225 wndClass.lpfnWndProc = ToolbarWindowProc;
7226 wndClass.cbClsExtra = 0;
7227 wndClass.cbWndExtra = sizeof(TOOLBAR_INFO *);
7228 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
7229 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
7231
7232 RegisterClassW (&wndClass);
7233}
static LRESULT WINAPI ToolbarWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6794
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:943
LPCWSTR lpszClassName
Definition: winuser.h:3185
HBRUSH hbrBackground
Definition: winuser.h:3183
int cbClsExtra
Definition: winuser.h:3178
UINT style
Definition: winuser.h:3176
WNDPROC lpfnWndProc
Definition: winuser.h:3177
int cbWndExtra
Definition: winuser.h:3179
HCURSOR hCursor
Definition: winuser.h:3182
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define CS_DBLCLKS
Definition: winuser.h:651
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define COLOR_BTNFACE
Definition: winuser.h:928

Referenced by DllMain().

◆ TOOLBAR_RelayEvent()

static VOID TOOLBAR_RelayEvent ( HWND  hwndTip,
HWND  hwndMsg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2149 of file toolbar.c.

2151{
2152 MSG msg;
2153
2154 msg.hwnd = hwndMsg;
2155 msg.message = uMsg;
2156 msg.wParam = wParam;
2157 msg.lParam = lParam;
2158 msg.time = GetMessageTime ();
2159 msg.pt.x = (short)LOWORD(GetMessagePos ());
2160 msg.pt.y = (short)HIWORD(GetMessagePos ());
2161
2162 SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
2163}
#define TTM_RELAYEVENT
Definition: commctrl.h:1792
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
LONG WINAPI GetMessageTime(void)
Definition: message.c:1361

Referenced by TOOLBAR_LButtonDown(), TOOLBAR_LButtonUp(), and TOOLBAR_MouseMove().

◆ TOOLBAR_ReplaceBitmap()

static LRESULT TOOLBAR_ReplaceBitmap ( TOOLBAR_INFO infoPtr,
const TBREPLACEBITMAP lpReplace 
)
static

Definition at line 4233 of file toolbar.c.

4234{
4236 int i = 0, nOldButtons = 0, pos = 0;
4237 int nOldBitmaps, nNewBitmaps = 0;
4238 HIMAGELIST himlDef = 0;
4239
4240 TRACE("hInstOld %p nIDOld %lx hInstNew %p nIDNew %lx nButtons %x\n",
4241 lpReplace->hInstOld, lpReplace->nIDOld, lpReplace->hInstNew, lpReplace->nIDNew,
4242 lpReplace->nButtons);
4243
4244 if (lpReplace->hInstOld == HINST_COMMCTRL)
4245 {
4246 FIXME("changing standard bitmaps not implemented\n");
4247 return FALSE;
4248 }
4249 else if (lpReplace->hInstOld != 0 && lpReplace->hInstOld != lpReplace->hInstNew)
4250 FIXME("resources not in the current module not implemented\n");
4251
4252 TRACE("To be replaced hInstOld %p nIDOld %lx\n", lpReplace->hInstOld, lpReplace->nIDOld);
4253 for (i = 0; i < infoPtr->nNumBitmapInfos; i++) {
4254 TBITMAP_INFO *tbi = &infoPtr->bitmaps[i];
4255 TRACE("tbimapinfo %d hInstOld %p nIDOld %x\n", i, tbi->hInst, tbi->nID);
4256 if (tbi->hInst == lpReplace->hInstOld && tbi->nID == lpReplace->nIDOld)
4257 {
4258 TRACE("Found: nButtons %d hInst %p nID %x\n", tbi->nButtons, tbi->hInst, tbi->nID);
4259 nOldButtons = tbi->nButtons;
4260 tbi->nButtons = lpReplace->nButtons;
4261 tbi->hInst = lpReplace->hInstNew;
4262 tbi->nID = lpReplace->nIDNew;
4263 TRACE("tbimapinfo changed %d hInstOld %p nIDOld %x\n", i, tbi->hInst, tbi->nID);
4264 break;
4265 }
4266 pos += tbi->nButtons;
4267 }
4268
4269 if (nOldButtons == 0)
4270 {
4271 WARN("No hinst/bitmap found! hInst %p nID %lx\n", lpReplace->hInstOld, lpReplace->nIDOld);
4272 return FALSE;
4273 }
4274
4275 /* copy the bitmap before adding it as ImageList_AddMasked modifies the
4276 * bitmap
4277 */
4278 if (lpReplace->hInstNew)
4279 hBitmap = LoadBitmapW(lpReplace->hInstNew,(LPWSTR)lpReplace->nIDNew);
4280 else
4281 hBitmap = CopyImage((HBITMAP)lpReplace->nIDNew, IMAGE_BITMAP, 0, 0, 0);
4282
4283 himlDef = GETDEFIMAGELIST(infoPtr, 0); /* fixme: correct? */
4284 nOldBitmaps = ImageList_GetImageCount(himlDef);
4285
4286 /* ImageList_Replace(GETDEFIMAGELIST(), pos, hBitmap, NULL); */
4287
4288 for (i = pos + nOldBitmaps - 1; i >= pos; i--)
4289 ImageList_Remove(himlDef, i);
4290
4291 if (hBitmap)
4292 {
4294 nNewBitmaps = ImageList_GetImageCount(himlDef);
4296 }
4297
4298 infoPtr->nNumBitmaps = infoPtr->nNumBitmaps - nOldBitmaps + nNewBitmaps;
4299
4300 TRACE(" pos %d %d old bitmaps replaced by %d new ones.\n",
4301 pos, nOldBitmaps, nNewBitmaps);
4302
4303 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
4304 return TRUE;
4305}
static HBITMAP hBitmap
Definition: timezone.c:26
BOOL WINAPI ImageList_Remove(HIMAGELIST himl, INT i)
Definition: imagelist.c:2568
UINT_PTR nIDOld
Definition: commctrl.h:1209
HINSTANCE hInstOld
Definition: commctrl.h:1208
UINT_PTR nIDNew
Definition: commctrl.h:1211
HINSTANCE hInstNew
Definition: commctrl.h:1210
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2207

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Restore()

static BOOL TOOLBAR_Restore ( TOOLBAR_INFO infoPtr,
const TBSAVEPARAMSW lpSave 
)
static

Definition at line 4382 of file toolbar.c.

4383{
4384 LONG res;
4385 HKEY hkey = NULL;
4386 BOOL ret = FALSE;
4387 DWORD dwType;
4388 DWORD dwSize = 0;
4389 NMTBRESTORE nmtbr;
4390 NMHDR hdr;
4391
4392 /* restore toolbar information */
4393 TRACE("restore from %s %s\n", debugstr_w(lpSave->pszSubKey),
4394 debugstr_w(lpSave->pszValueName));
4395
4396 memset(&nmtbr, 0, sizeof(nmtbr));
4397
4398 res = RegOpenKeyExW(lpSave->hkr, lpSave->pszSubKey, 0,
4399 KEY_QUERY_VALUE, &hkey);
4400 if (!res)
4401 res = RegQueryValueExW(hkey, lpSave->pszValueName, NULL, &dwType,
4402 NULL, &dwSize);
4403 if (!res && dwType != REG_BINARY)
4405 if (!res)
4406 {
4407 nmtbr.pData = Alloc(dwSize);
4408 nmtbr.cbData = dwSize;
4409 if (!nmtbr.pData) res = ERROR_OUTOFMEMORY;
4410 }
4411 if (!res)
4412 res = RegQueryValueExW(hkey, lpSave->pszValueName, NULL, &dwType,
4413 (LPBYTE)nmtbr.pData, &dwSize);
4414 if (!res)
4415 {
4416 nmtbr.pCurrent = nmtbr.pData;
4417 nmtbr.iItem = -1;
4418 nmtbr.cbBytesPerRecord = sizeof(DWORD);
4419 nmtbr.cButtons = nmtbr.cbData / nmtbr.cbBytesPerRecord;
4420
4421 if (!TOOLBAR_SendNotify(&nmtbr.hdr, infoPtr, TBN_RESTORE))
4422 {
4423 INT i, count = nmtbr.cButtons;
4424
4425 /* remove all existing buttons as this function is designed to
4426 * restore the toolbar to a previously saved state */
4427 TOOLBAR_DeleteAllButtons(infoPtr);
4428
4429 for (i = 0; i < count; i++)
4430 {
4431 nmtbr.iItem = i;
4432 nmtbr.tbButton.iBitmap = -1;
4433 nmtbr.tbButton.fsState = 0;
4434 nmtbr.tbButton.fsStyle = 0;
4435 nmtbr.tbButton.dwData = 0;
4436 nmtbr.tbButton.iString = 0;
4437
4438 if (*nmtbr.pCurrent & 0x80000000)
4439 {
4440 /* separator */
4442 nmtbr.tbButton.idCommand = 0;
4443 nmtbr.tbButton.fsStyle = BTNS_SEP;
4444 if (*nmtbr.pCurrent != (DWORD)-1)
4446 }
4447 else
4448 nmtbr.tbButton.idCommand = (int)*nmtbr.pCurrent;
4449
4450 nmtbr.pCurrent++;
4451
4452 TOOLBAR_SendNotify(&nmtbr.hdr, infoPtr, TBN_RESTORE);
4453
4454 /* All returned ptrs and -1 are ignored */
4455 if (!IS_INTRESOURCE(nmtbr.tbButton.iString))
4456 nmtbr.tbButton.iString = 0;
4457
4458 TOOLBAR_InsertButtonT(infoPtr, -1, &nmtbr.tbButton, TRUE);
4459 }
4460
4462 for (i = 0; ; i++)
4463 {
4464 NMTOOLBARW tb;
4465 TBBUTTONINFOW bi;
4466 WCHAR buf[128];
4468 INT idx;
4469
4470 memset( &tb, 0, sizeof(tb) );
4471 tb.iItem = i;
4472 tb.cchText = ARRAY_SIZE(buf);
4473 tb.pszText = buf;
4474
4475 /* Use the same struct for both A and W versions since the layout is the same. */
4476 if (!TOOLBAR_SendNotify( &tb.hdr, infoPtr, code ))
4477 break;
4478
4479 idx = TOOLBAR_GetButtonIndex( infoPtr, tb.tbButton.idCommand, FALSE );
4480 if (idx == -1) continue;
4481
4482 /* tb.pszText is ignored - the string comes from tb.tbButton.iString, which may
4483 be an index or a ptr. Either way it is simply copied. There is no api to change
4484 the string index, so we set it manually. The other properties can be set with SetButtonInfo. */
4485 free_string( infoPtr->buttons + idx );
4486 infoPtr->buttons[idx].iString = tb.tbButton.iString;
4487
4488 memset( &bi, 0, sizeof(bi) );
4489 bi.cbSize = sizeof(bi);
4491 bi.iImage = tb.tbButton.iBitmap;
4492 bi.fsState = tb.tbButton.fsState;
4493 bi.fsStyle = tb.tbButton.fsStyle;
4494 bi.lParam = tb.tbButton.dwData;
4495
4496 TOOLBAR_SetButtonInfo( infoPtr, tb.tbButton.idCommand, &bi, TRUE );
4497 }
4498 TOOLBAR_SendNotify( &hdr, infoPtr, TBN_ENDADJUST );
4499
4500 /* remove all uninitialised buttons
4501 * note: loop backwards to avoid having to fixup i on a
4502 * delete */
4503 for (i = infoPtr->nNumButtons - 1; i >= 0; i--)
4504 if (infoPtr->buttons[i].iBitmap == -1)
4505 TOOLBAR_DeleteButton(infoPtr, i);
4506
4507 /* only indicate success if at least one button survived */
4508 if (infoPtr->nNumButtons > 0) ret = TRUE;
4509 }
4510 }
4511 Free (nmtbr.pData);
4512 RegCloseKey(hkey);
4513
4514 return ret;
4515}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
unsigned int idx
Definition: utils.c:41
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
static void TOOLBAR_DeleteAllButtons(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:4364
static LRESULT TOOLBAR_SetButtonInfo(TOOLBAR_INFO *infoPtr, INT Id, const TBBUTTONINFOW *lptbbi, BOOL isW)
Definition: toolbar.c:4629
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static const WCHAR tb[]
Definition: suminfo.c:285
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DWORD
Definition: nt_native.h:44
long LONG
Definition: pedump.c:60
#define TBN_RESTORE
Definition: commctrl.h:1344
Definition: inflate.c:139
TBBUTTON tbButton
Definition: commctrl.h:1373
DWORD * pCurrent
Definition: commctrl.h:1368
DWORD * pData
Definition: commctrl.h:1367
int cbBytesPerRecord
Definition: commctrl.h:1372
LPCWSTR pszSubKey
Definition: commctrl.h:1121
LPCWSTR pszValueName
Definition: commctrl.h:1122
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by TOOLBAR_SaveRestoreW().

◆ TOOLBAR_Save()

static BOOL TOOLBAR_Save ( TOOLBAR_INFO infoPtr,
const TBSAVEPARAMSW params 
)
static

Definition at line 4310 of file toolbar.c.

4311{
4312 NMTBSAVE save;
4313 INT ret, i;
4314 BOOL alloced = FALSE;
4315 HKEY key;
4316
4317 TRACE( "save to %s %s\n", debugstr_w(params->pszSubKey), debugstr_w(params->pszValueName) );
4318
4319 memset( &save, 0, sizeof(save) );
4320 save.cbData = infoPtr->nNumButtons * sizeof(DWORD);
4321 save.iItem = -1;
4322 save.cButtons = infoPtr->nNumButtons;
4323 save.tbButton.idCommand = -1;
4324 TOOLBAR_SendNotify( &save.hdr, infoPtr, TBN_SAVE );
4325
4326 if (!save.pData)
4327 {
4328 save.pData = Alloc( save.cbData );
4329 if (!save.pData) return FALSE;
4330 alloced = TRUE;
4331 }
4332 if (!save.pCurrent) save.pCurrent = save.pData;
4333
4334 for (i = 0; i < infoPtr->nNumButtons; i++)
4335 {
4336 save.iItem = i;
4337 save.tbButton.iBitmap = infoPtr->buttons[i].iBitmap;
4338 save.tbButton.idCommand = infoPtr->buttons[i].idCommand;
4339 save.tbButton.fsState = infoPtr->buttons[i].fsState;
4340 save.tbButton.fsStyle = infoPtr->buttons[i].fsStyle;
4341 memset( save.tbButton.bReserved, 0, sizeof(save.tbButton.bReserved) );
4342 save.tbButton.dwData = infoPtr->buttons[i].dwData;
4343 save.tbButton.iString = infoPtr->buttons[i].iString;
4344
4345 *save.pCurrent++ = save.tbButton.idCommand;
4346
4347 TOOLBAR_SendNotify( &save.hdr, infoPtr, TBN_SAVE );
4348 }
4349
4350 ret = RegCreateKeyW( params->hkr, params->pszSubKey, &key );
4351 if (ret == ERROR_SUCCESS)
4352 {
4353 ret = RegSetValueExW( key, params->pszValueName, 0, REG_BINARY, (BYTE *)save.pData, save.cbData );
4354 RegCloseKey( key );
4355 }
4356
4357 if (alloced) Free( save.pData );
4358 return !ret;
4359}
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
GLenum const GLfloat * params
Definition: glext.h:5645
#define TBN_SAVE
Definition: commctrl.h:1345
Definition: copy.c:22
DWORD * pData
Definition: commctrl.h:1357
TBBUTTON tbButton
Definition: commctrl.h:1362
UINT cbData
Definition: commctrl.h:1359
NMHDR hdr
Definition: commctrl.h:1356
DWORD * pCurrent
Definition: commctrl.h:1358
int cButtons
Definition: commctrl.h:1361

Referenced by TOOLBAR_SaveRestoreW().

◆ TOOLBAR_SaveRestoreA()

static LRESULT TOOLBAR_SaveRestoreA ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
const TBSAVEPARAMSA lpSave 
)
static

Definition at line 4531 of file toolbar.c.

4532{
4533 LPWSTR pszValueName = 0, pszSubKey = 0;
4534 TBSAVEPARAMSW SaveW;
4535 LRESULT result = 0;
4536 int len;
4537
4538 if (lpSave == NULL) return 0;
4539
4540 len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, NULL, 0);
4541 pszSubKey = Alloc(len * sizeof(WCHAR));
4542 if (!pszSubKey) goto exit;
4543 MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, pszSubKey, len);
4544
4545 len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, NULL, 0);
4546 pszValueName = Alloc(len * sizeof(WCHAR));
4547 if (!pszValueName) goto exit;
4548 MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, pszValueName, len);
4549
4550 SaveW.pszValueName = pszValueName;
4551 SaveW.pszSubKey = pszSubKey;
4552 SaveW.hkr = lpSave->hkr;
4553 result = TOOLBAR_SaveRestoreW(infoPtr, wParam, &SaveW);
4554
4555exit:
4556 Free (pszValueName);
4557 Free (pszSubKey);
4558
4559 return result;
4560}
static LRESULT TOOLBAR_SaveRestoreW(TOOLBAR_INFO *infoPtr, WPARAM wParam, const TBSAVEPARAMSW *lpSave)
Definition: toolbar.c:4519
GLuint64EXT * result
Definition: glext.h:11304
#define exit(n)
Definition: config.h:202
LPCSTR pszSubKey
Definition: commctrl.h:1115
LPCSTR pszValueName
Definition: commctrl.h:1116

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SaveRestoreW()

static LRESULT TOOLBAR_SaveRestoreW ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
const TBSAVEPARAMSW lpSave 
)
static

Definition at line 4519 of file toolbar.c.

4520{
4521 if (lpSave == NULL) return 0;
4522
4523 if (wParam)
4524 return TOOLBAR_Save(infoPtr, lpSave);
4525 else
4526 return TOOLBAR_Restore(infoPtr, lpSave);
4527}
static BOOL TOOLBAR_Save(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *params)
Definition: toolbar.c:4310
static BOOL TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
Definition: toolbar.c:4382

Referenced by TOOLBAR_SaveRestoreA(), and ToolbarWindowProc().

◆ TOOLBAR_SendNotify()

static INT TOOLBAR_SendNotify ( NMHDR nmhdr,
const TOOLBAR_INFO infoPtr,
UINT  code 
)
static

◆ TOOLBAR_SetAnchorHighlight()

static LRESULT TOOLBAR_SetAnchorHighlight ( TOOLBAR_INFO infoPtr,
BOOL  bAnchor 
)
static

Definition at line 4564 of file toolbar.c.

4565{
4566 BOOL bOldAnchor = infoPtr->bAnchor;
4567
4568 TRACE("hwnd=%p, bAnchor = %s\n", infoPtr->hwndSelf, bAnchor ? "TRUE" : "FALSE");
4569
4570 infoPtr->bAnchor = bAnchor;
4571
4572 /* Native does not remove the hot effect from an already hot button */
4573
4574 return (LRESULT)bOldAnchor;
4575}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetBitmapSize()

static LRESULT TOOLBAR_SetBitmapSize ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 4579 of file toolbar.c.

4580{
4581 HIMAGELIST himlDef = GETDEFIMAGELIST(infoPtr, 0);
4582 short width = (short)LOWORD(lParam);
4583 short height = (short)HIWORD(lParam);
4584
4585 TRACE("hwnd=%p, wParam=%ld, size %d x %d\n", infoPtr->hwndSelf, wParam, width, height);
4586
4587 if (wParam != 0)
4588 FIXME("wParam is %ld. Perhaps image list index?\n", wParam);
4589
4590 /* 0 width or height is changed to 1 */
4591 if (width == 0)
4592 width = 1;
4593 if (height == 0)
4594 height = 1;
4595
4596 if (infoPtr->nNumButtons > 0)
4597 TRACE("%d buttons, undoc change to bitmap size : %d-%d -> %d-%d\n",
4598 infoPtr->nNumButtons,
4599 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight, width, height);
4600
4601 if (width < -1 || height < -1)
4602 {
4603 /* Windows destroys the imagelist and seems to actually use negative
4604 * values to compute button sizes */
4605 FIXME("Negative bitmap sizes not supported (%d, %d)\n", width, height);
4606 return FALSE;
4607 }
4608
4609 /* width or height of -1 means no change */
4610 if (width != -1)
4611 infoPtr->nBitmapWidth = width;
4612 if (height != -1)
4613 infoPtr->nBitmapHeight = height;
4614
4615 if ((himlDef == infoPtr->himlInt) &&
4616 (ImageList_GetImageCount(infoPtr->himlInt) == 0))
4617 {
4618 ImageList_SetIconSize(infoPtr->himlInt, infoPtr->nBitmapWidth,
4619 infoPtr->nBitmapHeight);
4620 }
4621
4622 TOOLBAR_CalcToolbar(infoPtr);
4623 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
4624 return TRUE;
4625}
BOOL WINAPI ImageList_SetIconSize(HIMAGELIST himl, INT cx, INT cy)
Definition: imagelist.c:3038
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetBoundingSize()

static LRESULT TOOLBAR_SetBoundingSize ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 5444 of file toolbar.c.

5445{
5446 SIZE * pSize = (SIZE*)lParam;
5447 FIXME("hwnd=%p, wParam=0x%08lx, size.cx=%d, size.cy=%d stub\n", hwnd, wParam, pSize->cx, pSize->cy);
5448 return 0;
5449}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetButtonInfo()

static LRESULT TOOLBAR_SetButtonInfo ( TOOLBAR_INFO infoPtr,
INT  Id,
const TBBUTTONINFOW lptbbi,
BOOL  isW 
)
static

Definition at line 4629 of file toolbar.c.

4631{
4632 TBUTTON_INFO *btnPtr;
4633 INT nIndex;
4634 RECT oldBtnRect;
4635
4636 if (lptbbi == NULL)
4637 return FALSE;
4638 if (lptbbi->cbSize < sizeof(TBBUTTONINFOW))
4639 return FALSE;
4640
4641 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, lptbbi->dwMask & TBIF_BYINDEX);
4642 if (nIndex == -1)
4643 return FALSE;
4644
4645 btnPtr = &infoPtr->buttons[nIndex];
4646 if (lptbbi->dwMask & TBIF_COMMAND)
4647 btnPtr->idCommand = lptbbi->idCommand;
4648 if (lptbbi->dwMask & TBIF_IMAGE)
4649 btnPtr->iBitmap = lptbbi->iImage;
4650 if (lptbbi->dwMask & TBIF_LPARAM)
4651 btnPtr->dwData = lptbbi->lParam;
4652 if (lptbbi->dwMask & TBIF_SIZE)
4653 btnPtr->cx = lptbbi->cx;
4654 if (lptbbi->dwMask & TBIF_STATE)
4655 btnPtr->fsState = lptbbi->fsState;
4656 if (lptbbi->dwMask & TBIF_STYLE)
4657 btnPtr->fsStyle = lptbbi->fsStyle;
4658
4659 if (lptbbi->dwMask & TBIF_TEXT)
4660 set_stringT( btnPtr, lptbbi->pszText, isW );
4661
4662 /* save the button rect to see if we need to redraw the whole toolbar */
4663 oldBtnRect = btnPtr->rect;
4664 TOOLBAR_LayoutToolbar(infoPtr);
4665
4666 if (!EqualRect(&oldBtnRect, &btnPtr->rect))
4667 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
4668 else
4669 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
4670
4671 return TRUE;
4672}
static void set_stringT(TBUTTON_INFO *btn, const WCHAR *str, BOOL unicode)
Definition: toolbar.c:381

Referenced by TOOLBAR_Restore(), and ToolbarWindowProc().

◆ TOOLBAR_SetButtonSize()

static LRESULT TOOLBAR_SetButtonSize ( TOOLBAR_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 4676 of file toolbar.c.

4677{
4679 int top = default_top_margin(infoPtr);
4680
4681 if ((cx < 0) || (cy < 0))
4682 {
4683 ERR("invalid parameter 0x%08x\n", (DWORD)lParam);
4684 return FALSE;
4685 }
4686
4687 TRACE("%p, cx = %d, cy = %d\n", infoPtr->hwndSelf, cx, cy);
4688
4689 /* The documentation claims you can only change the button size before
4690 * any button has been added. But this is wrong.
4691 * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding
4692 * it to the toolbar, and it checks that the return value is nonzero - mjm
4693 * Further testing shows that we must actually perform the change too.
4694 */
4695 /*
4696 * The documentation also does not mention that if 0 is supplied for
4697 * either size, the system changes it to the default of 24 wide and
4698 * 22 high. Demonstrated in ControlSpy Toolbar. GLA 3/02
4699 */
4700 if (cx == 0) cx = 24;
4701 if (cy == 0) cy = 22;
4702
4703#ifdef __REACTOS__
4704 cx = max(cx, infoPtr->szPadding.cx + infoPtr->nBitmapWidth + infoPtr->themeMargins.cxLeftWidth + infoPtr->themeMargins.cxRightWidth);
4705 cy = max(cy, infoPtr->szPadding.cy + infoPtr->nBitmapHeight + infoPtr->themeMargins.cyTopHeight + infoPtr->themeMargins.cyBottomHeight);
4706#else
4707 cx = max(cx, infoPtr->szPadding.cx + infoPtr->nBitmapWidth);
4708 cy = max(cy, infoPtr->szPadding.cy + infoPtr->nBitmapHeight);
4709#endif
4710
4711 if (cx != infoPtr->nButtonWidth || cy != infoPtr->nButtonHeight ||
4712 top != infoPtr->iTopMargin)
4713 {
4714 infoPtr->nButtonWidth = cx;
4715 infoPtr->nButtonHeight = cy;
4716 infoPtr->iTopMargin = top;
4717
4718 TOOLBAR_LayoutToolbar( infoPtr );
4719 InvalidateRect( infoPtr->hwndSelf, NULL, TRUE );
4720 }
4721 return TRUE;
4722}

Referenced by TOOLBAR_SetImageList(), and ToolbarWindowProc().

◆ TOOLBAR_SetButtonWidth()

static LRESULT TOOLBAR_SetButtonWidth ( TOOLBAR_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 4726 of file toolbar.c.

4727{
4728 /* if setting to current values, ignore */
4729 if ((infoPtr->cxMin == (short)LOWORD(lParam)) &&
4730 (infoPtr->cxMax == (short)HIWORD(lParam))) {
4731 TRACE("matches current width, min=%d, max=%d, no recalc\n",
4732 infoPtr->cxMin, infoPtr->cxMax);
4733 return TRUE;
4734 }
4735
4736 /* save new values */
4737 infoPtr->cxMin = (short)LOWORD(lParam);
4738 infoPtr->cxMax = (short)HIWORD(lParam);
4739
4740 /* otherwise we need to recalc the toolbar and in some cases
4741 recalc the bounding rectangle (does DrawText w/ DT_CALCRECT
4742 which doesn't actually draw - GA). */
4743 TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n",
4744 infoPtr->nNumButtons, infoPtr->cxMin, infoPtr->cxMax);
4745
4746 TOOLBAR_CalcToolbar (infoPtr);
4747
4748 InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
4749
4750 return TRUE;
4751}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetCmdId()

static LRESULT TOOLBAR_SetCmdId ( TOOLBAR_INFO infoPtr,
INT  nIndex,
INT  nId 
)
static

Definition at line 4755 of file toolbar.c.

4756{
4757 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
4758 return FALSE;
4759
4760 infoPtr->buttons[nIndex].idCommand = nId;
4761
4762 if (infoPtr->hwndToolTip) {
4763
4764 FIXME("change tool tip\n");
4765
4766 }
4767
4768 return TRUE;
4769}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetColorScheme()

static LRESULT TOOLBAR_SetColorScheme ( TOOLBAR_INFO infoPtr,
const COLORSCHEME lParam 
)
static

Definition at line 5356 of file toolbar.c.

5357{
5358 TRACE("new colors Hl=%x Shd=%x, old colors Hl=%x Shd=%x\n",
5359 lParam->clrBtnHighlight, lParam->clrBtnShadow,
5360 infoPtr->clrBtnHighlight, infoPtr->clrBtnShadow);
5361
5362 infoPtr->clrBtnHighlight = lParam->clrBtnHighlight;
5363 infoPtr->clrBtnShadow = lParam->clrBtnShadow;
5364 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
5365 return 0;
5366}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetDisabledImageList()

static LRESULT TOOLBAR_SetDisabledImageList ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
HIMAGELIST  himl 
)
static

Definition at line 4773 of file toolbar.c.

4774{
4775 HIMAGELIST himlTemp;
4776 INT id = 0;
4777
4778 if (infoPtr->iVersion >= 5)
4779 id = wParam;
4780
4781 himlTemp = TOOLBAR_InsertImageList(&infoPtr->himlDis,
4782 &infoPtr->cimlDis, himl, id);
4783
4784 /* FIXME: redraw ? */
4785
4786 return (LRESULT)himlTemp;
4787}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetDrawTextFlags()

static LRESULT TOOLBAR_SetDrawTextFlags ( TOOLBAR_INFO infoPtr,
DWORD  mask,
DWORD  flags 
)
static

Definition at line 4791 of file toolbar.c.

4792{
4793 DWORD old_flags;
4794
4795 TRACE("hwnd = %p, mask = 0x%08x, flags = 0x%08x\n", infoPtr->hwndSelf, mask, flags);
4796
4797 old_flags = infoPtr->dwDTFlags;
4798 infoPtr->dwDTFlags = (old_flags & ~mask) | (flags & mask);
4799
4800 return (LRESULT)old_flags;
4801}
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetExtendedStyle()

static LRESULT TOOLBAR_SetExtendedStyle ( TOOLBAR_INFO infoPtr,
DWORD  mask,
DWORD  style 
)
static

Definition at line 4810 of file toolbar.c.

4811{
4812 DWORD old_style = infoPtr->dwExStyle;
4813
4814 TRACE("mask=0x%08x, style=0x%08x\n", mask, style);
4815
4816 if (mask)
4817 infoPtr->dwExStyle = (old_style & ~mask) | (style & mask);
4818 else
4819 infoPtr->dwExStyle = style;
4820
4821 if (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL)
4822 FIXME("Unknown Toolbar Extended Style 0x%08x. Please report.\n",
4823 (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL));
4824
4825 if ((old_style ^ infoPtr->dwExStyle) & TBSTYLE_EX_MIXEDBUTTONS)
4826 TOOLBAR_CalcToolbar(infoPtr);
4827 else
4828 TOOLBAR_LayoutToolbar(infoPtr);
4829
4830 TOOLBAR_AutoSize(infoPtr);
4831 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
4832
4833 return old_style;
4834}
Arabic default style
Definition: afstyles.h:94
#define TBSTYLE_EX_ALL
Definition: toolbar.c:235

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetFocus()

static LRESULT TOOLBAR_SetFocus ( TOOLBAR_INFO infoPtr)
static

Definition at line 6644 of file toolbar.c.

6645{
6646 TRACE("nHotItem = %d\n", infoPtr->nHotItem);
6647
6648 /* make first item hot */
6649 if (infoPtr->nNumButtons > 0)
6650 TOOLBAR_SetHotItemEx(infoPtr, 0, HICF_OTHER);
6651
6652 return 0;
6653}
#define HICF_OTHER
Definition: commctrl.h:1325

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetFont()

static LRESULT TOOLBAR_SetFont ( TOOLBAR_INFO infoPtr,
HFONT  hFont,
WORD  Redraw 
)
static

Definition at line 6656 of file toolbar.c.

6657{
6658 TRACE("font=%p redraw=%d\n", hFont, Redraw);
6659
6660 if (hFont == 0)
6661 infoPtr->hFont = infoPtr->hDefaultFont;
6662 else
6663 infoPtr->hFont = hFont;
6664
6665 TOOLBAR_CalcToolbar(infoPtr);
6666
6667 if (Redraw)
6668 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
6669 return 1;
6670}
HFONT hFont
Definition: main.c:53

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetHotImageList()

static LRESULT TOOLBAR_SetHotImageList ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
HIMAGELIST  himl 
)
static

Definition at line 4838 of file toolbar.c.

4839{
4840 HIMAGELIST himlTemp;
4841 INT id = 0;
4842
4843 if (infoPtr->iVersion >= 5)
4844 id = wParam;
4845
4846 TRACE("hwnd = %p, himl = %p, id = %d\n", infoPtr->hwndSelf, himl, id);
4847
4848 himlTemp = TOOLBAR_InsertImageList(&infoPtr->himlHot,
4849 &infoPtr->cimlHot, himl, id);
4850
4851 /* FIXME: redraw ? */
4852
4853 return (LRESULT)himlTemp;
4854}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetHotItem()

static LRESULT TOOLBAR_SetHotItem ( TOOLBAR_INFO infoPtr,
INT  nHotItem 
)
static

Definition at line 4915 of file toolbar.c.

4916{
4917 INT nOldHotItem = infoPtr->nHotItem;
4918
4919 TRACE("hwnd = %p, nHotItem = %d\n", infoPtr->hwndSelf, nHotItem);
4920
4921 if (nHotItem >= infoPtr->nNumButtons)
4922 return infoPtr->nHotItem;
4923
4924 if (nHotItem < 0)
4925 nHotItem = -1;
4926
4927 /* NOTE: an application can still remove the hot item even if anchor
4928 * highlighting is enabled */
4929
4930 TOOLBAR_SetHotItemEx(infoPtr, nHotItem, HICF_OTHER);
4931
4932 if (nOldHotItem < 0)
4933 return -1;
4934
4935 return (LRESULT)nOldHotItem;
4936}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetHotItem2()

static LRESULT TOOLBAR_SetHotItem2 ( TOOLBAR_INFO infoPtr,
INT  nHotItem,
LPARAM  lParam 
)
static

Definition at line 5455 of file toolbar.c.

5456{
5457 INT nOldHotItem = infoPtr->nHotItem;
5458
5459 TRACE("old item=%d, new item=%d, flags=%08x\n",
5460 nOldHotItem, nHotItem, (DWORD)lParam);
5461
5462 if (nHotItem < 0 || nHotItem > infoPtr->nNumButtons)
5463 nHotItem = -1;
5464
5465 /* NOTE: an application can still remove the hot item even if anchor
5466 * highlighting is enabled */
5467
5468 TOOLBAR_SetHotItemEx(infoPtr, nHotItem, lParam);
5469
5470 return (nOldHotItem < 0) ? -1 : (LRESULT)nOldHotItem;
5471}
#define LRESULT
Definition: ole.h:14

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetHotItemEx()

static void TOOLBAR_SetHotItemEx ( TOOLBAR_INFO infoPtr,
INT  nHit,
DWORD  dwReason 
)
static

Definition at line 4864 of file toolbar.c.

4865{
4866 if (infoPtr->nHotItem != nHit)
4867 {
4868 NMTBHOTITEM nmhotitem;
4869 TBUTTON_INFO *btnPtr = NULL, *oldBtnPtr = NULL;
4870
4871 nmhotitem.dwFlags = dwReason;
4872 if(infoPtr->nHotItem >= 0)
4873 {
4874 oldBtnPtr = &infoPtr->buttons[infoPtr->nHotItem];
4875 nmhotitem.idOld = oldBtnPtr->idCommand;
4876 }
4877 else
4878 {
4879 nmhotitem.dwFlags |= HICF_ENTERING;
4880 nmhotitem.idOld = 0;
4881 }
4882
4883 if (nHit >= 0)
4884 {
4885 btnPtr = &infoPtr->buttons[nHit];
4886 nmhotitem.idNew = btnPtr->idCommand;
4887 }
4888 else
4889 {
4890 nmhotitem.dwFlags |= HICF_LEAVING;
4891 nmhotitem.idNew = 0;
4892 }
4893
4894 /* now change the hot and invalidate the old and new buttons - if the
4895 * parent agrees */
4896 if (!TOOLBAR_SendNotify(&nmhotitem.hdr, infoPtr, TBN_HOTITEMCHANGE))
4897 {
4898 if (oldBtnPtr) {
4899 oldBtnPtr->bHot = FALSE;
4900 InvalidateRect(infoPtr->hwndSelf, &oldBtnPtr->rect, TRUE);
4901 }
4902 /* setting disabled buttons as hot fails even if the notify contains the button id */
4903 if (btnPtr && (btnPtr->fsState & TBSTATE_ENABLED)) {
4904 btnPtr->bHot = TRUE;
4905 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
4906 infoPtr->nHotItem = nHit;
4907 }
4908 else
4909 infoPtr->nHotItem = -1;
4910 }
4911 }
4912}
DWORD dwReason
Definition: misc.cpp:154
#define TBN_HOTITEMCHANGE
Definition: commctrl.h:1336
#define HICF_ENTERING
Definition: commctrl.h:1330
#define HICF_LEAVING
Definition: commctrl.h:1331

Referenced by TOOLBAR_LButtonDown(), TOOLBAR_LButtonUp(), TOOLBAR_MouseLeave(), TOOLBAR_MouseMove(), TOOLBAR_SetFocus(), TOOLBAR_SetHotItem(), TOOLBAR_SetHotItem2(), and TOOLBAR_SetRelativeHotItem().

◆ TOOLBAR_SetImageList()

static LRESULT TOOLBAR_SetImageList ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
HIMAGELIST  himl 
)
static

Definition at line 4940 of file toolbar.c.

4941{
4942 HIMAGELIST himlTemp;
4943 INT oldButtonWidth = infoPtr->nButtonWidth;
4944 INT oldBitmapWidth = infoPtr->nBitmapWidth;
4945 INT oldBitmapHeight = infoPtr->nBitmapHeight;
4946 INT i, id = 0;
4947
4948 if (infoPtr->iVersion >= 5)
4949 id = wParam;
4950
4951 himlTemp = TOOLBAR_InsertImageList(&infoPtr->himlDef,
4952 &infoPtr->cimlDef, himl, id);
4953
4954 infoPtr->nNumBitmaps = 0;
4955 for (i = 0; i < infoPtr->cimlDef; i++)
4956 infoPtr->nNumBitmaps += ImageList_GetImageCount(infoPtr->himlDef[i]->himl);
4957
4958 if (!ImageList_GetIconSize(himl, &infoPtr->nBitmapWidth,
4959 &infoPtr->nBitmapHeight))
4960 {
4961 infoPtr->nBitmapWidth = 1;
4962 infoPtr->nBitmapHeight = 1;
4963 }
4964 if ((oldBitmapWidth != infoPtr->nBitmapWidth) || (oldBitmapHeight != infoPtr->nBitmapHeight))
4965 {
4966 TOOLBAR_CalcToolbar(infoPtr);
4967 if (infoPtr->nButtonWidth < oldButtonWidth)
4968 TOOLBAR_SetButtonSize(infoPtr, MAKELONG(oldButtonWidth, infoPtr->nButtonHeight));
4969 }
4970
4971 TRACE("hwnd %p, new himl=%p, id = %d, count=%d, bitmap w=%d, h=%d\n",
4972 infoPtr->hwndSelf, infoPtr->himlDef, id, infoPtr->nNumBitmaps,
4973 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
4974
4975 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
4976
4977 return (LRESULT)himlTemp;
4978}
static LRESULT TOOLBAR_SetButtonSize(TOOLBAR_INFO *infoPtr, LPARAM lParam)
Definition: toolbar.c:4676

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetIndent()

static LRESULT TOOLBAR_SetIndent ( TOOLBAR_INFO infoPtr,
INT  nIndent 
)
static

Definition at line 4982 of file toolbar.c.

4983{
4984 infoPtr->nIndent = nIndent;
4985
4986 TRACE("\n");
4987
4988 /* process only on indent changing */
4989 if(infoPtr->nIndent != nIndent)
4990 {
4991 infoPtr->nIndent = nIndent;
4992 TOOLBAR_CalcToolbar (infoPtr);
4993 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
4994 }
4995
4996 return TRUE;
4997}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetInsertMark()

static LRESULT TOOLBAR_SetInsertMark ( TOOLBAR_INFO infoPtr,
const TBINSERTMARK lptbim 
)
static

Definition at line 5001 of file toolbar.c.

5002{
5003 TRACE("hwnd = %p, lptbim = { %d, 0x%08x}\n", infoPtr->hwndSelf, lptbim->iButton, lptbim->dwFlags);
5004
5005 if ((lptbim->dwFlags & ~TBIMHT_AFTER) != 0)
5006 {
5007 FIXME("Unrecognized flag(s): 0x%08x\n", (lptbim->dwFlags & ~TBIMHT_AFTER));
5008 return 0;
5009 }
5010
5011 if ((lptbim->iButton == -1) ||
5012 ((lptbim->iButton < infoPtr->nNumButtons) &&
5013 (lptbim->iButton >= 0)))
5014 {
5015 infoPtr->tbim = *lptbim;
5016 /* FIXME: don't need to update entire toolbar */
5017 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
5018 }
5019 else
5020 ERR("Invalid button index %d\n", lptbim->iButton);
5021
5022 return 0;
5023}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetInsertMarkColor()

static LRESULT TOOLBAR_SetInsertMarkColor ( TOOLBAR_INFO infoPtr,
COLORREF  clr 
)
static

Definition at line 5027 of file toolbar.c.

5028{
5029 infoPtr->clrInsertMark = clr;
5030
5031 /* FIXME: don't need to update entire toolbar */
5032 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
5033
5034 return 0;
5035}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetListGap()

static LRESULT TOOLBAR_SetListGap ( TOOLBAR_INFO infoPtr,
INT  iListGap 
)
static

Definition at line 5476 of file toolbar.c.

5477{
5478 TRACE("hwnd=%p iListGap=%d\n", infoPtr->hwndSelf, iListGap);
5479
5480 infoPtr->iListGap = iListGap;
5481
5482 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
5483
5484 return 0;
5485}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetMaxTextRows()

static LRESULT TOOLBAR_SetMaxTextRows ( TOOLBAR_INFO infoPtr,
INT  nMaxRows 
)
static

Definition at line 5039 of file toolbar.c.

5040{
5041 infoPtr->nMaxTextRows = nMaxRows;
5042
5043 TOOLBAR_CalcToolbar(infoPtr);
5044 return TRUE;
5045}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetPadding()

static LRESULT TOOLBAR_SetPadding ( TOOLBAR_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 5098 of file toolbar.c.

5099{
5100 DWORD oldPad;
5101
5102 oldPad = MAKELONG(infoPtr->szPadding.cx, infoPtr->szPadding.cy);
5105 TRACE("cx=%d, cy=%d\n",
5106 infoPtr->szPadding.cx, infoPtr->szPadding.cy);
5107 return (LRESULT) oldPad;
5108}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetParent()

static LRESULT TOOLBAR_SetParent ( TOOLBAR_INFO infoPtr,
HWND  hParent 
)
static

Definition at line 5112 of file toolbar.c.

5113{
5114 HWND hwndOldNotify;
5115
5116 TRACE("\n");
5117
5118 hwndOldNotify = infoPtr->hwndNotify;
5119 infoPtr->hwndNotify = hParent;
5120
5121 return (LRESULT)hwndOldNotify;
5122}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetRedraw()

static LRESULT TOOLBAR_SetRedraw ( TOOLBAR_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 6673 of file toolbar.c.

6687{
6688 BOOL oldredraw = infoPtr->bDoRedraw;
6689
6690 TRACE("set to %s\n",
6691 (wParam) ? "TRUE" : "FALSE");
6692 infoPtr->bDoRedraw = (BOOL) wParam;
6693 if (wParam) {
6694 InvalidateRect (infoPtr->hwndSelf, 0, TRUE);
6695 }
6696 return (oldredraw) ? 1 : 0;
6697}
#define BOOL
Definition: nt_native.h:43

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetRelativeHotItem()

static void TOOLBAR_SetRelativeHotItem ( TOOLBAR_INFO infoPtr,
INT  iDirection,
DWORD  dwReason 
)
static

Definition at line 5715 of file toolbar.c.

5716{
5717 INT i;
5718 INT nNewHotItem = infoPtr->nHotItem;
5719
5720 for (i = 0; i < infoPtr->nNumButtons; i++)
5721 {
5722 /* did we wrap? */
5723 if ((nNewHotItem + iDirection < 0) ||
5724 (nNewHotItem + iDirection >= infoPtr->nNumButtons))
5725 {
5726 NMTBWRAPHOTITEM nmtbwhi;
5727 nmtbwhi.idNew = infoPtr->buttons[nNewHotItem].idCommand;
5728 nmtbwhi.iDirection = iDirection;
5729 nmtbwhi.dwReason = dwReason;
5730
5731 if (TOOLBAR_SendNotify(&nmtbwhi.hdr, infoPtr, TBN_WRAPHOTITEM))
5732 return;
5733 }
5734
5735 nNewHotItem += iDirection;
5736 nNewHotItem = (nNewHotItem + infoPtr->nNumButtons) % infoPtr->nNumButtons;
5737
5738 if ((infoPtr->buttons[nNewHotItem].fsState & TBSTATE_ENABLED) &&
5739 !(infoPtr->buttons[nNewHotItem].fsStyle & BTNS_SEP))
5740 {
5741 TOOLBAR_SetHotItemEx(infoPtr, nNewHotItem, dwReason);
5742 break;
5743 }
5744 }
5745}
#define TBN_WRAPHOTITEM
Definition: commctrl.h:1347
DWORD dwReason
Definition: commctrl.h:74

Referenced by TOOLBAR_KeyDown().

◆ TOOLBAR_SetRows()

static LRESULT TOOLBAR_SetRows ( TOOLBAR_INFO infoPtr,
WPARAM  wParam,
LPRECT  lprc 
)
static

Definition at line 5126 of file toolbar.c.

5127{
5128 int rows = LOWORD(wParam);
5129 BOOL bLarger = HIWORD(wParam);
5130
5131 TRACE("\n");
5132
5133 TRACE("Setting rows to %d (%d)\n", rows, bLarger);
5134
5135 if(infoPtr->nRows != rows)
5136 {
5137 TBUTTON_INFO *btnPtr = infoPtr->buttons;
5138 int curColumn = 0; /* Current column */
5139 int curRow = 0; /* Current row */
5140 int hidden = 0; /* Number of hidden buttons */
5141 int seps = 0; /* Number of separators */
5142 int idealWrap = 0; /* Ideal wrap point */
5143 int i;
5144 BOOL wrap;
5145
5146 /*
5147 Calculate new size and wrap points - Under windows, setrows will
5148 change the dimensions if needed to show the number of requested
5149 rows (if CCS_NORESIZE is set), or will take up the whole window
5150 (if no CCS_NORESIZE).
5151
5152 Basic algorithm - If N buttons, and y rows requested, each row
5153 contains N/y buttons.
5154
5155 FIXME: Handling of separators not obvious from testing results
5156 FIXME: Take width of window into account?
5157 */
5158
5159 /* Loop through the buttons one by one counting key items */
5160 for (i = 0; i < infoPtr->nNumButtons; i++ )
5161 {
5162 btnPtr[i].fsState &= ~TBSTATE_WRAP;
5163 if (btnPtr[i].fsState & TBSTATE_HIDDEN)
5164 hidden++;
5165 else if (btnPtr[i].fsStyle & BTNS_SEP)
5166 seps++;
5167 }
5168
5169 /* FIXME: Separators make this quite complex */
5170 if (seps) FIXME("Separators unhandled\n");
5171
5172 /* Round up so more per line, i.e., less rows */
5173 idealWrap = (infoPtr->nNumButtons - hidden + (rows-1)) / (rows ? rows : 1);
5174
5175 /* Calculate ideal wrap point if we are allowed to grow, but cannot
5176 achieve the requested number of rows. */
5177 if (bLarger && idealWrap > 1)
5178 {
5179 int resRows = (infoPtr->nNumButtons + (idealWrap-1)) / idealWrap;
5180 int moreRows = (infoPtr->nNumButtons + (idealWrap-2)) / (idealWrap-1);
5181
5182 if (resRows < rows && moreRows > rows)
5183 {
5184 idealWrap--;
5185 TRACE("Changing idealWrap due to bLarger (now %d)\n", idealWrap);
5186 }
5187 }
5188
5189 curColumn = curRow = 0;
5190 wrap = FALSE;
5191 TRACE("Trying to wrap at %d (%d,%d,%d)\n", idealWrap,
5192 infoPtr->nNumButtons, hidden, rows);
5193
5194 for (i = 0; i < infoPtr->nNumButtons; i++ )
5195 {
5196 if (btnPtr[i].fsState & TBSTATE_HIDDEN)
5197 continue;
5198
5199 /* Step on, wrap if necessary or flag next to wrap */
5200 if (!wrap) {
5201 curColumn++;
5202 } else {
5203 wrap = FALSE;
5204 curColumn = 1;
5205 curRow++;
5206 }
5207
5208 if (curColumn > (idealWrap-1)) {
5209 wrap = TRUE;
5210 btnPtr[i].fsState |= TBSTATE_WRAP;
5211 }
5212 }
5213
5214 TRACE("Result - %d rows\n", curRow + 1);
5215
5216 /* recalculate toolbar */
5217 TOOLBAR_CalcToolbar (infoPtr);
5218
5219 /* Resize if necessary (Only if NORESIZE is set - odd, but basically
5220 if NORESIZE is NOT set, then the toolbar will always be resized to
5221 take up the whole window. With it set, sizing needs to be manual. */
5222 if (infoPtr->dwStyle & CCS_NORESIZE) {
5223 SetWindowPos(infoPtr->hwndSelf, NULL, 0, 0,
5224 infoPtr->rcBound.right - infoPtr->rcBound.left,
5225 infoPtr->rcBound.bottom - infoPtr->rcBound.top,
5227 }
5228
5229 /* repaint toolbar */
5230 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
5231 }
5232
5233 /* return bounding rectangle */
5234 if (lprc) {
5235 lprc->left = infoPtr->rcBound.left;
5236 lprc->right = infoPtr->rcBound.right;
5237 lprc->top = infoPtr->rcBound.top;
5238 lprc->bottom = infoPtr->rcBound.bottom;
5239 }
5240
5241 return 0;
5242}
#define wrap(journal, var)
Definition: recovery.c:207
__u32 hidden
Definition: mkdosfs.c:13
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4466

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetState()

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

Definition at line 5246 of file toolbar.c.

5247{
5248 TBUTTON_INFO *btnPtr;
5249 INT nIndex;
5250
5251 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
5252 if (nIndex == -1)
5253 return FALSE;
5254
5255 btnPtr = &infoPtr->buttons[nIndex];
5256
5257 /* if hidden state has changed the invalidate entire window and recalc */
5258 if ((btnPtr->fsState & TBSTATE_HIDDEN) != (LOWORD(lParam) & TBSTATE_HIDDEN)) {
5259 btnPtr->fsState = LOWORD(lParam);
5260 TOOLBAR_CalcToolbar (infoPtr);
5261 InvalidateRect(infoPtr->hwndSelf, 0, TRUE);
5262 return TRUE;
5263 }
5264
5265 /* process state changing if current state doesn't match new state */
5266 if(btnPtr->fsState != LOWORD(lParam))
5267 {
5268 btnPtr->fsState = LOWORD(lParam);
5269 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
5270 }
5271
5272 return TRUE;
5273}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetStyle()

static LRESULT TOOLBAR_SetStyle ( TOOLBAR_INFO infoPtr,
DWORD  style 
)
static

Definition at line 5284 of file toolbar.c.

5285{
5286 DWORD dwOldStyle = infoPtr->dwStyle;
5287
5288 TRACE("new style 0x%08x\n", style);
5289
5290 if (style & TBSTYLE_LIST)
5292 else
5293 infoPtr->dwDTFlags = DT_CENTER | DT_END_ELLIPSIS;
5294
5295 infoPtr->dwStyle = style;
5296 TOOLBAR_CheckStyle(infoPtr);
5297
5298 if ((dwOldStyle ^ style) & TBSTYLE_WRAPABLE)
5299 {
5300 if (dwOldStyle & TBSTYLE_WRAPABLE)
5301 unwrap(infoPtr);
5302 TOOLBAR_CalcToolbar(infoPtr);
5303 }
5304 else if ((dwOldStyle ^ style) & CCS_VERT)
5305 TOOLBAR_LayoutToolbar(infoPtr);
5306
5307 /* only resize if one of the CCS_* styles was changed */
5308 if ((dwOldStyle ^ style) & COMMON_STYLES)
5309 {
5310 TOOLBAR_AutoSize(infoPtr);
5311 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
5312 }
5313
5314 return 0;
5315}
static void unwrap(TOOLBAR_INFO *info)
Definition: toolbar.c:5275
#define COMMON_STYLES
Definition: toolbar.c:242

Referenced by TOOLBAR_StyleChanged(), and ToolbarWindowProc().

◆ TOOLBAR_SetToolTips()

static LRESULT TOOLBAR_SetToolTips ( TOOLBAR_INFO infoPtr,
HWND  hwndTooltip 
)
inlinestatic

Definition at line 5319 of file toolbar.c.

5320{
5321 TRACE("hwnd=%p, hwndTooltip=%p\n", infoPtr->hwndSelf, hwndTooltip);
5322
5323 infoPtr->hwndToolTip = hwndTooltip;
5324 return 0;
5325}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetUnicodeFormat()

static LRESULT TOOLBAR_SetUnicodeFormat ( TOOLBAR_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 5329 of file toolbar.c.

5330{
5331 BOOL bTemp;
5332
5333 TRACE("%s hwnd=%p\n",
5334 ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf);
5335
5336 bTemp = infoPtr->bUnicode;
5337 infoPtr->bUnicode = (BOOL)wParam;
5338
5339 return bTemp;
5340}

Referenced by TOOLBAR_SetVersion(), and ToolbarWindowProc().

◆ TOOLBAR_SetVersion()

static LRESULT TOOLBAR_SetVersion ( TOOLBAR_INFO infoPtr,
INT  iVersion 
)
static

Definition at line 5370 of file toolbar.c.

5371{
5372 INT iOldVersion = infoPtr->iVersion;
5373
5374#ifdef __REACTOS__
5375 /* The v6 control doesn't support changing its version */
5376 if (iOldVersion == 6)
5377 return iOldVersion;
5378
5379 /* And a control that is not v6 can't be set to be a v6 one */
5380 if (iVersion >= 6)
5381 return -1;
5382#endif
5383
5384 infoPtr->iVersion = iVersion;
5385
5386 if (infoPtr->iVersion >= 5)
5388
5389 return iOldVersion;
5390}
static LRESULT TOOLBAR_SetUnicodeFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:5329

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Size()

static LRESULT TOOLBAR_Size ( TOOLBAR_INFO infoPtr)
static

Definition at line 6701 of file toolbar.c.

6702{
6703 TRACE("sizing toolbar\n");
6704
6706 {
6707 RECT delta_width, delta_height, client, dummy;
6708 DWORD min_x, max_x, min_y, max_y;
6709 TBUTTON_INFO *btnPtr;
6710 INT i;
6711
6712 GetClientRect(infoPtr->hwndSelf, &client);
6713 if(client.right > infoPtr->client_rect.right)
6714 {
6715 min_x = infoPtr->client_rect.right;
6716 max_x = client.right;
6717 }
6718 else
6719 {
6720 max_x = infoPtr->client_rect.right;
6721 min_x = client.right;
6722 }
6723 if(client.bottom > infoPtr->client_rect.bottom)
6724 {
6725 min_y = infoPtr->client_rect.bottom;
6726 max_y = client.bottom;
6727 }
6728 else
6729 {
6730 max_y = infoPtr->client_rect.bottom;
6731 min_y = client.bottom;
6732 }
6733
6734 SetRect(&delta_width, min_x, 0, max_x, min_y);
6735 SetRect(&delta_height, 0, min_y, max_x, max_y);
6736
6737 TRACE("delta_width %s delta_height %s\n", wine_dbgstr_rect(&delta_width), wine_dbgstr_rect(&delta_height));
6738 btnPtr = infoPtr->buttons;
6739 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++)
6740 if(IntersectRect(&dummy, &delta_width, &btnPtr->rect) ||
6741 IntersectRect(&dummy, &delta_height, &btnPtr->rect))
6742 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
6743 }
6744 GetClientRect(infoPtr->hwndSelf, &infoPtr->client_rect);
6745 TOOLBAR_AutoSize(infoPtr);
6746 return 0;
6747}
static FILE * client
Definition: client.c:41

Referenced by ToolbarWindowProc().

◆ TOOLBAR_StyleChanged()

static LRESULT TOOLBAR_StyleChanged ( TOOLBAR_INFO infoPtr,
INT  nType,
const STYLESTRUCT lpStyle 
)
static

Definition at line 6751 of file toolbar.c.

6752{
6753 if (nType == GWL_STYLE)
6754 return TOOLBAR_SetStyle(infoPtr, lpStyle->styleNew);
6755
6756 return 0;
6757}
static LRESULT TOOLBAR_SetStyle(TOOLBAR_INFO *infoPtr, DWORD style)
Definition: toolbar.c:5284
DWORD styleNew
Definition: winuser.h:3693

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SysColorChange()

static LRESULT TOOLBAR_SysColorChange ( void  )
static

Definition at line 6761 of file toolbar.c.

6762{
6764
6765 return 0;
6766}
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1586

Referenced by ToolbarWindowProc().

◆ TOOLBAR_TooltipAddTool()

static void TOOLBAR_TooltipAddTool ( const TOOLBAR_INFO infoPtr,
const TBUTTON_INFO button 
)
static

Definition at line 2166 of file toolbar.c.

2167{
2168 if (infoPtr->hwndToolTip && !(button->fsStyle & BTNS_SEP)) {
2169 TTTOOLINFOW ti;
2170
2171 ZeroMemory(&ti, sizeof(TTTOOLINFOW));
2172 ti.cbSize = sizeof (TTTOOLINFOW);
2173 ti.hwnd = infoPtr->hwndSelf;
2174 ti.uId = button->idCommand;
2175 ti.hinst = 0;
2177 /* ti.lParam = random value from the stack? */
2178
2180 0, (LPARAM)&ti);
2181 }
2182}
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2380
struct tagTOOLINFOW TTTOOLINFOW
#define TTM_ADDTOOLW
Definition: commctrl.h:1787
HINSTANCE hinst
Definition: commctrl.h:1745
UINT_PTR uId
Definition: commctrl.h:1743
LPWSTR lpszText
Definition: commctrl.h:1746

Referenced by TOOLBAR_InternalInsertButtonsT(), and TOOLBAR_TooltipCreateControl().

◆ TOOLBAR_TooltipCreateControl()

static void TOOLBAR_TooltipCreateControl ( TOOLBAR_INFO infoPtr)
static

Definition at line 2217 of file toolbar.c.

2218{
2219 int i;
2220 NMTOOLTIPSCREATED nmttc;
2221
2224 infoPtr->hwndSelf, 0, 0, 0);
2225
2226 if (!infoPtr->hwndToolTip)
2227 return;
2228
2229 /* Send NM_TOOLTIPSCREATED notification */
2230 nmttc.hwndToolTips = infoPtr->hwndToolTip;
2231 TOOLBAR_SendNotify(&nmttc.hdr, infoPtr, NM_TOOLTIPSCREATED);
2232
2233 for (i = 0; i < infoPtr->nNumButtons; i++)
2234 {
2235 TOOLBAR_TooltipAddTool(infoPtr, &infoPtr->buttons[i]);
2236 TOOLBAR_TooltipSetRect(infoPtr, &infoPtr->buttons[i]);
2237 }
2238}
#define WS_POPUP
Definition: pedump.c:616
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1707
#define NM_TOOLTIPSCREATED
Definition: commctrl.h:144
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define CW_USEDEFAULT
Definition: winuser.h:225

Referenced by TOOLBAR_GetToolTips(), and TOOLBAR_MouseMove().

◆ TOOLBAR_TooltipDelTool()

static void TOOLBAR_TooltipDelTool ( const TOOLBAR_INFO infoPtr,
const TBUTTON_INFO button 
)
static

Definition at line 2185 of file toolbar.c.

2186{
2187 if ((infoPtr->hwndToolTip) && !(button->fsStyle & BTNS_SEP)) {
2188 TTTOOLINFOW ti;
2189
2190 ZeroMemory(&ti, sizeof(ti));
2191 ti.cbSize = sizeof(ti);
2192 ti.hwnd = infoPtr->hwndSelf;
2193 ti.uId = button->idCommand;
2194
2195 SendMessageW(infoPtr->hwndToolTip, TTM_DELTOOLW, 0, (LPARAM)&ti);
2196 }
2197}
#define TTM_DELTOOLW
Definition: commctrl.h:1789

Referenced by TOOLBAR_DeleteAllButtons(), and TOOLBAR_DeleteButton().

◆ TOOLBAR_TooltipSetRect()

static void TOOLBAR_TooltipSetRect ( const TOOLBAR_INFO infoPtr,
const TBUTTON_INFO button 
)
static

Definition at line 2199 of file toolbar.c.

2200{
2201 /* Set the toolTip only for non-hidden, non-separator button */
2202 if (infoPtr->hwndToolTip && !(button->fsStyle & BTNS_SEP))
2203 {
2204 TTTOOLINFOW ti;
2205
2206 ZeroMemory(&ti, sizeof(ti));
2207 ti.cbSize = sizeof(ti);
2208 ti.hwnd = infoPtr->hwndSelf;
2209 ti.uId = button->idCommand;
2210 ti.rect = button->rect;
2211 SendMessageW(infoPtr->hwndToolTip, TTM_NEWTOOLRECTW, 0, (LPARAM)&ti);
2212 }
2213}
#define TTM_NEWTOOLRECTW
Definition: commctrl.h:1791

Referenced by TOOLBAR_LayoutToolbar(), and TOOLBAR_TooltipCreateControl().

◆ TOOLBAR_TranslateState()

static UINT TOOLBAR_TranslateState ( const TBUTTON_INFO btnPtr)
static

Definition at line 789 of file toolbar.c.

790{
791 UINT retstate = 0;
792
793 retstate |= (btnPtr->fsState & TBSTATE_CHECKED) ? CDIS_CHECKED : 0;
794 retstate |= (btnPtr->fsState & TBSTATE_PRESSED) ? CDIS_SELECTED : 0;
795 retstate |= (btnPtr->fsState & TBSTATE_ENABLED) ? 0 : CDIS_DISABLED;
796 retstate |= (btnPtr->fsState & TBSTATE_MARKED ) ? CDIS_MARKED : 0;
797 retstate |= (btnPtr->bHot ) ? CDIS_HOT : 0;
799 /* NOTE: we don't set CDIS_GRAYED, CDIS_FOCUS, CDIS_DEFAULT */
800 return retstate;
801}

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_TTGetDispInfo()

static LRESULT TOOLBAR_TTGetDispInfo ( TOOLBAR_INFO infoPtr,
NMTTDISPINFOW lpnmtdi 
)
static

Definition at line 6426 of file toolbar.c.

6427{
6428 int index = TOOLBAR_GetButtonIndex(infoPtr, lpnmtdi->hdr.idFrom, FALSE);
6429
6430 TRACE("button index = %d\n", index);
6431
6432 Free (infoPtr->pszTooltipText);
6433 infoPtr->pszTooltipText = NULL;
6434
6435 if (index < 0)
6436 return 0;
6437
6438 if (infoPtr->bUnicode)
6439 {
6440 WCHAR wszBuffer[INFOTIPSIZE+1];
6441 NMTBGETINFOTIPW tbgit;
6442 unsigned int len; /* in chars */
6443
6444 wszBuffer[0] = '\0';
6445 wszBuffer[INFOTIPSIZE] = '\0';
6446
6447 tbgit.pszText = wszBuffer;
6448 tbgit.cchTextMax = INFOTIPSIZE;
6449 tbgit.iItem = lpnmtdi->hdr.idFrom;
6450 tbgit.lParam = infoPtr->buttons[index].dwData;
6451
6452 TOOLBAR_SendNotify(&tbgit.hdr, infoPtr, TBN_GETINFOTIPW);
6453
6454 TRACE("TBN_GETINFOTIPW - got string %s\n", debugstr_w(tbgit.pszText));
6455
6456 len = strlenW(tbgit.pszText);
6457 if (len > ARRAY_SIZE(lpnmtdi->szText) - 1)
6458 {
6459 /* need to allocate temporary buffer in infoPtr as there
6460 * isn't enough space in buffer passed to us by the
6461 * tooltip control */
6462 infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR));
6463 if (infoPtr->pszTooltipText)
6464 {
6465 memcpy(infoPtr->pszTooltipText, tbgit.pszText, (len+1)*sizeof(WCHAR));
6466 lpnmtdi->lpszText = infoPtr->pszTooltipText;
6467 return 0;
6468 }
6469 }
6470 else if (len > 0)
6471 {
6472 memcpy(lpnmtdi->lpszText, tbgit.pszText, (len+1)*sizeof(WCHAR));
6473 return 0;
6474 }
6475 }
6476 else
6477 {
6478 CHAR szBuffer[INFOTIPSIZE+1];
6479 NMTBGETINFOTIPA tbgit;
6480 unsigned int len; /* in chars */
6481
6482 szBuffer[0] = '\0';
6483 szBuffer[INFOTIPSIZE] = '\0';
6484
6485 tbgit.pszText = szBuffer;
6486 tbgit.cchTextMax = INFOTIPSIZE;
6487 tbgit.iItem = lpnmtdi->hdr.idFrom;
6488 tbgit.lParam = infoPtr->buttons[index].dwData;
6489
6490 TOOLBAR_SendNotify(&tbgit.hdr, infoPtr, TBN_GETINFOTIPA);
6491
6492 TRACE("TBN_GETINFOTIPA - got string %s\n", debugstr_a(tbgit.pszText));
6493
6494 len = MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, NULL, 0);
6495 if (len > ARRAY_SIZE(lpnmtdi->szText))
6496 {
6497 /* need to allocate temporary buffer in infoPtr as there
6498 * isn't enough space in buffer passed to us by the
6499 * tooltip control */
6500 infoPtr->pszTooltipText = Alloc(len*sizeof(WCHAR));
6501 if (infoPtr->pszTooltipText)
6502 {
6503 MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, infoPtr->pszTooltipText, len);
6504 lpnmtdi->lpszText = infoPtr->pszTooltipText;
6505 return 0;
6506 }
6507 }
6508 else if (tbgit.pszText && tbgit.pszText[0])
6509 {
6510 MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, lpnmtdi->lpszText, ARRAY_SIZE(lpnmtdi->szText));
6511 return 0;
6512 }
6513 }
6514
6515 /* if button has text, but it is not shown then automatically
6516 * use that text as tooltip */
6517 if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) &&
6518 !(infoPtr->buttons[index].fsStyle & BTNS_SHOWTEXT))
6519 {
6520 LPWSTR pszText = TOOLBAR_GetText(infoPtr, &infoPtr->buttons[index]);
6521 unsigned int len = pszText ? strlenW(pszText) : 0;
6522
6523 TRACE("using button hidden text %s\n", debugstr_w(pszText));
6524
6525 if (len > ARRAY_SIZE(lpnmtdi->szText) - 1)
6526 {
6527 /* need to allocate temporary buffer in infoPtr as there
6528 * isn't enough space in buffer passed to us by the
6529 * tooltip control */
6530 infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR));
6531 if (infoPtr->pszTooltipText)
6532 {
6533 memcpy(infoPtr->pszTooltipText, pszText, (len+1)*sizeof(WCHAR));
6534 lpnmtdi->lpszText = infoPtr->pszTooltipText;
6535 return 0;
6536 }
6537 }
6538 else if (len > 0)
6539 {
6540 memcpy(lpnmtdi->lpszText, pszText, (len+1)*sizeof(WCHAR));
6541 return 0;
6542 }
6543 }
6544
6545 TRACE("Sending tooltip notification to %p\n", infoPtr->hwndNotify);
6546
6547 /* last resort: send notification on to app */
6548 /* FIXME: find out what is really used here */
6549 return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmtdi->hdr.idFrom, (LPARAM)lpnmtdi);
6550}
#define INFOTIPSIZE
Definition: commctrl.h:124
#define TBN_GETINFOTIPA
Definition: commctrl.h:1341
#define TBN_GETINFOTIPW
Definition: commctrl.h:1342
WCHAR szText[80]
Definition: commctrl.h:1907

Referenced by TOOLBAR_Notify().

◆ TOOLBAR_Unkwn464()

static LRESULT TOOLBAR_Unkwn464 ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 5545 of file toolbar.c.

5546{
5547 FIXME("hwnd=%p wParam %08lx lParam %08lx\n", hwnd, wParam, lParam);
5548
5550 return 1;
5551}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Unregister()

VOID TOOLBAR_Unregister ( void  )

Definition at line 7237 of file toolbar.c.

7238{
7240}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by DllMain().

◆ TOOLBAR_WrapToolbar()

static void TOOLBAR_WrapToolbar ( TOOLBAR_INFO infoPtr)
static

Definition at line 1470 of file toolbar.c.

1471{
1472 TBUTTON_INFO *btnPtr;
1473 INT x, cx, i, j, width;
1474 BOOL bButtonWrap;
1475
1476 /* When the toolbar window style is not TBSTYLE_WRAPABLE, */
1477 /* no layout is necessary. Applications may use this style */
1478 /* to perform their own layout on the toolbar. */
1479 if( !(infoPtr->dwStyle & TBSTYLE_WRAPABLE) &&
1480 !(infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL) ) return;
1481
1482#ifdef __REACTOS__ /* workaround CORE-16169 part 1 of 2 */
1483 /* if width is zero then return */
1484 if (infoPtr->client_rect.right == 0) return;
1485#endif
1486
1487 btnPtr = infoPtr->buttons;
1488 x = infoPtr->nIndent;
1489 width = infoPtr->client_rect.right - infoPtr->client_rect.left;
1490
1491 bButtonWrap = FALSE;
1492
1493 TRACE("start ButtonWidth=%d, BitmapWidth=%d, width=%d, nIndent=%d\n",
1494 infoPtr->nButtonWidth, infoPtr->nBitmapWidth, width,
1495 infoPtr->nIndent);
1496
1497 for (i = 0; i < infoPtr->nNumButtons; i++ )
1498 {
1499 btnPtr[i].fsState &= ~TBSTATE_WRAP;
1500
1501 if (btnPtr[i].fsState & TBSTATE_HIDDEN)
1502 continue;
1503
1504 if (btnPtr[i].cx > 0)
1505 cx = btnPtr[i].cx;
1506 /* horizontal separators are treated as buttons for width */
1507 else if ((btnPtr[i].fsStyle & BTNS_SEP) &&
1508 !(infoPtr->dwStyle & CCS_VERT))
1509 cx = (btnPtr[i].iBitmap > 0) ? btnPtr[i].iBitmap : SEPARATOR_WIDTH;
1510 else
1511 cx = infoPtr->nButtonWidth;
1512
1513 if (!btnPtr[i].cx && button_has_ddarrow( infoPtr, btnPtr + i ))
1514 cx += DDARROW_WIDTH;
1515
1516 /* Two or more adjacent separators form a separator group. */
1517 /* The first separator in a group should be wrapped to the */
1518 /* next row if the previous wrapping is on a button. */
1519 if( bButtonWrap &&
1520 (btnPtr[i].fsStyle & BTNS_SEP) &&
1521 (i + 1 < infoPtr->nNumButtons ) &&
1522 (btnPtr[i + 1].fsStyle & BTNS_SEP) )
1523 {
1524 TRACE("wrap point 1 btn %d style %02x\n", i, btnPtr[i].fsStyle);
1525 btnPtr[i].fsState |= TBSTATE_WRAP;
1526 x = infoPtr->nIndent;
1527 i++;
1528 bButtonWrap = FALSE;
1529 continue;
1530 }
1531
1532 /* The layout makes sure the bitmap is visible, but not the button. */
1533 /* Test added to also wrap after a button that starts a row but */
1534 /* is bigger than the area. - GA 8/01 */
1535 if ((x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 > width) ||
1536 ((x == infoPtr->nIndent) && (cx > width)))
1537 {
1538 BOOL bFound = FALSE;
1539
1540 /* If the current button is a separator and not hidden, */
1541 /* go to the next until it reaches a non separator. */
1542 /* Wrap the last separator if it is before a button. */
1543 while( ( ((btnPtr[i].fsStyle & BTNS_SEP) &&
1544 !(btnPtr[i].fsStyle & BTNS_DROPDOWN)) ||
1545 (btnPtr[i].fsState & TBSTATE_HIDDEN) ) &&
1546 i < infoPtr->nNumButtons )
1547 {
1548 i++;
1549 bFound = TRUE;
1550 }
1551
1552 if( bFound && i < infoPtr->nNumButtons )
1553 {
1554 i--;
1555 TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n",
1556 i, btnPtr[i].fsStyle, x, cx);
1557 btnPtr[i].fsState |= TBSTATE_WRAP;
1558 x = infoPtr->nIndent;
1559 bButtonWrap = FALSE;
1560 continue;
1561 }
1562 else if ( i >= infoPtr->nNumButtons)
1563 break;
1564
1565 /* If the current button is not a separator, find the last */
1566 /* separator and wrap it. */
1567 for ( j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--)
1568 {
1569 if ((btnPtr[j].fsStyle & BTNS_SEP) &&
1570 !(btnPtr[j].fsState & TBSTATE_HIDDEN))
1571 {
1572 bFound = TRUE;
1573 i = j;
1574 TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n",
1575 i, btnPtr[i].fsStyle, x, cx);
1576 x = infoPtr->nIndent;
1577 btnPtr[j].fsState |= TBSTATE_WRAP;
1578 bButtonWrap = FALSE;
1579 break;
1580 }
1581 }
1582
1583 /* If no separator available for wrapping, wrap one of */
1584 /* non-hidden previous button. */
1585 if (!bFound)
1586 {
1587 for ( j = i - 1;
1588 j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--)
1589 {
1590 if (btnPtr[j].fsState & TBSTATE_HIDDEN)
1591 continue;
1592
1593 bFound = TRUE;
1594 i = j;
1595 TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n",
1596 i, btnPtr[i].fsStyle, x, cx);
1597 x = infoPtr->nIndent;
1598 btnPtr[j].fsState |= TBSTATE_WRAP;
1599 bButtonWrap = TRUE;
1600 break;
1601 }
1602 }
1603
1604 /* If all above failed, wrap the current button. */
1605 if (!bFound)
1606 {
1607 TRACE("wrap point 5 btn %d style %02x, x=%d, cx=%d\n",
1608 i, btnPtr[i].fsStyle, x, cx);
1609 btnPtr[i].fsState |= TBSTATE_WRAP;
1610 x = infoPtr->nIndent;
1611 if (btnPtr[i].fsStyle & BTNS_SEP )
1612 bButtonWrap = FALSE;
1613 else
1614 bButtonWrap = TRUE;
1615 }
1616 }
1617 else {
1618 TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n",
1619 i, btnPtr[i].fsStyle, x, cx);
1620 x += cx;
1621 }
1622 }
1623}
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 GLint GLint j
Definition: glfuncs.h:250

Referenced by TOOLBAR_LayoutToolbar().

◆ ToolbarWindowProc()

static LRESULT WINAPI ToolbarWindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6794 of file toolbar.c.

6795{
6797
6798 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n",
6799 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
6800
6801 if (!infoPtr && (uMsg != WM_NCCREATE))
6802 return DefWindowProcW( hwnd, uMsg, wParam, lParam );
6803
6804 switch (uMsg)
6805 {
6806 case TB_ADDBITMAP:
6807 return TOOLBAR_AddBitmap (infoPtr, (INT)wParam, (TBADDBITMAP*)lParam);
6808
6809 case TB_ADDBUTTONSA:
6810 case TB_ADDBUTTONSW:
6811 return TOOLBAR_AddButtonsT (infoPtr, wParam, (LPTBBUTTON)lParam,
6812 uMsg == TB_ADDBUTTONSW);
6813 case TB_ADDSTRINGA:
6814 return TOOLBAR_AddStringA (infoPtr, (HINSTANCE)wParam, lParam);
6815
6816 case TB_ADDSTRINGW:
6817 return TOOLBAR_AddStringW (infoPtr, (HINSTANCE)wParam, lParam);
6818
6819 case TB_AUTOSIZE:
6820 return TOOLBAR_AutoSize (infoPtr);
6821
6822 case TB_BUTTONCOUNT:
6823 return TOOLBAR_ButtonCount (infoPtr);
6824
6826 return TOOLBAR_ButtonStructSize (infoPtr, wParam);
6827
6828 case TB_CHANGEBITMAP:
6829 return TOOLBAR_ChangeBitmap (infoPtr, wParam, LOWORD(lParam));
6830
6831 case TB_CHECKBUTTON:
6832 return TOOLBAR_CheckButton (infoPtr, wParam, lParam);
6833
6834 case TB_COMMANDTOINDEX:
6835 return TOOLBAR_CommandToIndex (infoPtr, wParam);
6836
6837 case TB_CUSTOMIZE:
6838 return TOOLBAR_Customize (infoPtr);
6839
6840 case TB_DELETEBUTTON:
6841 return TOOLBAR_DeleteButton (infoPtr, wParam);
6842
6843 case TB_ENABLEBUTTON:
6844 return TOOLBAR_EnableButton (infoPtr, wParam, lParam);
6845
6847 return TOOLBAR_GetAnchorHighlight (infoPtr);
6848
6849 case TB_GETBITMAP:
6850 return TOOLBAR_GetBitmap (infoPtr, wParam);
6851
6852 case TB_GETBITMAPFLAGS:
6853 return TOOLBAR_GetBitmapFlags ();
6854
6855 case TB_GETBUTTON:
6856 return TOOLBAR_GetButton (infoPtr, wParam, (TBBUTTON*)lParam);
6857
6858 case TB_GETBUTTONINFOA:
6859 case TB_GETBUTTONINFOW:
6861 uMsg == TB_GETBUTTONINFOW);
6862 case TB_GETBUTTONSIZE:
6863 return TOOLBAR_GetButtonSize (infoPtr);
6864
6865 case TB_GETBUTTONTEXTA:
6866 case TB_GETBUTTONTEXTW:
6867 return TOOLBAR_GetButtonText (infoPtr, wParam, (LPWSTR)lParam,
6868 uMsg == TB_GETBUTTONTEXTW);
6869
6871 return TOOLBAR_GetDisabledImageList (infoPtr, wParam);
6872
6874 return TOOLBAR_GetExtendedStyle (infoPtr);
6875
6876 case TB_GETHOTIMAGELIST:
6877 return TOOLBAR_GetHotImageList (infoPtr, wParam);
6878
6879 case TB_GETHOTITEM:
6880 return TOOLBAR_GetHotItem (infoPtr);
6881
6882 case TB_GETIMAGELIST:
6883 return TOOLBAR_GetDefImageList (infoPtr, wParam);
6884
6885 case TB_GETINSERTMARK:
6886 return TOOLBAR_GetInsertMark (infoPtr, (TBINSERTMARK*)lParam);
6887
6889 return TOOLBAR_GetInsertMarkColor (infoPtr);
6890
6891 case TB_GETITEMRECT:
6892 return TOOLBAR_GetItemRect (infoPtr, wParam, (LPRECT)lParam);
6893
6894 case TB_GETMAXSIZE:
6895 return TOOLBAR_GetMaxSize (infoPtr, (LPSIZE)lParam);
6896#ifdef __REACTOS__
6897 case TB_GETMETRICS:
6898 return TOOLBAR_GetMetrics (infoPtr, (TBMETRICS*)lParam);
6899#endif
6900
6901/* case TB_GETOBJECT: */ /* 4.71 */
6902
6903 case TB_GETPADDING:
6904 return TOOLBAR_GetPadding (infoPtr);
6905
6906 case TB_GETRECT:
6907 return TOOLBAR_GetRect (infoPtr, wParam, (LPRECT)lParam);
6908
6909 case TB_GETROWS:
6910 return TOOLBAR_GetRows (infoPtr);
6911
6912 case TB_GETSTATE:
6913 return TOOLBAR_GetState (infoPtr, wParam);
6914
6915 case TB_GETSTRINGA:
6916 return TOOLBAR_GetStringA (infoPtr, wParam, (LPSTR)lParam);
6917
6918 case TB_GETSTRINGW:
6919 return TOOLBAR_GetStringW (infoPtr, wParam, (LPWSTR)lParam);
6920
6921 case TB_GETSTYLE:
6922 return TOOLBAR_GetStyle (infoPtr);
6923
6924 case TB_GETTEXTROWS:
6925 return TOOLBAR_GetTextRows (infoPtr);
6926
6927 case TB_GETTOOLTIPS:
6928 return TOOLBAR_GetToolTips (infoPtr);
6929
6931 return TOOLBAR_GetUnicodeFormat (infoPtr);
6932
6933 case TB_HIDEBUTTON:
6934 return TOOLBAR_HideButton (infoPtr, wParam, LOWORD(lParam));
6935
6936 case TB_HITTEST:
6937 return TOOLBAR_HitTest (infoPtr, (LPPOINT)lParam);
6938
6939 case TB_INDETERMINATE:
6940 return TOOLBAR_Indeterminate (infoPtr, wParam, LOWORD(lParam));
6941
6942 case TB_INSERTBUTTONA:
6943 case TB_INSERTBUTTONW:
6944 return TOOLBAR_InsertButtonT(infoPtr, wParam, (TBBUTTON*)lParam,
6945 uMsg == TB_INSERTBUTTONW);
6946
6947/* case TB_INSERTMARKHITTEST: */ /* 4.71 */
6948
6949 case TB_ISBUTTONCHECKED:
6950 return TOOLBAR_IsButtonChecked (infoPtr, wParam);
6951
6952 case TB_ISBUTTONENABLED:
6953 return TOOLBAR_IsButtonEnabled (infoPtr, wParam);
6954
6955 case TB_ISBUTTONHIDDEN:
6956 return TOOLBAR_IsButtonHidden (infoPtr, wParam);
6957
6959 return TOOLBAR_IsButtonHighlighted (infoPtr, wParam);
6960
6962 return TOOLBAR_IsButtonIndeterminate (infoPtr, wParam);
6963
6964 case TB_ISBUTTONPRESSED:
6965 return TOOLBAR_IsButtonPressed (infoPtr, wParam);
6966
6967 case TB_LOADIMAGES:
6968 return TOOLBAR_LoadImages (infoPtr, wParam, (HINSTANCE)lParam);
6969
6970 case TB_MAPACCELERATORA:
6971 case TB_MAPACCELERATORW:
6972 return TOOLBAR_MapAccelerator (infoPtr, wParam, (UINT*)lParam);
6973
6974 case TB_MARKBUTTON:
6975 return TOOLBAR_MarkButton (infoPtr, wParam, LOWORD(lParam));
6976
6977 case TB_MOVEBUTTON:
6978 return TOOLBAR_MoveButton (infoPtr, wParam, lParam);
6979
6980 case TB_PRESSBUTTON:
6981 return TOOLBAR_PressButton (infoPtr, wParam, LOWORD(lParam));
6982
6983 case TB_REPLACEBITMAP:
6985
6986 case TB_SAVERESTOREA:
6988
6989 case TB_SAVERESTOREW:
6991
6993 return TOOLBAR_SetAnchorHighlight (infoPtr, (BOOL)wParam);
6994
6995 case TB_SETBITMAPSIZE:
6996 return TOOLBAR_SetBitmapSize (infoPtr, wParam, lParam);
6997
6998 case TB_SETBUTTONINFOA:
6999 case TB_SETBUTTONINFOW:
7001 uMsg == TB_SETBUTTONINFOW);
7002 case TB_SETBUTTONSIZE:
7003 return TOOLBAR_SetButtonSize (infoPtr, lParam);
7004
7005 case TB_SETBUTTONWIDTH:
7006 return TOOLBAR_SetButtonWidth (infoPtr, lParam);
7007
7008 case TB_SETCMDID:
7009 return TOOLBAR_SetCmdId (infoPtr, wParam, lParam);
7010
7013
7015 return TOOLBAR_SetDrawTextFlags (infoPtr, wParam, lParam);
7016
7018 return TOOLBAR_SetExtendedStyle (infoPtr, wParam, lParam);
7019
7020 case TB_SETHOTIMAGELIST:
7021 return TOOLBAR_SetHotImageList (infoPtr, wParam, (HIMAGELIST)lParam);
7022
7023 case TB_SETHOTITEM:
7024 return TOOLBAR_SetHotItem (infoPtr, wParam);
7025
7026 case TB_SETIMAGELIST:
7027 return TOOLBAR_SetImageList (infoPtr, wParam, (HIMAGELIST)lParam);
7028
7029 case TB_SETINDENT:
7030 return TOOLBAR_SetIndent (infoPtr, wParam);
7031
7032 case TB_SETINSERTMARK:
7033 return TOOLBAR_SetInsertMark (infoPtr, (TBINSERTMARK*)lParam);
7034
7036 return TOOLBAR_SetInsertMarkColor (infoPtr, lParam);
7037
7038 case TB_SETMAXTEXTROWS:
7039 return TOOLBAR_SetMaxTextRows (infoPtr, wParam);
7040
7041#ifdef __REACTOS__
7042 case TB_SETMETRICS:
7043 return TOOLBAR_SetMetrics (infoPtr, (TBMETRICS*)lParam);
7044#endif
7045
7046 case TB_SETPADDING:
7047 return TOOLBAR_SetPadding (infoPtr, lParam);
7048
7049 case TB_SETPARENT:
7050 return TOOLBAR_SetParent (infoPtr, (HWND)wParam);
7051
7052 case TB_SETROWS:
7053 return TOOLBAR_SetRows (infoPtr, wParam, (LPRECT)lParam);
7054
7055 case TB_SETSTATE:
7056 return TOOLBAR_SetState (infoPtr, wParam, lParam);
7057
7058 case TB_SETSTYLE:
7059 return TOOLBAR_SetStyle (infoPtr, lParam);
7060
7061 case TB_SETTOOLTIPS:
7062 return TOOLBAR_SetToolTips (infoPtr, (HWND)wParam);
7063
7065 return TOOLBAR_SetUnicodeFormat (infoPtr, wParam);
7066
7067 case TB_SETBOUNDINGSIZE:
7069
7070 case TB_SETHOTITEM2:
7071 return TOOLBAR_SetHotItem2 (infoPtr, wParam, lParam);
7072
7073 case TB_SETLISTGAP:
7074 return TOOLBAR_SetListGap(infoPtr, wParam);
7075
7077 return TOOLBAR_GetImageListCount(infoPtr);
7078
7079 case TB_GETIDEALSIZE:
7080 return TOOLBAR_GetIdealSize (infoPtr, wParam, lParam);
7081
7082 case TB_UNKWN464:
7084
7085/* Common Control Messages */
7086
7087/* case TB_GETCOLORSCHEME: */ /* identical to CCM_ */
7088 case CCM_GETCOLORSCHEME:
7089 return TOOLBAR_GetColorScheme (infoPtr, (LPCOLORSCHEME)lParam);
7090
7091/* case TB_SETCOLORSCHEME: */ /* identical to CCM_ */
7092 case CCM_SETCOLORSCHEME:
7093 return TOOLBAR_SetColorScheme (infoPtr, (LPCOLORSCHEME)lParam);
7094
7095 case CCM_GETVERSION:
7096 return TOOLBAR_GetVersion (infoPtr);
7097
7098 case CCM_SETVERSION:
7099 return TOOLBAR_SetVersion (infoPtr, (INT)wParam);
7100
7101
7102/* case WM_CHAR: */
7103
7104 case WM_CREATE:
7106
7107 case WM_DESTROY:
7108 return TOOLBAR_Destroy (infoPtr);
7109
7110 case WM_ERASEBKGND:
7111 return TOOLBAR_EraseBackground (infoPtr, wParam, lParam);
7112
7113 case WM_GETFONT:
7114 return TOOLBAR_GetFont (infoPtr);
7115
7116 case WM_KEYDOWN:
7117 return TOOLBAR_KeyDown (infoPtr, wParam, lParam);
7118
7119/* case WM_KILLFOCUS: */
7120
7121 case WM_LBUTTONDBLCLK:
7122 return TOOLBAR_LButtonDblClk (infoPtr, wParam, lParam);
7123
7124 case WM_LBUTTONDOWN:
7125 return TOOLBAR_LButtonDown (infoPtr, wParam, lParam);
7126
7127 case WM_LBUTTONUP:
7128 return TOOLBAR_LButtonUp (infoPtr, wParam, lParam);
7129
7130 case WM_RBUTTONUP:
7131 return TOOLBAR_RButtonUp (infoPtr, wParam, lParam);
7132
7133 case WM_RBUTTONDBLCLK:
7134 return TOOLBAR_RButtonDblClk (infoPtr, wParam, lParam);
7135
7136 case WM_MOUSEMOVE:
7137 return TOOLBAR_MouseMove (infoPtr, wParam, lParam);
7138
7139 case WM_MOUSELEAVE:
7140 return TOOLBAR_MouseLeave (infoPtr);
7141
7142 case WM_CAPTURECHANGED:
7143 if (hwnd == (HWND)lParam) return 0;
7144 return TOOLBAR_CaptureChanged(infoPtr);
7145
7146 case WM_NCACTIVATE:
7148
7149 case WM_NCCALCSIZE:
7151
7152 case WM_NCCREATE:
7153#ifdef __REACTOS__
7155#else
7157#endif
7158
7159 case WM_NCPAINT:
7160 return TOOLBAR_NCPaint (hwnd, wParam, lParam);
7161
7162 case WM_NOTIFY:
7163 return TOOLBAR_Notify (infoPtr, (LPNMHDR)lParam);
7164
7165 case WM_NOTIFYFORMAT:
7166 return TOOLBAR_NotifyFormat (infoPtr, wParam, lParam);
7167
7168 case WM_PRINTCLIENT:
7169 case WM_PAINT:
7170 return TOOLBAR_Paint (infoPtr, wParam);
7171
7172 case WM_SETFOCUS:
7173 return TOOLBAR_SetFocus (infoPtr);
7174
7175 case WM_SETFONT:
7176 return TOOLBAR_SetFont(infoPtr, (HFONT)wParam, (WORD)lParam);
7177
7178 case WM_SETREDRAW:
7179 return TOOLBAR_SetRedraw (infoPtr, wParam);
7180
7181 case WM_SIZE:
7182 return TOOLBAR_Size (infoPtr);
7183
7184 case WM_STYLECHANGED:
7185 return TOOLBAR_StyleChanged (infoPtr, (INT)wParam, (LPSTYLESTRUCT)lParam);
7186
7187 case WM_SYSCOLORCHANGE:
7188 return TOOLBAR_SysColorChange ();
7189 case WM_THEMECHANGED:
7190#ifdef __REACTOS__
7191 return theme_changed (infoPtr);
7192#else
7193 return theme_changed (hwnd);
7194#endif
7195
7196/* case WM_WININICHANGE: */
7197
7198 case WM_CHARTOITEM:
7199 case WM_COMMAND:
7200 case WM_DRAWITEM:
7201 case WM_MEASUREITEM:
7202 case WM_VKEYTOITEM:
7203 return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);
7204
7205 /* We see this in Outlook Express 5.x and just does DefWindowProc */
7206 case PGM_FORWARDMOUSE:
7207 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
7208
7209 default:
7210 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
7211 ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
7212 uMsg, wParam, lParam);
7213 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
7214 }
7215}
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1748
static LRESULT TOOLBAR_SetRedraw(TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:6673
static LRESULT TOOLBAR_NCActivate(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6286
static LRESULT TOOLBAR_SetCmdId(TOOLBAR_INFO *infoPtr, INT nIndex, INT nId)
Definition: toolbar.c:4755
static LRESULT TOOLBAR_GetStringA(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPSTR str)
Definition: toolbar.c:5394
static LRESULT TOOLBAR_SetRows(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPRECT lprc)
Definition: toolbar.c:5126
static LRESULT TOOLBAR_IsButtonPressed(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:4041
static LRESULT TOOLBAR_GetStringW(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPWSTR str)
Definition: toolbar.c:5417
static LRESULT TOOLBAR_GetColorScheme(const TOOLBAR_INFO *infoPtr, LPCOLORSCHEME lParam)
Definition: toolbar.c:5344
static LRESULT TOOLBAR_SetPadding(TOOLBAR_INFO *infoPtr, LPARAM lParam)
Definition: toolbar.c:5098
static LRESULT TOOLBAR_SetHotItem(TOOLBAR_INFO *infoPtr, INT nHotItem)
Definition: toolbar.c:4915
static LRESULT TOOLBAR_SetToolTips(TOOLBAR_INFO *infoPtr, HWND hwndTooltip)
Definition: toolbar.c:5319
static LRESULT TOOLBAR_SetBitmapSize(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:4579
static LRESULT TOOLBAR_CommandToIndex(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3388
static LRESULT TOOLBAR_MouseLeave(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:6167
static LRESULT TOOLBAR_IsButtonIndeterminate(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:4028
static LRESULT TOOLBAR_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
Definition: toolbar.c:6309
static LRESULT TOOLBAR_SetParent(TOOLBAR_INFO *infoPtr, HWND hParent)
Definition: toolbar.c:5112
static LRESULT TOOLBAR_PressButton(const TOOLBAR_INFO *infoPtr, INT Id, BOOL fPress)
Definition: toolbar.c:4206
static LRESULT TOOLBAR_HideButton(TOOLBAR_INFO *infoPtr, INT Id, BOOL fHide)
Definition: toolbar.c:3883
static LRESULT TOOLBAR_NotifyFormat(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6600
static LRESULT TOOLBAR_GetImageListCount(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:5489
static LRESULT TOOLBAR_SetButtonWidth(TOOLBAR_INFO *infoPtr, LPARAM lParam)
Definition: toolbar.c:4726
static LRESULT TOOLBAR_Size(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:6701
static LRESULT TOOLBAR_GetInsertMark(const TOOLBAR_INFO *infoPtr, TBINSERTMARK *lptbim)
Definition: toolbar.c:3702
static LRESULT TOOLBAR_LButtonUp(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5946
static LRESULT TOOLBAR_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6296
static LRESULT TOOLBAR_SetMaxTextRows(TOOLBAR_INFO *infoPtr, INT nMaxRows)
Definition: toolbar.c:5039
static LRESULT TOOLBAR_MarkButton(const TOOLBAR_INFO *infoPtr, INT Id, BOOL fMark)
Definition: toolbar.c:4108
static LRESULT TOOLBAR_Notify(TOOLBAR_INFO *infoPtr, LPNMHDR lpnmh)
Definition: toolbar.c:6554
static LRESULT TOOLBAR_GetDefImageList(const TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:3693
static LRESULT TOOLBAR_GetHotImageList(const TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:3671
static LRESULT TOOLBAR_SetColorScheme(TOOLBAR_INFO *infoPtr, const COLORSCHEME *lParam)
Definition: toolbar.c:5356
static LRESULT TOOLBAR_IsButtonHighlighted(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:4015
static LRESULT TOOLBAR_LoadImages(TOOLBAR_INFO *infoPtr, WPARAM wParam, HINSTANCE hInstance)
Definition: toolbar.c:4054
static LRESULT TOOLBAR_GetRows(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3823
static LRESULT TOOLBAR_SetIndent(TOOLBAR_INFO *infoPtr, INT nIndent)
Definition: toolbar.c:4982
static LRESULT TOOLBAR_SysColorChange(void)
Definition: toolbar.c:6761
static LRESULT theme_changed(HWND hwnd)
Definition: toolbar.c:6784
static LRESULT TOOLBAR_GetUnicodeFormat(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3866
static LRESULT TOOLBAR_GetButtonSize(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3617
static LRESULT TOOLBAR_SetVersion(TOOLBAR_INFO *infoPtr, INT iVersion)
Definition: toolbar.c:5370
static LRESULT TOOLBAR_Paint(TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:6624
static LRESULT TOOLBAR_HitTest(const TOOLBAR_INFO *infoPtr, const POINT *lpPt)
Definition: toolbar.c:3913
static LRESULT TOOLBAR_SetExtendedStyle(TOOLBAR_INFO *infoPtr, DWORD mask, DWORD style)
Definition: toolbar.c:4810
static LRESULT TOOLBAR_SetBoundingSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5444
static LRESULT TOOLBAR_AddButtonsT(TOOLBAR_INFO *infoPtr, INT nAddButtons, const TBBUTTON *lpTbb, BOOL fUnicode)
Definition: toolbar.c:3106
static LRESULT TOOLBAR_ButtonCount(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3303
static LRESULT TOOLBAR_RButtonUp(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6106
static LRESULT TOOLBAR_EnableButton(TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
Definition: toolbar.c:3475
static LRESULT TOOLBAR_Indeterminate(const TOOLBAR_INFO *infoPtr, INT Id, BOOL fIndeterminate)
Definition: toolbar.c:3920
static LRESULT TOOLBAR_GetToolTips(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3857
static LRESULT TOOLBAR_SetHotItem2(TOOLBAR_INFO *infoPtr, INT nHotItem, LPARAM lParam)
Definition: toolbar.c:5455
static LRESULT TOOLBAR_GetMaxSize(const TOOLBAR_INFO *infoPtr, LPSIZE lpSize)
Definition: toolbar.c:3745
static LRESULT TOOLBAR_RButtonDblClk(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6136
static LRESULT TOOLBAR_SetFont(TOOLBAR_INFO *infoPtr, HFONT hFont, WORD Redraw)
Definition: toolbar.c:6656
static LRESULT TOOLBAR_GetAnchorHighlight(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3508
static LRESULT TOOLBAR_SaveRestoreA(TOOLBAR_INFO *infoPtr, WPARAM wParam, const TBSAVEPARAMSA *lpSave)
Definition: toolbar.c:4531
static LRESULT TOOLBAR_SetListGap(TOOLBAR_INFO *infoPtr, INT iListGap)
Definition: toolbar.c:5476
static LRESULT TOOLBAR_GetState(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3830
static LRESULT TOOLBAR_KeyDown(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5748
static LRESULT TOOLBAR_SetInsertMarkColor(TOOLBAR_INFO *infoPtr, COLORREF clr)
Definition: toolbar.c:5027
static LRESULT TOOLBAR_EraseBackground(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5635
static LRESULT TOOLBAR_GetInsertMarkColor(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3713
static LRESULT TOOLBAR_SetDisabledImageList(TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST himl)
Definition: toolbar.c:4773
static LRESULT TOOLBAR_CheckButton(TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
Definition: toolbar.c:3342
static LRESULT TOOLBAR_SetImageList(TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST himl)
Definition: toolbar.c:4940
static LRESULT TOOLBAR_GetTextRows(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3850
static LRESULT TOOLBAR_StyleChanged(TOOLBAR_INFO *infoPtr, INT nType, const STYLESTRUCT *lpStyle)
Definition: toolbar.c:6751
static LRESULT TOOLBAR_Unkwn464(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5545
static LRESULT TOOLBAR_SetFocus(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:6644
static LRESULT TOOLBAR_CaptureChanged(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:6147
static LRESULT TOOLBAR_GetStyle(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3843
static LRESULT TOOLBAR_GetIdealSize(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5497
static LRESULT TOOLBAR_SetHotImageList(TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST himl)
Definition: toolbar.c:4838
static LRESULT TOOLBAR_Destroy(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:5588
static LRESULT TOOLBAR_LButtonDblClk(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5785
static LRESULT TOOLBAR_GetBitmapFlags(void)
Definition: toolbar.c:3528
static LRESULT TOOLBAR_MouseMove(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6212
static LRESULT TOOLBAR_ButtonStructSize(TOOLBAR_INFO *infoPtr, DWORD Size)
Definition: toolbar.c:3310
static LRESULT TOOLBAR_SetInsertMark(TOOLBAR_INFO *infoPtr, const TBINSERTMARK *lptbim)
Definition: toolbar.c:5001
static LRESULT TOOLBAR_GetVersion(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3876
static LRESULT TOOLBAR_IsButtonEnabled(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3989
static LRESULT TOOLBAR_IsButtonHidden(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:4002
static LRESULT TOOLBAR_GetFont(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:5708
static LRESULT TOOLBAR_GetHotItem(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3680
static LRESULT TOOLBAR_GetItemRect(const TOOLBAR_INFO *infoPtr, INT nIndex, LPRECT lpRect)
Definition: toolbar.c:3722
static LRESULT TOOLBAR_GetDisabledImageList(const TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:3653
static LRESULT TOOLBAR_MapAccelerator(const TOOLBAR_INFO *infoPtr, WCHAR wAccel, UINT *pIDButton)
Definition: toolbar.c:4067
static LRESULT TOOLBAR_ReplaceBitmap(TOOLBAR_INFO *infoPtr, const TBREPLACEBITMAP *lpReplace)
Definition: toolbar.c:4233
static LRESULT TOOLBAR_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
Definition: toolbar.c:5555
static LRESULT TOOLBAR_GetRect(const TOOLBAR_INFO *infoPtr, INT Id, LPRECT lpRect)
Definition: toolbar.c:3800
static LRESULT TOOLBAR_SetDrawTextFlags(TOOLBAR_INFO *infoPtr, DWORD mask, DWORD flags)
Definition: toolbar.c:4791
static LRESULT TOOLBAR_GetButtonText(const TOOLBAR_INFO *infoPtr, INT Id, LPWSTR lpStr, BOOL isW)
Definition: toolbar.c:3625
static LRESULT TOOLBAR_GetButtonInfoT(const TOOLBAR_INFO *infoPtr, INT Id, LPTBBUTTONINFOW lpTbInfo, BOOL bUnicode)
Definition: toolbar.c:3560
static LRESULT TOOLBAR_SetState(TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
Definition: toolbar.c:5246
static LRESULT TOOLBAR_GetButton(const TOOLBAR_INFO *infoPtr, INT nIndex, TBBUTTON *lpTbb)
Definition: toolbar.c:3535
static LRESULT TOOLBAR_GetExtendedStyle(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3662
static LRESULT TOOLBAR_AddStringA(TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
Definition: toolbar.c:3196
static LRESULT TOOLBAR_SetAnchorHighlight(TOOLBAR_INFO *infoPtr, BOOL bAnchor)
Definition: toolbar.c:4564
static LRESULT TOOLBAR_NCPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6396
static LRESULT TOOLBAR_ChangeBitmap(TOOLBAR_INFO *infoPtr, INT Id, INT Index)
Definition: toolbar.c:3319
static LRESULT TOOLBAR_GetPadding(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3793
static LRESULT TOOLBAR_IsButtonChecked(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3976
static LRESULT TOOLBAR_GetBitmap(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3515
#define WM_APP
Definition: eventvwr.h:73
#define TB_GETTOOLTIPS
Definition: commctrl.h:1138
#define TB_GETUNICODEFORMAT
Definition: commctrl.h:1201
#define TB_PRESSBUTTON
Definition: commctrl.h:1044
#define TB_GETMETRICS
Definition: commctrl.h:1302
#define TB_GETBUTTONINFOA
Definition: commctrl.h:1259
#define TB_MARKBUTTON
Definition: commctrl.h:1047
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1190
#define TB_SETHOTITEM2
Definition: commctrl.h:1280
#define TB_SAVERESTOREA
Definition: commctrl.h:1128
#define TB_SETPARENT
Definition: commctrl.h:1140
#define TB_AUTOSIZE
Definition: commctrl.h:1137
#define TB_ISBUTTONPRESSED
Definition: commctrl.h:1050
#define TB_ADDSTRINGA
Definition: commctrl.h:1131
#define TB_GETIDEALSIZE
Definition: commctrl.h:1284
#define TB_GETINSERTMARKCOLOR
Definition: commctrl.h:1195
#define TB_SETINSERTMARK
Definition: commctrl.h:1186
#define TB_GETSTRINGA
Definition: commctrl.h:1276
#define TB_SETTOOLTIPS
Definition: commctrl.h:1139
#define TB_SETPADDING
Definition: commctrl.h:1193
#define TB_SETLISTGAP
Definition: commctrl.h:1282
#define TB_SETSTATE
Definition: commctrl.h:1054
#define TB_GETHOTITEM
Definition: commctrl.h:1170
#define CCM_GETVERSION
Definition: commctrl.h:115
#define TB_GETBUTTONTEXTW
Definition: commctrl.h:1147
#define TB_GETBUTTONINFOW
Definition: commctrl.h:1257
#define TB_GETDISABLEDIMAGELIST
Definition: commctrl.h:1157
#define TB_CHANGEBITMAP
Definition: commctrl.h:1144
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1134
#define TB_CHECKBUTTON
Definition: commctrl.h:1043
#define TB_SETUNICODEFORMAT
Definition: commctrl.h:1200
#define TB_GETBUTTONSIZE
Definition: commctrl.h:1160
#define TB_GETANCHORHIGHLIGHT
Definition: commctrl.h:1173
#define TB_SETROWS
Definition: commctrl.h:1141
#define CCM_SETCOLORSCHEME
Definition: commctrl.h:94
#define TB_SETDISABLEDIMAGELIST
Definition: commctrl.h:1156
#define TB_REPLACEBITMAP
Definition: commctrl.h:1148
#define TB_ADDSTRINGW
Definition: commctrl.h:1132
#define TB_ISBUTTONINDETERMINATE
Definition: commctrl.h:1052
#define TB_ADDBUTTONSA
Definition: commctrl.h:1106
#define TB_SETIMAGELIST
Definition: commctrl.h:1150
#define TB_GETSTYLE
Definition: commctrl.h:1159
#define TB_SETBUTTONINFOW
Definition: commctrl.h:1258
#define TB_SAVERESTOREW
Definition: commctrl.h:1129
#define TB_SETBOUNDINGSIZE
Definition: commctrl.h:1176
#define TB_SETANCHORHIGHLIGHT
Definition: commctrl.h:1172
#define TB_GETRECT
Definition: commctrl.h:1153
#define TB_ENABLEBUTTON
Definition: commctrl.h:1042
#define TB_LOADIMAGES
Definition: commctrl.h:1152
#define TB_GETBUTTON
Definition: commctrl.h:1109
#define TB_GETMAXSIZE
Definition: commctrl.h:1189
#define TB_SETMETRICS
Definition: commctrl.h:1303
#define TB_SETBUTTONSIZE
Definition: commctrl.h:1135
#define TB_GETEXTENDEDSTYLE
Definition: commctrl.h:1191
#define CCM_GETCOLORSCHEME
Definition: commctrl.h:95
#define WM_MOUSELEAVE
Definition: commctrl.h:4975
#define TB_CUSTOMIZE
Definition: commctrl.h:1130
#define TB_SETDRAWTEXTFLAGS
Definition: commctrl.h:1273
#define TB_GETITEMRECT
Definition: commctrl.h:1133
#define TB_HIDEBUTTON
Definition: commctrl.h:1045
#define TB_GETBITMAP
Definition: commctrl.h:1145
#define TB_SETCMDID
Definition: commctrl.h:1143
#define PGM_FORWARDMOUSE
Definition: commctrl.h:4522
#define TB_GETBITMAPFLAGS
Definition: commctrl.h:1217
#define CCM_SETVERSION
Definition: commctrl.h:114
#define TB_ISBUTTONHIGHLIGHTED
Definition: commctrl.h:1053
#define TB_GETINSERTMARK
Definition: commctrl.h:1185
#define TB_GETHOTIMAGELIST
Definition: commctrl.h:1155
#define TB_INDETERMINATE
Definition: commctrl.h:1046
#define TB_SETSTYLE
Definition: commctrl.h:1158
#define TB_MAPACCELERATORW
Definition: commctrl.h:1203
#define TB_HITTEST
Definition: commctrl.h:1268
#define TB_GETSTATE
Definition: commctrl.h:1055
#define TB_SETHOTIMAGELIST
Definition: commctrl.h:1154
#define TB_SETBUTTONWIDTH
Definition: commctrl.h:1161
#define TB_ADDBUTTONSW
Definition: commctrl.h:1266
#define TB_GETBUTTONTEXTA
Definition: commctrl.h:1146
#define TB_SETINSERTMARKCOLOR
Definition: commctrl.h:1194
#define TB_GETPADDING
Definition: commctrl.h:1192
#define TB_GETROWS
Definition: commctrl.h:1142
#define TB_ISBUTTONCHECKED
Definition: commctrl.h:1049
#define TB_SETHOTITEM
Definition: commctrl.h:1171
#define TB_MOVEBUTTON
Definition: commctrl.h:1188
#define TB_ISBUTTONHIDDEN
Definition: commctrl.h:1051
#define TB_SETINDENT
Definition: commctrl.h:1149
#define TB_SETMAXTEXTROWS
Definition: commctrl.h:1162
#define TB_BUTTONCOUNT
Definition: commctrl.h:1110
#define TB_ISBUTTONENABLED
Definition: commctrl.h:1048
#define TB_GETTEXTROWS
Definition: commctrl.h:1163
#define TB_INSERTBUTTONA
Definition: commctrl.h:1107
#define TB_COMMANDTOINDEX
Definition: commctrl.h:1111
#define TB_GETSTRINGW
Definition: commctrl.h:1275
#define TB_SETBUTTONINFOA
Definition: commctrl.h:1260
#define TB_ADDBITMAP
Definition: commctrl.h:1056
#define TB_MAPACCELERATORA
Definition: commctrl.h:1174
#define TB_GETIMAGELISTCOUNT
Definition: commctrl.h:1283
#define TB_GETIMAGELIST
Definition: commctrl.h:1151
#define TB_UNKWN464
Definition: commctrl.h:81
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_PAINT
Definition: winuser.h:1620
#define WM_CHARTOITEM
Definition: winuser.h:1649
#define WM_CAPTURECHANGED
Definition: winuser.h:1808
#define WM_CREATE
Definition: winuser.h:1608
#define WM_SIZE
Definition: winuser.h:1611
#define WM_SETFOCUS
Definition: winuser.h:1613
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626
#define WM_GETFONT
Definition: winuser.h:1651
#define WM_SETFONT
Definition: winuser.h:1650
#define WM_VKEYTOITEM
Definition: winuser.h:1648
#define WM_SETREDRAW
Definition: winuser.h:1616

Referenced by TOOLBAR_Register().

◆ unwrap()

static void unwrap ( TOOLBAR_INFO info)
inlinestatic

Definition at line 5275 of file toolbar.c.

5276{
5277 int i;
5278
5279 for (i = 0; i < info->nNumButtons; i++)
5280 info->buttons[i].fsState &= ~TBSTATE_WRAP;
5281}

Referenced by TOOLBAR_SetStyle().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( toolbar  )

Variable Documentation

◆ DECLSPEC_HIDDEN

UINT uDragListMessage DECLSPEC_HIDDEN
extern

Definition at line 289 of file d3dcompiler_private.h.

◆ hCursorDrag

HCURSOR hCursorDrag = NULL
static

Definition at line 87 of file toolbar.c.

Referenced by TOOLBAR_LButtonDown().

◆ themeClass

const WCHAR themeClass[] = { 'T','o','o','l','b','a','r',0 }
static

Definition at line 251 of file toolbar.c.

Referenced by theme_changed(), and TOOLBAR_Create().