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

Go to the source code of this file.

Classes

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

Macros

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

Typedefs

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

Enumerations

enum  IMAGE_LIST_TYPE { IMAGE_LIST_DEFAULT , IMAGE_LIST_HOT , IMAGE_LIST_DISABLED }
 

Functions

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

Variables

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

Macro Definition Documentation

◆ ARROW_HEIGHT

#define ARROW_HEIGHT   3

Definition at line 206 of file toolbar.c.

◆ BOTTOM_BORDER

#define BOTTOM_BORDER   2

Definition at line 204 of file toolbar.c.

◆ COMMON_STYLES

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

Definition at line 241 of file toolbar.c.

◆ DDARROW_WIDTH

#define DDARROW_WIDTH   11

Definition at line 205 of file toolbar.c.

◆ DEFLISTGAP

#define DEFLISTGAP   4

Definition at line 219 of file toolbar.c.

◆ DEFPAD_CX

#define DEFPAD_CX   7

Definition at line 210 of file toolbar.c.

◆ DEFPAD_CY

#define DEFPAD_CY   6

Definition at line 211 of file toolbar.c.

◆ GETDEFIMAGELIST

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

Definition at line 246 of file toolbar.c.

◆ GETDISIMAGELIST

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

Definition at line 248 of file toolbar.c.

◆ GETHIMLID

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

Definition at line 245 of file toolbar.c.

◆ GETHOTIMAGELIST

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

Definition at line 247 of file toolbar.c.

◆ GETIBITMAP

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

Definition at line 244 of file toolbar.c.

◆ INSERTMARK_WIDTH

#define INSERTMARK_WIDTH   2

Definition at line 207 of file toolbar.c.

◆ LISTPAD_CY

#define LISTPAD_CY   9

Definition at line 225 of file toolbar.c.

◆ MAX_RESOURCE_STRING_LENGTH

#define MAX_RESOURCE_STRING_LENGTH   512

◆ NONLIST_NOTEXT_OFFSET

#define NONLIST_NOTEXT_OFFSET   2

Definition at line 229 of file toolbar.c.

◆ SEPARATOR_WIDTH

#define SEPARATOR_WIDTH   8

Definition at line 202 of file toolbar.c.

◆ TBSTYLE_EX_ALL

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

Definition at line 234 of file toolbar.c.

◆ TOOLBAR_NOWHERE

#define TOOLBAR_NOWHERE   (-1)

Definition at line 231 of file toolbar.c.

◆ TOP_BORDER

#define TOP_BORDER   2

Definition at line 203 of file toolbar.c.

Typedef Documentation

◆ PCUSTDLG_INFO

◆ PCUSTOMBUTTON

◆ PIMLENTRY

◆ PTOOLBAR_INFO

Enumeration Type Documentation

◆ IMAGE_LIST_TYPE

Enumerator
IMAGE_LIST_DEFAULT 
IMAGE_LIST_HOT 
IMAGE_LIST_DISABLED 

Definition at line 195 of file toolbar.c.

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

Function Documentation

◆ button_has_ddarrow()

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

Definition at line 282 of file toolbar.c.

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

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

◆ default_top_margin()

static int default_top_margin ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 268 of file toolbar.c.

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

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

◆ free_string()

static void free_string ( TBUTTON_INFO btn)
static

Definition at line 386 of file toolbar.c.

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

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

◆ set_string_index()

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

Definition at line 361 of file toolbar.c.

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

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

◆ set_stringT()

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

Definition at line 380 of file toolbar.c.

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

Referenced by TOOLBAR_SetButtonInfo().

◆ theme_changed()

static LRESULT theme_changed ( HWND  hwnd)
static

Definition at line 6846 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddBitmap()

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

Definition at line 2990 of file toolbar.c.

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

Referenced by TOOLBAR_LoadImages(), and ToolbarWindowProc().

◆ TOOLBAR_AddBitmapToImageList()

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

Definition at line 2912 of file toolbar.c.

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

Referenced by TOOLBAR_AddBitmap(), and TOOLBAR_CheckImageListIconSize().

◆ TOOLBAR_AddButtonsT()

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

Definition at line 3105 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringA()

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

Definition at line 3195 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringW()

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

Definition at line 3114 of file toolbar.c.

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

Referenced by TOOLBAR_AddStringA(), and ToolbarWindowProc().

◆ TOOLBAR_AutoSize()

static LRESULT TOOLBAR_AutoSize ( TOOLBAR_INFO infoPtr)
static

Definition at line 3231 of file toolbar.c.

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

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

◆ TOOLBAR_ButtonCount()

static LRESULT TOOLBAR_ButtonCount ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3302 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ButtonHasString()

static BOOL TOOLBAR_ButtonHasString ( const TBUTTON_INFO btnPtr)
inlinestatic

Definition at line 356 of file toolbar.c.

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

Referenced by set_string_index(), and TOOLBAR_InternalInsertButtonsT().

◆ TOOLBAR_ButtonStructSize()

static LRESULT TOOLBAR_ButtonStructSize ( TOOLBAR_INFO infoPtr,
DWORD  Size 
)
inlinestatic

Definition at line 3309 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CalcStrings()

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

Definition at line 1410 of file toolbar.c.

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

Referenced by TOOLBAR_CalcToolbar().

◆ TOOLBAR_CalcToolbar()

static void TOOLBAR_CalcToolbar ( TOOLBAR_INFO infoPtr)
static

Definition at line 1809 of file toolbar.c.

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

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

◆ TOOLBAR_CaptureChanged()

static LRESULT TOOLBAR_CaptureChanged ( TOOLBAR_INFO infoPtr)
static

Definition at line 6149 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ChangeBitmap()

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

Definition at line 3318 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CheckButton()

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

Definition at line 3341 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CheckImageListIconSize()

static void TOOLBAR_CheckImageListIconSize ( TOOLBAR_INFO infoPtr)
static

Definition at line 2956 of file toolbar.c.

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

Referenced by TOOLBAR_Refresh().

◆ TOOLBAR_CheckStyle()

static void TOOLBAR_CheckStyle ( const TOOLBAR_INFO infoPtr)
static

Definition at line 400 of file toolbar.c.

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

Referenced by TOOLBAR_Create(), and TOOLBAR_SetStyle().

◆ TOOLBAR_CommandToIndex()

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

Definition at line 3387 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Create()

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

Definition at line 5554 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Cust_AddButton()

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

Definition at line 2311 of file toolbar.c.

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

Referenced by TOOLBAR_Cust_AvailDragListNotification(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_AvailDragListNotification()

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

Definition at line 2464 of file toolbar.c.

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

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_InsertAvailButton()

static void TOOLBAR_Cust_InsertAvailButton ( HWND  hwnd,
PCUSTOMBUTTON  btnInfoNew 
)
static

Definition at line 2240 of file toolbar.c.

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

Referenced by TOOLBAR_Cust_RemoveButton(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_MoveButton()

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

Definition at line 2267 of file toolbar.c.

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

Referenced by TOOLBAR_Cust_ToolbarDragListNotification(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_RemoveButton()

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

Definition at line 2359 of file toolbar.c.

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

Referenced by TOOLBAR_Cust_ToolbarDragListNotification(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_ToolbarDragListNotification()

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

Definition at line 2389 of file toolbar.c.

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

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Customize()

static LRESULT TOOLBAR_Customize ( TOOLBAR_INFO infoPtr)
static

Definition at line 3394 of file toolbar.c.

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

Referenced by TOOLBAR_LButtonDblClk(), and ToolbarWindowProc().

◆ TOOLBAR_CustomizeDialogProc()

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

Definition at line 2527 of file toolbar.c.

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

Referenced by TOOLBAR_Customize().

◆ TOOLBAR_DeleteAllButtons()

static void TOOLBAR_DeleteAllButtons ( TOOLBAR_INFO infoPtr)
static

Definition at line 4363 of file toolbar.c.

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

Referenced by TOOLBAR_Restore().

◆ TOOLBAR_DeleteButton()

static LRESULT TOOLBAR_DeleteButton ( TOOLBAR_INFO infoPtr,
INT  nIndex 
)
static

Definition at line 3417 of file toolbar.c.

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

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

◆ TOOLBAR_DeleteImageList()

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

Definition at line 7374 of file toolbar.c.

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

Referenced by TOOLBAR_Destroy().

◆ TOOLBAR_Destroy()

static LRESULT TOOLBAR_Destroy ( TOOLBAR_INFO infoPtr)
static

Definition at line 5587 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_DrawArrow()

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

Definition at line 608 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton(), and TOOLBAR_DrawSepDDArrow().

◆ TOOLBAR_DrawButton()

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

Definition at line 974 of file toolbar.c.

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

Referenced by TOOLBAR_Refresh().

◆ TOOLBAR_DrawFlatHorizontalSeparator()

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

Definition at line 575 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawFlatSeparator()

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

Definition at line 536 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawFrame()

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

Definition at line 901 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawImage()

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

Definition at line 804 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawMasked()

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

Definition at line 745 of file toolbar.c.

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

Referenced by TOOLBAR_DrawImage().

◆ TOOLBAR_DrawPattern()

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

Definition at line 725 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawSepDDArrow()

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

Definition at line 935 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawString()

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

Definition at line 634 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DumpButton()

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

Definition at line 321 of file toolbar.c.

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

Referenced by TOOLBAR_DumpToolbar().

◆ TOOLBAR_DumpTBButton()

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

Definition at line 313 of file toolbar.c.

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

Referenced by TOOLBAR_InternalInsertButtonsT().

◆ TOOLBAR_DumpToolbar()

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

Definition at line 336 of file toolbar.c.

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

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_EraseBackground()

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

Definition at line 5634 of file toolbar.c.

5635{
5636 NMTBCUSTOMDRAW tbcd;
5637 INT ret = FALSE;
5638 DWORD ntfret;
5639 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
5640 DWORD dwEraseCustDraw = 0;
5641
5642 /* the app has told us not to redraw the toolbar */
5643 if (!infoPtr->bDoRedraw)
5644 return FALSE;
5645
5646 if (infoPtr->dwStyle & TBSTYLE_CUSTOMERASE) {
5647 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
5649 tbcd.nmcd.hdc = (HDC)wParam;
5650 ntfret = TOOLBAR_SendNotify (&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
5651 dwEraseCustDraw = ntfret & 0xffff;
5652
5653 /* FIXME: in general the return flags *can* be or'ed together */
5654 switch (dwEraseCustDraw)
5655 {
5656 case CDRF_DODEFAULT:
5657 break;
5658 case CDRF_SKIPDEFAULT:
5659 return TRUE;
5660 default:
5661 FIXME("[%p] response %d not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",
5662 infoPtr->hwndSelf, ntfret);
5663 }
5664 }
5665
5666 /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up
5667 * to my parent for processing.
5668 */
5669 if (theme || (infoPtr->dwStyle & TBSTYLE_TRANSPARENT)) {
5670 POINT pt, ptorig;
5671 HDC hdc = (HDC)wParam;
5672 HWND parent;
5673
5674 pt.x = 0;
5675 pt.y = 0;
5676 parent = GetParent(infoPtr->hwndSelf);
5677 MapWindowPoints(infoPtr->hwndSelf, parent, &pt, 1);
5678 OffsetWindowOrgEx (hdc, pt.x, pt.y, &ptorig);
5680 SetWindowOrgEx (hdc, ptorig.x, ptorig.y, 0);
5681 }
5682 if (!ret)
5684
5685 if (dwEraseCustDraw & CDRF_NOTIFYPOSTERASE) {
5686 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
5688 tbcd.nmcd.hdc = (HDC)wParam;
5689 ntfret = TOOLBAR_SendNotify (&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
5690 dwEraseCustDraw = ntfret & 0xffff;
5691 switch (dwEraseCustDraw)
5692 {
5693 case CDRF_DODEFAULT:
5694 break;
5695 case CDRF_SKIPDEFAULT:
5696 return TRUE;
5697 default:
5698 FIXME("[%p] response %d not handled to NM_CUSTOMDRAW (CDDS_POSTERASE)\n",
5699 infoPtr->hwndSelf, ntfret);
5700 }
5701 }
5702 return ret;
5703}
#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:1628
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 3507 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetBitmap()

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

Definition at line 3514 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetBitmapFlags()

static LRESULT TOOLBAR_GetBitmapFlags ( void  )
inlinestatic

Definition at line 3527 of file toolbar.c.

3528{
3529 return (GetDeviceCaps (0, LOGPIXELSX) >= 120) ? TBBF_LARGE : 0;
3530}
#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 431 of file toolbar.c.

432{
433 INT ret = btnPtr->iBitmap;
434
435 if (ret == I_IMAGECALLBACK)
436 {
437 /* issue TBN_GETDISPINFO */
438 NMTBDISPINFOW nmgd;
439
440 memset(&nmgd, 0, sizeof(nmgd));
441 nmgd.idCommand = btnPtr->idCommand;
442 nmgd.lParam = btnPtr->dwData;
443 nmgd.dwMask = TBNF_IMAGE;
444 nmgd.iImage = -1;
445 /* Windows also send TBN_GETDISPINFOW even if the control is ANSI */
446 TOOLBAR_SendNotify(&nmgd.hdr, infoPtr, TBN_GETDISPINFOW);
447 if (nmgd.dwMask & TBNF_DI_SETITEM)
448 btnPtr->iBitmap = nmgd.iImage;
449 ret = nmgd.iImage;
450 TRACE("TBN_GETDISPINFO returned bitmap id %d, mask=%08x, nNumBitmaps=%d\n",
451 ret, nmgd.dwMask, infoPtr->nNumBitmaps);
452 }
453
454 if (ret != I_IMAGENONE)
455 ret = GETIBITMAP(infoPtr, ret);
456
457 return ret;
458}
#define I_IMAGECALLBACK
Definition: commctrl.h:2390
#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:2391
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 3534 of file toolbar.c.

3535{
3536 TBUTTON_INFO *btnPtr;
3537
3538 if (lpTbb == NULL)
3539 return FALSE;
3540
3541 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
3542 return FALSE;
3543
3544 btnPtr = &infoPtr->buttons[nIndex];
3545 lpTbb->iBitmap = btnPtr->iBitmap;
3546 lpTbb->idCommand = btnPtr->idCommand;
3547 lpTbb->fsState = btnPtr->fsState;
3548 lpTbb->fsStyle = btnPtr->fsStyle;
3549 lpTbb->bReserved[0] = 0;
3550 lpTbb->bReserved[1] = 0;
3551 lpTbb->dwData = btnPtr->dwData;
3552 lpTbb->iString = btnPtr->iString;
3553
3554 return TRUE;
3555}
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 2079 of file toolbar.c.

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

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

7423{
7424 if (infoPtr->bUnicode)
7425 return TOOLBAR_SendNotify(&nmtb->hdr, infoPtr, TBN_GETBUTTONINFOW);
7426 else
7427 {
7428 CHAR Buffer[256];
7429 NMTOOLBARA nmtba;
7430 BOOL bRet = FALSE;
7431
7432 nmtba.iItem = nmtb->iItem;
7433 nmtba.pszText = Buffer;
7434 nmtba.cchText = 256;
7435 ZeroMemory(nmtba.pszText, nmtba.cchText);
7436
7437 if (TOOLBAR_SendNotify(&nmtba.hdr, infoPtr, TBN_GETBUTTONINFOA))
7438 {
7439 int ccht = strlen(nmtba.pszText);
7440 if (ccht)
7441 MultiByteToWideChar(CP_ACP, 0, nmtba.pszText, -1,
7442 nmtb->pszText, nmtb->cchText);
7443
7444 nmtb->tbButton = nmtba.tbButton;
7445 bRet = TRUE;
7446 }
7447
7448 return bRet;
7449 }
7450}
#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 3559 of file toolbar.c.

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

3617{
3618 return MAKELONG((WORD)infoPtr->nButtonWidth,
3619 (WORD)infoPtr->nButtonHeight);
3620}
#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 3624 of file toolbar.c.

3625{
3626 INT nIndex;
3627 LPWSTR lpText;
3628 LRESULT ret = 0;
3629
3630 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3631 if (nIndex == -1)
3632 return -1;
3633
3634 lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]);
3635
3636 if (isW)
3637 {
3638 if (lpText)
3639 {
3640 ret = lstrlenW (lpText);
3641 if (lpStr) lstrcpyW (lpStr, lpText);
3642 }
3643 }
3644 else
3645 ret = WideCharToMultiByte( CP_ACP, 0, lpText, -1,
3646 (LPSTR)lpStr, lpStr ? 0x7fffffff : 0, NULL, NULL ) - 1;
3647 return ret;
3648}
#define WideCharToMultiByte
Definition: compat.h:111
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 2102 of file toolbar.c.

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

5344{
5345 lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
5347 infoPtr->clrBtnHighlight;
5348 lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
5350 return 1;
5351}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetDefImageList()

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

Definition at line 3692 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetDisabledImageList()

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

Definition at line 3652 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetExtendedStyle()

static LRESULT TOOLBAR_GetExtendedStyle ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3661 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetFont()

static LRESULT TOOLBAR_GetFont ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 5707 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetHotImageList()

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

Definition at line 3670 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetHotItem()

static LRESULT TOOLBAR_GetHotItem ( const TOOLBAR_INFO infoPtr)
static

Definition at line 3679 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetIdealSize()

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

Definition at line 5496 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetImageList()

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

Definition at line 7410 of file toolbar.c.

7411{
7412 HIMAGELIST himlDef = 0;
7413 PIMLENTRY pie = TOOLBAR_GetImageListEntry(pies, cies, id);
7414
7415 if (pie)
7416 himlDef = pie->himl;
7417
7418 return himlDef;
7419}
static PIMLENTRY TOOLBAR_GetImageListEntry(const PIMLENTRY *pies, INT cies, INT id)
Definition: toolbar.c:7388
HIMAGELIST himl
Definition: toolbar.c:112

◆ TOOLBAR_GetImageListCount()

static LRESULT TOOLBAR_GetImageListCount ( const TOOLBAR_INFO infoPtr)
static

Definition at line 5488 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetImageListEntry()

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

Definition at line 7388 of file toolbar.c.

7389{
7390 PIMLENTRY c = NULL;
7391
7392 if (pies != NULL)
7393 {
7394 int i;
7395
7396 for (i = 0; i < cies; i++)
7397 {
7398 if (pies[i]->id == id)
7399 {
7400 c = pies[i];
7401 break;
7402 }
7403 }
7404 }
7405
7406 return c;
7407}
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 492 of file toolbar.c.

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

Referenced by TOOLBAR_DrawImage().

◆ TOOLBAR_GetInsertMark()

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

Definition at line 3701 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetInsertMarkColor()

static LRESULT TOOLBAR_GetInsertMarkColor ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3712 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetItemRect()

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

Definition at line 3721 of file toolbar.c.

3722{
3723 TBUTTON_INFO *btnPtr;
3724
3725 btnPtr = &infoPtr->buttons[nIndex];
3726 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
3727 return FALSE;
3728
3729 if (lpRect == NULL)
3730 return FALSE;
3731 if (btnPtr->fsState & TBSTATE_HIDDEN)
3732 return FALSE;
3733
3734 lpRect->left = btnPtr->rect.left;
3735 lpRect->right = btnPtr->rect.right;
3736 lpRect->bottom = btnPtr->rect.bottom;
3737 lpRect->top = btnPtr->rect.top;
3738
3739 return TRUE;
3740}
#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 3744 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetPadding()

static LRESULT TOOLBAR_GetPadding ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3792 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetRect()

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

Definition at line 3799 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetRows()

static LRESULT TOOLBAR_GetRows ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3822 of file toolbar.c.

3823{
3824 return infoPtr->nRows;
3825}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetState()

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

Definition at line 3829 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetStringA()

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

Definition at line 5393 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetStringW()

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

Definition at line 5416 of file toolbar.c.

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

3843{
3844 return infoPtr->dwStyle;
3845}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetText()

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

Definition at line 299 of file toolbar.c.

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

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

3850{
3851 return infoPtr->nMaxTextRows;
3852}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetToolTips()

static LRESULT TOOLBAR_GetToolTips ( TOOLBAR_INFO infoPtr)
static

Definition at line 3856 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetUnicodeFormat()

static LRESULT TOOLBAR_GetUnicodeFormat ( const TOOLBAR_INFO infoPtr)
static

Definition at line 3865 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_GetVersion()

static LRESULT TOOLBAR_GetVersion ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 3875 of file toolbar.c.

3876{
3877 return infoPtr->iVersion;
3878}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_HasDropDownArrows()

static BOOL TOOLBAR_HasDropDownArrows ( DWORD  exStyle)
inlinestatic

Definition at line 277 of file toolbar.c.

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

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

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

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Indeterminate()

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

Definition at line 3919 of file toolbar.c.

3920{
3921 TBUTTON_INFO *btnPtr;
3922 INT nIndex;
3923 DWORD oldState;
3924
3925 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3926 if (nIndex == -1)
3927 return FALSE;
3928
3929 btnPtr = &infoPtr->buttons[nIndex];
3930 oldState = btnPtr->fsState;
3931
3932 if (fIndeterminate)
3933 btnPtr->fsState |= TBSTATE_INDETERMINATE;
3934 else
3935 btnPtr->fsState &= ~TBSTATE_INDETERMINATE;
3936
3937 if(oldState != btnPtr->fsState)
3938 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3939
3940 return TRUE;
3941}
#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 3945 of file toolbar.c.

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

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

7339{
7340 HIMAGELIST himlold;
7341 PIMLENTRY c = NULL;
7342
7343 /* Check if the entry already exists */
7344 c = TOOLBAR_GetImageListEntry(*pies, *cies, id);
7345
7346 /* Don't add new entry for NULL imagelist */
7347 if (!c && !himl)
7348 return NULL;
7349
7350 /* If this is a new entry we must create it and insert into the array */
7351 if (!c)
7352 {
7353 PIMLENTRY *pnies;
7354
7355 c = Alloc(sizeof(IMLENTRY));
7356 c->id = id;
7357
7358 pnies = Alloc((*cies + 1) * sizeof(PIMLENTRY));
7359 memcpy(pnies, *pies, ((*cies) * sizeof(PIMLENTRY)));
7360 pnies[*cies] = c;
7361 (*cies)++;
7362
7363 Free(*pies);
7364 *pies = pnies;
7365 }
7366
7367 himlold = c->himl;
7368 c->himl = himl;
7369
7370 return himlold;
7371}
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 1989 of file toolbar.c.

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

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

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonEnabled()

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

Definition at line 3988 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonHidden()

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

Definition at line 4001 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonHighlighted()

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

Definition at line 4014 of file toolbar.c.

4015{
4016 INT nIndex;
4017
4018 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
4019 if (nIndex == -1)
4020 return -1;
4021
4022 return (infoPtr->buttons[nIndex].fsState & TBSTATE_MARKED);
4023}
#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 4027 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonPressed()

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

Definition at line 4040 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_IsButtonRemovable()

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

Definition at line 7453 of file toolbar.c.

7454{
7455 NMTOOLBARW nmtb;
7456
7457 /* MSDN states that iItem is the index of the button, rather than the
7458 * command ID as used by every other NMTOOLBAR notification */
7459 nmtb.iItem = iItem;
7460 memcpy(&nmtb.tbButton, &btnInfo->btn, sizeof(TBBUTTON));
7461
7462 return TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYDELETE);
7463}
#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 462 of file toolbar.c.

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

Referenced by TOOLBAR_GetImageListForDrawing(), and TOOLBAR_LayoutToolbar().

◆ TOOLBAR_IsValidImageList()

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

Definition at line 478 of file toolbar.c.

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

Referenced by TOOLBAR_CalcToolbar(), and TOOLBAR_LayoutToolbar().

◆ TOOLBAR_KeyDown()

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

Definition at line 5747 of file toolbar.c.

5748{
5749 NMKEY nmkey;
5750
5751 nmkey.nVKey = (UINT)wParam;
5752 nmkey.uFlags = HIWORD(lParam);
5753
5754 if (TOOLBAR_SendNotify(&nmkey.hdr, infoPtr, NM_KEYDOWN))
5755 return DefWindowProcW(infoPtr->hwndSelf, WM_KEYDOWN, wParam, lParam);
5756
5757 switch ((UINT)wParam)
5758 {
5759 case VK_LEFT:
5760 case VK_UP:
5762 break;
5763 case VK_RIGHT:
5764 case VK_DOWN:
5766 break;
5767 case VK_SPACE:
5768 case VK_RETURN:
5769 if ((infoPtr->nHotItem >= 0) &&
5770 (infoPtr->buttons[infoPtr->nHotItem].fsState & TBSTATE_ENABLED))
5771 {
5773 MAKEWPARAM(infoPtr->buttons[infoPtr->nHotItem].idCommand, BN_CLICKED),
5774 (LPARAM)infoPtr->hwndSelf);
5775 }
5776 break;
5777 }
5778
5779 return 0;
5780}
static void TOOLBAR_SetRelativeHotItem(TOOLBAR_INFO *infoPtr, INT iDirection, DWORD dwReason)
Definition: toolbar.c:5714
#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:4012
#define VK_SPACE
Definition: winuser.h:2222
#define VK_UP
Definition: winuser.h:2228
#define VK_RETURN
Definition: winuser.h:2204
#define VK_LEFT
Definition: winuser.h:2227
#define VK_RIGHT
Definition: winuser.h:2229
#define VK_DOWN
Definition: winuser.h:2230
#define BN_CLICKED
Definition: winuser.h:1928
#define WM_KEYDOWN
Definition: winuser.h:1718

Referenced by ToolbarWindowProc().

◆ TOOLBAR_LayoutToolbar()

static void TOOLBAR_LayoutToolbar ( TOOLBAR_INFO infoPtr)
static

Definition at line 1834 of file toolbar.c.

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

5785{
5786 POINT pt;
5787 BOOL button;
5788
5789 pt.x = (short)LOWORD(lParam);
5790 pt.y = (short)HIWORD(lParam);
5791 TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
5792
5793 if (button)
5794 TOOLBAR_LButtonDown (infoPtr, wParam, lParam);
5795 else if (infoPtr->dwStyle & CCS_ADJUSTABLE)
5796 TOOLBAR_Customize (infoPtr);
5797
5798 return 0;
5799}
static LRESULT TOOLBAR_LButtonDown(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5803
static LRESULT TOOLBAR_Customize(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3394
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 5803 of file toolbar.c.

5804{
5805 TBUTTON_INFO *btnPtr;
5806 POINT pt;
5807 INT nHit;
5808 NMTOOLBARA nmtb;
5809 NMMOUSE nmmouse;
5810 BOOL bDragKeyPressed;
5811 BOOL button;
5812
5813 TRACE("\n");
5814
5815 if (infoPtr->dwStyle & TBSTYLE_ALTDRAG)
5816 bDragKeyPressed = (GetKeyState(VK_MENU) < 0);
5817 else
5818 bDragKeyPressed = (wParam & MK_SHIFT);
5819
5820 if (infoPtr->hwndToolTip)
5821 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwndSelf,
5823
5824 pt.x = (short)LOWORD(lParam);
5825 pt.y = (short)HIWORD(lParam);
5826 nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
5827
5828 if (button)
5829 {
5830 btnPtr = &infoPtr->buttons[nHit];
5831
5832 if (bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE))
5833 {
5834 infoPtr->nButtonDrag = nHit;
5835 SetCapture (infoPtr->hwndSelf);
5836
5837 /* If drag cursor has not been loaded, load it.
5838 * Note: it doesn't need to be freed */
5839 if (!hCursorDrag)
5840#ifndef __REACTOS__
5842#else
5844#endif
5846 }
5847 else
5848 {
5849 RECT arrowRect;
5850 infoPtr->nOldHit = nHit;
5851
5852 arrowRect = btnPtr->rect;
5853 arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH);
5854
5855 /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */
5856 if ((btnPtr->fsState & TBSTATE_ENABLED) &&
5857 ((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) ||
5858 ((btnPtr->fsStyle & BTNS_DROPDOWN) &&
5859 ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) ||
5860 (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))))
5861 {
5862 LRESULT res;
5863
5864 /* draw in pressed state */
5865 if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
5866 btnPtr->fsState |= TBSTATE_PRESSED;
5867 else
5868 btnPtr->bDropDownPressed = TRUE;
5870
5871 memset(&nmtb, 0, sizeof(nmtb));
5872 nmtb.iItem = btnPtr->idCommand;
5873 nmtb.rcButton = btnPtr->rect;
5874 res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_DROPDOWN);
5875 TRACE("TBN_DROPDOWN responded with %ld\n", res);
5876
5878 {
5879 MSG msg;
5880
5881 /* redraw button in unpressed state */
5882 if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
5883 btnPtr->fsState &= ~TBSTATE_PRESSED;
5884 else
5885 btnPtr->bDropDownPressed = FALSE;
5886 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
5887
5888 /* find and set hot item */
5889 GetCursorPos(&pt);
5890 ScreenToClient(infoPtr->hwndSelf, &pt);
5891 nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button);
5892 if (!infoPtr->bAnchor || button)
5894
5895 /* remove any left mouse button down or double-click messages
5896 * so that we can get a toggle effect on the button */
5899 ;
5900
5901 return 0;
5902 }
5903 /* otherwise drop through and process as pushed */
5904 }
5905 infoPtr->bCaptured = TRUE;
5906 infoPtr->nButtonDown = nHit;
5907 infoPtr->bDragOutSent = FALSE;
5908
5909 btnPtr->fsState |= TBSTATE_PRESSED;
5910
5912
5913 if (btnPtr->fsState & TBSTATE_ENABLED)
5914 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
5915 UpdateWindow(infoPtr->hwndSelf);
5916 SetCapture (infoPtr->hwndSelf);
5917 }
5918
5919 memset(&nmtb, 0, sizeof(nmtb));
5920 nmtb.iItem = btnPtr->idCommand;
5921 TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
5922 }
5923
5924 nmmouse.dwHitInfo = nHit;
5925
5926 /* !!! Undocumented - sends NM_LDOWN with the NMMOUSE structure. */
5927 if (!button)
5928 nmmouse.dwItemSpec = -1;
5929 else
5930 {
5931 nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
5932 nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
5933 }
5934
5935 ClientToScreen(infoPtr->hwndSelf, &pt);
5936 nmmouse.pt = pt;
5937
5938 if (!TOOLBAR_SendNotify(&nmmouse.hdr, infoPtr, NM_LDOWN))
5940
5941 return 0;
5942}
#define msg(x)
Definition: auth_time.c:54
#define IDC_MOVEBUTTON
Definition: comctl32.h:96
static HCURSOR hCursorDrag
Definition: toolbar.c:86
static void TOOLBAR_SetHotItemEx(TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason)
Definition: toolbar.c:4863
static VOID TOOLBAR_RelayEvent(HWND hwndTip, HWND hwndMsg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:2148
#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:160
INT nButtonDrag
Definition: toolbar.c:135
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:2372
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1781
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2756
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define RDW_UPDATENOW
Definition: winuser.h:1223
#define RDW_ERASE
Definition: winuser.h:1214
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2191
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:1199
BOOL WINAPI UpdateWindow(_In_ HWND)
#define RDW_INVALIDATE
Definition: winuser.h:1217
SHORT WINAPI GetKeyState(_In_ int)
#define VK_MENU
Definition: winuser.h:2207
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 5945 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_LoadImages()

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

Definition at line 4053 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_MapAccelerator()

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

Definition at line 4066 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_MarkButton()

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

Definition at line 4107 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_MeasureButton()

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

Definition at line 1733 of file toolbar.c.

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

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

1369{
1370 RECT myrect;
1371
1372 lpSize->cx = 0;
1373 lpSize->cy = 0;
1374
1375 if (infoPtr->nMaxTextRows > 0 &&
1376 !(btnPtr->fsState & TBSTATE_HIDDEN) &&
1377 (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
1378 (btnPtr->fsStyle & BTNS_SHOWTEXT)) )
1379 {
1380 LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr);
1381
1382 if(lpText != NULL) {
1383 /* first get size of all the text */
1384 GetTextExtentPoint32W (hdc, lpText, lstrlenW (lpText), lpSize);
1385
1386 /* feed above size into the rectangle for DrawText */
1387 SetRect(&myrect, 0, 0, lpSize->cx, lpSize->cy);
1388
1389 /* Use DrawText to get true size as drawn (less pesky "&") */
1390 DrawTextW (hdc, lpText, -1, &myrect, DT_VCENTER | DT_SINGLELINE |
1391 DT_CALCRECT | ((btnPtr->fsStyle & BTNS_NOPREFIX) ?
1392 DT_NOPREFIX : 0));
1393
1394 /* feed back to caller */
1395 lpSize->cx = myrect.right;
1396 lpSize->cy = myrect.bottom;
1397 }
1398 }
1399
1400 TRACE("string size %d x %d!\n", lpSize->cx, lpSize->cy);
1401}
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 6169 of file toolbar.c.

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

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_MoveButton()

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

Definition at line 4155 of file toolbar.c.

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

Referenced by TOOLBAR_LButtonUp(), and ToolbarWindowProc().

◆ TOOLBAR_MoveFixupIndex()

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

Definition at line 4135 of file toolbar.c.

4136{
4137 if (bMoveUp)
4138 {
4139 if (*pIndex > nIndex && *pIndex <= nMoveIndex)
4140 (*pIndex)--;
4141 else if (*pIndex == nIndex)
4142 *pIndex = nMoveIndex;
4143 }
4144 else
4145 {
4146 if (*pIndex >= nMoveIndex && *pIndex < nIndex)
4147 (*pIndex)++;
4148 else if (*pIndex == nIndex)
4149 *pIndex = nMoveIndex;
4150 }
4151}
_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 6288 of file toolbar.c.

6289{
6290/* if (wndPtr->dwStyle & CCS_NODIVIDER) */
6292/* else */
6293/* return TOOLBAR_NCPaint (wndPtr, wParam, lParam); */
6294}
#define WM_NCACTIVATE
Definition: winuser.h:1691

Referenced by ToolbarWindowProc().

◆ TOOLBAR_NCCalcSize()

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

Definition at line 6298 of file toolbar.c.

6299{
6302
6304}
#define LPRECT
Definition: precomp.h:28
#define WM_NCCALCSIZE
Definition: winuser.h:1688

Referenced by ToolbarWindowProc().

◆ TOOLBAR_NCCreate()

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

Definition at line 6311 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_NCPaint()

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

Definition at line 6398 of file toolbar.c.

6399{
6400 DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
6401 RECT rcWindow;
6402 HDC hdc;
6403
6404 if (dwStyle & WS_MINIMIZE)
6405 return 0; /* Nothing to do */
6406
6408
6409 if (!(hdc = GetDCEx (hwnd, 0, DCX_USESTYLE | DCX_WINDOW)))
6410 return 0;
6411
6412 if (!(dwStyle & CCS_NODIVIDER))
6413 {
6414 GetWindowRect (hwnd, &rcWindow);
6415 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
6416 if( dwStyle & WS_BORDER )
6417 InflateRect (&rcWindow, -1, -1);
6418 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP);
6419 }
6420
6421 ReleaseDC( hwnd, hdc );
6422
6423 return 0;
6424}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define WS_MINIMIZE
Definition: pedump.c:622
#define DCX_WINDOW
Definition: winuser.h:2116
#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:1690

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Notify()

static LRESULT TOOLBAR_Notify ( TOOLBAR_INFO infoPtr,
LPNMHDR  lpnmh 
)
inlinestatic

Definition at line 6616 of file toolbar.c.

6617{
6618 switch (lpnmh->code)
6619 {
6620 case PGN_CALCSIZE:
6621 {
6622 LPNMPGCALCSIZE lppgc = (LPNMPGCALCSIZE)lpnmh;
6623
6624 if (lppgc->dwFlag == PGF_CALCWIDTH) {
6625 lppgc->iWidth = infoPtr->rcBound.right - infoPtr->rcBound.left;
6626 TRACE("processed PGN_CALCSIZE, returning horz size = %d\n",
6627 lppgc->iWidth);
6628 }
6629 else {
6630 lppgc->iHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top;
6631 TRACE("processed PGN_CALCSIZE, returning vert size = %d\n",
6632 lppgc->iHeight);
6633 }
6634 return 0;
6635 }
6636
6637 case PGN_SCROLL:
6638 {
6639 LPNMPGSCROLL lppgs = (LPNMPGSCROLL)lpnmh;
6640
6641 lppgs->iScroll = (lppgs->iDir & (PGF_SCROLLLEFT | PGF_SCROLLRIGHT)) ?
6642 infoPtr->nButtonWidth : infoPtr->nButtonHeight;
6643 TRACE("processed PGN_SCROLL, returning scroll=%d, dir=%d\n",
6644 lppgs->iScroll, lppgs->iDir);
6645 return 0;
6646 }
6647
6648 case TTN_GETDISPINFOW:
6649 return TOOLBAR_TTGetDispInfo(infoPtr, (LPNMTTDISPINFOW)lpnmh);
6650
6651 case TTN_GETDISPINFOA:
6652 FIXME("TTN_GETDISPINFOA - should not be received; please report\n");
6653 return 0;
6654
6655 default:
6656 return 0;
6657 }
6658}
static LRESULT TOOLBAR_TTGetDispInfo(TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnmtdi)
Definition: toolbar.c:6428
#define TTN_GETDISPINFOA
Definition: commctrl.h:1877
#define TTN_GETDISPINFOW
Definition: commctrl.h:1878
#define PGF_SCROLLRIGHT
Definition: commctrl.h:4565
#define PGN_CALCSIZE
Definition: commctrl.h:4585
#define PGF_SCROLLLEFT
Definition: commctrl.h:4564
struct NMPGSCROLL * LPNMPGSCROLL
#define PGF_CALCWIDTH
Definition: commctrl.h:4587
#define PGN_SCROLL
Definition: commctrl.h:4560
struct NMPGCALCSIZE * LPNMPGCALCSIZE
DWORD dwFlag
Definition: commctrl.h:4592
int iScroll
Definition: commctrl.h:4580
UINT code
Definition: winuser.h:3162

Referenced by ToolbarWindowProc().

◆ TOOLBAR_NotifyFormat()

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

Definition at line 6662 of file toolbar.c.

6663{
6665
6666 TRACE("wParam = 0x%lx, lParam = 0x%08lx\n", wParam, lParam);
6667
6668 if (lParam == NF_QUERY)
6669 return NFR_UNICODE;
6670
6671 if (lParam == NF_REQUERY) {
6672 format = SendMessageW(infoPtr->hwndNotify,
6673 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
6674 if ((format != NFR_ANSI) && (format != NFR_UNICODE)) {
6675 ERR("wrong response to WM_NOTIFYFORMAT (%ld), assuming ANSI\n",
6676 format);
6677 format = NFR_ANSI;
6678 }
6679 return format;
6680 }
6681 return 0;
6682}
Definition: format.c:58
#define NFR_ANSI
Definition: winuser.h:2461
#define NF_QUERY
Definition: winuser.h:2463

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Paint()

static LRESULT TOOLBAR_Paint ( TOOLBAR_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 6686 of file toolbar.c.

6687{
6688 HDC hdc;
6689 PAINTSTRUCT ps;
6690
6691 /* fill ps.rcPaint with a default rect */
6692 ps.rcPaint = infoPtr->rcBound;
6693
6694 hdc = wParam==0 ? BeginPaint(infoPtr->hwndSelf, &ps) : (HDC)wParam;
6695
6696 TRACE("psrect=(%s)\n", wine_dbgstr_rect(&ps.rcPaint));
6697
6698 TOOLBAR_Refresh (infoPtr, hdc, &ps);
6699 if (!wParam) EndPaint (infoPtr->hwndSelf, &ps);
6700
6701 return 0;
6702}
static void TOOLBAR_Refresh(TOOLBAR_INFO *infoPtr, HDC hdc, const PAINTSTRUCT *ps)
Definition: toolbar.c:1273
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 4205 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_RButtonDblClk()

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

Definition at line 6138 of file toolbar.c.

6139{
6140 NMHDR nmhdr;
6141
6142 if (!TOOLBAR_SendNotify(&nmhdr, infoPtr, NM_RDBLCLK))
6144
6145 return 0;
6146}
#define NM_RDBLCLK
Definition: commctrl.h:134
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1784

Referenced by ToolbarWindowProc().

◆ TOOLBAR_RButtonUp()

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

Definition at line 6108 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Refresh()

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

Definition at line 1273 of file toolbar.c.

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

7282{
7283 WNDCLASSW wndClass;
7284
7285 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
7286 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
7287 wndClass.lpfnWndProc = ToolbarWindowProc;
7288 wndClass.cbClsExtra = 0;
7289 wndClass.cbWndExtra = sizeof(TOOLBAR_INFO *);
7290 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
7291 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
7293
7294 RegisterClassW (&wndClass);
7295}
static LRESULT WINAPI ToolbarWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6856
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:943
LPCWSTR lpszClassName
Definition: winuser.h:3188
HBRUSH hbrBackground
Definition: winuser.h:3186
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
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:931

Referenced by DllMain().

◆ TOOLBAR_RelayEvent()

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

Definition at line 2148 of file toolbar.c.

2150{
2151 MSG msg;
2152
2153 msg.hwnd = hwndMsg;
2154 msg.message = uMsg;
2155 msg.wParam = wParam;
2156 msg.lParam = lParam;
2157 msg.time = GetMessageTime ();
2158 msg.pt.x = (short)LOWORD(GetMessagePos ());
2159 msg.pt.y = (short)HIWORD(GetMessagePos ());
2160
2161 SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
2162}
#define TTM_RELAYEVENT
Definition: commctrl.h:1797
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 4232 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Restore()

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

Definition at line 4381 of file toolbar.c.

4382{
4383 LONG res;
4384 HKEY hkey = NULL;
4385 BOOL ret = FALSE;
4386 DWORD dwType;
4387 DWORD dwSize = 0;
4388 NMTBRESTORE nmtbr;
4389 NMHDR hdr;
4390
4391 /* restore toolbar information */
4392 TRACE("restore from %s %s\n", debugstr_w(lpSave->pszSubKey),
4393 debugstr_w(lpSave->pszValueName));
4394
4395 memset(&nmtbr, 0, sizeof(nmtbr));
4396
4397 res = RegOpenKeyExW(lpSave->hkr, lpSave->pszSubKey, 0,
4398 KEY_QUERY_VALUE, &hkey);
4399 if (!res)
4400 res = RegQueryValueExW(hkey, lpSave->pszValueName, NULL, &dwType,
4401 NULL, &dwSize);
4402 if (!res && dwType != REG_BINARY)
4404 if (!res)
4405 {
4406 nmtbr.pData = Alloc(dwSize);
4407 nmtbr.cbData = dwSize;
4408 if (!nmtbr.pData) res = ERROR_OUTOFMEMORY;
4409 }
4410 if (!res)
4411 res = RegQueryValueExW(hkey, lpSave->pszValueName, NULL, &dwType,
4412 (LPBYTE)nmtbr.pData, &dwSize);
4413 if (!res)
4414 {
4415 nmtbr.pCurrent = nmtbr.pData;
4416 nmtbr.iItem = -1;
4417 nmtbr.cbBytesPerRecord = sizeof(DWORD);
4418 nmtbr.cButtons = nmtbr.cbData / nmtbr.cbBytesPerRecord;
4419
4420 if (!TOOLBAR_SendNotify(&nmtbr.hdr, infoPtr, TBN_RESTORE))
4421 {
4422 INT i, count = nmtbr.cButtons;
4423
4424 /* remove all existing buttons as this function is designed to
4425 * restore the toolbar to a previously saved state */
4426 TOOLBAR_DeleteAllButtons(infoPtr);
4427
4428 for (i = 0; i < count; i++)
4429 {
4430 nmtbr.iItem = i;
4431 nmtbr.tbButton.iBitmap = -1;
4432 nmtbr.tbButton.fsState = 0;
4433 nmtbr.tbButton.fsStyle = 0;
4434 nmtbr.tbButton.dwData = 0;
4435 nmtbr.tbButton.iString = 0;
4436
4437 if (*nmtbr.pCurrent & 0x80000000)
4438 {
4439 /* separator */
4441 nmtbr.tbButton.idCommand = 0;
4442 nmtbr.tbButton.fsStyle = BTNS_SEP;
4443 if (*nmtbr.pCurrent != (DWORD)-1)
4445 }
4446 else
4447 nmtbr.tbButton.idCommand = (int)*nmtbr.pCurrent;
4448
4449 nmtbr.pCurrent++;
4450
4451 TOOLBAR_SendNotify(&nmtbr.hdr, infoPtr, TBN_RESTORE);
4452
4453 /* All returned ptrs and -1 are ignored */
4454 if (!IS_INTRESOURCE(nmtbr.tbButton.iString))
4455 nmtbr.tbButton.iString = 0;
4456
4457 TOOLBAR_InsertButtonT(infoPtr, -1, &nmtbr.tbButton, TRUE);
4458 }
4459
4461 for (i = 0; ; i++)
4462 {
4463 NMTOOLBARW tb;
4464 TBBUTTONINFOW bi;
4465 WCHAR buf[128];
4467 INT idx;
4468
4469 memset( &tb, 0, sizeof(tb) );
4470 tb.iItem = i;
4471 tb.cchText = ARRAY_SIZE(buf);
4472 tb.pszText = buf;
4473
4474 /* Use the same struct for both A and W versions since the layout is the same. */
4475 if (!TOOLBAR_SendNotify( &tb.hdr, infoPtr, code ))
4476 break;
4477
4478 idx = TOOLBAR_GetButtonIndex( infoPtr, tb.tbButton.idCommand, FALSE );
4479 if (idx == -1) continue;
4480
4481 /* tb.pszText is ignored - the string comes from tb.tbButton.iString, which may
4482 be an index or a ptr. Either way it is simply copied. There is no api to change
4483 the string index, so we set it manually. The other properties can be set with SetButtonInfo. */
4484 free_string( infoPtr->buttons + idx );
4485 infoPtr->buttons[idx].iString = tb.tbButton.iString;
4486
4487 memset( &bi, 0, sizeof(bi) );
4488 bi.cbSize = sizeof(bi);
4490 bi.iImage = tb.tbButton.iBitmap;
4491 bi.fsState = tb.tbButton.fsState;
4492 bi.fsStyle = tb.tbButton.fsStyle;
4493 bi.lParam = tb.tbButton.dwData;
4494
4495 TOOLBAR_SetButtonInfo( infoPtr, tb.tbButton.idCommand, &bi, TRUE );
4496 }
4497 TOOLBAR_SendNotify( &hdr, infoPtr, TBN_ENDADJUST );
4498
4499 /* remove all uninitialised buttons
4500 * note: loop backwards to avoid having to fixup i on a
4501 * delete */
4502 for (i = infoPtr->nNumButtons - 1; i >= 0; i--)
4503 if (infoPtr->buttons[i].iBitmap == -1)
4504 TOOLBAR_DeleteButton(infoPtr, i);
4505
4506 /* only indicate success if at least one button survived */
4507 if (infoPtr->nNumButtons > 0) ret = TRUE;
4508 }
4509 }
4510 Free (nmtbr.pData);
4511 RegCloseKey(hkey);
4512
4513 return ret;
4514}
#define ARRAY_SIZE(A)
Definition: main.h:20
#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:4363
static LRESULT TOOLBAR_SetButtonInfo(TOOLBAR_INFO *infoPtr, INT Id, const TBBUTTONINFOW *lptbbi, BOOL isW)
Definition: toolbar.c:4628
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 4309 of file toolbar.c.

4310{
4311 NMTBSAVE save;
4312 INT ret, i;
4313 BOOL alloced = FALSE;
4314 HKEY key;
4315
4316 TRACE( "save to %s %s\n", debugstr_w(params->pszSubKey), debugstr_w(params->pszValueName) );
4317
4318 memset( &save, 0, sizeof(save) );
4319 save.cbData = infoPtr->nNumButtons * sizeof(DWORD);
4320 save.iItem = -1;
4321 save.cButtons = infoPtr->nNumButtons;
4322 save.tbButton.idCommand = -1;
4323 TOOLBAR_SendNotify( &save.hdr, infoPtr, TBN_SAVE );
4324
4325 if (!save.pData)
4326 {
4327 save.pData = Alloc( save.cbData );
4328 if (!save.pData) return FALSE;
4329 alloced = TRUE;
4330 }
4331 if (!save.pCurrent) save.pCurrent = save.pData;
4332
4333 for (i = 0; i < infoPtr->nNumButtons; i++)
4334 {
4335 save.iItem = i;
4336 save.tbButton.iBitmap = infoPtr->buttons[i].iBitmap;
4337 save.tbButton.idCommand = infoPtr->buttons[i].idCommand;
4338 save.tbButton.fsState = infoPtr->buttons[i].fsState;
4339 save.tbButton.fsStyle = infoPtr->buttons[i].fsStyle;
4340 memset( save.tbButton.bReserved, 0, sizeof(save.tbButton.bReserved) );
4341 save.tbButton.dwData = infoPtr->buttons[i].dwData;
4342 save.tbButton.iString = infoPtr->buttons[i].iString;
4343
4344 *save.pCurrent++ = save.tbButton.idCommand;
4345
4346 TOOLBAR_SendNotify( &save.hdr, infoPtr, TBN_SAVE );
4347 }
4348
4349 ret = RegCreateKeyW( params->hkr, params->pszSubKey, &key );
4350 if (ret == ERROR_SUCCESS)
4351 {
4352 ret = RegSetValueExW( key, params->pszValueName, 0, REG_BINARY, (BYTE *)save.pData, save.cbData );
4353 RegCloseKey( key );
4354 }
4355
4356 if (alloced) Free( save.pData );
4357 return !ret;
4358}
#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 4530 of file toolbar.c.

4531{
4532 LPWSTR pszValueName = 0, pszSubKey = 0;
4533 TBSAVEPARAMSW SaveW;
4534 LRESULT result = 0;
4535 int len;
4536
4537 if (lpSave == NULL) return 0;
4538
4539 len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, NULL, 0);
4540 pszSubKey = Alloc(len * sizeof(WCHAR));
4541 if (!pszSubKey) goto exit;
4542 MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, pszSubKey, len);
4543
4544 len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, NULL, 0);
4545 pszValueName = Alloc(len * sizeof(WCHAR));
4546 if (!pszValueName) goto exit;
4547 MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, pszValueName, len);
4548
4549 SaveW.pszValueName = pszValueName;
4550 SaveW.pszSubKey = pszSubKey;
4551 SaveW.hkr = lpSave->hkr;
4552 result = TOOLBAR_SaveRestoreW(infoPtr, wParam, &SaveW);
4553
4554exit:
4555 Free (pszValueName);
4556 Free (pszSubKey);
4557
4558 return result;
4559}
static LRESULT TOOLBAR_SaveRestoreW(TOOLBAR_INFO *infoPtr, WPARAM wParam, const TBSAVEPARAMSW *lpSave)
Definition: toolbar.c:4518
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 4518 of file toolbar.c.

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

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

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetBitmapSize()

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

Definition at line 4578 of file toolbar.c.

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

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetButtonInfo()

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

Definition at line 4628 of file toolbar.c.

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

Referenced by TOOLBAR_Restore(), and ToolbarWindowProc().

◆ TOOLBAR_SetButtonSize()

static LRESULT TOOLBAR_SetButtonSize ( TOOLBAR_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 4675 of file toolbar.c.

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

Referenced by TOOLBAR_SetImageList(), and ToolbarWindowProc().

◆ TOOLBAR_SetButtonWidth()

static LRESULT TOOLBAR_SetButtonWidth ( TOOLBAR_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 4725 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetCmdId()

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

Definition at line 4754 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetColorScheme()

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

Definition at line 5355 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetDisabledImageList()

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

Definition at line 4772 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetDrawTextFlags()

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

Definition at line 4790 of file toolbar.c.

4791{
4792 DWORD old_flags;
4793
4794 TRACE("hwnd = %p, mask = 0x%08x, flags = 0x%08x\n", infoPtr->hwndSelf, mask, flags);
4795
4796 old_flags = infoPtr->dwDTFlags;
4797 infoPtr->dwDTFlags = (old_flags & ~mask) | (flags & mask);
4798
4799 return (LRESULT)old_flags;
4800}
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 4809 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetFocus()

static LRESULT TOOLBAR_SetFocus ( TOOLBAR_INFO infoPtr)
static

Definition at line 6706 of file toolbar.c.

6707{
6708 TRACE("nHotItem = %d\n", infoPtr->nHotItem);
6709
6710 /* make first item hot */
6711 if (infoPtr->nNumButtons > 0)
6712 TOOLBAR_SetHotItemEx(infoPtr, 0, HICF_OTHER);
6713
6714 return 0;
6715}
#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 6718 of file toolbar.c.

6719{
6720 TRACE("font=%p redraw=%d\n", hFont, Redraw);
6721
6722 if (hFont == 0)
6723 infoPtr->hFont = infoPtr->hDefaultFont;
6724 else
6725 infoPtr->hFont = hFont;
6726
6727 TOOLBAR_CalcToolbar(infoPtr);
6728
6729 if (Redraw)
6730 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
6731 return 1;
6732}
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 4837 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetHotItem()

static LRESULT TOOLBAR_SetHotItem ( TOOLBAR_INFO infoPtr,
INT  nHotItem 
)
static

Definition at line 4914 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetHotItem2()

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

Definition at line 5454 of file toolbar.c.

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

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

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetIndent()

static LRESULT TOOLBAR_SetIndent ( TOOLBAR_INFO infoPtr,
INT  nIndent 
)
static

Definition at line 4981 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetInsertMark()

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

Definition at line 5000 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetInsertMarkColor()

static LRESULT TOOLBAR_SetInsertMarkColor ( TOOLBAR_INFO infoPtr,
COLORREF  clr 
)
static

Definition at line 5026 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetListGap()

static LRESULT TOOLBAR_SetListGap ( TOOLBAR_INFO infoPtr,
INT  iListGap 
)
static

Definition at line 5475 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetMaxTextRows()

static LRESULT TOOLBAR_SetMaxTextRows ( TOOLBAR_INFO infoPtr,
INT  nMaxRows 
)
static

Definition at line 5038 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetPadding()

static LRESULT TOOLBAR_SetPadding ( TOOLBAR_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 5097 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetParent()

static LRESULT TOOLBAR_SetParent ( TOOLBAR_INFO infoPtr,
HWND  hParent 
)
static

Definition at line 5111 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetRedraw()

static LRESULT TOOLBAR_SetRedraw ( TOOLBAR_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 6735 of file toolbar.c.

6749{
6750 BOOL oldredraw = infoPtr->bDoRedraw;
6751
6752 TRACE("set to %s\n",
6753 (wParam) ? "TRUE" : "FALSE");
6754 infoPtr->bDoRedraw = (BOOL) wParam;
6755 if (wParam) {
6756 InvalidateRect (infoPtr->hwndSelf, 0, TRUE);
6757 }
6758 return (oldredraw) ? 1 : 0;
6759}
#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 5714 of file toolbar.c.

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

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetState()

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

Definition at line 5245 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetStyle()

static LRESULT TOOLBAR_SetStyle ( TOOLBAR_INFO infoPtr,
DWORD  style 
)
static

Definition at line 5283 of file toolbar.c.

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

Referenced by TOOLBAR_StyleChanged(), and ToolbarWindowProc().

◆ TOOLBAR_SetToolTips()

static LRESULT TOOLBAR_SetToolTips ( TOOLBAR_INFO infoPtr,
HWND  hwndTooltip 
)
inlinestatic

Definition at line 5318 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SetUnicodeFormat()

static LRESULT TOOLBAR_SetUnicodeFormat ( TOOLBAR_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 5328 of file toolbar.c.

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

Referenced by TOOLBAR_SetVersion(), and ToolbarWindowProc().

◆ TOOLBAR_SetVersion()

static LRESULT TOOLBAR_SetVersion ( TOOLBAR_INFO infoPtr,
INT  iVersion 
)
static

Definition at line 5369 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Size()

static LRESULT TOOLBAR_Size ( TOOLBAR_INFO infoPtr)
static

Definition at line 6763 of file toolbar.c.

6764{
6765 TRACE("sizing toolbar\n");
6766
6768 {
6769 RECT delta_width, delta_height, client, dummy;
6770 DWORD min_x, max_x, min_y, max_y;
6771 TBUTTON_INFO *btnPtr;
6772 INT i;
6773
6774 GetClientRect(infoPtr->hwndSelf, &client);
6775 if(client.right > infoPtr->client_rect.right)
6776 {
6777 min_x = infoPtr->client_rect.right;
6778 max_x = client.right;
6779 }
6780 else
6781 {
6782 max_x = infoPtr->client_rect.right;
6783 min_x = client.right;
6784 }
6785 if(client.bottom > infoPtr->client_rect.bottom)
6786 {
6787 min_y = infoPtr->client_rect.bottom;
6788 max_y = client.bottom;
6789 }
6790 else
6791 {
6792 max_y = infoPtr->client_rect.bottom;
6793 min_y = client.bottom;
6794 }
6795
6796 SetRect(&delta_width, min_x, 0, max_x, min_y);
6797 SetRect(&delta_height, 0, min_y, max_x, max_y);
6798
6799 TRACE("delta_width %s delta_height %s\n", wine_dbgstr_rect(&delta_width), wine_dbgstr_rect(&delta_height));
6800 btnPtr = infoPtr->buttons;
6801 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++)
6802 if(IntersectRect(&dummy, &delta_width, &btnPtr->rect) ||
6803 IntersectRect(&dummy, &delta_height, &btnPtr->rect))
6804 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
6805 }
6806 GetClientRect(infoPtr->hwndSelf, &infoPtr->client_rect);
6807 TOOLBAR_AutoSize(infoPtr);
6808 return 0;
6809}
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 6813 of file toolbar.c.

6814{
6815 if (nType == GWL_STYLE)
6816 return TOOLBAR_SetStyle(infoPtr, lpStyle->styleNew);
6817
6818 return 0;
6819}
static LRESULT TOOLBAR_SetStyle(TOOLBAR_INFO *infoPtr, DWORD style)
Definition: toolbar.c:5283
DWORD styleNew
Definition: winuser.h:3696

Referenced by ToolbarWindowProc().

◆ TOOLBAR_SysColorChange()

static LRESULT TOOLBAR_SysColorChange ( void  )
static

Definition at line 6823 of file toolbar.c.

6824{
6826
6827 return 0;
6828}
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1593

Referenced by ToolbarWindowProc().

◆ TOOLBAR_TooltipAddTool()

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

Definition at line 2165 of file toolbar.c.

2166{
2167 if (infoPtr->hwndToolTip && !(button->fsStyle & BTNS_SEP)) {
2168 TTTOOLINFOW ti;
2169
2170 ZeroMemory(&ti, sizeof(TTTOOLINFOW));
2171 ti.cbSize = sizeof (TTTOOLINFOW);
2172 ti.hwnd = infoPtr->hwndSelf;
2173 ti.uId = button->idCommand;
2174 ti.hinst = 0;
2176 /* ti.lParam = random value from the stack? */
2177
2179 0, (LPARAM)&ti);
2180 }
2181}
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2385
struct tagTOOLINFOW TTTOOLINFOW
#define TTM_ADDTOOLW
Definition: commctrl.h:1792
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 2216 of file toolbar.c.

2217{
2218 int i;
2219 NMTOOLTIPSCREATED nmttc;
2220
2223 infoPtr->hwndSelf, 0, 0, 0);
2224
2225 if (!infoPtr->hwndToolTip)
2226 return;
2227
2228 /* Send NM_TOOLTIPSCREATED notification */
2229 nmttc.hwndToolTips = infoPtr->hwndToolTip;
2230 TOOLBAR_SendNotify(&nmttc.hdr, infoPtr, NM_TOOLTIPSCREATED);
2231
2232 for (i = 0; i < infoPtr->nNumButtons; i++)
2233 {
2234 TOOLBAR_TooltipAddTool(infoPtr, &infoPtr->buttons[i]);
2235 TOOLBAR_TooltipSetRect(infoPtr, &infoPtr->buttons[i]);
2236 }
2237}
#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 2184 of file toolbar.c.

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

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

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

Referenced by TOOLBAR_LayoutToolbar(), and TOOLBAR_TooltipCreateControl().

◆ TOOLBAR_TranslateState()

static UINT TOOLBAR_TranslateState ( const TBUTTON_INFO btnPtr,
BOOL  captured 
)
static

Definition at line 788 of file toolbar.c.

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_TTGetDispInfo()

static LRESULT TOOLBAR_TTGetDispInfo ( TOOLBAR_INFO infoPtr,
NMTTDISPINFOW lpnmtdi 
)
static

Definition at line 6428 of file toolbar.c.

6429{
6430 int index = TOOLBAR_GetButtonIndex(infoPtr, lpnmtdi->hdr.idFrom, FALSE);
6431 NMTTDISPINFOA nmtdi;
6432 unsigned int len;
6433 LRESULT ret;
6434
6435 TRACE("button index = %d\n", index);
6436
6437 Free (infoPtr->pszTooltipText);
6438 infoPtr->pszTooltipText = NULL;
6439
6440 if (index < 0)
6441 return 0;
6442
6443 if (infoPtr->bUnicode)
6444 {
6445 WCHAR wszBuffer[INFOTIPSIZE+1];
6446 NMTBGETINFOTIPW tbgit;
6447
6448 wszBuffer[0] = '\0';
6449 wszBuffer[INFOTIPSIZE] = '\0';
6450
6451 tbgit.pszText = wszBuffer;
6452 tbgit.cchTextMax = INFOTIPSIZE;
6453 tbgit.iItem = lpnmtdi->hdr.idFrom;
6454 tbgit.lParam = infoPtr->buttons[index].dwData;
6455
6456 TOOLBAR_SendNotify(&tbgit.hdr, infoPtr, TBN_GETINFOTIPW);
6457
6458 TRACE("TBN_GETINFOTIPW - got string %s\n", debugstr_w(tbgit.pszText));
6459
6460 len = tbgit.pszText ? lstrlenW(tbgit.pszText) : 0;
6461 if (len > ARRAY_SIZE(lpnmtdi->szText) - 1)
6462 {
6463 /* need to allocate temporary buffer in infoPtr as there
6464 * isn't enough space in buffer passed to us by the
6465 * tooltip control */
6466 infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR));
6467 if (infoPtr->pszTooltipText)
6468 {
6469 memcpy(infoPtr->pszTooltipText, tbgit.pszText, (len+1)*sizeof(WCHAR));
6470 lpnmtdi->lpszText = infoPtr->pszTooltipText;
6471 return 0;
6472 }
6473 }
6474 else if (len > 0)
6475 {
6476 memcpy(lpnmtdi->lpszText, tbgit.pszText, (len+1)*sizeof(WCHAR));
6477 return 0;
6478 }
6479 }
6480 else
6481 {
6482 CHAR szBuffer[INFOTIPSIZE+1];
6483 NMTBGETINFOTIPA tbgit;
6484
6485 szBuffer[0] = '\0';
6486 szBuffer[INFOTIPSIZE] = '\0';
6487
6488 tbgit.pszText = szBuffer;
6489 tbgit.cchTextMax = INFOTIPSIZE;
6490 tbgit.iItem = lpnmtdi->hdr.idFrom;
6491 tbgit.lParam = infoPtr->buttons[index].dwData;
6492
6493 TOOLBAR_SendNotify(&tbgit.hdr, infoPtr, TBN_GETINFOTIPA);
6494
6495 TRACE("TBN_GETINFOTIPA - got string %s\n", debugstr_a(tbgit.pszText));
6496
6497 len = MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, NULL, 0);
6498 if (len > ARRAY_SIZE(lpnmtdi->szText))
6499 {
6500 /* need to allocate temporary buffer in infoPtr as there
6501 * isn't enough space in buffer passed to us by the
6502 * tooltip control */
6503 infoPtr->pszTooltipText = Alloc(len*sizeof(WCHAR));
6504 if (infoPtr->pszTooltipText)
6505 {
6506 MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, infoPtr->pszTooltipText, len);
6507 lpnmtdi->lpszText = infoPtr->pszTooltipText;
6508 return 0;
6509 }
6510 }
6511 else if (tbgit.pszText && tbgit.pszText[0])
6512 {
6513 MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, lpnmtdi->lpszText, ARRAY_SIZE(lpnmtdi->szText));
6514 return 0;
6515 }
6516 }
6517
6518 /* if button has text, but it is not shown then automatically
6519 * use that text as tooltip */
6520 if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) &&
6521 !(infoPtr->buttons[index].fsStyle & BTNS_SHOWTEXT))
6522 {
6523 LPWSTR pszText = TOOLBAR_GetText(infoPtr, &infoPtr->buttons[index]);
6524 len = pszText ? lstrlenW(pszText) : 0;
6525
6526 TRACE("using button hidden text %s\n", debugstr_w(pszText));
6527
6528 if (len > ARRAY_SIZE(lpnmtdi->szText) - 1)
6529 {
6530 /* need to allocate temporary buffer in infoPtr as there
6531 * isn't enough space in buffer passed to us by the
6532 * tooltip control */
6533 infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR));
6534 if (infoPtr->pszTooltipText)
6535 {
6536 memcpy(infoPtr->pszTooltipText, pszText, (len+1)*sizeof(WCHAR));
6537 lpnmtdi->lpszText = infoPtr->pszTooltipText;
6538 return 0;
6539 }
6540 }
6541 else if (len > 0)
6542 {
6543 memcpy(lpnmtdi->lpszText, pszText, (len+1)*sizeof(WCHAR));
6544 return 0;
6545 }
6546 }
6547
6548 TRACE("Sending tooltip notification to %p\n", infoPtr->hwndNotify);
6549
6550 /* Last resort, forward TTN_GETDISPINFO to the app:
6551
6552 - NFR_UNICODE gets TTN_GETDISPINFOW, and TTN_GETDISPINFOA if -W returned no text;
6553 - NFR_ANSI gets only TTN_GETDISPINFOA.
6554 */
6555 if (infoPtr->bUnicode)
6556 {
6557 ret = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmtdi->hdr.idFrom, (LPARAM)lpnmtdi);
6558
6559 TRACE("TTN_GETDISPINFOW - got string %s\n", debugstr_w(lpnmtdi->lpszText));
6560
6561 if (IS_INTRESOURCE(lpnmtdi->lpszText))
6562 return ret;
6563
6564 if (lpnmtdi->lpszText && *lpnmtdi->lpszText)
6565 return ret;
6566 }
6567
6568 nmtdi.hdr.hwndFrom = lpnmtdi->hdr.hwndFrom;
6569 nmtdi.hdr.idFrom = lpnmtdi->hdr.idFrom;
6570 nmtdi.hdr.code = TTN_GETDISPINFOA;
6571 nmtdi.lpszText = nmtdi.szText;
6572 nmtdi.szText[0] = 0;
6573 nmtdi.hinst = lpnmtdi->hinst;
6574 nmtdi.uFlags = lpnmtdi->uFlags;
6575 nmtdi.lParam = lpnmtdi->lParam;
6576
6577 ret = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmtdi.hdr.idFrom, (LPARAM)&nmtdi);
6578
6579 TRACE("TTN_GETDISPINFOA - got string %s\n", debugstr_a(nmtdi.lpszText));
6580
6581 lpnmtdi->hinst = nmtdi.hinst;
6582 lpnmtdi->uFlags = nmtdi.uFlags;
6583 lpnmtdi->lParam = nmtdi.lParam;
6584
6585 if (IS_INTRESOURCE(nmtdi.lpszText))
6586 {
6587 lpnmtdi->lpszText = (WCHAR *)nmtdi.lpszText;
6588 return ret;
6589 }
6590
6591 if (!nmtdi.lpszText || !*nmtdi.lpszText)
6592 return ret;
6593
6594 len = MultiByteToWideChar(CP_ACP, 0, nmtdi.lpszText, -1, NULL, 0);
6595 if (len > ARRAY_SIZE(lpnmtdi->szText))
6596 {
6597 infoPtr->pszTooltipText = Alloc(len * sizeof(WCHAR));
6598 if (infoPtr->pszTooltipText)
6599 {
6600 MultiByteToWideChar(CP_ACP, 0, nmtdi.lpszText, -1, infoPtr->pszTooltipText, len);
6601 lpnmtdi->lpszText = infoPtr->pszTooltipText;
6602 return 0;
6603 }
6604 }
6605 else
6606 {
6607 MultiByteToWideChar(CP_ACP, 0, nmtdi.lpszText, -1, lpnmtdi->lpszText, ARRAY_SIZE(nmtdi.szText));
6608 return 0;
6609 }
6610
6611 return ret;
6612}
#define INFOTIPSIZE
Definition: commctrl.h:124
#define TBN_GETINFOTIPA
Definition: commctrl.h:1341
#define TBN_GETINFOTIPW
Definition: commctrl.h:1342
char szText[80]
Definition: commctrl.h:1903
HINSTANCE hinst
Definition: commctrl.h:1904
HINSTANCE hinst
Definition: commctrl.h:1913
WCHAR szText[80]
Definition: commctrl.h:1912

Referenced by TOOLBAR_Notify().

◆ TOOLBAR_Unkwn464()

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

Definition at line 5544 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Unregister()

VOID TOOLBAR_Unregister ( void  )

Definition at line 7299 of file toolbar.c.

7300{
7302}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by DllMain().

◆ TOOLBAR_WrapToolbar()

static void TOOLBAR_WrapToolbar ( TOOLBAR_INFO infoPtr)
static

Definition at line 1469 of file toolbar.c.

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

6857{
6859
6860 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n",
6861 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
6862
6863 if (!infoPtr && (uMsg != WM_NCCREATE))
6864 return DefWindowProcW( hwnd, uMsg, wParam, lParam );
6865
6866 switch (uMsg)
6867 {
6868 case TB_ADDBITMAP:
6869 return TOOLBAR_AddBitmap (infoPtr, (INT)wParam, (TBADDBITMAP*)lParam);
6870
6871 case TB_ADDBUTTONSA:
6872 case TB_ADDBUTTONSW:
6873 return TOOLBAR_AddButtonsT (infoPtr, wParam, (LPTBBUTTON)lParam,
6874 uMsg == TB_ADDBUTTONSW);
6875 case TB_ADDSTRINGA:
6876 return TOOLBAR_AddStringA (infoPtr, (HINSTANCE)wParam, lParam);
6877
6878 case TB_ADDSTRINGW:
6879 return TOOLBAR_AddStringW (infoPtr, (HINSTANCE)wParam, lParam);
6880
6881 case TB_AUTOSIZE:
6882 return TOOLBAR_AutoSize (infoPtr);
6883
6884 case TB_BUTTONCOUNT:
6885 return TOOLBAR_ButtonCount (infoPtr);
6886
6888 return TOOLBAR_ButtonStructSize (infoPtr, wParam);
6889
6890 case TB_CHANGEBITMAP:
6891 return TOOLBAR_ChangeBitmap (infoPtr, wParam, LOWORD(lParam));
6892
6893 case TB_CHECKBUTTON:
6894 return TOOLBAR_CheckButton (infoPtr, wParam, lParam);
6895
6896 case TB_COMMANDTOINDEX:
6897 return TOOLBAR_CommandToIndex (infoPtr, wParam);
6898
6899 case TB_CUSTOMIZE:
6900 return TOOLBAR_Customize (infoPtr);
6901
6902 case TB_DELETEBUTTON:
6903 return TOOLBAR_DeleteButton (infoPtr, wParam);
6904
6905 case TB_ENABLEBUTTON:
6906 return TOOLBAR_EnableButton (infoPtr, wParam, lParam);
6907
6909 return TOOLBAR_GetAnchorHighlight (infoPtr);
6910
6911 case TB_GETBITMAP:
6912 return TOOLBAR_GetBitmap (infoPtr, wParam);
6913
6914 case TB_GETBITMAPFLAGS:
6915 return TOOLBAR_GetBitmapFlags ();
6916
6917 case TB_GETBUTTON:
6918 return TOOLBAR_GetButton (infoPtr, wParam, (TBBUTTON*)lParam);
6919
6920 case TB_GETBUTTONINFOA:
6921 case TB_GETBUTTONINFOW:
6923 uMsg == TB_GETBUTTONINFOW);
6924 case TB_GETBUTTONSIZE:
6925 return TOOLBAR_GetButtonSize (infoPtr);
6926
6927 case TB_GETBUTTONTEXTA:
6928 case TB_GETBUTTONTEXTW:
6929 return TOOLBAR_GetButtonText (infoPtr, wParam, (LPWSTR)lParam,
6930 uMsg == TB_GETBUTTONTEXTW);
6931
6933 return TOOLBAR_GetDisabledImageList (infoPtr, wParam);
6934
6936 return TOOLBAR_GetExtendedStyle (infoPtr);
6937
6938 case TB_GETHOTIMAGELIST:
6939 return TOOLBAR_GetHotImageList (infoPtr, wParam);
6940
6941 case TB_GETHOTITEM:
6942 return TOOLBAR_GetHotItem (infoPtr);
6943
6944 case TB_GETIMAGELIST:
6945 return TOOLBAR_GetDefImageList (infoPtr, wParam);
6946
6947 case TB_GETINSERTMARK:
6948 return TOOLBAR_GetInsertMark (infoPtr, (TBINSERTMARK*)lParam);
6949
6951 return TOOLBAR_GetInsertMarkColor (infoPtr);
6952
6953 case TB_GETITEMRECT:
6954 return TOOLBAR_GetItemRect (infoPtr, wParam, (LPRECT)lParam);
6955
6956 case TB_GETMAXSIZE:
6957 return TOOLBAR_GetMaxSize (infoPtr, (LPSIZE)lParam);
6958#ifdef __REACTOS__
6959 case TB_GETMETRICS:
6960 return TOOLBAR_GetMetrics (infoPtr, (TBMETRICS*)lParam);
6961#endif
6962
6963/* case TB_GETOBJECT: */ /* 4.71 */
6964
6965 case TB_GETPADDING:
6966 return TOOLBAR_GetPadding (infoPtr);
6967
6968 case TB_GETRECT:
6969 return TOOLBAR_GetRect (infoPtr, wParam, (LPRECT)lParam);
6970
6971 case TB_GETROWS:
6972 return TOOLBAR_GetRows (infoPtr);
6973
6974 case TB_GETSTATE:
6975 return TOOLBAR_GetState (infoPtr, wParam);
6976
6977 case TB_GETSTRINGA:
6978 return TOOLBAR_GetStringA (infoPtr, wParam, (LPSTR)lParam);
6979
6980 case TB_GETSTRINGW:
6981 return TOOLBAR_GetStringW (infoPtr, wParam, (LPWSTR)lParam);
6982
6983 case TB_GETSTYLE:
6984 return TOOLBAR_GetStyle (infoPtr);
6985
6986 case TB_GETTEXTROWS:
6987 return TOOLBAR_GetTextRows (infoPtr);
6988
6989 case TB_GETTOOLTIPS:
6990 return TOOLBAR_GetToolTips (infoPtr);
6991
6993 return TOOLBAR_GetUnicodeFormat (infoPtr);
6994
6995 case TB_HIDEBUTTON:
6996 return TOOLBAR_HideButton (infoPtr, wParam, LOWORD(lParam));
6997
6998 case TB_HITTEST:
6999 return TOOLBAR_HitTest (infoPtr, (LPPOINT)lParam);
7000
7001 case TB_INDETERMINATE:
7002 return TOOLBAR_Indeterminate (infoPtr, wParam, LOWORD(lParam));
7003
7004 case TB_INSERTBUTTONA:
7005 case TB_INSERTBUTTONW:
7006 return TOOLBAR_InsertButtonT(infoPtr, wParam, (TBBUTTON*)lParam,
7007 uMsg == TB_INSERTBUTTONW);
7008
7009/* case TB_INSERTMARKHITTEST: */ /* 4.71 */
7010
7011 case TB_ISBUTTONCHECKED:
7012 return TOOLBAR_IsButtonChecked (infoPtr, wParam);
7013
7014 case TB_ISBUTTONENABLED:
7015 return TOOLBAR_IsButtonEnabled (infoPtr, wParam);
7016
7017 case TB_ISBUTTONHIDDEN:
7018 return TOOLBAR_IsButtonHidden (infoPtr, wParam);
7019
7021 return TOOLBAR_IsButtonHighlighted (infoPtr, wParam);
7022
7024 return TOOLBAR_IsButtonIndeterminate (infoPtr, wParam);
7025
7026 case TB_ISBUTTONPRESSED:
7027 return TOOLBAR_IsButtonPressed (infoPtr, wParam);
7028
7029 case TB_LOADIMAGES:
7030 return TOOLBAR_LoadImages (infoPtr, wParam, (HINSTANCE)lParam);
7031
7032 case TB_MAPACCELERATORA:
7033 case TB_MAPACCELERATORW:
7034 return TOOLBAR_MapAccelerator (infoPtr, wParam, (UINT*)lParam);
7035
7036 case TB_MARKBUTTON:
7037 return TOOLBAR_MarkButton (infoPtr, wParam, LOWORD(lParam));
7038
7039 case TB_MOVEBUTTON:
7040 return TOOLBAR_MoveButton (infoPtr, wParam, lParam);
7041
7042 case TB_PRESSBUTTON:
7043 return TOOLBAR_PressButton (infoPtr, wParam, LOWORD(lParam));
7044
7045 case TB_REPLACEBITMAP:
7047
7048 case TB_SAVERESTOREA:
7050
7051 case TB_SAVERESTOREW:
7053
7055 return TOOLBAR_SetAnchorHighlight (infoPtr, (BOOL)wParam);
7056
7057 case TB_SETBITMAPSIZE:
7058 return TOOLBAR_SetBitmapSize (infoPtr, wParam, lParam);
7059
7060 case TB_SETBUTTONINFOA:
7061 case TB_SETBUTTONINFOW:
7063 uMsg == TB_SETBUTTONINFOW);
7064 case TB_SETBUTTONSIZE:
7065 return TOOLBAR_SetButtonSize (infoPtr, lParam);
7066
7067 case TB_SETBUTTONWIDTH:
7068 return TOOLBAR_SetButtonWidth (infoPtr, lParam);
7069
7070 case TB_SETCMDID:
7071 return TOOLBAR_SetCmdId (infoPtr, wParam, lParam);
7072
7075
7077 return TOOLBAR_SetDrawTextFlags (infoPtr, wParam, lParam);
7078
7080 return TOOLBAR_SetExtendedStyle (infoPtr, wParam, lParam);
7081
7082 case TB_SETHOTIMAGELIST:
7083 return TOOLBAR_SetHotImageList (infoPtr, wParam, (HIMAGELIST)lParam);
7084
7085 case TB_SETHOTITEM:
7086 return TOOLBAR_SetHotItem (infoPtr, wParam);
7087
7088 case TB_SETIMAGELIST:
7089 return TOOLBAR_SetImageList (infoPtr, wParam, (HIMAGELIST)lParam);
7090
7091 case TB_SETINDENT:
7092 return TOOLBAR_SetIndent (infoPtr, wParam);
7093
7094 case TB_SETINSERTMARK:
7095 return TOOLBAR_SetInsertMark (infoPtr, (TBINSERTMARK*)lParam);
7096
7098 return TOOLBAR_SetInsertMarkColor (infoPtr, lParam);
7099
7100 case TB_SETMAXTEXTROWS:
7101 return TOOLBAR_SetMaxTextRows (infoPtr, wParam);
7102
7103#ifdef __REACTOS__
7104 case TB_SETMETRICS:
7105 return TOOLBAR_SetMetrics (infoPtr, (TBMETRICS*)lParam);
7106#endif
7107
7108 case TB_SETPADDING:
7109 return TOOLBAR_SetPadding (infoPtr, lParam);
7110
7111 case TB_SETPARENT:
7112 return TOOLBAR_SetParent (infoPtr, (HWND)wParam);
7113
7114 case TB_SETROWS:
7115 return TOOLBAR_SetRows (infoPtr, wParam, (LPRECT)lParam);
7116
7117 case TB_SETSTATE:
7118 return TOOLBAR_SetState (infoPtr, wParam, lParam);
7119
7120 case TB_SETSTYLE:
7121 return TOOLBAR_SetStyle (infoPtr, lParam);
7122
7123 case TB_SETTOOLTIPS:
7124 return TOOLBAR_SetToolTips (infoPtr, (HWND)wParam);
7125
7127 return TOOLBAR_SetUnicodeFormat (infoPtr, wParam);
7128
7129 case TB_SETBOUNDINGSIZE:
7131
7132 case TB_SETHOTITEM2:
7133 return TOOLBAR_SetHotItem2 (infoPtr, wParam, lParam);
7134
7135 case TB_SETLISTGAP:
7136 return TOOLBAR_SetListGap(infoPtr, wParam);
7137
7139 return TOOLBAR_GetImageListCount(infoPtr);
7140
7141 case TB_GETIDEALSIZE:
7142 return TOOLBAR_GetIdealSize (infoPtr, wParam, lParam);
7143
7144 case TB_UNKWN464:
7146
7147/* Common Control Messages */
7148
7149/* case TB_GETCOLORSCHEME: */ /* identical to CCM_ */
7150 case CCM_GETCOLORSCHEME:
7151 return TOOLBAR_GetColorScheme (infoPtr, (LPCOLORSCHEME)lParam);
7152
7153/* case TB_SETCOLORSCHEME: */ /* identical to CCM_ */
7154 case CCM_SETCOLORSCHEME:
7155 return TOOLBAR_SetColorScheme (infoPtr, (LPCOLORSCHEME)lParam);
7156
7157 case CCM_GETVERSION:
7158 return TOOLBAR_GetVersion (infoPtr);
7159
7160 case CCM_SETVERSION:
7161 return TOOLBAR_SetVersion (infoPtr, (INT)wParam);
7162
7163
7164/* case WM_CHAR: */
7165
7166 case WM_CREATE:
7168
7169 case WM_DESTROY:
7170 return TOOLBAR_Destroy (infoPtr);
7171
7172 case WM_ERASEBKGND:
7173 return TOOLBAR_EraseBackground (infoPtr, wParam, lParam);
7174
7175 case WM_GETFONT:
7176 return TOOLBAR_GetFont (infoPtr);
7177
7178 case WM_KEYDOWN:
7179 return TOOLBAR_KeyDown (infoPtr, wParam, lParam);
7180
7181/* case WM_KILLFOCUS: */
7182
7183 case WM_LBUTTONDBLCLK:
7184 return TOOLBAR_LButtonDblClk (infoPtr, wParam, lParam);
7185
7186 case WM_LBUTTONDOWN:
7187 return TOOLBAR_LButtonDown (infoPtr, wParam, lParam);
7188
7189 case WM_LBUTTONUP:
7190 return TOOLBAR_LButtonUp (infoPtr, wParam, lParam);
7191
7192 case WM_RBUTTONUP:
7193 return TOOLBAR_RButtonUp (infoPtr, wParam, lParam);
7194
7195 case WM_RBUTTONDBLCLK:
7196 return TOOLBAR_RButtonDblClk (infoPtr, wParam, lParam);
7197
7198 case WM_MOUSEMOVE:
7199 return TOOLBAR_MouseMove (infoPtr, wParam, lParam);
7200
7201 case WM_MOUSELEAVE:
7202 return TOOLBAR_MouseLeave (infoPtr);
7203
7204 case WM_CAPTURECHANGED:
7205 if (hwnd == (HWND)lParam) return 0;
7206 return TOOLBAR_CaptureChanged(infoPtr);
7207
7208 case WM_NCACTIVATE:
7210
7211 case WM_NCCALCSIZE:
7213
7214 case WM_NCCREATE:
7215#ifdef __REACTOS__
7217#else
7219#endif
7220
7221 case WM_NCPAINT:
7222 return TOOLBAR_NCPaint (hwnd, wParam, lParam);
7223
7224 case WM_NOTIFY:
7225 return TOOLBAR_Notify (infoPtr, (LPNMHDR)lParam);
7226
7227 case WM_NOTIFYFORMAT:
7228 return TOOLBAR_NotifyFormat (infoPtr, wParam, lParam);
7229
7230 case WM_PRINTCLIENT:
7231 case WM_PAINT:
7232 return TOOLBAR_Paint (infoPtr, wParam);
7233
7234 case WM_SETFOCUS:
7235 return TOOLBAR_SetFocus (infoPtr);
7236
7237 case WM_SETFONT:
7238 return TOOLBAR_SetFont(infoPtr, (HFONT)wParam, (WORD)lParam);
7239
7240 case WM_SETREDRAW:
7241 return TOOLBAR_SetRedraw (infoPtr, wParam);
7242
7243 case WM_SIZE:
7244 return TOOLBAR_Size (infoPtr);
7245
7246 case WM_STYLECHANGED:
7247 return TOOLBAR_StyleChanged (infoPtr, (INT)wParam, (LPSTYLESTRUCT)lParam);
7248
7249 case WM_SYSCOLORCHANGE:
7250 return TOOLBAR_SysColorChange ();
7251 case WM_THEMECHANGED:
7252#ifdef __REACTOS__
7253 return theme_changed (infoPtr);
7254#else
7255 return theme_changed (hwnd);
7256#endif
7257
7258/* case WM_WININICHANGE: */
7259
7260 case WM_CHARTOITEM:
7261 case WM_COMMAND:
7262 case WM_DRAWITEM:
7263 case WM_MEASUREITEM:
7264 case WM_VKEYTOITEM:
7265 return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);
7266
7267 /* We see this in Outlook Express 5.x and just does DefWindowProc */
7268 case PGM_FORWARDMOUSE:
7269 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
7270
7271 default:
7272 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
7273 ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
7274 uMsg, wParam, lParam);
7275 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
7276 }
7277}
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1755
static LRESULT TOOLBAR_SetRedraw(TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:6735
static LRESULT TOOLBAR_NCActivate(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6288
static LRESULT TOOLBAR_SetCmdId(TOOLBAR_INFO *infoPtr, INT nIndex, INT nId)
Definition: toolbar.c:4754
static LRESULT TOOLBAR_GetStringA(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPSTR str)
Definition: toolbar.c:5393
static LRESULT TOOLBAR_SetRows(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPRECT lprc)
Definition: toolbar.c:5125
static LRESULT TOOLBAR_IsButtonPressed(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:4040
static LRESULT TOOLBAR_GetStringW(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPWSTR str)
Definition: toolbar.c:5416
static LRESULT TOOLBAR_GetColorScheme(const TOOLBAR_INFO *infoPtr, LPCOLORSCHEME lParam)
Definition: toolbar.c:5343
static LRESULT TOOLBAR_SetPadding(TOOLBAR_INFO *infoPtr, LPARAM lParam)
Definition: toolbar.c:5097
static LRESULT TOOLBAR_SetHotItem(TOOLBAR_INFO *infoPtr, INT nHotItem)
Definition: toolbar.c:4914
static LRESULT TOOLBAR_SetToolTips(TOOLBAR_INFO *infoPtr, HWND hwndTooltip)
Definition: toolbar.c:5318
static LRESULT TOOLBAR_SetBitmapSize(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:4578
static LRESULT TOOLBAR_CommandToIndex(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3387
static LRESULT TOOLBAR_MouseLeave(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:6169
static LRESULT TOOLBAR_IsButtonIndeterminate(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:4027
static LRESULT TOOLBAR_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
Definition: toolbar.c:6311
static LRESULT TOOLBAR_SetParent(TOOLBAR_INFO *infoPtr, HWND hParent)
Definition: toolbar.c:5111
static LRESULT TOOLBAR_PressButton(const TOOLBAR_INFO *infoPtr, INT Id, BOOL fPress)
Definition: toolbar.c:4205
static LRESULT TOOLBAR_HideButton(TOOLBAR_INFO *infoPtr, INT Id, BOOL fHide)
Definition: toolbar.c:3882
static LRESULT TOOLBAR_NotifyFormat(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6662
static LRESULT TOOLBAR_GetImageListCount(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:5488
static LRESULT TOOLBAR_SetButtonWidth(TOOLBAR_INFO *infoPtr, LPARAM lParam)
Definition: toolbar.c:4725
static LRESULT TOOLBAR_Size(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:6763
static LRESULT TOOLBAR_GetInsertMark(const TOOLBAR_INFO *infoPtr, TBINSERTMARK *lptbim)
Definition: toolbar.c:3701
static LRESULT TOOLBAR_LButtonUp(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5945
static LRESULT TOOLBAR_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6298
static LRESULT TOOLBAR_SetMaxTextRows(TOOLBAR_INFO *infoPtr, INT nMaxRows)
Definition: toolbar.c:5038
static LRESULT TOOLBAR_MarkButton(const TOOLBAR_INFO *infoPtr, INT Id, BOOL fMark)
Definition: toolbar.c:4107
static LRESULT TOOLBAR_Notify(TOOLBAR_INFO *infoPtr, LPNMHDR lpnmh)
Definition: toolbar.c:6616
static LRESULT TOOLBAR_GetDefImageList(const TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:3692
static LRESULT TOOLBAR_GetHotImageList(const TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:3670
static LRESULT TOOLBAR_SetColorScheme(TOOLBAR_INFO *infoPtr, const COLORSCHEME *lParam)
Definition: toolbar.c:5355
static LRESULT TOOLBAR_IsButtonHighlighted(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:4014
static LRESULT TOOLBAR_LoadImages(TOOLBAR_INFO *infoPtr, WPARAM wParam, HINSTANCE hInstance)
Definition: toolbar.c:4053
static LRESULT TOOLBAR_GetRows(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3822
static LRESULT TOOLBAR_SetIndent(TOOLBAR_INFO *infoPtr, INT nIndent)
Definition: toolbar.c:4981
static LRESULT TOOLBAR_SysColorChange(void)
Definition: toolbar.c:6823
static LRESULT theme_changed(HWND hwnd)
Definition: toolbar.c:6846
static LRESULT TOOLBAR_GetUnicodeFormat(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3865
static LRESULT TOOLBAR_GetButtonSize(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3616
static LRESULT TOOLBAR_SetVersion(TOOLBAR_INFO *infoPtr, INT iVersion)
Definition: toolbar.c:5369
static LRESULT TOOLBAR_Paint(TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:6686
static LRESULT TOOLBAR_HitTest(const TOOLBAR_INFO *infoPtr, const POINT *lpPt)
Definition: toolbar.c:3912
static LRESULT TOOLBAR_SetExtendedStyle(TOOLBAR_INFO *infoPtr, DWORD mask, DWORD style)
Definition: toolbar.c:4809
static LRESULT TOOLBAR_SetBoundingSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5443
static LRESULT TOOLBAR_AddButtonsT(TOOLBAR_INFO *infoPtr, INT nAddButtons, const TBBUTTON *lpTbb, BOOL fUnicode)
Definition: toolbar.c:3105
static LRESULT TOOLBAR_ButtonCount(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3302
static LRESULT TOOLBAR_RButtonUp(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6108
static LRESULT TOOLBAR_EnableButton(TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
Definition: toolbar.c:3474
static LRESULT TOOLBAR_Indeterminate(const TOOLBAR_INFO *infoPtr, INT Id, BOOL fIndeterminate)
Definition: toolbar.c:3919
static LRESULT TOOLBAR_GetToolTips(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3856
static LRESULT TOOLBAR_SetHotItem2(TOOLBAR_INFO *infoPtr, INT nHotItem, LPARAM lParam)
Definition: toolbar.c:5454
static LRESULT TOOLBAR_GetMaxSize(const TOOLBAR_INFO *infoPtr, LPSIZE lpSize)
Definition: toolbar.c:3744
static LRESULT TOOLBAR_RButtonDblClk(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6138
static LRESULT TOOLBAR_SetFont(TOOLBAR_INFO *infoPtr, HFONT hFont, WORD Redraw)
Definition: toolbar.c:6718
static LRESULT TOOLBAR_GetAnchorHighlight(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3507
static LRESULT TOOLBAR_SaveRestoreA(TOOLBAR_INFO *infoPtr, WPARAM wParam, const TBSAVEPARAMSA *lpSave)
Definition: toolbar.c:4530
static LRESULT TOOLBAR_SetListGap(TOOLBAR_INFO *infoPtr, INT iListGap)
Definition: toolbar.c:5475
static LRESULT TOOLBAR_GetState(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3829
static LRESULT TOOLBAR_KeyDown(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5747
static LRESULT TOOLBAR_SetInsertMarkColor(TOOLBAR_INFO *infoPtr, COLORREF clr)
Definition: toolbar.c:5026
static LRESULT TOOLBAR_EraseBackground(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5634
static LRESULT TOOLBAR_GetInsertMarkColor(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3712
static LRESULT TOOLBAR_SetDisabledImageList(TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST himl)
Definition: toolbar.c:4772
static LRESULT TOOLBAR_CheckButton(TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
Definition: toolbar.c:3341
static LRESULT TOOLBAR_SetImageList(TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST himl)
Definition: toolbar.c:4939
static LRESULT TOOLBAR_GetTextRows(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3849
static LRESULT TOOLBAR_StyleChanged(TOOLBAR_INFO *infoPtr, INT nType, const STYLESTRUCT *lpStyle)
Definition: toolbar.c:6813
static LRESULT TOOLBAR_Unkwn464(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5544
static LRESULT TOOLBAR_SetFocus(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:6706
static LRESULT TOOLBAR_CaptureChanged(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:6149
static LRESULT TOOLBAR_GetStyle(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3842
static LRESULT TOOLBAR_GetIdealSize(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5496
static LRESULT TOOLBAR_SetHotImageList(TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST himl)
Definition: toolbar.c:4837
static LRESULT TOOLBAR_Destroy(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:5587
static LRESULT TOOLBAR_LButtonDblClk(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:5784
static LRESULT TOOLBAR_GetBitmapFlags(void)
Definition: toolbar.c:3527
static LRESULT TOOLBAR_MouseMove(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6214
static LRESULT TOOLBAR_ButtonStructSize(TOOLBAR_INFO *infoPtr, DWORD Size)
Definition: toolbar.c:3309
static LRESULT TOOLBAR_SetInsertMark(TOOLBAR_INFO *infoPtr, const TBINSERTMARK *lptbim)
Definition: toolbar.c:5000
static LRESULT TOOLBAR_GetVersion(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3875
static LRESULT TOOLBAR_IsButtonEnabled(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3988
static LRESULT TOOLBAR_IsButtonHidden(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:4001
static LRESULT TOOLBAR_GetFont(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:5707
static LRESULT TOOLBAR_GetHotItem(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3679
static LRESULT TOOLBAR_GetItemRect(const TOOLBAR_INFO *infoPtr, INT nIndex, LPRECT lpRect)
Definition: toolbar.c:3721
static LRESULT TOOLBAR_GetDisabledImageList(const TOOLBAR_INFO *infoPtr, WPARAM wParam)
Definition: toolbar.c:3652
static LRESULT TOOLBAR_MapAccelerator(const TOOLBAR_INFO *infoPtr, WCHAR wAccel, UINT *pIDButton)
Definition: toolbar.c:4066
static LRESULT TOOLBAR_ReplaceBitmap(TOOLBAR_INFO *infoPtr, const TBREPLACEBITMAP *lpReplace)
Definition: toolbar.c:4232
static LRESULT TOOLBAR_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
Definition: toolbar.c:5554
static LRESULT TOOLBAR_GetRect(const TOOLBAR_INFO *infoPtr, INT Id, LPRECT lpRect)
Definition: toolbar.c:3799
static LRESULT TOOLBAR_SetDrawTextFlags(TOOLBAR_INFO *infoPtr, DWORD mask, DWORD flags)
Definition: toolbar.c:4790
static LRESULT TOOLBAR_GetButtonText(const TOOLBAR_INFO *infoPtr, INT Id, LPWSTR lpStr, BOOL isW)
Definition: toolbar.c:3624
static LRESULT TOOLBAR_GetButtonInfoT(const TOOLBAR_INFO *infoPtr, INT Id, LPTBBUTTONINFOW lpTbInfo, BOOL bUnicode)
Definition: toolbar.c:3559
static LRESULT TOOLBAR_SetState(TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
Definition: toolbar.c:5245
static LRESULT TOOLBAR_GetButton(const TOOLBAR_INFO *infoPtr, INT nIndex, TBBUTTON *lpTbb)
Definition: toolbar.c:3534
static LRESULT TOOLBAR_GetExtendedStyle(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3661
static LRESULT TOOLBAR_AddStringA(TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
Definition: toolbar.c:3195
static LRESULT TOOLBAR_SetAnchorHighlight(TOOLBAR_INFO *infoPtr, BOOL bAnchor)
Definition: toolbar.c:4563
static LRESULT TOOLBAR_NCPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:6398
static LRESULT TOOLBAR_ChangeBitmap(TOOLBAR_INFO *infoPtr, INT Id, INT Index)
Definition: toolbar.c:3318
static LRESULT TOOLBAR_GetPadding(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:3792
static LRESULT TOOLBAR_IsButtonChecked(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3975
static LRESULT TOOLBAR_GetBitmap(const TOOLBAR_INFO *infoPtr, INT Id)
Definition: toolbar.c:3514
#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:4980
#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:4527
#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:1623
#define WM_CHARTOITEM
Definition: winuser.h:1652
#define WM_CAPTURECHANGED
Definition: winuser.h:1811
#define WM_CREATE
Definition: winuser.h:1611
#define WM_SIZE
Definition: winuser.h:1614
#define WM_SETFOCUS
Definition: winuser.h:1616
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1629
#define WM_GETFONT
Definition: winuser.h:1654
#define WM_SETFONT
Definition: winuser.h:1653
#define WM_VKEYTOITEM
Definition: winuser.h:1651
#define WM_SETREDRAW
Definition: winuser.h:1619

Referenced by TOOLBAR_Register().

◆ unwrap()

static void unwrap ( TOOLBAR_INFO info)
inlinestatic

Definition at line 5274 of file toolbar.c.

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

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

Referenced by TOOLBAR_LButtonDown().

◆ themeClass

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

Definition at line 250 of file toolbar.c.

Referenced by theme_changed(), and TOOLBAR_Create().