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

Go to the source code of this file.

Classes

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

Macros

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

Typedefs

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

Enumerations

enum  IMAGE_LIST_TYPE { IMAGE_LIST_DEFAULT , IMAGE_LIST_HOT , IMAGE_LIST_DISABLED }
 

Functions

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

Variables

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

Macro Definition Documentation

◆ ARROW_HEIGHT

#define ARROW_HEIGHT   3

Definition at line 207 of file toolbar.c.

◆ BOTTOM_BORDER

#define BOTTOM_BORDER   2

Definition at line 205 of file toolbar.c.

◆ COMMON_STYLES

#define COMMON_STYLES
Value:
#define CCS_BOTTOM
Definition: commctrl.h:2244
#define CCS_ADJUSTABLE
Definition: commctrl.h:2247
#define CCS_VERT
Definition: commctrl.h:2249
#define CCS_NODIVIDER
Definition: commctrl.h:2248
#define CCS_TOP
Definition: commctrl.h:2242
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2246
#define CCS_NORESIZE
Definition: commctrl.h:2245
#define CCS_NOMOVEY
Definition: commctrl.h:2243

Definition at line 242 of file toolbar.c.

◆ DDARROW_WIDTH

#define DDARROW_WIDTH   11

Definition at line 206 of file toolbar.c.

◆ DEFLISTGAP

#define DEFLISTGAP   4

Definition at line 220 of file toolbar.c.

◆ DEFPAD_CX

#define DEFPAD_CX   7

Definition at line 211 of file toolbar.c.

◆ DEFPAD_CY

#define DEFPAD_CY   6

Definition at line 212 of file toolbar.c.

◆ GETDEFIMAGELIST

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

Definition at line 247 of file toolbar.c.

◆ GETDISIMAGELIST

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

Definition at line 249 of file toolbar.c.

◆ GETHIMLID

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

Definition at line 246 of file toolbar.c.

◆ GETHOTIMAGELIST

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

Definition at line 248 of file toolbar.c.

◆ GETIBITMAP

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

Definition at line 245 of file toolbar.c.

◆ INSERTMARK_WIDTH

#define INSERTMARK_WIDTH   2

Definition at line 208 of file toolbar.c.

◆ LISTPAD_CY

#define LISTPAD_CY   9

Definition at line 226 of file toolbar.c.

◆ MAX_RESOURCE_STRING_LENGTH

#define MAX_RESOURCE_STRING_LENGTH   512

◆ NONLIST_NOTEXT_OFFSET

#define NONLIST_NOTEXT_OFFSET   2

Definition at line 230 of file toolbar.c.

◆ SEPARATOR_WIDTH

#define SEPARATOR_WIDTH   8

Definition at line 203 of file toolbar.c.

◆ TBSTYLE_EX_ALL

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

Definition at line 235 of file toolbar.c.

◆ TOOLBAR_NOWHERE

#define TOOLBAR_NOWHERE   (-1)

Definition at line 232 of file toolbar.c.

◆ TOP_BORDER

#define TOP_BORDER   2

Definition at line 204 of file toolbar.c.

Typedef Documentation

◆ PCUSTDLG_INFO

◆ PCUSTOMBUTTON

◆ PIMLENTRY

◆ PTOOLBAR_INFO

Enumeration Type Documentation

◆ IMAGE_LIST_TYPE

Enumerator
IMAGE_LIST_DEFAULT 
IMAGE_LIST_HOT 
IMAGE_LIST_DISABLED 

Definition at line 196 of file toolbar.c.

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

Function Documentation

◆ button_has_ddarrow()

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

Definition at line 283 of file toolbar.c.

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

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

◆ default_top_margin()

static int default_top_margin ( const TOOLBAR_INFO infoPtr)
inlinestatic

Definition at line 269 of file toolbar.c.

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

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

◆ free_string()

static void free_string ( TBUTTON_INFO btn)
static

Definition at line 377 of file toolbar.c.

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

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

◆ set_string_index()

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

Definition at line 352 of file toolbar.c.

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

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

◆ set_stringT()

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

Definition at line 371 of file toolbar.c.

372{
373 if (IS_INTRESOURCE( (DWORD_PTR)str ) || (DWORD_PTR)str == -1) return;
374 set_string_index( btn, (DWORD_PTR)str, unicode );
375}
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by TOOLBAR_SetButtonInfo().

◆ theme_changed()

static LRESULT theme_changed ( HWND  hwnd)
static

Definition at line 6754 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddBitmap()

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

Definition at line 2965 of file toolbar.c.

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

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

Referenced by TOOLBAR_AddBitmap(), and TOOLBAR_CheckImageListIconSize().

◆ TOOLBAR_AddButtonsT()

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

Definition at line 3080 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringA()

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

Definition at line 3170 of file toolbar.c.

3171{
3172 BOOL fFirstString = (infoPtr->nNumStrings == 0);
3173 LPSTR p;
3174 INT nIndex;
3175 INT len;
3176
3177 TRACE("%p, %lx\n", hInstance, lParam);
3178
3179 if (IS_INTRESOURCE(lParam)) /* load from resources */
3180 return TOOLBAR_AddStringW(infoPtr, hInstance, lParam);
3181
3182 p = (LPSTR)lParam;
3183 if (p == NULL)
3184 return -1;
3185
3186 TRACE("adding string(s) from array\n");
3187 nIndex = infoPtr->nNumStrings;
3188 while (*p) {
3189 len = strlen (p);
3190 TRACE("len=%d \"%s\"\n", len, p);
3191
3192 infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3193 Str_SetPtrAtoW(&infoPtr->strings[infoPtr->nNumStrings], p);
3194 infoPtr->nNumStrings++;
3195
3196 p += (len+1);
3197 }
3198
3199 if (fFirstString)
3200 TOOLBAR_CalcToolbar(infoPtr);
3201 return nIndex;
3202}
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:3089
unsigned int BOOL
Definition: ntddk_ex.h:94
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
INT nNumStrings
Definition: toolbar.c:133
LPWSTR * strings
Definition: toolbar.c:176
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by ToolbarWindowProc().

◆ TOOLBAR_AddStringW()

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

Definition at line 3089 of file toolbar.c.

3090{
3091#define MAX_RESOURCE_STRING_LENGTH 512
3092 BOOL fFirstString = (infoPtr->nNumStrings == 0);
3093 INT nIndex = infoPtr->nNumStrings;
3094
3095 TRACE("%p, %lx\n", hInstance, lParam);
3096
3097 if (IS_INTRESOURCE(lParam)) {
3100 WCHAR *next_delim;
3101 HRSRC hrsrc;
3102 WCHAR *p;
3103 INT len;
3104
3105 TRACE("adding string from resource\n");
3106
3107 if (!hInstance) return -1;
3108
3109 hrsrc = FindResourceW( hInstance, MAKEINTRESOURCEW((LOWORD(lParam) >> 4) + 1),
3110 (LPWSTR)RT_STRING );
3111 if (!hrsrc)
3112 {
3113 TRACE("string not found in resources\n");
3114 return -1;
3115 }
3116
3118 szString, MAX_RESOURCE_STRING_LENGTH);
3119
3120 TRACE("len=%d %s\n", len, debugstr_w(szString));
3121 if (len == 0 || len == 1)
3122 return nIndex;
3123
3124 TRACE("delimiter: 0x%x\n", *szString);
3125 delimiter = *szString;
3126 p = szString + 1;
3127
3128 while ((next_delim = strchrW(p, delimiter)) != NULL) {
3129 *next_delim = 0;
3130 if (next_delim + 1 >= szString + len)
3131 {
3132 /* this may happen if delimiter == '\0' or if the last char is a
3133 * delimiter (then it is ignored like the native does) */
3134 break;
3135 }
3136
3137 infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3138 Str_SetPtrW(&infoPtr->strings[infoPtr->nNumStrings], p);
3139 infoPtr->nNumStrings++;
3140
3141 p = next_delim + 1;
3142 }
3143 }
3144 else {
3145 LPWSTR p = (LPWSTR)lParam;
3146 INT len;
3147
3148 if (p == NULL)
3149 return -1;
3150 TRACE("adding string(s) from array\n");
3151 while (*p) {
3152 len = strlenW (p);
3153
3154 TRACE("len=%d %s\n", len, debugstr_w(p));
3155 infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
3156 Str_SetPtrW (&infoPtr->strings[infoPtr->nNumStrings], p);
3157 infoPtr->nNumStrings++;
3158
3159 p += (len+1);
3160 }
3161 }
3162
3163 if (fFirstString)
3164 TOOLBAR_CalcToolbar(infoPtr);
3165 return nIndex;
3166}
#define MAX_RESOURCE_STRING_LENGTH
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define debugstr_w
Definition: kernel32.h:32
const char * delimiter
Definition: string.c:1566
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define RT_STRING
Definition: pedump.c:368
#define strchrW(s, c)
Definition: unicode.h:34
#define strlenW(s)
Definition: unicode.h:28
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 3206 of file toolbar.c.

3207{
3208 TRACE("auto sizing, style=%#x\n", infoPtr->dwStyle);
3209 TRACE("nRows: %d, infoPtr->nButtonHeight: %d\n", infoPtr->nRows, infoPtr->nButtonHeight);
3210
3211#ifdef __REACTOS__ /* workaround CORE-16169 part 2 of 2 */
3212 if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL))
3213 {
3214 TOOLBAR_LayoutToolbar(infoPtr);
3215 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
3216 }
3217#endif
3218
3219 if (!(infoPtr->dwStyle & CCS_NORESIZE))
3220 {
3221 RECT window_rect, parent_rect;
3222 UINT uPosFlags = SWP_NOZORDER | SWP_NOACTIVATE;
3223 HWND parent;
3224 INT x, y, cx, cy;
3225
3226 parent = GetParent (infoPtr->hwndSelf);
3227
3228 if (!parent || !infoPtr->bDoRedraw)
3229 return 0;
3230
3231 GetClientRect(parent, &parent_rect);
3232
3233 x = parent_rect.left;
3234 y = parent_rect.top;
3235
3236 cy = TOP_BORDER + infoPtr->nRows * infoPtr->nButtonHeight + BOTTOM_BORDER;
3237 cx = parent_rect.right - parent_rect.left;
3238
3239 if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_NOMOVEY)
3240 {
3241 GetWindowRect(infoPtr->hwndSelf, &window_rect);
3242 MapWindowPoints( 0, parent, (POINT *)&window_rect, 2 );
3243 y = window_rect.top;
3244 }
3245 if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_BOTTOM)
3246 {
3247 GetWindowRect(infoPtr->hwndSelf, &window_rect);
3248 y = parent_rect.bottom - ( window_rect.bottom - window_rect.top);
3249 }
3250
3251 if (infoPtr->dwStyle & CCS_NOPARENTALIGN)
3252 uPosFlags |= SWP_NOMOVE;
3253
3254 if (!(infoPtr->dwStyle & CCS_NODIVIDER))
3256
3257 if (infoPtr->dwStyle & WS_BORDER)
3258 {
3261 }
3262
3263 SetWindowPos(infoPtr->hwndSelf, NULL, x, y, cx, cy, uPosFlags);
3264 }
3265
3266 if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL))
3267 {
3268 TOOLBAR_LayoutToolbar(infoPtr);
3269 InvalidateRect( infoPtr->hwndSelf, NULL, TRUE );
3270 }
3271
3272 return 0;
3273}
#define BOTTOM_BORDER
Definition: toolbar.c:205
static void TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:1809
r parent
Definition: btrfs.c:3010
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define WS_BORDER
Definition: pedump.c:625
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:990
BOOL bDoRedraw
Definition: toolbar.c:160
INT nButtonHeight
Definition: toolbar.c:122
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define SWP_NOACTIVATE
Definition: winuser.h:1232
#define SM_CYEDGE
Definition: winuser.h:1003
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:1234
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:959
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SM_CXBORDER
Definition: winuser.h:958
HWND WINAPI GetParent(_In_ HWND)
#define SWP_NOZORDER
Definition: winuser.h:1237
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 3277 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ButtonHasString()

static BOOL TOOLBAR_ButtonHasString ( const TBUTTON_INFO btnPtr)
inlinestatic

Definition at line 347 of file toolbar.c.

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

Referenced by set_string_index(), and TOOLBAR_InternalInsertButtonsT().

◆ TOOLBAR_ButtonStructSize()

static LRESULT TOOLBAR_ButtonStructSize ( TOOLBAR_INFO infoPtr,
DWORD  Size 
)
inlinestatic

Definition at line 3284 of file toolbar.c.

3285{
3286 infoPtr->dwStructSize = Size;
3287
3288 return 0;
3289}
DWORD dwStructSize
Definition: toolbar.c:119
_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 1385 of file toolbar.c.

1386{
1387 TBUTTON_INFO *btnPtr;
1388 INT i;
1389 SIZE sz;
1390 HDC hdc;
1391 HFONT hOldFont;
1392
1393 lpSize->cx = 0;
1394 lpSize->cy = 0;
1395
1396 if (infoPtr->nMaxTextRows == 0)
1397 return;
1398
1399 hdc = GetDC (infoPtr->hwndSelf);
1400 hOldFont = SelectObject (hdc, infoPtr->hFont);
1401
1402 if (infoPtr->nNumButtons == 0 && infoPtr->nNumStrings > 0)
1403 {
1405
1407 lpSize->cy = tm.tmHeight;
1408 }
1409
1410 btnPtr = infoPtr->buttons;
1411 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) {
1412 if(TOOLBAR_GetText(infoPtr, btnPtr))
1413 {
1414 TOOLBAR_MeasureString(infoPtr, btnPtr, hdc, &sz);
1415 if (sz.cx > lpSize->cx)
1416 lpSize->cx = sz.cx;
1417 if (sz.cy > lpSize->cy)
1418 lpSize->cy = sz.cy;
1419 }
1420 }
1421
1422 SelectObject (hdc, hOldFont);
1423 ReleaseDC (infoPtr->hwndSelf, hdc);
1424
1425 TRACE("max string size %d x %d\n", lpSize->cx, lpSize->cy);
1426}
static LPWSTR TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
Definition: toolbar.c:290
static void TOOLBAR_MeasureString(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr, HDC hdc, LPSIZE lpSize)
Definition: toolbar.c:1342
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HFONT hFont
Definition: toolbar.c:148
TBUTTON_INFO * buttons
Definition: toolbar.c:175
INT nMaxTextRows
Definition: toolbar.c:128
LONG cx
Definition: 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:1539
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 1784 of file toolbar.c.

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

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

◆ TOOLBAR_CaptureChanged()

static LRESULT TOOLBAR_CaptureChanged ( TOOLBAR_INFO infoPtr)
static

Definition at line 6117 of file toolbar.c.

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

Referenced by ToolbarWindowProc().

◆ TOOLBAR_ChangeBitmap()

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

Definition at line 3293 of file toolbar.c.

3294{
3295 TBUTTON_INFO *btnPtr;
3296 INT nIndex;
3297
3298 TRACE("button %d, iBitmap now %d\n", Id, Index);
3299
3300 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3301 if (nIndex == -1)
3302 return FALSE;
3303
3304 btnPtr = &infoPtr->buttons[nIndex];
3305 btnPtr->iBitmap = Index;
3306
3307 /* we HAVE to erase the background, the new bitmap could be */
3308 /* transparent */
3309 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3310
3311 return TRUE;
3312}
DWORD Id
static INT TOOLBAR_GetButtonIndex(const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
Definition: toolbar.c:2054
INT iBitmap
Definition: toolbar.c:91
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by ToolbarWindowProc().

◆ TOOLBAR_CheckButton()

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

Definition at line 3316 of file toolbar.c.

3317{
3318 TBUTTON_INFO *btnPtr;
3319 INT nIndex;
3320 INT nOldIndex = -1;
3321 BOOL bChecked = FALSE;
3322
3323 nIndex = TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3324
3325 TRACE("hwnd=%p, btn index=%d, lParam=0x%08lx\n", infoPtr->hwndSelf, nIndex, lParam);
3326
3327 if (nIndex == -1)
3328 return FALSE;
3329
3330 btnPtr = &infoPtr->buttons[nIndex];
3331
3332 bChecked = (btnPtr->fsState & TBSTATE_CHECKED) != 0;
3333
3334 if (!LOWORD(lParam))
3335 btnPtr->fsState &= ~TBSTATE_CHECKED;
3336 else {
3337 if (btnPtr->fsStyle & BTNS_GROUP) {
3338 nOldIndex =
3339 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex);
3340 if (nOldIndex == nIndex)
3341 return 0;
3342 if (nOldIndex != -1)
3343 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;
3344 }
3345 btnPtr->fsState |= TBSTATE_CHECKED;
3346 }
3347
3348 if( bChecked != LOWORD(lParam) )
3349 {
3350 if (nOldIndex != -1)
3351 InvalidateRect(infoPtr->hwndSelf, &infoPtr->buttons[nOldIndex].rect, TRUE);
3352 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
3353 }
3354
3355 /* FIXME: Send a WM_NOTIFY?? */
3356
3357 return TRUE;
3358}
static INT TOOLBAR_GetCheckedGroupButtonIndex(const TOOLBAR_INFO *infoPtr, INT nIndex)
Definition: toolbar.c:2077
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 2931 of file toolbar.c.

2932{
2933 HIMAGELIST himlDef;
2934 HIMAGELIST himlNew;
2935 INT cx, cy;
2936 INT i;
2937
2938 himlDef = GETDEFIMAGELIST(infoPtr, 0);
2939 if (himlDef == NULL || himlDef != infoPtr->himlInt)
2940 return;
2941 if (!ImageList_GetIconSize(himlDef, &cx, &cy))
2942 return;
2943 if (cx == infoPtr->nBitmapWidth && cy == infoPtr->nBitmapHeight)
2944 return;
2945
2946 TRACE("Update icon size: %dx%d -> %dx%d\n",
2947 cx, cy, infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
2948
2949 himlNew = ImageList_Create(infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
2950 ILC_COLOR32|ILC_MASK, 8, 2);
2951 for (i = 0; i < infoPtr->nNumBitmapInfos; i++)
2952 TOOLBAR_AddBitmapToImageList(infoPtr, himlNew, &infoPtr->bitmaps[i]);
2953 TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlNew, 0);
2954 infoPtr->himlInt = himlNew;
2955
2956 infoPtr->nNumBitmaps -= ImageList_GetImageCount(himlDef);
2957 ImageList_Destroy(himlDef);
2958}
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 391 of file toolbar.c.

392{
393 if (infoPtr->dwStyle & TBSTYLE_REGISTERDROP)
394 FIXME("[%p] TBSTYLE_REGISTERDROP not implemented\n", infoPtr->hwndSelf);
395}
#define FIXME(fmt,...)
Definition: debug.h:111
#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 3362 of file toolbar.c.

3363{
3364 return TOOLBAR_GetButtonIndex (infoPtr, Id, FALSE);
3365}

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Create()

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

Definition at line 5529 of file toolbar.c.

5530{
5532 LOGFONTW logFont;
5533
5534 TRACE("hwnd = %p, style=0x%08x\n", hwnd, lpcs->style);
5535
5536 infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
5537 GetClientRect(hwnd, &infoPtr->client_rect);
5538 infoPtr->bUnicode = infoPtr->hwndNotify &&
5539 (NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_REQUERY));
5540 infoPtr->hwndToolTip = NULL; /* if needed the tooltip control will be created after a WM_MOUSEMOVE */
5541
5543 infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont);
5544
5545#ifdef __REACTOS__
5546 {
5548 if (theme)
5549 GetThemeMargins(theme, NULL, TP_BUTTON, TS_NORMAL, TMT_CONTENTMARGINS, NULL, &infoPtr->themeMargins);
5550 }
5551#else
5553#endif
5554
5555 TOOLBAR_CheckStyle (infoPtr);
5556
5557 return 0;
5558}
static void TOOLBAR_CheckStyle(const TOOLBAR_INFO *infoPtr)
Definition: toolbar.c:391
HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, RECT *prc, MARGINS *pMargins)
Definition: property.c:216
RECT client_rect
Definition: toolbar.c:120
BOOL bUnicode
Definition: toolbar.c:162
HFONT hDefaultFont
Definition: toolbar.c:147
HWND hwndNotify
Definition: toolbar.c:157
HWND hwndToolTip
Definition: toolbar.c:156
@ TP_BUTTON
Definition: vsstyle.h:1394
@ TS_NORMAL
Definition: vsstyle.h:1405
#define TMT_CONTENTMARGINS
Definition: vssym32.h:324
UINT_PTR WPARAM
Definition: windef.h:207
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define GetWindowLongPtrW
Definition: winuser.h:4819
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1370
#define NF_REQUERY
Definition: winuser.h:2451
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define NFR_UNICODE
Definition: winuser.h:2449
#define GWL_STYLE
Definition: winuser.h:846

Referenced by ToolbarWindowProc().

◆ TOOLBAR_Cust_AddButton()

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

Definition at line 2286 of file toolbar.c.

2287{
2288 NMTOOLBARW nmtb;
2289
2290 TRACE("Add: nIndexAvail %d, nIndexTo %d\n", nIndexAvail, nIndexTo);
2291
2292 /* MSDN states that iItem is the index of the button, rather than the
2293 * command ID as used by every other NMTOOLBAR notification */
2294 nmtb.iItem = nIndexAvail;
2295 if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
2296 {
2297 PCUSTOMBUTTON btnInfo;
2298 NMHDR hdr;
2300 HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2301 int count = SendMessageW(hwndAvail, LB_GETCOUNT, 0, 0);
2302
2303 btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndAvail, LB_GETITEMDATA, nIndexAvail, 0);
2304
2305 if (nIndexAvail != 0) /* index == 0 indicates separator */
2306 {
2307 /* remove from 'available buttons' list */
2308 SendMessageW(hwndAvail, LB_DELETESTRING, nIndexAvail, 0);
2309 if (nIndexAvail == count-1)
2310 SendMessageW(hwndAvail, LB_SETCURSEL, nIndexAvail-1 , 0);
2311 else
2312 SendMessageW(hwndAvail, LB_SETCURSEL, nIndexAvail , 0);
2313 }
2314 else
2315 {
2316 PCUSTOMBUTTON btnNew;
2317
2318 /* duplicate 'separator' button */
2319 btnNew = Alloc(sizeof(CUSTOMBUTTON));
2320 *btnNew = *btnInfo;
2321 btnInfo = btnNew;
2322 }
2323
2324 /* insert into 'toolbar button' list */
2325 SendMessageW(hwndList, LB_INSERTSTRING, nIndexTo, 0);
2326 SendMessageW(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
2327
2328 SendMessageW(custInfo->tbHwnd, TB_INSERTBUTTONW, nIndexTo, (LPARAM)&(btnInfo->btn));
2329
2331 }
2332}
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:399
char hdr[14]
Definition: iptest.cpp:33
#define TBN_TOOLBARCHANGE
Definition: commctrl.h:1314
#define TBN_QUERYINSERT
Definition: commctrl.h:1312
#define TB_INSERTBUTTONW
Definition: commctrl.h:1265
PTOOLBAR_INFO tbInfo
Definition: toolbar.c:184
HWND tbHwnd
Definition: toolbar.c:185
TBBUTTON btn
Definition: toolbar.c:190
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETCOUNT
Definition: winuser.h:2028
#define LB_GETITEMDATA
Definition: winuser.h:2031
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define LB_DELETESTRING
Definition: winuser.h:2022
#define LB_INSERTSTRING
Definition: winuser.h:2043
#define LB_SETITEMDATA
Definition: winuser.h:2055
#define LB_SETCURSEL
Definition: winuser.h:2053

Referenced by TOOLBAR_Cust_AvailDragListNotification(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_AvailDragListNotification()

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

Definition at line 2439 of file toolbar.c.

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

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_InsertAvailButton()

static void TOOLBAR_Cust_InsertAvailButton ( HWND  hwnd,
PCUSTOMBUTTON  btnInfoNew 
)
static

Definition at line 2215 of file toolbar.c.

2216{
2217 int i;
2218 int count;
2219 PCUSTOMBUTTON btnInfo;
2220 HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2221
2222 TRACE("button %s, idCommand %d\n", debugstr_w(btnInfoNew->text), btnInfoNew->btn.idCommand);
2223
2224 count = SendMessageW(hwndAvail, LB_GETCOUNT, 0, 0);
2225
2226 /* position 0 is always separator */
2227 for (i = 1; i < count; i++)
2228 {
2229 btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndAvail, LB_GETITEMDATA, i, 0);
2230 if (btnInfoNew->btn.idCommand < btnInfo->btn.idCommand)
2231 {
2232 i = SendMessageW(hwndAvail, LB_INSERTSTRING, i, 0);
2233 SendMessageW(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
2234 return;
2235 }
2236 }
2237 /* id higher than all others add to end */
2238 i = SendMessageW(hwndAvail, LB_ADDSTRING, 0, 0);
2239 SendMessageW(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
2240}
WCHAR text[64]
Definition: toolbar.c:193
int idCommand
Definition: commctrl.h:950
#define LB_ADDSTRING
Definition: winuser.h:2021

Referenced by TOOLBAR_Cust_RemoveButton(), and TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Cust_MoveButton()

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

Definition at line 2242 of file toolbar.c.

2243{
2244 NMTOOLBARW nmtb;
2245
2246 TRACE("index from %d, index to %d\n", nIndexFrom, nIndexTo);
2247
2248 if (nIndexFrom == nIndexTo)
2249 return;
2250
2251 /* MSDN states that iItem is the index of the button, rather than the
2252 * command ID as used by every other NMTOOLBAR notification */
2253 nmtb.iItem = nIndexFrom;
2254 if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
2255 {
2256 PCUSTOMBUTTON btnInfo;
2257 NMHDR hdr;
2259 int count = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2260
2261 btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndList, LB_GETITEMDATA, nIndexFrom, 0);
2262
2263 SendMessageW(hwndList, LB_DELETESTRING, nIndexFrom, 0);
2264 SendMessageW(hwndList, LB_INSERTSTRING, nIndexTo, 0);
2265 SendMessageW(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
2266 SendMessageW(hwndList, LB_SETCURSEL, nIndexTo, 0);
2267
2268 if (nIndexTo <= 0)
2270 else
2272
2273 /* last item is always separator, so -2 instead of -1 */
2274 if (nIndexTo >= (count - 2))
2276 else
2278
2279 SendMessageW(custInfo->tbHwnd, TB_DELETEBUTTON, nIndexFrom, 0);
2280 SendMessageW(custInfo->tbHwnd, TB_INSERTBUTTONW, nIndexTo, (LPARAM)&(btnInfo->btn));
2281
2283 }
2284}
#define 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 2334 of file toolbar.c.

2335{
2336 PCUSTOMBUTTON btnInfo;
2338
2339 TRACE("Remove: index %d\n", index);
2340
2341 btnInfo = (PCUSTOMBUTTON)SendMessageW(hwndList, LB_GETITEMDATA, index, 0);
2342
2343 /* send TBN_QUERYDELETE notification */
2344 if (TOOLBAR_IsButtonRemovable(custInfo->tbInfo, index, btnInfo))
2345 {
2346 NMHDR hdr;
2347
2348 SendMessageW(hwndList, LB_DELETESTRING, index, 0);
2349 SendMessageW(hwndList, LB_SETCURSEL, index , 0);
2350
2351 SendMessageW(custInfo->tbHwnd, TB_DELETEBUTTON, index, 0);
2352
2353 /* insert into 'available button' list */
2354 if (!(btnInfo->btn.fsStyle & BTNS_SEP))
2356 else
2357 Free(btnInfo);
2358
2360 }
2361}
static BOOL TOOLBAR_IsButtonRemovable(const TOOLBAR_INFO *infoPtr, int iItem, const CUSTOMBUTTON *btnInfo)
Definition: toolbar.c:7361
static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew)
Definition: toolbar.c:2215
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 2364 of file toolbar.c.

2366{
2368 switch (pDLI->uNotification)
2369 {
2370 case DL_BEGINDRAG:
2371 {
2372 INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2373 INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2374 /* no dragging for last item (separator) */
2375 if (nCurrentItem >= (nCount - 1)) return FALSE;
2376 return TRUE;
2377 }
2378 case DL_DRAGGING:
2379 {
2380 INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2381 INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2382 /* no dragging past last item (separator) */
2383 if ((nCurrentItem >= 0) && (nCurrentItem < (nCount - 1)))
2384 {
2385 DrawInsert(hwnd, hwndList, nCurrentItem);
2386 /* FIXME: native uses "move button" cursor */
2387 return DL_COPYCURSOR;
2388 }
2389
2390 /* not over toolbar buttons list */
2391 if (nCurrentItem < 0)
2392 {
2393 POINT ptWindow = pDLI->ptCursor;
2394 HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2395 MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2396 /* over available buttons list? */
2397 if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2398 /* FIXME: native uses "move button" cursor */
2399 return DL_COPYCURSOR;
2400 }
2401 /* clear drag arrow */
2402 DrawInsert(hwnd, hwndList, -1);
2403 return DL_STOPCURSOR;
2404 }
2405 case DL_DROPPED:
2406 {
2407 INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
2408 INT nIndexFrom = SendMessageW(hwndList, LB_GETCURSEL, 0, 0);
2409 INT nCount = SendMessageW(hwndList, LB_GETCOUNT, 0, 0);
2410 if ((nIndexTo >= 0) && (nIndexTo < (nCount - 1)))
2411 {
2412 /* clear drag arrow */
2413 DrawInsert(hwnd, hwndList, -1);
2414 /* move item */
2415 TOOLBAR_Cust_MoveButton(custInfo, hwnd, nIndexFrom, nIndexTo);
2416 }
2417 /* not over toolbar buttons list */
2418 if (nIndexTo < 0)
2419 {
2420 POINT ptWindow = pDLI->ptCursor;
2421 HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
2422 MapWindowPoints(NULL, hwnd, &ptWindow, 1);
2423 /* over available buttons list? */
2424 if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
2425 TOOLBAR_Cust_RemoveButton(custInfo, hwnd, nIndexFrom);
2426 }
2427 break;
2428 }
2429 case DL_CANCELDRAG:
2430 /* Clear drag arrow */
2431 DrawInsert(hwnd, hwndList, -1);
2432 break;
2433 }
2434
2435 return 0;
2436}
static void TOOLBAR_Cust_MoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo)
Definition: toolbar.c:2242
static void TOOLBAR_Cust_RemoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT index)
Definition: toolbar.c:2334

Referenced by TOOLBAR_CustomizeDialogProc().

◆ TOOLBAR_Customize()

static LRESULT TOOLBAR_Customize ( TOOLBAR_INFO infoPtr)
static

Definition at line 3369 of file toolbar.c.

3370{
3371 CUSTDLG_INFO custInfo;
3372 LRESULT ret;
3373 NMHDR nmhdr;
3374
3375 custInfo.tbInfo = infoPtr;
3376 custInfo.tbHwnd = infoPtr->hwndSelf;
3377
3378 /* send TBN_BEGINADJUST notification */
3379 TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_BEGINADJUST);
3380
3382 infoPtr->hwndSelf, TOOLBAR_CustomizeDialogProc, (LPARAM)&custInfo);
3383
3384 /* send TBN_ENDADJUST notification */
3385 TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_ENDADJUST);
3386
3387 return ret;
3388}
#define IDD_TBCUSTOMIZE
Definition: comctl32.h:64
static INT_PTR CALLBACK TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:2502
#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 2502 of file toolbar.c.

2503{
2505 PCUSTOMBUTTON btnInfo;
2506 NMTOOLBARA nmtb;
2507 TOOLBAR_INFO *infoPtr = custInfo ? custInfo->tbInfo : NULL;
2508
2509 switch (uMsg)
2510 {
2511 case WM_INITDIALOG:
2512 custInfo = (PCUSTDLG_INFO)lParam;
2514
2515 if (custInfo)
2516 {
2517 WCHAR Buffer[256];
2518 int i = 0;
2519 int index;
2520 NMTBINITCUSTOMIZE nmtbic;
2521
2522 infoPtr = custInfo->tbInfo;
2523
2524 /* send TBN_QUERYINSERT notification */
2525 nmtb.iItem = custInfo->tbInfo->nNumButtons;
2526
2527 if (!TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT))
2528 return FALSE;
2529
2530 nmtbic.hwndDialog = hwnd;
2531 /* Send TBN_INITCUSTOMIZE notification */
2532 if (TOOLBAR_SendNotify (&nmtbic.hdr, infoPtr, TBN_INITCUSTOMIZE) ==
2534 {
2535 TRACE("TBNRF_HIDEHELP requested\n");
2537 }
2538
2539 /* add items to 'toolbar buttons' list and check if removable */
2540 for (i = 0; i < custInfo->tbInfo->nNumButtons; i++)
2541 {
2542 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2543 memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2544 btnInfo->btn.fsStyle = BTNS_SEP;
2545 btnInfo->bVirtual = FALSE;
2547
2548 /* send TBN_QUERYDELETE notification */
2549 btnInfo->bRemovable = TOOLBAR_IsButtonRemovable(infoPtr, i, btnInfo);
2550
2553 }
2554
2556
2557 /* insert separator button into 'available buttons' list */
2558 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2559 memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2560 btnInfo->btn.fsStyle = BTNS_SEP;
2561 btnInfo->bVirtual = FALSE;
2562 btnInfo->bRemovable = TRUE;
2566
2567 /* insert all buttons into dsa */
2568 for (i = 0;; i++)
2569 {
2570 /* send TBN_GETBUTTONINFO notification */
2571 NMTOOLBARW nmtb;
2572 nmtb.iItem = i;
2573 nmtb.pszText = Buffer;
2574 nmtb.cchText = 256;
2575
2576 /* Clear previous button's text */
2577 ZeroMemory(nmtb.pszText, nmtb.cchText * sizeof(WCHAR));
2578
2579 if (!TOOLBAR_GetButtonInfo(infoPtr, &nmtb))
2580 break;
2581
2582 TRACE("WM_INITDIALOG style: %x iItem(%d) idCommand(%d) iString(%ld) %s\n",
2583 nmtb.tbButton.fsStyle, i,
2584 nmtb.tbButton.idCommand,
2585 nmtb.tbButton.iString,
2586 nmtb.tbButton.iString >= 0 ? debugstr_w(infoPtr->strings[nmtb.tbButton.iString])
2587 : "");
2588
2589 /* insert button into the appropriate list */
2591 if (index == -1)
2592 {
2593 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2594 btnInfo->bVirtual = FALSE;
2595 btnInfo->bRemovable = TRUE;
2596 }
2597 else
2598 {
2601 }
2602
2603 btnInfo->btn = nmtb.tbButton;
2604 if (!(nmtb.tbButton.fsStyle & BTNS_SEP))
2605 {
2606 if (lstrlenW(nmtb.pszText))
2607 lstrcpyW(btnInfo->text, nmtb.pszText);
2608 else if (nmtb.tbButton.iString >= 0 &&
2609 nmtb.tbButton.iString < infoPtr->nNumStrings)
2610 {
2611 lstrcpyW(btnInfo->text,
2612 infoPtr->strings[nmtb.tbButton.iString]);
2613 }
2614 }
2615
2616 if (index == -1)
2618 }
2619
2621
2622 /* select first item in the 'available' list */
2624
2625 /* append 'virtual' separator button to the 'toolbar buttons' list */
2626 btnInfo = Alloc(sizeof(CUSTOMBUTTON));
2627 memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
2628 btnInfo->btn.fsStyle = BTNS_SEP;
2629 btnInfo->bVirtual = TRUE;
2630 btnInfo->bRemovable = FALSE;
2634
2635 /* select last item in the 'toolbar' list */
2638
2641
2642 /* set focus and disable buttons */
2643 PostMessageW (hwnd, WM_USER, 0, 0);
2644 }
2645 return TRUE;
2646
2647 case WM_USER:
2652 return TRUE;
2653
2654 case WM_CLOSE:
2656 return TRUE;
2657
2658 case WM_COMMAND:
2659 switch (LOWORD(wParam))
2660 {
2662 if (HIWORD(wParam) == LBN_SELCHANGE)
2663 {
2664 PCUSTOMBUTTON btnInfo;
2665 NMTOOLBARA nmtb;
2666 int count;
2667 int index;
2668
2671
2672 /* send TBN_QUERYINSERT notification */
2673 nmtb.iItem = index;
2674 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT);
2675
2676 /* get list box item */
2678
2679 if (index == (count - 1))
2680 {
2681 /* last item (virtual separator) */
2684 }
2685 else if (index == (count - 2))
2686 {
2687 /* second last item (last non-virtual item) */
2690 }
2691 else if (index == 0)
2692 {
2693 /* first item */
2696 }
2697 else
2698 {
2701 }
2702
2704 }
2705 break;
2706
2707 case IDC_MOVEUP_BTN:
2708 {
2710 TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index-1);
2711 }
2712 break;
2713
2714 case IDC_MOVEDN_BTN: /* move down */
2715 {
2717 TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index+1);
2718 }
2719 break;
2720
2721 case IDC_REMOVE_BTN: /* remove button */
2722 {
2724
2725 if (LB_ERR == index)
2726 break;
2727
2729 }
2730 break;
2731 case IDC_HELP_BTN:
2732 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_CUSTHELP);
2733 break;
2734 case IDC_RESET_BTN:
2735 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_RESET);
2736 break;
2737
2738 case IDOK: /* Add button */
2739 {
2740 int index;
2741 int indexto;
2742
2745
2746 TOOLBAR_Cust_AddButton(custInfo, hwnd, index, indexto);
2747 }
2748 break;
2749
2750 case IDCANCEL:
2752 break;
2753 }
2754 return TRUE;
2755
2756 case WM_DESTROY:
2757 {
2758 int count;
2759 int i;
2760
2761 /* delete items from 'toolbar buttons' listbox*/
2763 for (i = 0; i < count; i++)
2764 {
2766 Free(btnInfo);
2768 }
2770
2771
2772 /* delete items from 'available buttons' listbox*/
2774 for (i = 0; i < count; i++)
2775 {
2777 Free(btnInfo);
2779 }
2781 }
2782 return TRUE;
2783
2784 case WM_DRAWITEM:
2786 {
2788 RECT rcButton;
2789 RECT rcText;
2790 HPEN hPen, hOldPen;
2791 HBRUSH hOldBrush;
2792 COLORREF oldText = 0;
2793 COLORREF oldBk = 0;
2794
2795 /* get item data */
2797 if (btnInfo == NULL)
2798 {
2799 FIXME("btnInfo invalid\n");
2800 return TRUE;
2801 }
2802
2803 /* set colors and select objects */
2805 if (btnInfo->bVirtual)
2806 oldText = SetTextColor (lpdis->hDC, comctl32_color.clrGrayText);
2807 else
2809 hPen = CreatePen( PS_SOLID, 1,
2811 hOldPen = SelectObject (lpdis->hDC, hPen );
2813
2814 /* fill background rectangle */
2815 Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
2816 lpdis->rcItem.right, lpdis->rcItem.bottom);
2817
2818 /* calculate button and text rectangles */
2819 rcButton = lpdis->rcItem;
2820 InflateRect (&rcButton, -1, -1);
2821 rcText = rcButton;
2822 rcButton.right = rcButton.left + custInfo->tbInfo->nBitmapWidth + 6;
2823 rcText.left = rcButton.right + 2;
2824
2825 /* draw focus rectangle */
2826 if (lpdis->itemState & ODS_FOCUS)
2827 DrawFocusRect (lpdis->hDC, &lpdis->rcItem);
2828
2829 /* draw button */
2830 if (!(infoPtr->dwStyle & TBSTYLE_FLAT))
2831 DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT);
2832
2833 /* draw image and text */
2834 if ((btnInfo->btn.fsStyle & BTNS_SEP) == 0) {
2835 HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr,
2836 btnInfo->btn.iBitmap));
2837 ImageList_Draw (himl, GETIBITMAP(infoPtr, btnInfo->btn.iBitmap),
2838 lpdis->hDC, rcButton.left+3, rcButton.top+3, ILD_NORMAL);
2839 }
2840 DrawTextW (lpdis->hDC, btnInfo->text, -1, &rcText,
2842
2843 /* delete objects and reset colors */
2844 SelectObject (lpdis->hDC, hOldBrush);
2845 SelectObject (lpdis->hDC, hOldPen);
2846 SetBkColor (lpdis->hDC, oldBk);
2847 SetTextColor (lpdis->hDC, oldText);
2848 DeleteObject( hPen );
2849 return TRUE;
2850 }
2851 return FALSE;
2852
2853 case WM_MEASUREITEM:
2855 {
2857
2858 lpmis->itemHeight = 15 + 8; /* default height */
2859
2860 return TRUE;
2861 }
2862 return FALSE;
2863
2864 default:
2865 if (uDragListMessage && (uMsg == uDragListMessage))
2866 {
2868 {
2870 custInfo, hwnd, (DRAGLISTINFO *)lParam);
2872 return TRUE;
2873 }
2874 else if (wParam == IDC_AVAILBTN_LBOX)
2875 {
2877 custInfo, hwnd, (DRAGLISTINFO *)lParam);
2879 return TRUE;
2880 }
2881 }
2882 return FALSE;
2883 }
2884}
#define 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:7330
struct CUSTDLG_INFO * PCUSTDLG_INFO
#define GETHIMLID(infoPtr, i)
Definition: toolbar.c:246
static LRESULT TOOLBAR_Cust_AvailDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2439
#define GETIBITMAP(infoPtr, i)
Definition: toolbar.c:245
static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd, const DRAGLISTINFO *pDLI)
Definition: toolbar.c:2364
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
UINT uDragListMessage
Definition: draglist.c:73
BOOL WINAPI MakeDragList(HWND hwndLB)
Definition: draglist.c:204
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:17
#define ILD_NORMAL
Definition: commctrl.h:417
#define TBN_RESET
Definition: commctrl.h:1311
#define TBNRF_HIDEHELP
Definition: commctrl.h:1352
#define TBN_INITCUSTOMIZE
Definition: commctrl.h:1346
#define TBN_CUSTHELP
Definition: commctrl.h:1315
#define memset(x, y, z)
Definition: compat.h:39
COLORREF clrHighlightText
Definition: comctl32.h:170
COLORREF clrWindow
Definition: comctl32.h:176
COLORREF clrGrayText
Definition: comctl32.h:178
COLORREF clrWindowText
Definition: comctl32.h:177
COLORREF clrHighlight
Definition: comctl32.h:169
BOOL bRemovable
Definition: toolbar.c:192
BOOL bVirtual
Definition: toolbar.c:191
INT_PTR iString
Definition: commctrl.h:959
int iBitmap
Definition: commctrl.h:949
LPWSTR pszText
Definition: commctrl.h:1452
TBBUTTON tbButton
Definition: commctrl.h:1450
#define ZeroMemory
Definition: winbase.h:1670
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:2422
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define ODS_SELECTED
Definition: winuser.h:2535
#define SW_HIDE
Definition: winuser.h:762
#define WM_CLOSE
Definition: winuser.h:1611
#define DWLP_USER
Definition: winuser.h:866
#define COLOR_WINDOW
Definition: winuser.h:912
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:825
#define LB_SETTOPINDEX
Definition: winuser.h:2060
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1730
#define BF_MIDDLE
Definition: winuser.h:468
#define WM_INITDIALOG
Definition: winuser.h:1729
#define IDOK
Definition: winuser.h:824
#define WM_DRAWITEM
Definition: winuser.h:1635
#define LB_SETITEMHEIGHT
Definition: winuser.h:2056
#define DT_LEFT
Definition: winuser.h:534
#define LB_RESETCONTENT
Definition: winuser.h:2045
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_MEASUREITEM
Definition: winuser.h:1636
#define DT_VCENTER
Definition: winuser.h:543
#define LBN_SELCHANGE
Definition: winuser.h:2065
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define WM_USER
Definition: winuser.h:1885
#define WM_DESTROY
Definition: winuser.h:1599
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define BF_SOFT
Definition: winuser.h:469
#define SetWindowLongPtrW
Definition: winuser.h:5336
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:2539
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 4338 of file toolbar.c.

4339{
4340 INT i;
4341
4342 for (i = 0; i < infoPtr->nNumButtons; i++)
4343 {
4344 free_string( infoPtr->buttons + i );
4345 TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[i]);
4346 }
4347
4348 Free(infoPtr->buttons);
4349 infoPtr->buttons = NULL;
4350 infoPtr->nNumButtons = 0;
4351}
static void free_string(TBUTTON_INFO *btn)
Definition: toolbar.c:377
static void TOOLBAR_TooltipDelTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
Definition: toolbar.c:2159

Referenced by TOOLBAR_Restore().

◆ TOOLBAR_DeleteButton()

static LRESULT TOOLBAR_DeleteButton ( TOOLBAR_INFO infoPtr,
INT  nIndex 
)
static

Definition at line 3392 of file toolbar.c.

3393{
3394 NMTOOLBARW nmtb;
3395 TBUTTON_INFO *btnPtr = &infoPtr->buttons[nIndex];
3396
3397 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
3398 return FALSE;
3399
3400 memset(&nmtb, 0, sizeof(nmtb));
3401 nmtb.iItem = btnPtr->idCommand;
3402 nmtb.tbButton.iBitmap = btnPtr->iBitmap;
3403 nmtb.tbButton.idCommand = btnPtr->idCommand;
3404 nmtb.tbButton.fsState = btnPtr->fsState;
3405 nmtb.tbButton.fsStyle = btnPtr->fsStyle;
3406 nmtb.tbButton.dwData = btnPtr->dwData;
3407 nmtb.tbButton.iString = btnPtr->iString;
3408 TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_DELETINGBUTTON);
3409
3410 TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[nIndex]);
3411
3412 infoPtr->nHotItem = -1;
3413 if (infoPtr->nNumButtons == 1) {
3414 TRACE(" simple delete\n");
3415 free_string( infoPtr->buttons );
3416 Free (infoPtr->buttons);
3417 infoPtr->buttons = NULL;
3418 infoPtr->nNumButtons = 0;
3419 }
3420 else {
3421 TBUTTON_INFO *oldButtons = infoPtr->buttons;
3422 TRACE("complex delete [nIndex=%d]\n", nIndex);
3423
3424 infoPtr->nNumButtons--;
3425 infoPtr->buttons = Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons);
3426 if (nIndex > 0) {
3427 memcpy (&infoPtr->buttons[0], &oldButtons[0],
3428 nIndex * sizeof(TBUTTON_INFO));
3429 }
3430
3431 if (nIndex < infoPtr->nNumButtons) {
3432 memcpy (&infoPtr->buttons[nIndex], &oldButtons[nIndex+1],
3433 (infoPtr->nNumButtons - nIndex) * sizeof(TBUTTON_INFO));
3434 }
3435
3436 free_string( oldButtons + nIndex );
3437 Free (oldButtons);
3438 }
3439
3440 TOOLBAR_LayoutToolbar(infoPtr);
3441
3442 InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
3443
3444 return TRUE;
3445}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TBN_DELETINGBUTTON
Definition: commctrl.h:1338
INT idCommand
Definition: toolbar.c:92
DWORD_PTR dwData
Definition: toolbar.c:97
INT nHotItem
Definition: toolbar.c:138
BYTE fsState
Definition: commctrl.h:951
DWORD_PTR dwData
Definition: commctrl.h:958

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

◆ TOOLBAR_DeleteImageList()

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

Definition at line 7282 of file toolbar.c.

7283{
7284 int i;
7285
7286 for (i = 0; i < *cies; i++)
7287 Free((*pies)[i]);
7288
7289 Free(*pies);
7290
7291 *cies = 0;
7292 *pies = NULL;
7293}

Referenced by TOOLBAR_Destroy().

◆ TOOLBAR_Destroy()

static LRESULT TOOLBAR_Destroy ( TOOLBAR_INFO infoPtr)
static

Definition at line 5562 of file toolbar.c.

5563{
5564 INT i;
5565
5566 /* delete tooltip control */
5567 if (infoPtr->hwndToolTip)
5568 DestroyWindow (infoPtr->hwndToolTip);
5569
5570 /* delete temporary buffer for tooltip text */
5571 Free (infoPtr->pszTooltipText);
5572 Free (infoPtr->bitmaps); /* bitmaps list */
5573
5574 /* delete button data */
5575 for (i = 0; i < infoPtr->nNumButtons; i++)
5576 free_string( infoPtr->buttons + i );
5577 Free (infoPtr->buttons);
5578
5579 /* delete strings */
5580 if (infoPtr->strings) {
5581 for (i = 0; i < infoPtr->nNumStrings; i++)
5582 Free (infoPtr->strings[i]);
5583
5584 Free (infoPtr->strings);
5585 }
5586
5587 /* destroy internal image list */
5588 if (infoPtr->himlInt)
5589 ImageList_Destroy (infoPtr->himlInt);
5590
5591 TOOLBAR_DeleteImageList(&infoPtr->himlDef, &infoPtr->cimlDef);
5592 TOOLBAR_DeleteImageList(&infoPtr->himlDis, &infoPtr->cimlDis);
5593 TOOLBAR_DeleteImageList(&infoPtr->himlHot, &infoPtr->cimlHot);
5594
5595 /* delete default font */
5596 DeleteObject (infoPtr->hDefaultFont);
5597
5599
5600 /* free toolbar info data */
5601 SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
5602 Free (infoPtr);
5603
5604 return 0;
5605}
static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies)
Definition: toolbar.c:7282
PIMLENTRY * himlDis
Definition: toolbar.c:154
INT cimlHot
Definition: toolbar.c:153
INT cimlDis
Definition: toolbar.c:155
PIMLENTRY * himlHot
Definition: toolbar.c:152
LPWSTR pszTooltipText
Definition: toolbar.c:172
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by ToolbarWindowProc().

◆ TOOLBAR_DrawArrow()

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

Definition at line 599 of file toolbar.c.

600{
601 INT x, y;
602 HPEN hPen, hOldPen;
603
604 if (!(hPen = CreatePen( PS_SOLID, 1, clr))) return;
605 hOldPen = SelectObject ( hdc, hPen );
606 x = left + 2;
607 y = top;
608 MoveToEx (hdc, x, y, NULL);
609 LineTo (hdc, x+5, y++); x++;
610 MoveToEx (hdc, x, y, NULL);
611 LineTo (hdc, x+3, y++); x++;
612 MoveToEx (hdc, x, y, NULL);
613 LineTo (hdc, x+1, y);
614 SelectObject( hdc, hOldPen );
615 DeleteObject( hPen );
616}
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 953 of file toolbar.c.

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

568{
569 RECT myrect;
570 COLORREF oldcolor, newcolor;
571
572 myrect.left = lpRect->left;
573 myrect.right = lpRect->right;
574 myrect.top = lpRect->top + (lpRect->bottom - lpRect->top - 2)/2;
575 myrect.bottom = myrect.top + 1;
576
577 InflateRect (&myrect, -2, 0);
578
579 TRACE("rect=(%s)\n", wine_dbgstr_rect(&myrect));
580
581 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
583 oldcolor = SetBkColor (hdc, newcolor);
584 ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
585
586 myrect.top = myrect.bottom;
587 myrect.bottom = myrect.top + 1;
588
589 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
591 SetBkColor (hdc, newcolor);
592 ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
593
594 SetBkColor (hdc, oldcolor);
595}
#define CLR_DEFAULT
Definition: commctrl.h:320
static __inline const char * wine_dbgstr_rect(const RECT *rect)
Definition: debug.h:219
COLORREF clrBtnShadow
Definition: comctl32.h:166
COLORREF clrBtnShadow
Definition: toolbar.c:170
COLORREF clrBtnHighlight
Definition: toolbar.c:169

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DrawFlatSeparator()

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

Definition at line 527 of file toolbar.c.

528{
529 RECT myrect;
530 COLORREF oldcolor, newcolor;
531
532 myrect.left = (lpRect->left + lpRect->right) / 2 - 1;
533 myrect.right = myrect.left + 1;
534 myrect.top = lpRect->top + 2;
535 myrect.bottom = lpRect->bottom - 2;
536
537 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
539 oldcolor = SetBkColor (hdc, newcolor);
540 ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
541
542 myrect.left = myrect.right;
543 myrect.right = myrect.left + 1;
544
545 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
547 SetBkColor (hdc, newcolor);
548 ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
549
550 SetBkColor (hdc, oldcolor);
551}

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

881{
882 HDC hdc = tbcd->nmcd.hdc;
883 RECT rc = *rect;
884 /* if the state is disabled or indeterminate then the button
885 * cannot have an interactive look like pressed or hot */
886 BOOL non_interactive_state = (tbcd->nmcd.uItemState & CDIS_DISABLED) ||
888 BOOL pressed_look = !non_interactive_state &&
889 ((tbcd->nmcd.uItemState & CDIS_SELECTED) ||
890 (tbcd->nmcd.uItemState & CDIS_CHECKED));
891
892 /* app don't want us to draw any edges */
893 if (dwItemCDFlag & TBCDRF_NOEDGES)
894 return;
895
896 if (infoPtr->dwStyle & TBSTYLE_FLAT)
897 {
898 if (pressed_look)
900 else if ((tbcd->nmcd.uItemState & CDIS_HOT) && !non_interactive_state)
902 }
903 else
904 {
905 if (pressed_look)
907 else
908 DrawEdge (hdc, &rc, EDGE_RAISED,
910 }
911}
#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 783 of file toolbar.c.

785{
787 BOOL draw_masked = FALSE, draw_desaturated = FALSE;
788 INT index;
789 INT offset = 0;
790 UINT draw_flags = ILD_TRANSPARENT;
791#ifdef __REACTOS__
792 IMAGEINFO info = {0};
793 BITMAP bm = {0};
794#endif
795
797 {
799 if (!himl)
800 {
802
803#ifdef __REACTOS__
805 GetObjectW(info.hbmImage, sizeof(bm), &bm);
806
807 if (bm.bmBitsPixel == 32)
808 {
809 draw_desaturated = TRUE;
810 }
811 else
812 {
813 draw_masked = TRUE;
814 }
815#else
816 draw_masked = TRUE;
817#endif
818 }
819 }
820 else if (tbcd->nmcd.uItemState & CDIS_CHECKED ||
821 ((tbcd->nmcd.uItemState & CDIS_HOT)
822 && ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf))))
823 {
824 /* if hot, attempt to draw with hot image list, if fails,
825 use default image list */
827 if (!himl)
829 }
830 else
832
833 if (!himl)
834 return;
835
836 if (!(dwItemCDFlag & TBCDRF_NOOFFSET) &&
838 offset = 1;
839
840 if (!(dwItemCDFlag & TBCDRF_NOMARK) &&
841 (tbcd->nmcd.uItemState & CDIS_MARKED))
842 draw_flags |= ILD_BLEND50;
843
844 TRACE("drawing index=%d, himl=%p, left=%d, top=%d, offset=%d\n",
845 index, himl, left, top, offset);
846
847 if (draw_masked)
848 {
849 /* code path for drawing flat disabled icons without alpha channel */
850 TOOLBAR_DrawMasked (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
851 }
852 else if (draw_desaturated)
853 {
854 /* code path for drawing disabled, alpha-blended (32bpp) icons */
855 IMAGELISTDRAWPARAMS imldp = {0};
856
857 imldp.cbSize = sizeof(imldp);
858 imldp.himl = himl;
859 imldp.i = index;
860 imldp.hdcDst = tbcd->nmcd.hdc,
861 imldp.x = offset + left;
862 imldp.y = offset + top;
863 imldp.rgbBk = CLR_NONE;
864 imldp.rgbFg = CLR_DEFAULT;
865 imldp.fStyle = ILD_TRANSPARENT;
866 imldp.fState = ILS_ALPHA | ILS_SATURATE;
867 imldp.Frame = 192;
868
869 ImageList_DrawIndirect (&imldp);
870 }
871 else
872 {
873 /* code path for drawing standard icons as-is */
874 ImageList_Draw (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
875 }
876}
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:724
static HIMAGELIST TOOLBAR_GetImageListForDrawing(const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMAGE_LIST_TYPE imagelist, INT *index)
Definition: toolbar.c:483
#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 724 of file toolbar.c.

725{
726 INT cx, cy;
727 HBITMAP hbmMask, hbmImage;
728 HDC hdcMask, hdcImage;
729
731
732 /* Create src image */
733 hdcImage = CreateCompatibleDC(hdc);
734 hbmImage = CreateCompatibleBitmap(hdc, cx, cy);
735 SelectObject(hdcImage, hbmImage);
736 ImageList_DrawEx(himl, index, hdcImage, 0, 0, cx, cy,
737 RGB(0xff, 0xff, 0xff), RGB(0,0,0), draw_flags);
738
739 /* Create Mask */
740 hdcMask = CreateCompatibleDC(0);
741 hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
742 SelectObject(hdcMask, hbmMask);
743
744 /* Remove the background and all white pixels */
745 ImageList_DrawEx(himl, index, hdcMask, 0, 0, cx, cy,
746 RGB(0xff, 0xff, 0xff), RGB(0,0,0), ILD_MASK);
747 SetBkColor(hdcImage, RGB(0xff, 0xff, 0xff));
748 BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, NOTSRCERASE);
749
750 /* draw the new mask 'etched' to hdc */
751 SetBkColor(hdc, RGB(255, 255, 255));
753 /* E20746 op code is (Dst ^ (Src & (Pat ^ Dst))) */
754 BitBlt(hdc, x + 1, y + 1, cx, cy, hdcMask, 0, 0, 0xE20746);
756 BitBlt(hdc, x, y, cx, cy, hdcMask, 0, 0, 0xE20746);
757
758 /* Cleanup */
759 DeleteObject(hbmImage);
760 DeleteDC(hdcImage);
761 DeleteObject (hbmMask);
762 DeleteDC(hdcMask);
763}
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 NTAPI 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:49
#define RGB(r, g, b)
Definition: precomp.h:62
#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:925
#define COLOR_3DHILIGHT
Definition: winuser.h:931

Referenced by TOOLBAR_DrawImage().

◆ TOOLBAR_DrawPattern()

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

Definition at line 704 of file toolbar.c.

705{
706 HDC hdc = tbcd->nmcd.hdc;
707 HBRUSH hbr = SelectObject (hdc, tbcd->hbrMonoDither);
708 COLORREF clrTextOld;
709 COLORREF clrBkOld;
710 INT cx = lpRect->right - lpRect->left;
711 INT cy = lpRect->bottom - lpRect->top;
714 clrTextOld = SetTextColor(hdc, tbcd->clrBtnHighlight);
715 clrBkOld = SetBkColor(hdc, tbcd->clrBtnFace);
716 PatBlt (hdc, lpRect->left + cxEdge, lpRect->top + cyEdge,
717 cx - (2 * cxEdge), cy - (2 * cyEdge), PATCOPY);
718 SetBkColor(hdc, clrBkOld);
719 SetTextColor(hdc, clrTextOld);
720 SelectObject (hdc, hbr);
721}
#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 914 of file toolbar.c.

915{
916 HDC hdc = tbcd->nmcd.hdc;
917 int offset = 0;
918 BOOL pressed = bDropDownPressed ||
920
921 if (infoPtr->dwStyle & TBSTYLE_FLAT)
922 {
923 if (pressed)
924 DrawEdge (hdc, rcArrow, BDR_SUNKENOUTER, BF_RECT);
925 else if ( (tbcd->nmcd.uItemState & CDIS_HOT) &&
926 !(tbcd->nmcd.uItemState & CDIS_DISABLED) &&
928 DrawEdge (hdc, rcArrow, BDR_RAISEDINNER, BF_RECT);
929 }
930 else
931 {
932 if (pressed)
934 else
935 DrawEdge (hdc, rcArrow, EDGE_RAISED,
937 }
938
939 if (pressed)
940 offset = (dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
941
943 {
944 TOOLBAR_DrawArrow(hdc, rcArrow->left+1, rcArrow->top+1 + (rcArrow->bottom - rcArrow->top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnHighlight);
945 TOOLBAR_DrawArrow(hdc, rcArrow->left, rcArrow->top + (rcArrow->bottom - rcArrow->top - ARROW_HEIGHT) / 2, comctl32_color.clr3dShadow);
946 }
947 else
948 TOOLBAR_DrawArrow(hdc, rcArrow->left + offset, rcArrow->top + offset + (rcArrow->bottom - rcArrow->top - ARROW_HEIGHT) / 2, comctl32_color.clrBtnText);
949}

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

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

Referenced by TOOLBAR_DrawButton().

◆ TOOLBAR_DumpButton()

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

Definition at line 312 of file toolbar.c.

313{
314 if (TRACE_ON(toolbar)){
315 TRACE("button %d id %d, bitmap=%d, state=%02x, style=%02x, data=%08lx, stringid=0x%08lx\n",
316 btn_num, bP->idCommand, GETIBITMAP(infoPtr, bP->iBitmap),
317 bP->fsState, bP->fsStyle, bP->dwData, bP->iString);
318 TRACE("string %s\n", debugstr_w(TOOLBAR_GetText(infoPtr,bP)));
319 TRACE("button %d id %d, hot=%s, row=%d, rect=(%s)\n",
320 btn_num, bP->idCommand, (bP->bHot) ? "TRUE":"FALSE", bP->nRow,
321 wine_dbgstr_rect(&bP->rect));
322 }
323}
#define TRACE_ON(x)
Definition: compat.h:75
INT nRow
Definition: toolbar.c:99
BOOL bHot
Definition: toolbar.c:95

Referenced by TOOLBAR_DumpToolbar().

◆ TOOLBAR_DumpTBButton()

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

Definition at line 304 of file toolbar.c.

305{
306 TRACE("TBBUTTON: id %d, bitmap=%d, state=%02x, style=%02x, data=%p, stringid=%p (%s)\n", tbb->idCommand,
307 tbb->iBitmap, tbb->fsState, tbb->fsStyle, (void *)tbb->dwData, (void *)tbb->iString,
308 tbb->iString != -1 ? (fUnicode ? debugstr_w((LPWSTR)tbb->iString) : debugstr_a((LPSTR)tbb->iString)) : "");
309}
#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 327 of file toolbar.c.

328{
329 if (TRACE_ON(toolbar)) {
330 INT i;
331
332 TRACE("toolbar %p at line %d, exStyle=%08x, buttons=%d, bitmaps=%d, strings=%d, style=%08x\n",
333 iP->hwndSelf, line,
334 iP->dwExStyle, iP->nNumButtons, iP->nNumBitmaps,
335 iP->nNumStrings, iP->dwStyle);
336 TRACE("toolbar %p at line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n",
337 iP->hwndSelf, line,
338 iP->himlInt, iP->himlDef, iP->himlHot, iP->himlDis,
339 (iP->bDoRedraw) ? "TRUE" : "FALSE");
340 for(i=0; i<iP->nNumButtons; i++) {
341 TOOLBAR_DumpButton(iP, &iP->buttons[i], i);
342 }
343 }
344}
static void TOOLBAR_DumpButton(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *bP, INT btn_num)
Definition: toolbar.c:312
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