ReactOS  0.4.15-dev-4582-g6dc1738
tab.c File Reference
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/debug.h"
#include <math.h>
Include dependency graph for tab.c:

Go to the source code of this file.

Classes

struct  TAB_ITEM
 
struct  TAB_INFO
 

Macros

#define EXTRA_ITEM_SIZE(infoPtr)   (max((infoPtr)->cbInfo, sizeof(LPARAM)))
 
#define TAB_ITEM_SIZE(infoPtr)   FIELD_OFFSET(TAB_ITEM, extra[EXTRA_ITEM_SIZE(infoPtr)])
 
#define SELECTED_TAB_OFFSET   2
 
#define ROUND_CORNER_SIZE   2
 
#define DISPLAY_AREA_PADDINGX   2
 
#define DISPLAY_AREA_PADDINGY   2
 
#define CONTROL_BORDER_SIZEX   2
 
#define CONTROL_BORDER_SIZEY   2
 
#define BUTTON_SPACINGX   3
 
#define BUTTON_SPACINGY   3
 
#define FLAT_BTN_SPACINGX   8
 
#define DEFAULT_MIN_TAB_WIDTH   54
 
#define DEFAULT_PADDING_X   6
 
#define EXTRA_ICON_PADDING   3
 
#define TAB_GetInfoPtr(hwnd)   ((TAB_INFO *)GetWindowLongPtrW(hwnd,0))
 
#define GET_DEFAULT_MIN_TAB_WIDTH(infoPtr)   (DEFAULT_MIN_TAB_WIDTH - (DEFAULT_PADDING_X - (infoPtr)->uHItemPadding) * 2)
 
#define TAB_HOTTRACK_TIMER   1
 
#define TAB_HOTTRACK_TIMER_INTERVAL   100 /* milliseconds */
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (tab)
 
static TAB_ITEMTAB_GetItem (const TAB_INFO *infoPtr, INT i)
 
static void TAB_InvalidateTabArea (const TAB_INFO *)
 
static void TAB_EnsureSelectionVisible (TAB_INFO *)
 
static void TAB_DrawItemInterior (const TAB_INFO *, HDC, INT, RECT *)
 
static LRESULT TAB_DeselectAll (TAB_INFO *, BOOL)
 
static BOOL TAB_InternalGetItemRect (const TAB_INFO *, INT, RECT *, RECT *)
 
static BOOL TAB_SendSimpleNotify (const TAB_INFO *infoPtr, UINT code)
 
static void TAB_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void TAB_DumpItemExternalT (const TCITEMW *pti, UINT iItem, BOOL isW)
 
static void TAB_DumpItemInternal (const TAB_INFO *infoPtr, UINT iItem)
 
static LRESULT TAB_GetCurSel (const TAB_INFO *infoPtr)
 
static LRESULT TAB_GetCurFocus (const TAB_INFO *infoPtr)
 
static LRESULT TAB_GetToolTips (const TAB_INFO *infoPtr)
 
static LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
 
static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
 
static LRESULT TAB_SetToolTips (TAB_INFO *infoPtr, HWND hwndToolTip)
 
static LRESULT TAB_SetPadding (TAB_INFO *infoPtr, LPARAM lParam)
 
static BOOL TAB_GetItemRect (const TAB_INFO *infoPtr, INT item, RECT *rect)
 
static LRESULT TAB_KeyDown (TAB_INFO *infoPtr, WPARAM keyCode, LPARAM lParam)
 
static void TAB_KillFocus (TAB_INFO *infoPtr)
 
static void TAB_FocusChanging (const TAB_INFO *infoPtr)
 
static INT TAB_InternalHitTest (const TAB_INFO *infoPtr, POINT pt, UINT *flags)
 
static LRESULT TAB_HitTest (const TAB_INFO *infoPtr, LPTCHITTESTINFO lptest)
 
static LRESULT TAB_NCHitTest (const TAB_INFO *infoPtr, LPARAM lParam)
 
static LRESULT TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TAB_LButtonUp (const TAB_INFO *infoPtr)
 
static void TAB_RButtonUp (const TAB_INFO *infoPtr)
 
static void TAB_DrawLoneItemInterior (const TAB_INFO *infoPtr, int iItem)
 
static void hottrack_refresh (const TAB_INFO *infoPtr, int tabIndex)
 
static void CALLBACK TAB_HotTrackTimerProc (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
 
static void TAB_RecalcHotTrack (TAB_INFO *infoPtr, const LPARAM *pos, int *out_redrawLeave, int *out_redrawEnter)
 
static LRESULT TAB_MouseMove (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TAB_AdjustRect (const TAB_INFO *infoPtr, WPARAM fLarger, LPRECT prc)
 
static LRESULT TAB_OnHScroll (TAB_INFO *infoPtr, int nScrollCode, int nPos)
 
static void TAB_SetupScrolling (TAB_INFO *infoPtr, const RECT *clientRect)
 
static void TAB_SetItemBounds (TAB_INFO *infoPtr)
 
static void TAB_EraseTabInterior (const TAB_INFO *infoPtr, HDC hdc, INT iItem, const RECT *drawRect)
 
static void TAB_DrawItem (const TAB_INFO *infoPtr, HDC hdc, INT iItem)
 
static void TAB_DrawBorder (const TAB_INFO *infoPtr, HDC hdc)
 
static void TAB_Refresh (const TAB_INFO *infoPtr, HDC hdc)
 
static DWORD TAB_GetRowCount (const TAB_INFO *infoPtr)
 
static LRESULT TAB_SetRedraw (TAB_INFO *infoPtr, BOOL doRedraw)
 
static LRESULT TAB_Paint (TAB_INFO *infoPtr, HDC hdcPaint)
 
static LRESULT TAB_InsertItemT (TAB_INFO *infoPtr, INT iItem, const TCITEMW *pti, BOOL bUnicode)
 
static LRESULT TAB_SetItemSize (TAB_INFO *infoPtr, INT cx, INT cy)
 
static LRESULT TAB_SetMinTabWidth (TAB_INFO *infoPtr, INT cx)
 
static LRESULT TAB_HighlightItem (TAB_INFO *infoPtr, INT iItem, BOOL fHighlight)
 
static LRESULT TAB_SetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode)
 
static LRESULT TAB_GetItemCount (const TAB_INFO *infoPtr)
 
static LRESULT TAB_GetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode)
 
static LRESULT TAB_DeleteItem (TAB_INFO *infoPtr, INT iItem)
 
static LRESULT TAB_DeleteAllItems (TAB_INFO *infoPtr)
 
static LRESULT TAB_GetFont (const TAB_INFO *infoPtr)
 
static LRESULT TAB_SetFont (TAB_INFO *infoPtr, HFONT hNewFont)
 
static LRESULT TAB_GetImageList (const TAB_INFO *infoPtr)
 
static LRESULT TAB_SetImageList (TAB_INFO *infoPtr, HIMAGELIST himlNew)
 
static LRESULT TAB_GetUnicodeFormat (const TAB_INFO *infoPtr)
 
static LRESULT TAB_SetUnicodeFormat (TAB_INFO *infoPtr, BOOL bUnicode)
 
static LRESULT TAB_Size (TAB_INFO *infoPtr)
 
static LRESULT TAB_Create (HWND hwnd, LPARAM lParam)
 
static LRESULT TAB_Destroy (TAB_INFO *infoPtr)
 
static LRESULT theme_changed (const TAB_INFO *infoPtr)
 
static LRESULT TAB_NCCalcSize (WPARAM wParam)
 
static LRESULT TAB_SetItemExtra (TAB_INFO *infoPtr, INT cbInfo)
 
static LRESULT TAB_RemoveImage (TAB_INFO *infoPtr, INT image)
 
static LRESULT TAB_SetExtendedStyle (TAB_INFO *infoPtr, DWORD exMask, DWORD exStyle)
 
static LRESULT TAB_GetExtendedStyle (const TAB_INFO *infoPtr)
 
static INT TAB_StyleChanged (TAB_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
 
static LRESULT WINAPI TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void TAB_Register (void)
 
void TAB_Unregister (void)
 

Variables

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

Macro Definition Documentation

◆ BUTTON_SPACINGX

#define BUTTON_SPACINGX   3

Definition at line 138 of file tab.c.

◆ BUTTON_SPACINGY

#define BUTTON_SPACINGY   3

Definition at line 139 of file tab.c.

◆ CONTROL_BORDER_SIZEX

#define CONTROL_BORDER_SIZEX   2

Definition at line 136 of file tab.c.

◆ CONTROL_BORDER_SIZEY

#define CONTROL_BORDER_SIZEY   2

Definition at line 137 of file tab.c.

◆ DEFAULT_MIN_TAB_WIDTH

#define DEFAULT_MIN_TAB_WIDTH   54

Definition at line 141 of file tab.c.

◆ DEFAULT_PADDING_X

#define DEFAULT_PADDING_X   6

Definition at line 142 of file tab.c.

◆ DISPLAY_AREA_PADDINGX

#define DISPLAY_AREA_PADDINGX   2

Definition at line 134 of file tab.c.

◆ DISPLAY_AREA_PADDINGY

#define DISPLAY_AREA_PADDINGY   2

Definition at line 135 of file tab.c.

◆ EXTRA_ICON_PADDING

#define EXTRA_ICON_PADDING   3

Definition at line 143 of file tab.c.

◆ EXTRA_ITEM_SIZE

#define EXTRA_ITEM_SIZE (   infoPtr)    (max((infoPtr)->cbInfo, sizeof(LPARAM)))

Definition at line 89 of file tab.c.

◆ FLAT_BTN_SPACINGX

#define FLAT_BTN_SPACINGX   8

Definition at line 140 of file tab.c.

◆ GET_DEFAULT_MIN_TAB_WIDTH

#define GET_DEFAULT_MIN_TAB_WIDTH (   infoPtr)    (DEFAULT_MIN_TAB_WIDTH - (DEFAULT_PADDING_X - (infoPtr)->uHItemPadding) * 2)

Definition at line 147 of file tab.c.

◆ ROUND_CORNER_SIZE

#define ROUND_CORNER_SIZE   2

Definition at line 133 of file tab.c.

◆ SELECTED_TAB_OFFSET

#define SELECTED_TAB_OFFSET   2

Definition at line 132 of file tab.c.

◆ TAB_GetInfoPtr

#define TAB_GetInfoPtr (   hwnd)    ((TAB_INFO *)GetWindowLongPtrW(hwnd,0))

Definition at line 145 of file tab.c.

◆ TAB_HOTTRACK_TIMER

#define TAB_HOTTRACK_TIMER   1

Definition at line 152 of file tab.c.

◆ TAB_HOTTRACK_TIMER_INTERVAL

#define TAB_HOTTRACK_TIMER_INTERVAL   100 /* milliseconds */

Definition at line 153 of file tab.c.

◆ TAB_ITEM_SIZE

#define TAB_ITEM_SIZE (   infoPtr)    FIELD_OFFSET(TAB_ITEM, extra[EXTRA_ITEM_SIZE(infoPtr)])

Definition at line 90 of file tab.c.

Function Documentation

◆ hottrack_refresh()

static void hottrack_refresh ( const TAB_INFO infoPtr,
int  tabIndex 
)
inlinestatic

Definition at line 757 of file tab.c.

758 {
759  if (tabIndex == -1) return;
760 
761  if (GetWindowTheme (infoPtr->hwnd))
762  {
763  RECT rect;
764  TAB_InternalGetItemRect(infoPtr, tabIndex, &rect, NULL);
765  InvalidateRect (infoPtr->hwnd, &rect, FALSE);
766  }
767  else
768  TAB_DrawLoneItemInterior(infoPtr, tabIndex);
769 }
static void TAB_DrawLoneItemInterior(const TAB_INFO *infoPtr, int iItem)
Definition: tab.c:739
& rect
Definition: startmenu.cpp:1413
#define FALSE
Definition: types.h:117
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HWND hwnd
Definition: tab.c:94
#define NULL
Definition: types.h:112

Referenced by TAB_HotTrackTimerProc(), and TAB_MouseMove().

◆ TAB_AdjustRect()

static LRESULT TAB_AdjustRect ( const TAB_INFO infoPtr,
WPARAM  fLarger,
LPRECT  prc 
)
static

Definition at line 941 of file tab.c.

942 {
943  LONG *iRightBottom, *iLeftTop;
944 
945  TRACE ("hwnd=%p fLarger=%ld (%s)\n", infoPtr->hwnd, fLarger,
947 
948  if (!prc) return -1;
949 
950  if(infoPtr->dwStyle & TCS_VERTICAL)
951  {
952  iRightBottom = &(prc->right);
953  iLeftTop = &(prc->left);
954  }
955  else
956  {
957  iRightBottom = &(prc->bottom);
958  iLeftTop = &(prc->top);
959  }
960 
961  if (fLarger) /* Go from display rectangle */
962  {
963  /* Add the height of the tabs. */
964  if (infoPtr->dwStyle & TCS_BOTTOM)
965  *iRightBottom += infoPtr->tabHeight * infoPtr->uNumRows;
966  else
967  *iLeftTop -= infoPtr->tabHeight * infoPtr->uNumRows +
968  ((infoPtr->dwStyle & TCS_BUTTONS)? 3 * (infoPtr->uNumRows - 1) : 0);
969 
970  /* Inflate the rectangle for the padding */
972 
973  /* Inflate for the border */
975  }
976  else /* Go from window rectangle. */
977  {
978  /* Deflate the rectangle for the border */
980 
981  /* Deflate the rectangle for the padding */
983 
984  /* Remove the height of the tabs. */
985  if (infoPtr->dwStyle & TCS_BOTTOM)
986  *iRightBottom -= infoPtr->tabHeight * infoPtr->uNumRows;
987  else
988  *iLeftTop += (infoPtr->tabHeight) * infoPtr->uNumRows +
989  ((infoPtr->dwStyle & TCS_BUTTONS)? 3 * (infoPtr->uNumRows - 1) : 0);
990  }
991 
992  return 0;
993 }
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define TCS_BUTTONS
Definition: commctrl.h:3948
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define DISPLAY_AREA_PADDINGX
Definition: tab.c:134
LONG right
Definition: windef.h:308
long LONG
Definition: pedump.c:60
#define CONTROL_BORDER_SIZEX
Definition: tab.c:136
#define DISPLAY_AREA_PADDINGY
Definition: tab.c:135
#define TRACE(s)
Definition: solgame.cpp:4
#define TCS_BOTTOM
Definition: commctrl.h:3939
const char * wine_dbgstr_rect(const RECT *rect)
#define TCS_VERTICAL
Definition: commctrl.h:3946
UINT uNumRows
Definition: tab.c:97
#define CONTROL_BORDER_SIZEY
Definition: tab.c:137
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
LONG bottom
Definition: windef.h:309
_Out_ LPRECT prc
Definition: ntgdi.h:1658
INT tabHeight
Definition: tab.c:98

Referenced by TAB_InvalidateTabArea(), and TAB_WindowProc().

◆ TAB_Create()

static LRESULT TAB_Create ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 3004 of file tab.c.

3005 {
3006  TAB_INFO *infoPtr;
3007  TEXTMETRICW fontMetrics;
3008  HDC hdc;
3009  HFONT hOldFont;
3010  DWORD style;
3011 
3012  infoPtr = Alloc (sizeof(TAB_INFO));
3013 
3014  SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
3015 
3016  infoPtr->hwnd = hwnd;
3017  infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
3018  infoPtr->uNumItem = 0;
3019  infoPtr->uNumRows = 0;
3020  infoPtr->uHItemPadding = 6;
3021  infoPtr->uVItemPadding = 3;
3022  infoPtr->uHItemPadding_s = 6;
3023  infoPtr->uVItemPadding_s = 3;
3024  infoPtr->hFont = 0;
3025  infoPtr->items = DPA_Create(8);
3026  infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW);
3027  infoPtr->iSelected = -1;
3028  infoPtr->iHotTracked = -1;
3029  infoPtr->uFocus = -1;
3030  infoPtr->hwndToolTip = 0;
3031  infoPtr->DoRedraw = TRUE;
3032  infoPtr->needsScrolling = FALSE;
3033  infoPtr->hwndUpDown = 0;
3034  infoPtr->leftmostVisible = 0;
3035  infoPtr->fHeightSet = FALSE;
3036  infoPtr->bUnicode = IsWindowUnicode (hwnd);
3037  infoPtr->cbInfo = sizeof(LPARAM);
3038 
3039  TRACE("Created tab control, hwnd [%p]\n", hwnd);
3040 
3041  /* The tab control always has the WS_CLIPSIBLINGS style. Even
3042  if you don't specify it in CreateWindow. This is necessary in
3043  order for paint to work correctly. This follows windows behaviour. */
3048 
3049  infoPtr->dwStyle = style;
3050  infoPtr->exStyle = (style & TCS_FLATBUTTONS) ? TCS_EX_FLATSEPARATORS : 0;
3051 
3052  if (infoPtr->dwStyle & TCS_TOOLTIPS) {
3053  /* Create tooltip control */
3054  infoPtr->hwndToolTip =
3058  hwnd, 0, 0, 0);
3059 
3060  /* Send NM_TOOLTIPSCREATED notification */
3061  if (infoPtr->hwndToolTip) {
3062  NMTOOLTIPSCREATED nmttc;
3063 
3064  nmttc.hdr.hwndFrom = hwnd;
3066  nmttc.hdr.code = NM_TOOLTIPSCREATED;
3067  nmttc.hwndToolTips = infoPtr->hwndToolTip;
3068 
3069  SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
3070  GetWindowLongPtrW(hwnd, GWLP_ID), (LPARAM)&nmttc);
3071  }
3072  }
3073 
3074  OpenThemeData (infoPtr->hwnd, themeClass);
3075 
3076  /*
3077  * We need to get text information so we need a DC and we need to select
3078  * a font.
3079  */
3080  hdc = GetDC(hwnd);
3081  hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT));
3082 
3083  /* Use the system font to determine the initial height of a tab. */
3084  GetTextMetricsW(hdc, &fontMetrics);
3085 
3086  /*
3087  * Make sure there is enough space for the letters + growing the
3088  * selected item + extra space for the selected item.
3089  */
3090  infoPtr->tabHeight = fontMetrics.tmHeight + SELECTED_TAB_OFFSET +
3091  ((infoPtr->dwStyle & TCS_BUTTONS) ? 2 : 1) *
3092  infoPtr->uVItemPadding;
3093 
3094  /* Initialize the width of a tab. */
3095  if (infoPtr->dwStyle & TCS_FIXEDWIDTH)
3096  infoPtr->tabWidth = GetDeviceCaps(hdc, LOGPIXELSX);
3097 
3098  infoPtr->tabMinWidth = -1;
3099 
3100  TRACE("tabH=%d, tabW=%d\n", infoPtr->tabHeight, infoPtr->tabWidth);
3101 
3102  SelectObject (hdc, hOldFont);
3103  ReleaseDC(hwnd, hdc);
3104 
3105  return 0;
3106 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define LOGPIXELSX
Definition: wingdi.h:718
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950
#define SELECTED_TAB_OFFSET
Definition: tab.c:132
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
INT leftmostVisible
Definition: tab.c:109
USHORT uVItemPadding
Definition: tab.c:102
UINT uNumItem
Definition: tab.c:96
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
HFONT hFont
Definition: tab.c:105
BOOL bUnicode
Definition: tab.c:118
static HDC
Definition: imagelist.c:92
#define TCS_BUTTONS
Definition: commctrl.h:3948
static const WCHAR themeClass[]
Definition: tab.c:155
USHORT uVItemPadding_s
Definition: tab.c:104
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
INT tabMinWidth
Definition: tab.c:100
#define GetWindowLongPtrW
Definition: winuser.h:4809
INT uFocus
Definition: tab.c:113
#define TCS_EX_FLATSEPARATORS
Definition: commctrl.h:3959
#define TCS_FLATBUTTONS
Definition: commctrl.h:3942
#define TCS_FIXEDWIDTH
Definition: commctrl.h:3952
UINT code
Definition: winuser.h:3139
HCURSOR hcurArrow
Definition: tab.c:106
#define FALSE
Definition: types.h:117
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
UINT_PTR idFrom
Definition: winuser.h:3138
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define CW_USEDEFAULT
Definition: winuser.h:225
HWND hwndNotify
Definition: tab.c:95
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SYSTEM_FONT
Definition: wingdi.h:911
LONG_PTR LPARAM
Definition: windef.h:208
BOOL fHeightSet
Definition: tab.c:117
BOOL WINAPI IsWindowUnicode(_In_ HWND)
BOOL DoRedraw
Definition: tab.c:114
INT cbInfo
Definition: tab.c:120
#define TRACE(s)
Definition: solgame.cpp:4
INT tabWidth
Definition: tab.c:99
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1707
HDPA items
Definition: tab.c:126
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
HWND hwndFrom
Definition: winuser.h:3137
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define TCS_VERTICAL
Definition: commctrl.h:3946
USHORT uHItemPadding
Definition: tab.c:101
UINT uNumRows
Definition: tab.c:97
BOOL needsScrolling
Definition: tab.c:115
#define GWL_STYLE
Definition: winuser.h:846
HWND hwndUpDown
Definition: tab.c:119
INT iHotTracked
Definition: tab.c:112
INT iSelected
Definition: tab.c:111
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct tagCREATESTRUCTW * LPCREATESTRUCTW
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
Definition: tab.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define IDC_ARROW
Definition: winuser.h:682
#define TCS_TOOLTIPS
Definition: commctrl.h:3956
USHORT uHItemPadding_s
Definition: tab.c:103
#define SetWindowLongPtrW
Definition: winuser.h:5326
#define TCS_MULTILINE
Definition: commctrl.h:3950
LONG tmHeight
Definition: wingdi.h:2383
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define NM_TOOLTIPSCREATED
Definition: commctrl.h:144
Arabic default style
Definition: afstyles.h:93
LPARAM lParam
Definition: combotst.c:139
DWORD exStyle
Definition: tab.c:122
#define GWLP_ID
Definition: winuser.h:854
#define WM_NOTIFY
Definition: richedit.h:61
INT tabHeight
Definition: tab.c:98
HWND hwndToolTip
Definition: tab.c:108

Referenced by TAB_WindowProc().

◆ TAB_DeleteAllItems()

static LRESULT TAB_DeleteAllItems ( TAB_INFO infoPtr)
inlinestatic

Definition at line 2907 of file tab.c.

2908 {
2909  TRACE("(%p)\n", infoPtr);
2910  while (infoPtr->uNumItem)
2911  TAB_DeleteItem (infoPtr, 0);
2912  return TRUE;
2913 }
static LRESULT TAB_DeleteItem(TAB_INFO *infoPtr, INT iItem)
Definition: tab.c:2861
UINT uNumItem
Definition: tab.c:96
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by TAB_WindowProc().

◆ TAB_DeleteItem()

static LRESULT TAB_DeleteItem ( TAB_INFO infoPtr,
INT  iItem 
)
static

Definition at line 2861 of file tab.c.

2862 {
2863  TAB_ITEM *item;
2864 
2865  TRACE("(%p, %d)\n", infoPtr, iItem);
2866 
2867  if (iItem < 0 || iItem >= infoPtr->uNumItem) return FALSE;
2868 
2869  TAB_InvalidateTabArea(infoPtr);
2870  item = TAB_GetItem(infoPtr, iItem);
2871  Free(item->pszText);
2872  Free(item);
2873  infoPtr->uNumItem--;
2874  DPA_DeletePtr(infoPtr->items, iItem);
2875 
2876  if (infoPtr->uNumItem == 0)
2877  {
2878  if (infoPtr->iHotTracked >= 0)
2879  {
2880  KillTimer(infoPtr->hwnd, TAB_HOTTRACK_TIMER);
2881  infoPtr->iHotTracked = -1;
2882  }
2883 
2884  infoPtr->iSelected = -1;
2885  }
2886  else
2887  {
2888  if (iItem <= infoPtr->iHotTracked)
2889  {
2890  /* When tabs move left/up, the hot track item may change */
2891  FIXME("Recalc hot track\n");
2892  }
2893  }
2894 
2895  /* adjust the selected index */
2896  if (iItem == infoPtr->iSelected)
2897  infoPtr->iSelected = -1;
2898  else if (iItem < infoPtr->iSelected)
2899  infoPtr->iSelected--;
2900 
2901  /* reposition and repaint tabs */
2902  TAB_SetItemBounds(infoPtr);
2903 
2904  return TRUE;
2905 }
#define TAB_HOTTRACK_TIMER
Definition: tab.c:152
UINT uNumItem
Definition: tab.c:96
#define TRUE
Definition: types.h:120
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
static void TAB_SetItemBounds(TAB_INFO *infoPtr)
Definition: tab.c:1117
HDPA items
Definition: tab.c:126
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
Definition: tab.c:73
static void TAB_InvalidateTabArea(const TAB_INFO *)
Definition: tab.c:2548
INT iHotTracked
Definition: tab.c:112
INT iSelected
Definition: tab.c:111
static ATOM item
Definition: dde.c:856
HWND hwnd
Definition: tab.c:94
LPVOID WINAPI DPA_DeletePtr(HDPA hdpa, INT i)
Definition: dpa.c:677

Referenced by TAB_DeleteAllItems(), and TAB_WindowProc().

◆ TAB_DeselectAll()

static LRESULT TAB_DeselectAll ( TAB_INFO infoPtr,
BOOL  excludesel 
)
static

Definition at line 3234 of file tab.c.

3235 {
3236  BOOL paint = FALSE;
3237  INT i, selected = infoPtr->iSelected;
3238 
3239  TRACE("(%p, %d)\n", infoPtr, excludesel);
3240 
3241  if (!(infoPtr->dwStyle & TCS_BUTTONS))
3242  return 0;
3243 
3244  for (i = 0; i < infoPtr->uNumItem; i++)
3245  {
3246  if ((TAB_GetItem(infoPtr, i)->dwState & TCIS_BUTTONPRESSED) &&
3247  (selected != i))
3248  {
3249  TAB_GetItem(infoPtr, i)->dwState &= ~TCIS_BUTTONPRESSED;
3250  paint = TRUE;
3251  }
3252  }
3253 
3254  if (!excludesel && (selected != -1))
3255  {
3257  infoPtr->iSelected = -1;
3258  paint = TRUE;
3259  }
3260 
3261  if (paint)
3262  TAB_InvalidateTabArea (infoPtr);
3263 
3264  return 0;
3265 }
UINT uNumItem
Definition: tab.c:96
#define TRUE
Definition: types.h:120
#define TCS_BUTTONS
Definition: commctrl.h:3948
DWORD dwState
Definition: tab.c:75
int32_t INT
Definition: typedefs.h:58
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define FALSE
Definition: types.h:117
#define TCIS_BUTTONPRESSED
Definition: commctrl.h:3977
unsigned int BOOL
Definition: ntddk_ex.h:94
static char selected[MAX_PATH+1]
Definition: dirdlg.c:7
#define TRACE(s)
Definition: solgame.cpp:4
static void TAB_InvalidateTabArea(const TAB_INFO *)
Definition: tab.c:2548
INT iSelected
Definition: tab.c:111
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
DWORD dwStyle
Definition: tab.c:124

Referenced by TAB_LButtonDown(), and TAB_WindowProc().

◆ TAB_Destroy()

static LRESULT TAB_Destroy ( TAB_INFO infoPtr)
static

Definition at line 3109 of file tab.c.

3110 {
3111  INT iItem;
3112 
3113  SetWindowLongPtrW(infoPtr->hwnd, 0, 0);
3114 
3115  for (iItem = infoPtr->uNumItem - 1; iItem >= 0; iItem--)
3116  {
3117  TAB_ITEM *tab = TAB_GetItem(infoPtr, iItem);
3118 
3119  DPA_DeletePtr(infoPtr->items, iItem);
3120  infoPtr->uNumItem--;
3121 
3122  Free(tab->pszText);
3123  Free(tab);
3124  }
3125  DPA_Destroy(infoPtr->items);
3126  infoPtr->items = NULL;
3127 
3128  if (infoPtr->hwndToolTip)
3129  DestroyWindow (infoPtr->hwndToolTip);
3130 
3131  if (infoPtr->hwndUpDown)
3132  DestroyWindow(infoPtr->hwndUpDown);
3133 
3134  if (infoPtr->iHotTracked >= 0)
3135  KillTimer(infoPtr->hwnd, TAB_HOTTRACK_TIMER);
3136 
3137  CloseThemeData (GetWindowTheme (infoPtr->hwnd));
3138 
3139  Free (infoPtr);
3140  return 0;
3141 }
#define TAB_HOTTRACK_TIMER
Definition: tab.c:152
UINT uNumItem
Definition: tab.c:96
BOOL WINAPI DPA_Destroy(HDPA hdpa)
Definition: dpa.c:396
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:58
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
LPWSTR pszText
Definition: tab.c:76
HDPA items
Definition: tab.c:126
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
Definition: tab.c:73
HWND hwndUpDown
Definition: tab.c:119
INT iHotTracked
Definition: tab.c:112
HWND hwnd
Definition: tab.c:94
#define NULL
Definition: types.h:112
LPVOID WINAPI DPA_DeletePtr(HDPA hdpa, INT i)
Definition: dpa.c:677
#define SetWindowLongPtrW
Definition: winuser.h:5326
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
HWND hwndToolTip
Definition: tab.c:108

Referenced by TAB_WindowProc().

◆ TAB_DrawBorder()

static void TAB_DrawBorder ( const TAB_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 2337 of file tab.c.

2338 {
2339  RECT rect;
2340  HTHEME theme = GetWindowTheme (infoPtr->hwnd);
2341 
2342  GetClientRect (infoPtr->hwnd, &rect);
2343 
2344  /*
2345  * Adjust for the style
2346  */
2347 
2348  if (infoPtr->uNumItem)
2349  {
2350  if ((infoPtr->dwStyle & TCS_BOTTOM) && !(infoPtr->dwStyle & TCS_VERTICAL))
2351  rect.bottom -= infoPtr->tabHeight * infoPtr->uNumRows + CONTROL_BORDER_SIZEX;
2352  else if((infoPtr->dwStyle & TCS_BOTTOM) && (infoPtr->dwStyle & TCS_VERTICAL))
2353  rect.right -= infoPtr->tabHeight * infoPtr->uNumRows + CONTROL_BORDER_SIZEX;
2354  else if(infoPtr->dwStyle & TCS_VERTICAL)
2355  rect.left += infoPtr->tabHeight * infoPtr->uNumRows + CONTROL_BORDER_SIZEX;
2356  else /* not TCS_VERTICAL and not TCS_BOTTOM */
2357  rect.top += infoPtr->tabHeight * infoPtr->uNumRows + CONTROL_BORDER_SIZEX;
2358  }
2359 
2360  TRACE("border=(%s)\n", wine_dbgstr_rect(&rect));
2361 
2362  if (theme)
2363  DrawThemeBackground (theme, hdc, TABP_PANE, 0, &rect, NULL);
2364  else
2366 }
UINT uNumItem
Definition: tab.c:96
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
& rect
Definition: startmenu.cpp:1413
#define BF_RECT
Definition: winuser.h:462
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define CONTROL_BORDER_SIZEX
Definition: tab.c:136
#define TRACE(s)
Definition: solgame.cpp:4
#define TCS_BOTTOM
Definition: commctrl.h:3939
const char * wine_dbgstr_rect(const RECT *rect)
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HDC hdc
Definition: main.c:9
#define TCS_VERTICAL
Definition: commctrl.h:3946
UINT uNumRows
Definition: tab.c:97
#define EDGE_RAISED
Definition: winuser.h:450
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define BF_SOFT
Definition: winuser.h:469
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
#define NULL
Definition: types.h:112
INT tabHeight
Definition: tab.c:98

Referenced by TAB_Refresh().

◆ TAB_DrawItem()

static void TAB_DrawItem ( const TAB_INFO infoPtr,
HDC  hdc,
INT  iItem 
)
static

Definition at line 1990 of file tab.c.

1991 {
1992  RECT itemRect;
1993  RECT selectedRect;
1994  BOOL isVisible;
1995  RECT r, fillRect, r1;
1996  INT clRight = 0;
1997  INT clBottom = 0;
1998  COLORREF bkgnd, corner;
1999  HTHEME theme;
2000 
2001  /*
2002  * Get the rectangle for the item.
2003  */
2004  isVisible = TAB_InternalGetItemRect(infoPtr,
2005  iItem,
2006  &itemRect,
2007  &selectedRect);
2008 
2009  if (isVisible)
2010  {
2011  RECT rUD, rC;
2012 
2013  /* Clip UpDown control to not draw over it */
2014  if (infoPtr->needsScrolling)
2015  {
2016  GetWindowRect(infoPtr->hwnd, &rC);
2017  GetWindowRect(infoPtr->hwndUpDown, &rUD);
2018  ExcludeClipRect(hdc, rUD.left - rC.left, rUD.top - rC.top, rUD.right - rC.left, rUD.bottom - rC.top);
2019  }
2020 
2021  /* If you need to see what the control is doing,
2022  * then override these variables. They will change what
2023  * fill colors are used for filling the tabs, and the
2024  * corners when drawing the edge.
2025  */
2026  bkgnd = comctl32_color.clrBtnFace;
2027  corner = comctl32_color.clrBtnFace;
2028 
2029  if (infoPtr->dwStyle & TCS_BUTTONS)
2030  {
2031  /* Get item rectangle */
2032  r = itemRect;
2033 
2034  /* Separators between flat buttons */
2035  if ((infoPtr->dwStyle & TCS_FLATBUTTONS) && (infoPtr->exStyle & TCS_EX_FLATSEPARATORS))
2036  {
2037  r1 = r;
2038  r1.right += (FLAT_BTN_SPACINGX -2);
2040  }
2041 
2042  if (iItem == infoPtr->iSelected)
2043  {
2045 
2046  OffsetRect(&r, 1, 1);
2047  }
2048  else /* ! selected */
2049  {
2050  DWORD state = TAB_GetItem(infoPtr, iItem)->dwState;
2051 
2052  if ((state & TCIS_BUTTONPRESSED) || (iItem == infoPtr->uFocus))
2054  else
2055  if (!(infoPtr->dwStyle & TCS_FLATBUTTONS))
2057  }
2058  }
2059  else /* !TCS_BUTTONS */
2060  {
2061  /* We draw a rectangle of different sizes depending on the selection
2062  * state. */
2063  if (iItem == infoPtr->iSelected) {
2064  RECT rect;
2065  GetClientRect (infoPtr->hwnd, &rect);
2066  clRight = rect.right;
2067  clBottom = rect.bottom;
2068  r = selectedRect;
2069  }
2070  else
2071  r = itemRect;
2072 
2073  /*
2074  * Erase the background. (Delay it but setup rectangle.)
2075  * This is necessary when drawing the selected item since it is larger
2076  * than the others, it might overlap with stuff already drawn by the
2077  * other tabs
2078  */
2079  fillRect = r;
2080 
2081  /* Draw themed tabs - but only if they are at the top.
2082  * Windows draws even side or bottom tabs themed, with wacky results.
2083  * However, since in Wine apps may get themed that did not opt in via
2084  * a manifest avoid theming when we know the result will be wrong */
2085  if ((theme = GetWindowTheme (infoPtr->hwnd))
2086  && ((infoPtr->dwStyle & (TCS_VERTICAL | TCS_BOTTOM)) == 0))
2087  {
2088  static const int partIds[8] = {
2089  /* Normal item */
2090  TABP_TABITEM,
2094  /* Selected tab */
2099  };
2100  int partIndex = 0;
2101  int stateId = TIS_NORMAL;
2102 
2103  /* selected and unselected tabs have different parts */
2104  if (iItem == infoPtr->iSelected)
2105  partIndex += 4;
2106  /* The part also differs on the position of a tab on a line.
2107  * "Visually" determining the position works well enough. */
2108  GetClientRect(infoPtr->hwnd, &r1);
2109  if(selectedRect.left == 0)
2110  partIndex += 1;
2111  if(selectedRect.right == r1.right)
2112  partIndex += 2;
2113 
2114  if (iItem == infoPtr->iSelected)
2115  stateId = TIS_SELECTED;
2116  else if (iItem == infoPtr->iHotTracked)
2117  stateId = TIS_HOT;
2118  else if (iItem == infoPtr->uFocus)
2119  stateId = TIS_FOCUSED;
2120 
2121  /* Adjust rectangle for bottommost row */
2122  if (TAB_GetItem(infoPtr, iItem)->rect.top == infoPtr->uNumRows-1)
2123  r.bottom += 3;
2124 
2125  DrawThemeBackground (theme, hdc, partIds[partIndex], stateId, &r, NULL);
2126  GetThemeBackgroundContentRect (theme, hdc, partIds[partIndex], stateId, &r, &r);
2127  }
2128  else if(infoPtr->dwStyle & TCS_VERTICAL)
2129  {
2130  /* These are for adjusting the drawing of a Selected tab */
2131  /* The initial values are for the normal case of non-Selected */
2132  int ZZ = 1; /* Do not stretch if selected */
2133  if (iItem == infoPtr->iSelected) {
2134  ZZ = 0;
2135 
2136  /* if leftmost draw the line longer */
2137  if(selectedRect.top == 0)
2138  fillRect.top += CONTROL_BORDER_SIZEY;
2139  /* if rightmost draw the line longer */
2140  if(selectedRect.bottom == clBottom)
2141  fillRect.bottom -= CONTROL_BORDER_SIZEY;
2142  }
2143 
2144  if (infoPtr->dwStyle & TCS_BOTTOM)
2145  {
2146  /* Adjust both rectangles to match native */
2147  r.left += (1-ZZ);
2148 
2149  TRACE("<right> item=%d, fill=(%s), edge=(%s)\n",
2150  iItem, wine_dbgstr_rect(&fillRect), wine_dbgstr_rect(&r));
2151 
2152  /* Clear interior */
2153  SetBkColor(hdc, bkgnd);
2154  ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
2155 
2156  /* Draw rectangular edge around tab */
2158 
2159  /* Now erase the top corner and draw diagonal edge */
2160  SetBkColor(hdc, corner);
2161  r1.left = r.right - ROUND_CORNER_SIZE - 1;
2162  r1.top = r.top;
2163  r1.right = r.right;
2164  r1.bottom = r1.top + ROUND_CORNER_SIZE;
2165  ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
2166  r1.right--;
2168 
2169  /* Now erase the bottom corner and draw diagonal edge */
2170  r1.left = r.right - ROUND_CORNER_SIZE - 1;
2171  r1.bottom = r.bottom;
2172  r1.right = r.right;
2173  r1.top = r1.bottom - ROUND_CORNER_SIZE;
2174  ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
2175  r1.right--;
2177 
2178  if ((iItem == infoPtr->iSelected) && (selectedRect.top == 0)) {
2179  r1 = r;
2180  r1.right = r1.left;
2181  r1.left--;
2183  }
2184 
2185  }
2186  else
2187  {
2188  TRACE("<left> item=%d, fill=(%s), edge=(%s)\n",
2189  iItem, wine_dbgstr_rect(&fillRect), wine_dbgstr_rect(&r));
2190 
2191  /* Clear interior */
2192  SetBkColor(hdc, bkgnd);
2193  ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
2194 
2195  /* Draw rectangular edge around tab */
2197 
2198  /* Now erase the top corner and draw diagonal edge */
2199  SetBkColor(hdc, corner);
2200  r1.left = r.left;
2201  r1.top = r.top;
2202  r1.right = r1.left + ROUND_CORNER_SIZE + 1;
2203  r1.bottom = r1.top + ROUND_CORNER_SIZE;
2204  ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
2205  r1.left++;
2207 
2208  /* Now erase the bottom corner and draw diagonal edge */
2209  r1.left = r.left;
2210  r1.bottom = r.bottom;
2211  r1.right = r1.left + ROUND_CORNER_SIZE + 1;
2212  r1.top = r1.bottom - ROUND_CORNER_SIZE;
2213  ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
2214  r1.left++;
2216  }
2217  }
2218  else /* ! TCS_VERTICAL */
2219  {
2220  /* These are for adjusting the drawing of a Selected tab */
2221  /* The initial values are for the normal case of non-Selected */
2222  if (iItem == infoPtr->iSelected) {
2223  /* if leftmost draw the line longer */
2224  if(selectedRect.left == 0)
2225  fillRect.left += CONTROL_BORDER_SIZEX;
2226  /* if rightmost draw the line longer */
2227  if(selectedRect.right == clRight)
2228  fillRect.right -= CONTROL_BORDER_SIZEX;
2229  }
2230 
2231  if (infoPtr->dwStyle & TCS_BOTTOM)
2232  {
2233  /* Adjust both rectangles for topmost row */
2234  if (TAB_GetItem(infoPtr, iItem)->rect.top == infoPtr->uNumRows-1)
2235  {
2236  fillRect.top -= 2;
2237  r.top -= 1;
2238  }
2239 
2240  TRACE("<bottom> item=%d, fill=(%s), edge=(%s)\n",
2241  iItem, wine_dbgstr_rect(&fillRect), wine_dbgstr_rect(&r));
2242 
2243  /* Clear interior */
2244  SetBkColor(hdc, bkgnd);
2245  ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
2246 
2247  /* Draw rectangular edge around tab */
2249 
2250  /* Now erase the righthand corner and draw diagonal edge */
2251  SetBkColor(hdc, corner);
2252  r1.left = r.right - ROUND_CORNER_SIZE;
2253  r1.bottom = r.bottom;
2254  r1.right = r.right;
2255  r1.top = r1.bottom - ROUND_CORNER_SIZE - 1;
2256  ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
2257  r1.bottom--;
2259 
2260  /* Now erase the lefthand corner and draw diagonal edge */
2261  r1.left = r.left;
2262  r1.bottom = r.bottom;
2263  r1.right = r1.left + ROUND_CORNER_SIZE;
2264  r1.top = r1.bottom - ROUND_CORNER_SIZE - 1;
2265  ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
2266  r1.bottom--;
2268 
2269  if (iItem == infoPtr->iSelected)
2270  {
2271  r.top += 2;
2272  r.left += 1;
2273  if (selectedRect.left == 0)
2274  {
2275  r1 = r;
2276  r1.bottom = r1.top;
2277  r1.top--;
2279  }
2280  }
2281 
2282  }
2283  else
2284  {
2285  /* Adjust both rectangles for bottommost row */
2286  if (TAB_GetItem(infoPtr, iItem)->rect.top == infoPtr->uNumRows-1)
2287  {
2288  fillRect.bottom += 3;
2289  r.bottom += 2;
2290  }
2291 
2292  TRACE("<top> item=%d, fill=(%s), edge=(%s)\n",
2293  iItem, wine_dbgstr_rect(&fillRect), wine_dbgstr_rect(&r));
2294 
2295  /* Clear interior */
2296  SetBkColor(hdc, bkgnd);
2297  ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
2298 
2299  /* Draw rectangular edge around tab */
2301 
2302  /* Now erase the righthand corner and draw diagonal edge */
2303  SetBkColor(hdc, corner);
2304  r1.left = r.right - ROUND_CORNER_SIZE;
2305  r1.top = r.top;
2306  r1.right = r.right;
2307  r1.bottom = r1.top + ROUND_CORNER_SIZE + 1;
2308  ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
2309  r1.top++;
2311 
2312  /* Now erase the lefthand corner and draw diagonal edge */
2313  r1.left = r.left;
2314  r1.top = r.top;
2315  r1.right = r1.left + ROUND_CORNER_SIZE;
2316  r1.bottom = r1.top + ROUND_CORNER_SIZE + 1;
2317  ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
2318  r1.top++;
2320  }
2321  }
2322  }
2323 
2324  TAB_DumpItemInternal(infoPtr, iItem);
2325 
2326  /* This modifies r to be the text rectangle. */
2327  TAB_DrawItemInterior(infoPtr, hdc, iItem, &r);
2328  }
2329 }
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 BF_DIAGONAL_ENDTOPLEFT
Definition: winuser.h:465
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define FLAT_BTN_SPACINGX
Definition: tab.c:140
#define BF_DIAGONAL_ENDTOPRIGHT
Definition: winuser.h:464
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ROUND_CORNER_SIZE
Definition: tab.c:133
static DNS_RECORDW r1
Definition: record.c:37
#define BF_BOTTOM
Definition: winuser.h:457
#define TCS_BUTTONS
Definition: commctrl.h:3948
LONG top
Definition: windef.h:307
DWORD dwState
Definition: tab.c:75
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
LONG left
Definition: windef.h:306
INT uFocus
Definition: tab.c:113
LONG right
Definition: windef.h:308
#define TCS_EX_FLATSEPARATORS
Definition: commctrl.h:3959
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
#define TCS_FLATBUTTONS
Definition: commctrl.h:3942
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define BF_RECT
Definition: winuser.h:462
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define TCIS_BUTTONPRESSED
Definition: commctrl.h:3977
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BF_DIAGONAL_ENDBOTTOMLEFT
Definition: winuser.h:466
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
static void TAB_DumpItemInternal(const TAB_INFO *infoPtr, UINT iItem)
Definition: tab.c:214
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
#define CONTROL_BORDER_SIZEX
Definition: tab.c:136
#define TRACE(s)
Definition: solgame.cpp:4
#define TCS_BOTTOM
Definition: commctrl.h:3939
#define BF_RIGHT
Definition: winuser.h:456
DWORD COLORREF
Definition: windef.h:300
#define BF_DIAGONAL_ENDBOTTOMRIGHT
Definition: winuser.h:467
const char * wine_dbgstr_rect(const RECT *rect)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EDGE_ETCHED
Definition: winuser.h:452
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HDC hdc
Definition: main.c:9
static int state
Definition: maze.c:121
#define TCS_VERTICAL
Definition: commctrl.h:3946
UINT uNumRows
Definition: tab.c:97
#define EDGE_RAISED
Definition: winuser.h:450
BOOL needsScrolling
Definition: tab.c:115
HWND hwndUpDown
Definition: tab.c:119
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
COLORREF clrBtnFace
Definition: comctl32.h:168
INT iHotTracked
Definition: tab.c:112
static void TAB_DrawItemInterior(const TAB_INFO *, HDC, INT, RECT *)
Definition: tab.c:1556
INT iSelected
Definition: tab.c:111
#define CONTROL_BORDER_SIZEY
Definition: tab.c:137
#define BF_SOFT
Definition: winuser.h:469
int WINAPI ExcludeClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define BF_TOP
Definition: winuser.h:455
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
#define NULL
Definition: types.h:112
HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
Definition: draw.c:1479
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define EDGE_SUNKEN
Definition: winuser.h:451
DWORD exStyle
Definition: tab.c:122
#define BF_LEFT
Definition: winuser.h:454

Referenced by TAB_Refresh().

◆ TAB_DrawItemInterior()

static void TAB_DrawItemInterior ( const TAB_INFO infoPtr,
HDC  hdc,
INT  iItem,
RECT drawRect 
)
static

Definition at line 1556 of file tab.c.

1557 {
1558  RECT localRect;
1559 
1560  HPEN htextPen;
1561  HPEN holdPen;
1562  INT oldBkMode;
1563  HFONT hOldFont;
1564 #ifdef __REACTOS__
1565 HTHEME theme = GetWindowTheme (infoPtr->hwnd);
1566 #endif
1567 
1568 /* if (drawRect == NULL) */
1569  {
1570  BOOL isVisible;
1571  RECT itemRect;
1572  RECT selectedRect;
1573 
1574  /*
1575  * Get the rectangle for the item.
1576  */
1577  isVisible = TAB_InternalGetItemRect(infoPtr, iItem, &itemRect, &selectedRect);
1578  if (!isVisible)
1579  return;
1580 
1581  /*
1582  * Make sure drawRect points to something valid; simplifies code.
1583  */
1584  drawRect = &localRect;
1585 
1586  /*
1587  * This logic copied from the part of TAB_DrawItem which draws
1588  * the tab background. It's important to keep it in sync. I
1589  * would have liked to avoid code duplication, but couldn't figure
1590  * out how without making spaghetti of TAB_DrawItem.
1591  */
1592  if (iItem == infoPtr->iSelected)
1593  *drawRect = selectedRect;
1594  else
1595  *drawRect = itemRect;
1596 
1597  if (infoPtr->dwStyle & TCS_BUTTONS)
1598  {
1599  if (iItem == infoPtr->iSelected)
1600  {
1601  drawRect->left += 4;
1602  drawRect->top += 4;
1603  drawRect->right -= 4;
1604 
1605  if (infoPtr->dwStyle & TCS_VERTICAL)
1606  {
1607  if (!(infoPtr->dwStyle & TCS_BOTTOM)) drawRect->right += 1;
1608  drawRect->bottom -= 4;
1609  }
1610  else
1611  {
1612  if (infoPtr->dwStyle & TCS_BOTTOM)
1613  {
1614  drawRect->top -= 2;
1615  drawRect->bottom -= 4;
1616  }
1617  else
1618  drawRect->bottom -= 1;
1619  }
1620  }
1621  else
1622  InflateRect(drawRect, -2, -2);
1623  }
1624  else
1625  {
1626  if ((infoPtr->dwStyle & TCS_VERTICAL) && (infoPtr->dwStyle & TCS_BOTTOM))
1627  {
1628  if (iItem != infoPtr->iSelected)
1629  {
1630  drawRect->left += 2;
1631  InflateRect(drawRect, 0, -2);
1632  }
1633  }
1634  else if (infoPtr->dwStyle & TCS_VERTICAL)
1635  {
1636  if (iItem == infoPtr->iSelected)
1637  {
1638  drawRect->right += 1;
1639  }
1640  else
1641  {
1642  drawRect->right -= 2;
1643  InflateRect(drawRect, 0, -2);
1644  }
1645  }
1646  else if (infoPtr->dwStyle & TCS_BOTTOM)
1647  {
1648  if (iItem == infoPtr->iSelected)
1649  {
1650  drawRect->top -= 2;
1651  }
1652  else
1653  {
1654  InflateRect(drawRect, -2, -2);
1655  drawRect->bottom += 2;
1656  }
1657  }
1658  else
1659  {
1660  if (iItem == infoPtr->iSelected)
1661  {
1662  drawRect->bottom += 3;
1663  }
1664  else
1665  {
1666  drawRect->bottom -= 2;
1667  InflateRect(drawRect, -2, 0);
1668  }
1669  }
1670  }
1671  }
1672  TRACE("drawRect=(%s)\n", wine_dbgstr_rect(drawRect));
1673 
1674  /* Clear interior */
1675  TAB_EraseTabInterior (infoPtr, hdc, iItem, drawRect);
1676 
1677  /* Draw the focus rectangle */
1678  if (!(infoPtr->dwStyle & TCS_FOCUSNEVER) &&
1679  (GetFocus() == infoPtr->hwnd) &&
1680  (iItem == infoPtr->uFocus) )
1681  {
1682  RECT rFocus = *drawRect;
1683 
1684  if (!(infoPtr->dwStyle & TCS_BUTTONS)) InflateRect(&rFocus, -3, -3);
1685  if (infoPtr->dwStyle & TCS_BOTTOM && !(infoPtr->dwStyle & TCS_VERTICAL))
1686  rFocus.top -= 3;
1687 
1688  /* focus should stay on selected item for TCS_BUTTONS style */
1689  if (!((infoPtr->dwStyle & TCS_BUTTONS) && (infoPtr->iSelected != iItem)))
1690  DrawFocusRect(hdc, &rFocus);
1691  }
1692 
1693  /*
1694  * Text pen
1695  */
1696  htextPen = CreatePen( PS_SOLID, 1, comctl32_color.clrBtnText );
1697  holdPen = SelectObject(hdc, htextPen);
1698  hOldFont = SelectObject(hdc, infoPtr->hFont);
1699 
1700  /*
1701  * Setup for text output
1702  */
1703  oldBkMode = SetBkMode(hdc, TRANSPARENT);
1704  if (!GetWindowTheme (infoPtr->hwnd) || (infoPtr->dwStyle & TCS_BUTTONS))
1705  {
1706  if ((infoPtr->dwStyle & TCS_HOTTRACK) && (iItem == infoPtr->iHotTracked) &&
1707  !(infoPtr->dwStyle & TCS_FLATBUTTONS))
1709  else if (TAB_GetItem(infoPtr, iItem)->dwState & TCIS_HIGHLIGHTED)
1711  else
1713  }
1714 
1715  /*
1716  * if owner draw, tell the owner to draw
1717  */
1718  if ((infoPtr->dwStyle & TCS_OWNERDRAWFIXED) && IsWindow(infoPtr->hwndNotify))
1719  {
1720  DRAWITEMSTRUCT dis;
1721  UINT id;
1722 
1723  drawRect->top += 2;
1724  drawRect->right -= 1;
1725  if ( iItem == infoPtr->iSelected )
1726  InflateRect(drawRect, -1, 0);
1727 
1728  id = (UINT)GetWindowLongPtrW( infoPtr->hwnd, GWLP_ID );
1729 
1730  /* fill DRAWITEMSTRUCT */
1731  dis.CtlType = ODT_TAB;
1732  dis.CtlID = id;
1733  dis.itemID = iItem;
1734  dis.itemAction = ODA_DRAWENTIRE;
1735  dis.itemState = 0;
1736  if ( iItem == infoPtr->iSelected )
1737  dis.itemState |= ODS_SELECTED;
1738  if (infoPtr->uFocus == iItem)
1739  dis.itemState |= ODS_FOCUS;
1740  dis.hwndItem = infoPtr->hwnd;
1741  dis.hDC = hdc;
1742  dis.rcItem = *drawRect;
1743 
1744  /* when extra data fits ULONG_PTR, store it directly */
1745  if (infoPtr->cbInfo > sizeof(LPARAM))
1746  dis.itemData = (ULONG_PTR) TAB_GetItem(infoPtr, iItem)->extra;
1747  else
1748  {
1749  /* this could be considered broken on 64 bit, but that's how it works -
1750  only first 4 bytes are copied */
1751  dis.itemData = 0;
1752  memcpy(&dis.itemData, (ULONG_PTR*)TAB_GetItem(infoPtr, iItem)->extra, 4);
1753  }
1754 
1755  /* draw notification */
1756  SendMessageW( infoPtr->hwndNotify, WM_DRAWITEM, id, (LPARAM)&dis );
1757  }
1758  else
1759  {
1760  TAB_ITEM *item = TAB_GetItem(infoPtr, iItem);
1761  RECT rcTemp;
1762  RECT rcImage;
1763 
1764  /* used to center the icon and text in the tab */
1765  RECT rcText;
1766  INT center_offset_h, center_offset_v;
1767 
1768  /* set rcImage to drawRect, we will use top & left in our ImageList_Draw call */
1769  rcImage = *drawRect;
1770 
1771  rcTemp = *drawRect;
1772  SetRectEmpty(&rcText);
1773 
1774  /* get the rectangle that the text fits in */
1775  if (item->pszText)
1776  {
1777  DrawTextW(hdc, item->pszText, -1, &rcText, DT_CALCRECT);
1778  }
1779  /*
1780  * If not owner draw, then do the drawing ourselves.
1781  *
1782  * Draw the icon.
1783  */
1784  if (infoPtr->himl && item->iImage != -1)
1785  {
1786  INT cx;
1787  INT cy;
1788 
1789  ImageList_GetIconSize(infoPtr->himl, &cx, &cy);
1790 
1791  if(infoPtr->dwStyle & TCS_VERTICAL)
1792  {
1793  center_offset_h = ((drawRect->bottom - drawRect->top) - (cy + infoPtr->uHItemPadding + (rcText.right - rcText.left))) / 2;
1794  center_offset_v = ((drawRect->right - drawRect->left) - cx) / 2;
1795  }
1796  else
1797  {
1798  center_offset_h = ((drawRect->right - drawRect->left) - (cx + infoPtr->uHItemPadding + (rcText.right - rcText.left))) / 2;
1799  center_offset_v = ((drawRect->bottom - drawRect->top) - cy) / 2;
1800  }
1801 
1802  /* if an item is selected, the icon is shifted up instead of down */
1803  if (iItem == infoPtr->iSelected)
1804  center_offset_v -= infoPtr->uVItemPadding / 2;
1805  else
1806  center_offset_v += infoPtr->uVItemPadding / 2;
1807 
1808  if (infoPtr->dwStyle & TCS_FIXEDWIDTH && infoPtr->dwStyle & (TCS_FORCELABELLEFT | TCS_FORCEICONLEFT))
1809  center_offset_h = infoPtr->uHItemPadding;
1810 
1811  if (center_offset_h < 2)
1812  center_offset_h = 2;
1813 
1814  if (center_offset_v < 0)
1815  center_offset_v = 0;
1816 
1817  TRACE("for <%s>, c_o_h=%d, c_o_v=%d, draw=(%s), textlen=%d\n",
1818  debugstr_w(item->pszText), center_offset_h, center_offset_v,
1819  wine_dbgstr_rect(drawRect), (rcText.right-rcText.left));
1820 
1821  if((infoPtr->dwStyle & TCS_VERTICAL) && (infoPtr->dwStyle & TCS_BOTTOM))
1822  {
1823  rcImage.top = drawRect->top + center_offset_h;
1824  /* if tab is TCS_VERTICAL and TCS_BOTTOM, the text is drawn from the */
1825  /* right side of the tab, but the image still uses the left as its x position */
1826  /* this keeps the image always drawn off of the same side of the tab */
1827  rcImage.left = drawRect->right - cx - center_offset_v;
1828  drawRect->top += cy + infoPtr->uHItemPadding;
1829  }
1830  else if(infoPtr->dwStyle & TCS_VERTICAL)
1831  {
1832  rcImage.top = drawRect->bottom - cy - center_offset_h;
1833  rcImage.left = drawRect->left + center_offset_v;
1834  drawRect->bottom -= cy + infoPtr->uHItemPadding;
1835  }
1836  else /* normal style, whether TCS_BOTTOM or not */
1837  {
1838  rcImage.left = drawRect->left + center_offset_h;
1839  rcImage.top = drawRect->top + center_offset_v;
1840  drawRect->left += cx + infoPtr->uHItemPadding;
1841  }
1842 
1843  TRACE("drawing image=%d, left=%d, top=%d\n",
1844  item->iImage, rcImage.left, rcImage.top-1);
1846  (
1847  infoPtr->himl,
1848  item->iImage,
1849  hdc,
1850  rcImage.left,
1851  rcImage.top,
1852  ILD_NORMAL
1853  );
1854  }
1855 
1856  /* Now position text */
1857  if (infoPtr->dwStyle & TCS_FIXEDWIDTH && infoPtr->dwStyle & TCS_FORCELABELLEFT)
1858  center_offset_h = infoPtr->uHItemPadding;
1859  else
1860  if(infoPtr->dwStyle & TCS_VERTICAL)
1861  center_offset_h = ((drawRect->bottom - drawRect->top) - (rcText.right - rcText.left)) / 2;
1862  else
1863  center_offset_h = ((drawRect->right - drawRect->left) - (rcText.right - rcText.left)) / 2;
1864 
1865  if(infoPtr->dwStyle & TCS_VERTICAL)
1866  {
1867  if(infoPtr->dwStyle & TCS_BOTTOM)
1868  drawRect->top+=center_offset_h;
1869  else
1870  drawRect->bottom-=center_offset_h;
1871 
1872  center_offset_v = ((drawRect->right - drawRect->left) - (rcText.bottom - rcText.top)) / 2;
1873  }
1874  else
1875  {
1876  drawRect->left += center_offset_h;
1877  center_offset_v = ((drawRect->bottom - drawRect->top) - (rcText.bottom - rcText.top)) / 2;
1878  }
1879 
1880  /* if an item is selected, the text is shifted up instead of down */
1881  if (iItem == infoPtr->iSelected)
1882  center_offset_v -= infoPtr->uVItemPadding / 2;
1883  else
1884  center_offset_v += infoPtr->uVItemPadding / 2;
1885 
1886  if (center_offset_v < 0)
1887  center_offset_v = 0;
1888 
1889  if(infoPtr->dwStyle & TCS_VERTICAL)
1890  drawRect->left += center_offset_v;
1891  else
1892  drawRect->top += center_offset_v;
1893 
1894  /* Draw the text */
1895  if(infoPtr->dwStyle & TCS_VERTICAL) /* if we are vertical rotate the text and each character */
1896  {
1897  LOGFONTW logfont;
1898  HFONT hFont;
1899  INT nEscapement = 900;
1900  INT nOrientation = 900;
1901 
1902  if(infoPtr->dwStyle & TCS_BOTTOM)
1903  {
1904  nEscapement = -900;
1905  nOrientation = -900;
1906  }
1907 
1908  /* to get a font with the escapement and orientation we are looking for, we need to */
1909  /* call CreateFontIndirect, which requires us to set the values of the logfont we pass in */
1910  if (!GetObjectW(infoPtr->hFont, sizeof(logfont), &logfont))
1911  GetObjectW(GetStockObject(DEFAULT_GUI_FONT), sizeof(logfont), &logfont);
1912 
1913  logfont.lfEscapement = nEscapement;
1914  logfont.lfOrientation = nOrientation;
1915  hFont = CreateFontIndirectW(&logfont);
1917 
1918  if (item->pszText)
1919  {
1920  ExtTextOutW(hdc,
1921  (infoPtr->dwStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left,
1922  (!(infoPtr->dwStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top,
1923  ETO_CLIPPED,
1924  drawRect,
1925  item->pszText,
1926  lstrlenW(item->pszText),
1927  0);
1928  }
1929 
1931  }
1932  else
1933  {
1934  TRACE("for <%s>, c_o_h=%d, c_o_v=%d, draw=(%s), textlen=%d\n",
1935  debugstr_w(item->pszText), center_offset_h, center_offset_v,
1936  wine_dbgstr_rect(drawRect), (rcText.right-rcText.left));
1937 #ifdef __REACTOS__
1938  if (theme && item->pszText)
1939  {
1940  int partIndex = iItem == infoPtr->iSelected ? TABP_TABITEM : TABP_TOPTABITEM;
1941  int stateId = TIS_NORMAL;
1942 
1943  if (iItem == infoPtr->iSelected)
1944  stateId = TIS_SELECTED;
1945  else if (iItem == infoPtr->iHotTracked)
1946  stateId = TIS_HOT;
1947  else if (iItem == infoPtr->uFocus)
1948  stateId = TIS_FOCUSED;
1949 
1950  DrawThemeText(theme,
1951  hdc,
1952  partIndex,
1953  stateId,
1954  item->pszText,
1955  lstrlenW(item->pszText),
1956  DT_LEFT | DT_SINGLELINE, 0, drawRect);
1957  }
1958  else
1959 #endif
1960  if (item->pszText)
1961  {
1962  DrawTextW
1963  (
1964  hdc,
1965  item->pszText,
1966  lstrlenW(item->pszText),
1967  drawRect,
1969  );
1970  }
1971  }
1972 
1973  *drawRect = rcTemp; /* restore drawRect */
1974  }
1975 
1976  /*
1977  * Cleanup
1978  */
1979  SelectObject(hdc, hOldFont);
1980  SetBkMode(hdc, oldBkMode);
1981  SelectObject(hdc, holdPen);
1982  DeleteObject( htextPen );
1983 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
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)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
USHORT uVItemPadding
Definition: tab.c:102
BYTE extra[1]
Definition: tab.c:84
BOOL WINAPI IsWindow(_In_opt_ HWND)
HFONT hFont
Definition: tab.c:105
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define TCS_BUTTONS
Definition: commctrl.h:3948
ULONG_PTR itemData
Definition: winuser.h:3073
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define ODS_FOCUS
Definition: winuser.h:2529
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
static void TAB_EraseTabInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, const RECT *drawRect)
Definition: tab.c:1481
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG lfEscapement
Definition: dimm.idl:61
COLORREF clrBtnText
Definition: comctl32.h:167
#define GetWindowLongPtrW
Definition: winuser.h:4809
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
LONG left
Definition: windef.h:306
#define TCIS_HIGHLIGHTED
Definition: commctrl.h:3978
INT uFocus
Definition: tab.c:113
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define TCS_HOTTRACK
Definition: commctrl.h:3945
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:609
int32_t INT
Definition: typedefs.h:58
#define TCS_FLATBUTTONS
Definition: commctrl.h:3942
static HFONT hFont
Definition: tab.c:79
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define TCS_FIXEDWIDTH
Definition: commctrl.h:3952
#define PS_SOLID
Definition: wingdi.h:586
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define DT_LEFT
Definition: winuser.h:534
#define DT_CALCRECT
Definition: winuser.h:526
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG lfOrientation
Definition: dimm.idl:62
#define TCS_FOCUSNEVER
Definition: commctrl.h:3957
#define debugstr_w
Definition: kernel32.h:32
#define TRANSPARENT
Definition: wingdi.h:950
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
HWND hwndNotify
Definition: tab.c:95
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define TCS_FORCEICONLEFT
Definition: commctrl.h:3943
COLORREF clrHighlightText
Definition: comctl32.h:170
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
LONG_PTR LPARAM
Definition: windef.h:208
#define ETO_CLIPPED
Definition: wingdi.h:648
#define TCS_FORCELABELLEFT
Definition: commctrl.h:3944
INT cbInfo
Definition: tab.c:120
#define ODA_DRAWENTIRE
Definition: winuser.h:2522
#define TRACE(s)
Definition: solgame.cpp:4
Definition: id3.c:95
#define TCS_BOTTOM
Definition: commctrl.h:3939
const char * wine_dbgstr_rect(const RECT *rect)
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
#define TCS_OWNERDRAWFIXED
Definition: commctrl.h:3955
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HDC hdc
Definition: main.c:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define TCS_VERTICAL
Definition: commctrl.h:3946
USHORT uHItemPadding
Definition: tab.c:101
Definition: tab.c:73
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:911
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define DT_SINGLELINE
Definition: winuser.h:540
INT iHotTracked
Definition: tab.c:112
INT iSelected
Definition: tab.c:111
static ATOM item
Definition: dde.c:856
HIMAGELIST himl
Definition: tab.c:107
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
unsigned int UINT
Definition: ndis.h:50
COLORREF clrHighlight
Definition: comctl32.h:169
#define WM_DRAWITEM
Definition: winuser.h:1632
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HWND WINAPI GetFocus(void)
Definition: window.c:1894
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ODS_SELECTED
Definition: winuser.h:2525
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
GLenum GLuint id
Definition: glext.h:5579
LONG bottom
Definition: windef.h:309
#define ILD_NORMAL
Definition: commctrl.h:417
#define ODT_TAB
Definition: commctrl.h:79
static UINT
Definition: tab.c:43
#define GWLP_ID
Definition: winuser.h:854
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
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by TAB_DrawItem(), and TAB_DrawLoneItemInterior().

◆ TAB_DrawLoneItemInterior()

static void TAB_DrawLoneItemInterior ( const TAB_INFO infoPtr,
int  iItem 
)
static

Definition at line 739 of file tab.c.

740 {
741  HDC hdc = GetDC(infoPtr->hwnd);
742  RECT r, rC;
743 
744  /* Clip UpDown control to not draw over it */
745  if (infoPtr->needsScrolling)
746  {
747  GetWindowRect(infoPtr->hwnd, &rC);
748  GetWindowRect(infoPtr->hwndUpDown, &r);
749  ExcludeClipRect(hdc, r.left - rC.left, r.top - rC.top, r.right - rC.left, r.bottom - rC.top);
750  }
751  TAB_DrawItemInterior(infoPtr, hdc, iItem, NULL);
752  ReleaseDC(infoPtr->hwnd, hdc);
753 }
HDC WINAPI GetDC(_In_opt_ HWND)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: main.c:9
BOOL needsScrolling
Definition: tab.c:115
HWND hwndUpDown
Definition: tab.c:119
static void TAB_DrawItemInterior(const TAB_INFO *, HDC, INT, RECT *)
Definition: tab.c:1556
int WINAPI ExcludeClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HWND hwnd
Definition: tab.c:94
#define NULL
Definition: types.h:112
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)

Referenced by hottrack_refresh().

◆ TAB_DumpItemExternalT()

static void TAB_DumpItemExternalT ( const TCITEMW pti,
UINT  iItem,
BOOL  isW 
)
static

Definition at line 203 of file tab.c.

204 {
205  if (TRACE_ON(tab)) {
206  TRACE("external tab %d, mask=0x%08x, dwState=0x%08x, dwStateMask=0x%08x, cchTextMax=0x%08x\n",
207  iItem, pti->mask, pti->dwState, pti->dwStateMask, pti->cchTextMax);
208  TRACE("external tab %d, iImage=%d, lParam=0x%08lx, pszTextW=%s\n",
209  iItem, pti->iImage, pti->lParam, isW ? debugstr_w(pti->pszText) : debugstr_a((LPSTR)pti->pszText));
210  }
211 }
static const WCHAR isW[]
Definition: lex.c:62
int iImage
Definition: commctrl.h:4025
LPWSTR pszText
Definition: commctrl.h:4023
DWORD dwState
Definition: commctrl.h:4021
LPARAM lParam
Definition: commctrl.h:4026
char * LPSTR
Definition: xmlstorage.h:182
#define debugstr_w
Definition: kernel32.h:32
int cchTextMax
Definition: commctrl.h:4024
UINT mask
Definition: commctrl.h:4020
DWORD dwStateMask
Definition: commctrl.h:4022
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define TRACE_ON(x)
Definition: compat.h:75

Referenced by TAB_GetItemT(), TAB_InsertItemT(), and TAB_SetItemT().

◆ TAB_DumpItemInternal()

static void TAB_DumpItemInternal ( const TAB_INFO infoPtr,
UINT  iItem 
)
static

Definition at line 214 of file tab.c.

215 {
216  if (TRACE_ON(tab)) {
217  TAB_ITEM *ti = TAB_GetItem(infoPtr, iItem);
218 
219  TRACE("tab %d, dwState=0x%08x, pszText=%s, iImage=%d\n",
220  iItem, ti->dwState, debugstr_w(ti->pszText), ti->iImage);
221  TRACE("tab %d, rect.left=%d, rect.top(row)=%d\n",
222  iItem, ti->rect.left, ti->rect.top);
223  }
224 }
RECT rect
Definition: tab.c:78
LONG top
Definition: windef.h:307
DWORD dwState
Definition: tab.c:75
LONG left
Definition: windef.h:306
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR pszText
Definition: tab.c:76
Definition: tab.c:73
INT iImage
Definition: tab.c:77
#define TRACE_ON(x)
Definition: compat.h:75

Referenced by TAB_DrawItem().

◆ TAB_EnsureSelectionVisible()

static void TAB_EnsureSelectionVisible ( TAB_INFO infoPtr)
static

Definition at line 2426 of file tab.c.

2428 {
2429  INT iSelected = infoPtr->iSelected;
2430  INT iOrigLeftmostVisible = infoPtr->leftmostVisible;
2431 
2432  if (iSelected < 0)
2433  return;
2434 
2435  /* set the items row to the bottommost row or topmost row depending on
2436  * style */
2437  if ((infoPtr->uNumRows > 1) && !(infoPtr->dwStyle & TCS_BUTTONS))
2438  {
2439  TAB_ITEM *selected = TAB_GetItem(infoPtr, iSelected);
2440  INT newselected;
2441  INT iTargetRow;
2442 
2443  if(infoPtr->dwStyle & TCS_VERTICAL)
2444  newselected = selected->rect.left;
2445  else
2446  newselected = selected->rect.top;
2447 
2448  /* the target row is always (number of rows - 1)
2449  as row 0 is furthest from the clientRect */
2450  iTargetRow = infoPtr->uNumRows - 1;
2451 
2452  if (newselected != iTargetRow)
2453  {
2454  UINT i;
2455  if(infoPtr->dwStyle & TCS_VERTICAL)
2456  {
2457  for (i=0; i < infoPtr->uNumItem; i++)
2458  {
2459  /* move everything in the row of the selected item to the iTargetRow */
2460  TAB_ITEM *item = TAB_GetItem(infoPtr, i);
2461 
2462  if (item->rect.left == newselected )
2463  item->rect.left = iTargetRow;
2464  else
2465  {
2466  if (item->rect.left > newselected)
2467  item->rect.left-=1;
2468  }
2469  }
2470  }
2471  else
2472  {
2473  for (i=0; i < infoPtr->uNumItem; i++)
2474  {
2475  TAB_ITEM *item = TAB_GetItem(infoPtr, i);
2476 
2477  if (item->rect.top == newselected )
2478  item->rect.top = iTargetRow;
2479  else
2480  {
2481  if (item->rect.top > newselected)
2482  item->rect.top-=1;
2483  }
2484  }
2485  }
2486  TAB_RecalcHotTrack(infoPtr, NULL, NULL, NULL);
2487  }
2488  }
2489 
2490  /*
2491  * Do the trivial cases first.
2492  */
2493  if ( (!infoPtr->needsScrolling) ||
2494  (infoPtr->hwndUpDown==0) || (infoPtr->dwStyle & TCS_VERTICAL))
2495  return;
2496 
2497  if (infoPtr->leftmostVisible >= iSelected)
2498  {
2499  infoPtr->leftmostVisible = iSelected;
2500  }
2501  else
2502  {
2503  TAB_ITEM *selected = TAB_GetItem(infoPtr, iSelected);
2504  RECT r;
2505  INT width;
2506  UINT i;
2507 
2508  /* Calculate the part of the client area that is visible */
2509  GetClientRect(infoPtr->hwnd, &r);
2510  width = r.right;
2511 
2512  GetClientRect(infoPtr->hwndUpDown, &r);
2513  width -= r.right;
2514 
2515  if ((selected->rect.right -
2516  selected->rect.left) >= width )
2517  {
2518  /* Special case: width of selected item is greater than visible
2519  * part of control.
2520  */
2521  infoPtr->leftmostVisible = iSelected;
2522  }
2523  else
2524  {
2525  for (i = infoPtr->leftmostVisible; i < infoPtr->uNumItem; i++)
2526  {
2527  if ((selected->rect.right - TAB_GetItem(infoPtr, i)->rect.left) < width)
2528  break;
2529  }
2530  infoPtr->leftmostVisible = i;
2531  }
2532  }
2533 
2534  if (infoPtr->leftmostVisible != iOrigLeftmostVisible)
2535  TAB_RecalcHotTrack(infoPtr, NULL, NULL, NULL);
2536 
2537  SendMessageW(infoPtr->hwndUpDown, UDM_SETPOS, 0,
2538  MAKELONG(infoPtr->leftmostVisible, 0));
2539 }
GLint GLint GLsizei width
Definition: gl.h:1546
INT leftmostVisible
Definition: tab.c:109
UINT uNumItem
Definition: tab.c:96
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define TCS_BUTTONS
Definition: commctrl.h:3948
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
static char selected[MAX_PATH+1]
Definition: dirdlg.c:7
#define MAKELONG(a, b)
Definition: typedefs.h:249
static void TAB_RecalcHotTrack(TAB_INFO *infoPtr, const LPARAM *pos, int *out_redrawLeave, int *out_redrawEnter)
Definition: tab.c:836
#define TCS_VERTICAL
Definition: commctrl.h:3946
UINT uNumRows
Definition: tab.c:97
Definition: tab.c:73
BOOL needsScrolling
Definition: tab.c:115
HWND hwndUpDown
Definition: tab.c:119
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
INT iSelected
Definition: tab.c:111
static ATOM item
Definition: dde.c:856
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
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
#define UDM_SETPOS
Definition: commctrl.h:2143
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112

Referenced by TAB_SetCurFocus(), TAB_SetCurSel(), and TAB_SetItemBounds().

◆ TAB_EraseTabInterior()

static void TAB_EraseTabInterior ( const TAB_INFO infoPtr,
HDC  hdc,
INT  iItem,
const RECT drawRect 
)
static

Definition at line 1481 of file tab.c.

1482 {
1484  BOOL deleteBrush = TRUE;
1485  RECT rTemp = *drawRect;
1486 
1487  if (infoPtr->dwStyle & TCS_BUTTONS)
1488  {
1489  if (iItem == infoPtr->iSelected)
1490  {
1491  /* Background color */
1492  if (!(infoPtr->dwStyle & TCS_OWNERDRAWFIXED))
1493  {
1494  DeleteObject(hbr);
1496 
1499 
1500  /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
1501  * we better use 0x55aa bitmap brush to make scrollbar's background
1502  * look different from the window background.
1503  */
1506 
1507  deleteBrush = FALSE;
1508  }
1509  FillRect(hdc, &rTemp, hbr);
1510  }
1511  else /* ! selected */
1512  {
1513  if (infoPtr->dwStyle & TCS_FLATBUTTONS)
1514  {
1515  InflateRect(&rTemp, 2, 2);
1516  FillRect(hdc, &rTemp, hbr);
1517  if (iItem == infoPtr->iHotTracked ||
1518  (iItem != infoPtr->iSelected && iItem == infoPtr->uFocus))
1519  DrawEdge(hdc, &rTemp, BDR_RAISEDINNER, BF_RECT);
1520  }
1521  else
1522  FillRect(hdc, &rTemp, hbr);
1523  }
1524 
1525  }
1526  else /* !TCS_BUTTONS */
1527  {
1528  InflateRect(&rTemp, -2, -2);
1529  if (!GetWindowTheme (infoPtr->hwnd))
1530  FillRect(hdc, &rTemp, hbr);
1531  }
1532 
1533  /* highlighting is drawn on top of previous fills */
1534  if (TAB_GetItem(infoPtr, iItem)->dwState & TCIS_HIGHLIGHTED)
1535  {
1536  if (deleteBrush)
1537  {
1538  DeleteObject(hbr);
1539  deleteBrush = FALSE;
1540  }
1542  FillRect(hdc, &rTemp, hbr);
1543  }
1544 
1545  /* Cleanup */
1546  if (deleteBrush) DeleteObject(hbr);
1547 }
HBRUSH COMCTL32_hPattern55AABrush
Definition: commctrl.c:81
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
#define TRUE
Definition: types.h:120
#define TCS_BUTTONS
Definition: commctrl.h:3948
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
COLORREF clr3dHilight
Definition: comctl32.h:172
#define TCIS_HIGHLIGHTED
Definition: commctrl.h:3978
INT uFocus
Definition: tab.c:113
COLORREF clr3dFace
Definition: comctl32.h:175
#define TCS_FLATBUTTONS
Definition: commctrl.h:3942
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define BF_RECT
Definition: winuser.h:462
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define COLOR_SCROLLBAR
Definition: winuser.h:906
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
#define TCS_OWNERDRAWFIXED
Definition: commctrl.h:3955
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HDC hdc
Definition: main.c:9
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:911
COLORREF clrBtnFace
Definition: comctl32.h:168
INT iHotTracked
Definition: tab.c:112
INT iSelected
Definition: tab.c:111
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define BDR_RAISEDINNER
Definition: winuser.h:444
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
COLORREF clrWindow
Definition: comctl32.h:176
HBRUSH WINAPI GetSysColorBrush(_In_ int)

Referenced by TAB_DrawItemInterior().

◆ TAB_FocusChanging()

static void TAB_FocusChanging ( const TAB_INFO infoPtr)
static

Definition at line 570 of file tab.c.

571 {
572  RECT selectedRect;
573  BOOL isVisible;
574 
575  /*
576  * Get the rectangle for the item.
577  */
578  isVisible = TAB_InternalGetItemRect(infoPtr,
579  infoPtr->uFocus,
580  NULL,
581  &selectedRect);
582 
583  /*
584  * If the rectangle is not completely invisible, invalidate that
585  * portion of the window.
586  */
587  if (isVisible)
588  {
589  TRACE("invalidate (%s)\n", wine_dbgstr_rect(&selectedRect));
590  InvalidateRect(infoPtr->hwnd, &selectedRect, TRUE);
591  }
592 }
#define TRUE
Definition: types.h:120
INT uFocus
Definition: tab.c:113
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
#define TRACE(s)
Definition: solgame.cpp:4
const char * wine_dbgstr_rect(const RECT *rect)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND hwnd
Definition: tab.c:94
#define NULL
Definition: types.h:112

Referenced by TAB_WindowProc().

◆ TAB_GetCurFocus()

static LRESULT TAB_GetCurFocus ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 237 of file tab.c.

238 {
239  TRACE("(%p)\n", infoPtr);
240  return infoPtr->uFocus;
241 }
INT uFocus
Definition: tab.c:113
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by TAB_WindowProc().

◆ TAB_GetCurSel()

static LRESULT TAB_GetCurSel ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 228 of file tab.c.

229 {
230  TRACE("(%p)\n", infoPtr);
231  return infoPtr->iSelected;
232 }
#define TRACE(s)
Definition: solgame.cpp:4
INT iSelected
Definition: tab.c:111

Referenced by TAB_WindowProc().

◆ TAB_GetExtendedStyle()

static LRESULT TAB_GetExtendedStyle ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 3228 of file tab.c.

3229 {
3230  return infoPtr->exStyle;
3231 }
DWORD exStyle
Definition: tab.c:122

Referenced by TAB_WindowProc().

◆ TAB_GetFont()

static LRESULT TAB_GetFont ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 2916 of file tab.c.

2917 {
2918  TRACE("(%p) returning %p\n", infoPtr, infoPtr->hFont);
2919  return (LRESULT)infoPtr->hFont;
2920 }
HFONT hFont
Definition: tab.c:105
#define TRACE(s)
Definition: solgame.cpp:4
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by TAB_WindowProc().

◆ TAB_GetImageList()

static LRESULT TAB_GetImageList ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 2936 of file tab.c.

2937 {
2938  TRACE("\n");
2939  return (LRESULT)infoPtr->himl;
2940 }
#define TRACE(s)
Definition: solgame.cpp:4
HIMAGELIST himl
Definition: tab.c:107
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by TAB_WindowProc().

◆ TAB_GetItem()

static TAB_ITEM* TAB_GetItem ( const TAB_INFO infoPtr,
INT  i 
)
inlinestatic

Definition at line 157 of file tab.c.

158 {
159  assert(i >= 0 && i < infoPtr->uNumItem);
160  return DPA_GetPtr(infoPtr->items, i);
161 }
#define assert(x)
Definition: debug.h:53
HDPA items
Definition: tab.c:126
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 DPA_GetPtr
Definition: commctrl.h:5

Referenced by TAB_DeleteItem(), TAB_DeselectAll(), TAB_Destroy(), TAB_DrawItem(), TAB_DrawItemInterior(), TAB_DumpItemInternal(), TAB_EnsureSelectionVisible(), TAB_EraseTabInterior(), TAB_GetItemT(), TAB_HighlightItem(), TAB_InternalGetItemRect(), TAB_LButtonDown(), TAB_RemoveImage(), TAB_SetCurFocus(), TAB_SetCurSel(), TAB_SetItemBounds(), TAB_SetItemT(), and TAB_SetupScrolling().

◆ TAB_GetItemCount()

static LRESULT TAB_GetItemCount ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 2808 of file tab.c.

2809 {
2810  TRACE("\n");
2811  return infoPtr->uNumItem;
2812 }
UINT uNumItem
Definition: tab.c:96
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by TAB_WindowProc().

◆ TAB_GetItemRect()

static BOOL TAB_GetItemRect ( const TAB_INFO infoPtr,
INT  item,
RECT rect 
)
inlinestatic

Definition at line 506 of file tab.c.

507 {
508  TRACE("(%p, %d, %p)\n", infoPtr, item, rect);
509  return TAB_InternalGetItemRect(infoPtr, item, rect, NULL);
510 }
& rect
Definition: startmenu.cpp:1413
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
#define TRACE(s)
Definition: solgame.cpp:4
static ATOM item
Definition: dde.c:856
#define NULL
Definition: types.h:112

Referenced by TAB_WindowProc().

◆ TAB_GetItemT()

static LRESULT TAB_GetItemT ( TAB_INFO infoPtr,
INT  iItem,
LPTCITEMW  tabItem,
BOOL  bUnicode 
)
static

Definition at line 2816 of file tab.c.

2817 {
2818  TAB_ITEM *wineItem;
2819 
2820  TRACE("(%p,%d,%p,%s)\n", infoPtr, iItem, tabItem, bUnicode ? "true" : "false");
2821 
2822  if (!tabItem) return FALSE;
2823 
2824  if (iItem < 0 || iItem >= infoPtr->uNumItem)
2825  {
2826  /* init requested fields */
2827  if (tabItem->mask & TCIF_IMAGE) tabItem->iImage = 0;
2828  if (tabItem->mask & TCIF_PARAM) tabItem->lParam = 0;
2829  if (tabItem->mask & TCIF_STATE) tabItem->dwState = 0;
2830  return FALSE;
2831  }
2832 
2833  wineItem = TAB_GetItem(infoPtr, iItem);
2834 
2835  if (tabItem->mask & TCIF_IMAGE)
2836  tabItem->iImage = wineItem->iImage;
2837 
2838  if (tabItem->mask & TCIF_PARAM)
2839  memcpy(&tabItem->lParam, wineItem->extra, infoPtr->cbInfo);
2840 
2841  if (tabItem->mask & TCIF_RTLREADING)
2842  FIXME("TCIF_RTLREADING\n");
2843 
2844  if (tabItem->mask & TCIF_STATE)
2845  tabItem->dwState = wineItem->dwState & tabItem->dwStateMask;
2846 
2847  if (tabItem->mask & TCIF_TEXT)
2848  {
2849  if (bUnicode)
2850  Str_GetPtrW (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax);
2851  else
2852  Str_GetPtrWtoA (wineItem->pszText, (LPSTR)tabItem->pszText, tabItem->cchTextMax);
2853  }
2854 
2855  TAB_DumpItemExternalT(tabItem, iItem, bUnicode);
2856 
2857  return TRUE;
2858 }
BYTE extra[1]
Definition: tab.c:84
UINT uNumItem
Definition: tab.c:96
#define TRUE
Definition: types.h:120
int iImage
Definition: commctrl.h:4025
DWORD dwState
Definition: tab.c:75
LPWSTR pszText
Definition: commctrl.h:4023
#define TCIF_TEXT
Definition: commctrl.h:3971
DWORD dwState
Definition: commctrl.h:4021
LPARAM lParam
Definition: commctrl.h:4026
char * LPSTR
Definition: xmlstorage.h:182
#define TCIF_STATE
Definition: commctrl.h:3975
INT Str_GetPtrWtoA(LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen) DECLSPEC_HIDDEN
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define FALSE
Definition: types.h:117
int cchTextMax
Definition: commctrl.h:4024
#define FIXME(fmt,...)
Definition: debug.h:111
UINT mask
Definition: commctrl.h:4020
static void TAB_DumpItemExternalT(const TCITEMW *pti, UINT iItem, BOOL isW)
Definition: tab.c:203
DWORD dwStateMask
Definition: commctrl.h:4022
INT cbInfo
Definition: tab.c:120
#define TRACE(s)
Definition: solgame.cpp:4
#define TCIF_PARAM
Definition: commctrl.h:3974
LPWSTR pszText
Definition: tab.c:76
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: tab.c:73
INT WINAPI Str_GetPtrW(LPCWSTR, LPWSTR, INT)
Definition: string.c:204
INT iImage
Definition: tab.c:77
#define TCIF_IMAGE
Definition: commctrl.h:3972
#define TCIF_RTLREADING
Definition: commctrl.h:3973

Referenced by TAB_WindowProc().

◆ TAB_GetRowCount()

static DWORD TAB_GetRowCount ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 2408 of file tab.c.

2409 {
2410  TRACE("(%p)\n", infoPtr);
2411  return infoPtr->uNumRows;
2412 }
#define TRACE(s)
Definition: solgame.cpp:4
UINT uNumRows
Definition: tab.c:97

Referenced by TAB_WindowProc().

◆ TAB_GetToolTips()

static LRESULT TAB_GetToolTips ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 243 of file tab.c.

244 {
245  TRACE("(%p)\n", infoPtr);
246  return (LRESULT)infoPtr->hwndToolTip;
247 }
#define TRACE(s)
Definition: solgame.cpp:4
LONG_PTR LRESULT
Definition: windef.h:209
HWND hwndToolTip
Definition: tab.c:108

Referenced by TAB_WindowProc().

◆ TAB_GetUnicodeFormat()

static LRESULT TAB_GetUnicodeFormat ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 2952 of file tab.c.

2953 {
2954  TRACE("(%p)\n", infoPtr);
2955  return infoPtr->bUnicode;
2956 }
BOOL bUnicode
Definition: tab.c:118
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by TAB_WindowProc().

◆ TAB_HighlightItem()

static LRESULT TAB_HighlightItem ( TAB_INFO infoPtr,
INT  iItem,
BOOL  fHighlight 
)
inlinestatic

Definition at line 2739 of file tab.c.

2740 {
2741  LPDWORD lpState;
2742  DWORD oldState;
2743  RECT r;
2744 
2745  TRACE("(%p,%d,%s)\n", infoPtr, iItem, fHighlight ? "true" : "false");
2746 
2747  if (iItem < 0 || iItem >= infoPtr->uNumItem)
2748  return FALSE;
2749 
2750  lpState = &TAB_GetItem(infoPtr, iItem)->dwState;
2751  oldState = *lpState;
2752 
2753  if (fHighlight)
2754  *lpState |= TCIS_HIGHLIGHTED;
2755  else
2756  *lpState &= ~TCIS_HIGHLIGHTED;
2757 
2758  if ((oldState != *lpState) && TAB_InternalGetItemRect (infoPtr, iItem, &r, NULL))
2759  InvalidateRect (infoPtr->hwnd, &r, TRUE);
2760 
2761  return TRUE;
2762 }
UINT uNumItem
Definition: tab.c:96
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
DWORD dwState
Definition: tab.c:75
#define TCIS_HIGHLIGHTED
Definition: commctrl.h:3978
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define FALSE
Definition: types.h:117
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND hwnd
Definition: tab.c:94
#define NULL
Definition: types.h:112
uint32_t * LPDWORD
Definition: typedefs.h:59

Referenced by TAB_WindowProc().

◆ TAB_HitTest()

static LRESULT TAB_HitTest ( const TAB_INFO infoPtr,
LPTCHITTESTINFO  lptest 
)
inlinestatic

Definition at line 615 of file tab.c.

616 {
617  TRACE("(%p, %p)\n", infoPtr, lptest);
618  return TAB_InternalHitTest (infoPtr, lptest->pt, &lptest->flags);
619 }
static INT TAB_InternalHitTest(const TAB_INFO *infoPtr, POINT pt, UINT *flags)
Definition: tab.c:594
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by TAB_WindowProc().

◆ TAB_HotTrackTimerProc()

static void CALLBACK TAB_HotTrackTimerProc ( HWND  hwnd,
UINT  uMsg,
UINT_PTR  idEvent,
DWORD  dwTime 
)
static

Definition at line 784 of file tab.c.

790 {
791  TAB_INFO* infoPtr = TAB_GetInfoPtr(hwnd);
792 
793  if (infoPtr != NULL && infoPtr->iHotTracked >= 0)
794  {
795  POINT pt;
796 
797  /*
798  ** If we can't get the cursor position, or if the cursor is outside our
799  ** window, we un-highlight the hot-tracked tab. Note that the cursor is
800  ** "outside" even if it is within our bounding rect if another window
801  ** overlaps. Note also that the case where the cursor stayed within our
802  ** window but has moved off the hot-tracked tab will be handled by the
803  ** WM_MOUSEMOVE event.
804  */
805  if (!GetCursorPos(&pt) || WindowFromPoint(pt) != hwnd)
806  {
807  /* Redraw iHotTracked to look normal */
808  INT iRedraw = infoPtr->iHotTracked;
809  infoPtr->iHotTracked = -1;
810  hottrack_refresh (infoPtr, iRedraw);
811 
812  /* Kill this timer */
814  }
815  }
816 }
#define TAB_HOTTRACK_TIMER
Definition: tab.c:152
#define pt(x, y)
Definition: drawing.c:79
#define TAB_GetInfoPtr(hwnd)
Definition: tab.c:145
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
int32_t INT
Definition: typedefs.h:58
static void hottrack_refresh(const TAB_INFO *infoPtr, int tabIndex)
Definition: tab.c:757
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
INT iHotTracked
Definition: tab.c:112
#define NULL
Definition: types.h:112
Definition: tab.c:92
HWND WINAPI WindowFromPoint(_In_ POINT)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022

Referenced by TAB_RecalcHotTrack().

◆ TAB_InsertItemT()

static LRESULT TAB_InsertItemT ( TAB_INFO infoPtr,
INT  iItem,
const TCITEMW pti,
BOOL  bUnicode 
)
static

Definition at line 2625 of file tab.c.

2626 {
2627  TAB_ITEM *item;
2628  RECT rect;
2629 
2630  GetClientRect (infoPtr->hwnd, &rect);
2631  TRACE("Rect: %p %s\n", infoPtr->hwnd, wine_dbgstr_rect(&rect));
2632 
2633  if (iItem < 0) return -1;
2634  if (iItem > infoPtr->uNumItem)
2635  iItem = infoPtr->uNumItem;
2636 
2637  TAB_DumpItemExternalT(pti, iItem, bUnicode);
2638 
2639  if (!(item = Alloc(TAB_ITEM_SIZE(infoPtr)))) return FALSE;
2640  if (DPA_InsertPtr(infoPtr->items, iItem, item) == -1)
2641  {
2642  Free(item);
2643  return FALSE;
2644  }
2645 
2646  if (infoPtr->uNumItem == 0)
2647  infoPtr->iSelected = 0;
2648  else if (iItem <= infoPtr->iSelected)
2649  infoPtr->iSelected++;
2650 
2651  infoPtr->uNumItem++;
2652 
2653  item->pszText = NULL;
2654  if (pti->mask & TCIF_TEXT)
2655  {
2656  if (bUnicode)
2657  Str_SetPtrW (&item->pszText, pti->pszText);
2658  else
2659  Str_SetPtrAtoW (&item->pszText, (LPSTR)pti->pszText);
2660  }
2661 
2662  if (pti->mask & TCIF_IMAGE)
2663  item->iImage = pti->iImage;
2664  else
2665  item->iImage = -1;
2666 
2667  if (pti->mask & TCIF_PARAM)
2668  memcpy(item->extra, &pti->lParam, EXTRA_ITEM_SIZE(infoPtr));
2669  else
2670  memset(item->extra, 0, EXTRA_ITEM_SIZE(infoPtr));
2671 
2672  TAB_SetItemBounds(infoPtr);
2673  if (infoPtr->uNumItem > 1)
2674  TAB_InvalidateTabArea(infoPtr);
2675  else
2676  InvalidateRect(infoPtr->hwnd, NULL, TRUE);
2677 
2678  TRACE("[%p]: added item %d %s\n",
2679  infoPtr->hwnd, iItem, debugstr_w(item->pszText));
2680 
2681  /* If we haven't set the current focus yet, set it now. */
2682  if (infoPtr->uFocus == -1)
2683  TAB_SetCurFocus(infoPtr, iItem);
2684 
2685  return iItem;
2686 }
UINT uNumItem
Definition: tab.c:96
#define TRUE
Definition: types.h:120
int iImage
Definition: commctrl.h:4025
LPWSTR pszText
Definition: commctrl.h:4023
#define TCIF_TEXT
Definition: commctrl.h:3971
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:236
INT uFocus
Definition: tab.c:113
LPARAM lParam
Definition: commctrl.h:4026
char * LPSTR
Definition: xmlstorage.h:182
& rect
Definition: startmenu.cpp:1413
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
UINT mask
Definition: commctrl.h:4020
static void TAB_DumpItemExternalT(const TCITEMW *pti, UINT iItem, BOOL isW)
Definition: tab.c:203
#define TRACE(s)
Definition: solgame.cpp:4
#define TCIF_PARAM
Definition: commctrl.h:3974
const char * wine_dbgstr_rect(const RECT *rect)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
static void TAB_SetItemBounds(TAB_INFO *infoPtr)
Definition: tab.c:1117
static LRESULT TAB_SetCurFocus(TAB_INFO *infoPtr, INT iItem)
Definition: tab.c:281
HDPA items
Definition: tab.c:126
INT WINAPI DPA_InsertPtr(HDPA hdpa, INT i, LPVOID p)
Definition: dpa.c:591
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: tab.c:73
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
static void TAB_InvalidateTabArea(const TAB_INFO *)
Definition: tab.c:2548
#define TCIF_IMAGE
Definition: commctrl.h:3972
#define EXTRA_ITEM_SIZE(infoPtr)
Definition: tab.c:89
INT iSelected
Definition: tab.c:111
static ATOM item
Definition: dde.c:856
BOOL Str_SetPtrAtoW(LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN
#define TAB_ITEM_SIZE(infoPtr)
Definition: tab.c:90
HWND hwnd
Definition: tab.c:94
#define NULL
Definition: types.h:112
#define memset(x, y, z)
Definition: compat.h:39

Referenced by TAB_WindowProc().

◆ TAB_InternalGetItemRect()

static BOOL TAB_InternalGetItemRect ( const TAB_INFO infoPtr,
INT  itemIndex,
RECT itemRect,
RECT selectedRect 
)
static

Definition at line 372 of file tab.c.

377 {
378  RECT tmpItemRect,clientRect;
379 
380  /* Perform a sanity check and a trivial visibility check. */
381  if ( (infoPtr->uNumItem <= 0) ||
382  (itemIndex >= infoPtr->uNumItem) ||
383  (!(((infoPtr->dwStyle & TCS_MULTILINE) || (infoPtr->dwStyle & TCS_VERTICAL))) &&
384  (itemIndex < infoPtr->leftmostVisible)))
385  {
386  TRACE("Not Visible\n");
387  SetRect(itemRect, 0, 0, 0, infoPtr->tabHeight);
388  SetRectEmpty(selectedRect);
389  return FALSE;
390  }
391 
392  /*
393  * Avoid special cases in this procedure by assigning the "out"
394  * parameters if the caller didn't supply them
395  */
396  if (itemRect == NULL)
397  itemRect = &tmpItemRect;
398 
399  /* Retrieve the unmodified item rect. */
400  *itemRect = TAB_GetItem(infoPtr,itemIndex)->rect;
401 
402  /* calculate the times bottom and top based on the row */
403  GetClientRect(infoPtr->hwnd, &clientRect);
404 
405  if ((infoPtr->dwStyle & TCS_BOTTOM) && (infoPtr->dwStyle & TCS_VERTICAL))
406  {
407  itemRect->right = clientRect.right - SELECTED_TAB_OFFSET - itemRect->left * infoPtr->tabHeight -
408  ((infoPtr->dwStyle & TCS_BUTTONS) ? itemRect->left * BUTTON_SPACINGX : 0);
409  itemRect->left = itemRect->right - infoPtr->tabHeight;
410  }
411  else if (infoPtr->dwStyle & TCS_VERTICAL)
412  {
413  itemRect->left = clientRect.left + SELECTED_TAB_OFFSET + itemRect->left * infoPtr->tabHeight +
414  ((infoPtr->dwStyle & TCS_BUTTONS) ? itemRect->left * BUTTON_SPACINGX : 0);
415  itemRect->right = itemRect->left + infoPtr->tabHeight;
416  }
417  else if (infoPtr->dwStyle & TCS_BOTTOM)
418  {
419  itemRect->bottom = clientRect.bottom - itemRect->top * infoPtr->tabHeight -
420  ((infoPtr->dwStyle & TCS_BUTTONS) ? itemRect->top * BUTTON_SPACINGY : SELECTED_TAB_OFFSET);
421  itemRect->top = itemRect->bottom - infoPtr->tabHeight;
422  }
423  else /* not TCS_BOTTOM and not TCS_VERTICAL */
424  {
425  itemRect->top = clientRect.top + itemRect->top * infoPtr->tabHeight +
426  ((infoPtr->dwStyle & TCS_BUTTONS) ? itemRect->top * BUTTON_SPACINGY : SELECTED_TAB_OFFSET);
427  itemRect->bottom = itemRect->top + infoPtr->tabHeight;
428  }
429 
430  /*
431  * "scroll" it to make sure the item at the very left of the
432  * tab control is the leftmost visible tab.
433  */
434  if(infoPtr->dwStyle & TCS_VERTICAL)
435  {
436  OffsetRect(itemRect,
437  0,
438  -TAB_GetItem(infoPtr, infoPtr->leftmostVisible)->rect.top);
439 
440  /*
441  * Move the rectangle so the first item is slightly offset from
442  * the bottom of the tab control.
443  */
444  OffsetRect(itemRect,
445  0,
447 
448  } else
449  {
450  OffsetRect(itemRect,
451  -TAB_GetItem(infoPtr, infoPtr->leftmostVisible)->rect.left,
452  0);
453 
454  /*
455  * Move the rectangle so the first item is slightly offset from
456  * the left of the tab control.
457  */
458  OffsetRect(itemRect,
460  0);
461  }
462  TRACE("item %d tab h=%d, rect=(%s)\n",
463  itemIndex, infoPtr->tabHeight, wine_dbgstr_rect(itemRect));
464 
465  /* Now, calculate the position of the item as if it were selected. */
466  if (selectedRect!=NULL)
467  {
468  *selectedRect = *itemRect;
469 
470  /* The rectangle of a selected item is a bit wider. */
471  if(infoPtr->dwStyle & TCS_VERTICAL)
472  InflateRect(selectedRect, 0, SELECTED_TAB_OFFSET);
473  else
474  InflateRect(selectedRect, SELECTED_TAB_OFFSET, 0);
475 
476  /* If it also a bit higher. */
477  if ((infoPtr->dwStyle & TCS_BOTTOM) && (infoPtr->dwStyle & TCS_VERTICAL))
478  {
479  selectedRect->left -= 2; /* the border is thicker on the right */
480  selectedRect->right += SELECTED_TAB_OFFSET;
481  }
482  else if (infoPtr->dwStyle & TCS_VERTICAL)
483  {
484  selectedRect->left -= SELECTED_TAB_OFFSET;
485  selectedRect->right += 1;
486  }
487  else if (infoPtr->dwStyle & TCS_BOTTOM)
488  {
489  selectedRect->bottom += SELECTED_TAB_OFFSET;
490  }
491  else /* not TCS_BOTTOM and not TCS_VERTICAL */
492  {
493  selectedRect->top -= SELECTED_TAB_OFFSET;
494  selectedRect->bottom -= 1;
495  }
496  }
497 
498  /* Check for visibility */
499  if (infoPtr->dwStyle & TCS_VERTICAL)
500  return (itemRect->top < clientRect.bottom) && (itemRect->bottom > clientRect.top);
501  else
502  return (itemRect->left < clientRect.right) && (itemRect->right > clientRect.left);
503 }
#define BUTTON_SPACINGX
Definition: tab.c:138
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SELECTED_TAB_OFFSET
Definition: tab.c:132
INT leftmostVisible
Definition: tab.c:109
RECT rect
Definition: tab.c:78
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
UINT uNumItem
Definition: tab.c:96
#define TCS_BUTTONS
Definition: commctrl.h:3948
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define TCS_BOTTOM
Definition: commctrl.h:3939
const char * wine_dbgstr_rect(const RECT *rect)
#define BUTTON_SPACINGY
Definition: tab.c:139
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define TCS_VERTICAL
Definition: commctrl.h:3946
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
#define TCS_MULTILINE
Definition: commctrl.h:3950
INT tabHeight
Definition: tab.c:98

Referenced by hottrack_refresh(), TAB_DrawItem(), TAB_DrawItemInterior(), TAB_FocusChanging(), TAB_GetItemRect(), TAB_HighlightItem(), TAB_InternalHitTest(), TAB_InvalidateTabArea(), TAB_KillFocus(), TAB_LButtonDown(), TAB_RemoveImage(), and TAB_SetCurFocus().

◆ TAB_InternalHitTest()

static INT TAB_InternalHitTest ( const TAB_INFO infoPtr,
POINT  pt,
UINT flags 
)
static

Definition at line 594 of file tab.c.

595 {
596  RECT rect;
597  INT iCount;
598 
599  for (iCount = 0; iCount < infoPtr->uNumItem; iCount++)
600  {
601  TAB_InternalGetItemRect(infoPtr, iCount, &rect, NULL);
602 
603  if (PtInRect(&rect, pt))
604  {
605  *flags = TCHT_ONITEM;
606  return iCount;
607  }
608  }
609 
610  *flags = TCHT_NOWHERE;
611  return -1;
612 }
#define TCHT_NOWHERE
Definition: commctrl.h:4068
UINT uNumItem
Definition: tab.c:96
#define pt(x, y)
Definition: drawing.c:79
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
GLbitfield flags
Definition: glext.h:7161
#define TCHT_ONITEM
Definition: commctrl.h:4071
#define NULL
Definition: types.h:112
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by TAB_HitTest(), TAB_LButtonDown(), TAB_NCHitTest(), and TAB_RecalcHotTrack().

◆ TAB_InvalidateTabArea()

static void TAB_InvalidateTabArea ( const TAB_INFO infoPtr)
static

Definition at line 2548 of file tab.c.

2549 {
2550  RECT clientRect, rInvalidate, rAdjClient;
2551  INT lastRow = infoPtr->uNumRows - 1;
2552  RECT rect;
2553 
2554  if (lastRow < 0) return;
2555 
2556  GetClientRect(infoPtr->hwnd, &clientRect);
2557  rInvalidate = clientRect;
2558  rAdjClient = clientRect;
2559 
2560  TAB_AdjustRect(infoPtr, 0, &rAdjClient);
2561 
2562  TAB_InternalGetItemRect(infoPtr, infoPtr->uNumItem-1 , &rect, NULL);
2563  if ((infoPtr->dwStyle & TCS_BOTTOM) && (infoPtr->dwStyle & TCS_VERTICAL))
2564  {
2565  rInvalidate.left = rAdjClient.right;
2566  if (infoPtr->uNumRows == 1)
2567  rInvalidate.bottom = clientRect.top + rect.bottom + 2 * SELECTED_TAB_OFFSET;
2568  }
2569  else if(infoPtr->dwStyle & TCS_VERTICAL)
2570  {
2571  rInvalidate.right = rAdjClient.left;
2572  if (infoPtr->uNumRows == 1)
2573  rInvalidate.bottom = clientRect.top + rect.bottom + 2 * SELECTED_TAB_OFFSET;
2574  }
2575  else if (infoPtr->dwStyle & TCS_BOTTOM)
2576  {
2577  rInvalidate.top = rAdjClient.bottom;
2578  if (infoPtr->uNumRows == 1)
2579  rInvalidate.right = clientRect.left + rect.right + 2 * SELECTED_TAB_OFFSET;
2580  }
2581  else
2582  {
2583  rInvalidate.bottom = rAdjClient.top;
2584  if (infoPtr->uNumRows == 1)
2585  rInvalidate.right = clientRect.left + rect.right + 2 * SELECTED_TAB_OFFSET;
2586  }
2587 
2588  /* Punch out the updown control */
2589  if (infoPtr->needsScrolling && (rInvalidate.right > 0)) {
2590  RECT r;
2591  GetClientRect(infoPtr->hwndUpDown, &r);
2592  if (rInvalidate.right > clientRect.right - r.left)
2593  rInvalidate.right = rInvalidate.right - (r.right - r.left);
2594  else
2595  rInvalidate.right = clientRect.right - r.left;
2596  }
2597 
2598  TRACE("invalidate (%s)\n", wine_dbgstr_rect(&rInvalidate));
2599 
2600  InvalidateRect(infoPtr->hwnd, &rInvalidate, TRUE);
2601 }
#define SELECTED_TAB_OFFSET
Definition: tab.c:132
UINT uNumItem
Definition: tab.c:96
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
static LRESULT TAB_AdjustRect(const TAB_INFO *infoPtr, WPARAM fLarger, LPRECT prc)
Definition: tab.c:941
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
#define TRACE(s)
Definition: solgame.cpp:4
#define TCS_BOTTOM
Definition: commctrl.h:3939
const char * wine_dbgstr_rect(const RECT *rect)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define TCS_VERTICAL
Definition: commctrl.h:3946
UINT uNumRows
Definition: tab.c:97
BOOL needsScrolling
Definition: tab.c:115
HWND hwndUpDown
Definition: tab.c:119
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309

Referenced by TAB_DeleteItem(), TAB_DeselectAll(), TAB_InsertItemT(), TAB_OnHScroll(), TAB_SetCurFocus(), TAB_SetCurSel(), TAB_SetExtendedStyle(), TAB_SetFont(), and TAB_SetItemT().

◆ TAB_KeyDown()

static LRESULT TAB_KeyDown ( TAB_INFO infoPtr,
WPARAM  keyCode,
LPARAM  lParam 
)
static

Definition at line 517 of file tab.c.

518 {
519  INT newItem = -1;
520  NMTCKEYDOWN nm;
521 
522  /* TCN_KEYDOWN notification sent always */
523  nm.hdr.hwndFrom = infoPtr->hwnd;
524  nm.hdr.idFrom = GetWindowLongPtrW(infoPtr->hwnd, GWLP_ID);
525  nm.hdr.code = TCN_KEYDOWN;
526  nm.wVKey = keyCode;
527  nm.flags = lParam;
528  SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nm.hdr.idFrom, (LPARAM)&nm);
529 
530  switch (keyCode)
531  {
532  case VK_LEFT:
533  newItem = infoPtr->uFocus - 1;
534  break;
535  case VK_RIGHT:
536  newItem = infoPtr->uFocus + 1;
537  break;
538  }
539 
540  /* If we changed to a valid item, change focused item */
541  if (newItem >= 0 && newItem < infoPtr->uNumItem && infoPtr->uFocus != newItem)
542  TAB_SetCurFocus(infoPtr, newItem);
543 
544  return 0;
545 }
#define VK_LEFT
Definition: winuser.h:2204
#define GetWindowLongPtrW
Definition: winuser.h:4809
INT uFocus
Definition: tab.c:113
int32_t INT
Definition: typedefs.h:58
UINT code
Definition: winuser.h:3139
UINT_PTR idFrom
Definition: winuser.h:3138
HWND hwndNotify
Definition: tab.c:95
LONG_PTR LPARAM
Definition: windef.h:208
static LRESULT TAB_SetCurFocus(TAB_INFO *infoPtr, INT iItem)
Definition: tab.c:281
HWND hwndFrom
Definition: winuser.h:3137
#define VK_RIGHT
Definition: winuser.h:2206
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hwnd
Definition: tab.c:94
LPARAM lParam
Definition: combotst.c:139
#define TCN_KEYDOWN
Definition: commctrl.h:4118
#define GWLP_ID
Definition: winuser.h:854
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by TAB_WindowProc().

◆ TAB_KillFocus()

static void TAB_KillFocus ( TAB_INFO infoPtr)
static

Definition at line 550 of file tab.c.

551 {
552  /* clear current focused item back to selected for TCS_BUTTONS */
553  if ((infoPtr->dwStyle & TCS_BUTTONS) && (infoPtr->uFocus != infoPtr->iSelected))
554  {
555  RECT r;
556 
557  if (TAB_InternalGetItemRect(infoPtr, infoPtr->uFocus, &r, NULL))
558  InvalidateRect(infoPtr->hwnd, &r, FALSE);
559 
560  infoPtr->uFocus = infoPtr->iSelected;
561  }
562 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define TCS_BUTTONS
Definition: commctrl.h:3948
INT uFocus
Definition: tab.c:113
#define FALSE
Definition: types.h:117
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
INT iSelected
Definition: tab.c:111
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
#define NULL
Definition: types.h:112

Referenced by TAB_WindowProc().

◆ TAB_LButtonDown()

static LRESULT TAB_LButtonDown ( TAB_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 650 of file tab.c.

651 {
652  POINT pt;
653  INT newItem;
654  UINT dummy;
655 
656  if (infoPtr->hwndToolTip)
657  TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd,
659 
660  if (!(infoPtr->dwStyle & TCS_FOCUSNEVER)) {
661  SetFocus (infoPtr->hwnd);
662  }
663 
664  if (infoPtr->hwndToolTip)
665  TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd,
667 
668  pt.x = (short)LOWORD(lParam);
669  pt.y = (short)HIWORD(lParam);
670 
671  newItem = TAB_InternalHitTest (infoPtr, pt, &dummy);
672 
673  TRACE("On Tab, item %d\n", newItem);
674 
675  if ((newItem != -1) && (infoPtr->iSelected != newItem))
676  {
677  if ((infoPtr->dwStyle & TCS_BUTTONS) && (infoPtr->dwStyle & TCS_MULTISELECT) &&
678  (wParam & MK_CONTROL))
679  {
680  RECT r;
681 
682  /* toggle multiselection */
683  TAB_GetItem(infoPtr, newItem)->dwState ^= TCIS_BUTTONPRESSED;
684  if (TAB_InternalGetItemRect (infoPtr, newItem, &r, NULL))
685  InvalidateRect (infoPtr->hwnd, &r, TRUE);
686  }
687  else
688  {
689  INT i;
690  BOOL pressed = FALSE;
691 
692  /* any button pressed ? */
693  for (i = 0; i < infoPtr->uNumItem; i++)
694  if ((TAB_GetItem (infoPtr, i)->dwState & TCIS_BUTTONPRESSED) &&
695  (infoPtr->iSelected != i))
696  {
697  pressed = TRUE;
698  break;
699  }
700 
702  return 0;
703 
704  if (pressed)
705  TAB_DeselectAll (infoPtr, FALSE);
706  else
707  TAB_SetCurSel(infoPtr, newItem);
708 
710  }
711  }
712 
713  return 0;
714 }
#define WM_LBUTTONDOWN
Definition: winuser.h:1763
UINT uNumItem
Definition: tab.c:96
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define TCS_BUTTONS
Definition: commctrl.h:3948
DWORD dwState
Definition: tab.c:75
HWND WINAPI SetFocus(_In_opt_ HWND)
int32_t INT
Definition: typedefs.h:58
static INT TAB_InternalHitTest(const TAB_INFO *infoPtr, POINT pt, UINT *flags)
Definition: tab.c:594
WPARAM wParam
Definition: combotst.c:138
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TCIS_BUTTONPRESSED
Definition: commctrl.h:3977
#define TCS_FOCUSNEVER
Definition: commctrl.h:3957
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
static BOOL TAB_SendSimpleNotify(const TAB_INFO *infoPtr, UINT code)
Definition: tab.c:173
#define TCN_SELCHANGE
Definition: commctrl.h:4132
static LRESULT TAB_DeselectAll(TAB_INFO *, BOOL)
Definition: tab.c:3234
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
INT iSelected
Definition: tab.c:111
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 TCS_MULTISELECT
Definition: commctrl.h:3941
unsigned char dummy
Definition: maze.c:118
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define MK_CONTROL
Definition: winuser.h:2350
static LRESULT TAB_SetCurSel(TAB_INFO *infoPtr, INT iItem)
Definition: tab.c:249
#define HIWORD(l)
Definition: typedefs.h:247
static void TAB_RelayEvent(HWND hwndTip, HWND hwndMsg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: tab.c:186
#define TCN_SELCHANGING
Definition: commctrl.h:4133
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
HWND hwndToolTip
Definition: tab.c:108

Referenced by TAB_WindowProc().

◆ TAB_LButtonUp()

static LRESULT TAB_LButtonUp ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 717 of file tab.c.

718 {
719  TAB_SendSimpleNotify(infoPtr, NM_CLICK);
720 
721  return 0;
722 }
static BOOL TAB_SendSimpleNotify(const TAB_INFO *infoPtr, UINT code)
Definition: tab.c:173
#define NM_CLICK
Definition: commctrl.h:130

Referenced by TAB_WindowProc().

◆ TAB_MouseMove()

static LRESULT TAB_MouseMove ( TAB_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 916 of file tab.c.

917 {
918  int redrawLeave;
919  int redrawEnter;
920 
921  if (infoPtr->hwndToolTip)
922  TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd,
924 
925  /* Determine which tab to highlight. Redraw tabs which change highlight
926  ** status. */
927  TAB_RecalcHotTrack(infoPtr, &lParam, &redrawLeave, &redrawEnter);
928 
929  hottrack_refresh (infoPtr, redrawLeave);
930  hottrack_refresh (infoPtr, redrawEnter);
931 
932  return 0;
933 }
#define WM_LBUTTONDOWN
Definition: winuser.h:1763
WPARAM wParam
Definition: combotst.c:138
static void TAB_RecalcHotTrack(TAB_INFO *infoPtr, const LPARAM *pos, int *out_redrawLeave, int *out_redrawEnter)
Definition: tab.c:836
static void hottrack_refresh(const TAB_INFO *infoPtr, int tabIndex)
Definition: tab.c:757
HWND hwnd
Definition: tab.c:94
static void TAB_RelayEvent(HWND hwndTip, HWND hwndMsg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: tab.c:186
LPARAM lParam
Definition: combotst.c:139
HWND hwndToolTip
Definition: tab.c:108

Referenced by TAB_WindowProc().

◆ TAB_NCCalcSize()

static LRESULT TAB_NCCalcSize ( WPARAM  wParam)
static

Definition at line 3152 of file tab.c.

3153 {
3154  if (!wParam)
3155  return 0;
3156  return WVR_ALIGNTOP;
3157 }
WPARAM wParam
Definition: combotst.c:138
#define WVR_ALIGNTOP
Definition: winuser.h:2495

Referenced by TAB_WindowProc().

◆ TAB_NCHitTest()

static LRESULT TAB_NCHitTest ( const TAB_INFO infoPtr,
LPARAM  lParam 
)
inlinestatic

Definition at line 634 of file tab.c.

635 {
636  POINT pt;
637  UINT dummyflag;
638 
639  pt.x = (short)LOWORD(lParam);
640  pt.y = (short)HIWORD(lParam);
641  ScreenToClient(infoPtr->hwnd, &pt);
642 
643  if (TAB_InternalHitTest(infoPtr, pt, &dummyflag) == -1)
644  return HTTRANSPARENT;
645  else
646  return HTCLIENT;
647 }
#define HTTRANSPARENT
Definition: winuser.h:2453
#define pt(x, y)
Definition: drawing.c:79
static INT TAB_InternalHitTest(const TAB_INFO *infoPtr, POINT pt, UINT *flags)
Definition: tab.c:594
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
HWND hwnd
Definition: tab.c:94
unsigned int UINT
Definition: ndis.h:50
#define HIWORD(l)
Definition: typedefs.h:247
#define HTCLIENT
Definition: winuser.h:2455
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by TAB_WindowProc().

◆ TAB_OnHScroll()

static LRESULT TAB_OnHScroll ( TAB_INFO infoPtr,
int  nScrollCode,
int  nPos 
)
static

Definition at line 1001 of file tab.c.

1002 {
1003  if(nScrollCode == SB_THUMBPOSITION && nPos != infoPtr->leftmostVisible)
1004  {
1005  if(nPos < infoPtr->leftmostVisible)
1006  infoPtr->leftmostVisible--;
1007  else
1008  infoPtr->leftmostVisible++;
1009 
1010  TAB_RecalcHotTrack(infoPtr, NULL, NULL, NULL);
1011  TAB_InvalidateTabArea(infoPtr);
1012  SendMessageW(infoPtr->hwndUpDown, UDM_SETPOS, 0,
1013  MAKELONG(infoPtr->leftmostVisible, 0));
1014  }
1015 
1016  return 0;
1017 }
INT leftmostVisible
Definition: tab.c:109
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define SB_THUMBPOSITION
Definition: winuser.h:572
static void TAB_RecalcHotTrack(TAB_INFO *infoPtr, const LPARAM *pos, int *out_redrawLeave, int *out_redrawEnter)
Definition: tab.c:836
HWND hwndUpDown
Definition: tab.c:119
static void TAB_InvalidateTabArea(const TAB_INFO *)
Definition: tab.c:2548
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define UDM_SETPOS
Definition: commctrl.h:2143
#define NULL
Definition: types.h:112

Referenced by TAB_WindowProc().

◆ TAB_Paint()

static LRESULT TAB_Paint ( TAB_INFO infoPtr,
HDC  hdcPaint 
)
inlinestatic

Definition at line 2603 of file tab.c.

2604 {
2605  HDC hdc;
2606  PAINTSTRUCT ps;
2607 
2608  if (hdcPaint)
2609  hdc = hdcPaint;
2610  else
2611  {
2612  hdc = BeginPaint (infoPtr->hwnd, &ps);
2613  TRACE("erase %d, rect=(%s)\n", ps.fErase, wine_dbgstr_rect(&ps.rcPaint));
2614  }
2615 
2616  TAB_Refresh (infoPtr, hdc);
2617 
2618  if (!hdcPaint)
2619  EndPaint (infoPtr->hwnd, &ps);
2620 
2621  return 0;
2622 }
static HDC
Definition: imagelist.c:92
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define TRACE(s)
Definition: solgame.cpp:4
const char * wine_dbgstr_rect(const RECT *rect)
HDC hdc
Definition: main.c:9
HWND hwnd
Definition: tab.c:94
static void TAB_Refresh(const TAB_INFO *infoPtr, HDC hdc)
Definition: tab.c:2373

Referenced by TAB_WindowProc().

◆ TAB_RButtonUp()

static void TAB_RButtonUp ( const TAB_INFO infoPtr)
inlinestatic

Definition at line 725 of file tab.c.

726 {
728 }
static BOOL TAB_SendSimpleNotify(const TAB_INFO *infoPtr, UINT code)
Definition: tab.c:173
#define NM_RCLICK
Definition: commctrl.h:133

Referenced by TAB_WindowProc().

◆ TAB_RecalcHotTrack()

static void TAB_RecalcHotTrack ( TAB_INFO infoPtr,
const LPARAM pos,
int out_redrawLeave,
int out_redrawEnter 
)
static

Definition at line 836 of file tab.c.

842 {
843  int item = -1;
844 
845 
846  if (out_redrawLeave != NULL)
847  *out_redrawLeave = -1;
848  if (out_redrawEnter != NULL)
849  *out_redrawEnter = -1;
850 
851  if ((infoPtr->dwStyle & TCS_HOTTRACK) || GetWindowTheme(infoPtr->hwnd))
852  {
853  POINT pt;
854  UINT flags;
855 
856  if (pos == NULL)
857  {
858  GetCursorPos(&pt);
859  ScreenToClient(infoPtr->hwnd, &pt);
860  }
861  else
862  {
863  pt.x = (short)LOWORD(*pos);
864  pt.y = (short)HIWORD(*pos);
865  }
866 
867  item = TAB_InternalHitTest(infoPtr, pt, &flags);
868  }
869 
870  if (item != infoPtr->iHotTracked)
871  {
872  if (infoPtr->iHotTracked >= 0)
873  {
874  /* Mark currently hot-tracked to be redrawn to look normal */
875  if (out_redrawLeave != NULL)
876  *out_redrawLeave = infoPtr->iHotTracked;
877 
878  if (item < 0)
879  {
880  /* Kill timer which forces recheck of mouse pos */
881  KillTimer(infoPtr->hwnd, TAB_HOTTRACK_TIMER);
882  }
883  }
884  else
885  {
886  /* Start timer so we recheck mouse pos */
887  UINT timerID = SetTimer
888  (
889  infoPtr->hwnd,
893  );
894 
895  if (timerID == 0)
896  return; /* Hot tracking not available */
897  }
898 
899  infoPtr->iHotTracked = item;
900 
901  if (item >= 0)
902  {
903  /* Mark new hot-tracked to be redrawn to look highlighted */
904  if (out_redrawEnter != NULL)
905  *out_redrawEnter = item;
906  }
907  }
908 }
static void CALLBACK TAB_HotTrackTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: tab.c:784
#define TAB_HOTTRACK_TIMER
Definition: tab.c:152
#define pt(x, y)
Definition: drawing.c:79
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
#define TCS_HOTTRACK
Definition: commctrl.h:3945
static INT TAB_InternalHitTest(const TAB_INFO *infoPtr, POINT pt, UINT *flags)
Definition: tab.c:594
#define TAB_HOTTRACK_TIMER_INTERVAL
Definition: tab.c:153
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
GLbitfield flags
Definition: glext.h:7161
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
INT iHotTracked
Definition: tab.c:112
static ATOM item
Definition: dde.c:856
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define HIWORD(l)
Definition: typedefs.h:247
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define LOWORD(l)
Definition: pedump.c:82

Referenced by TAB_EnsureSelectionVisible(), TAB_MouseMove(), TAB_OnHScroll(), and TAB_SetItemBounds().

◆ TAB_Refresh()

static void TAB_Refresh ( const TAB_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 2373 of file tab.c.

2374 {
2375  HFONT hOldFont;
2376  INT i;
2377 
2378  if (!infoPtr->DoRedraw)
2379  return;
2380 
2381  hOldFont = SelectObject (hdc, infoPtr->hFont);
2382 
2383  if (infoPtr->dwStyle & TCS_BUTTONS)
2384  {
2385  for (i = 0; i < infoPtr->uNumItem; i++)
2386  TAB_DrawItem (infoPtr, hdc, i);
2387  }
2388  else
2389  {
2390  /* Draw all the non selected item first */
2391  for (i = 0; i < infoPtr->uNumItem; i++)
2392  {
2393  if (i != infoPtr->iSelected)
2394  TAB_DrawItem (infoPtr, hdc, i);
2395  }
2396 
2397  /* Now, draw the border, draw it before the selected item
2398  * since the selected item overwrites part of the border. */
2399  TAB_DrawBorder (infoPtr, hdc);
2400 
2401  /* Then, draw the selected item */
2402  TAB_DrawItem (infoPtr, hdc, infoPtr->iSelected);
2403  }
2404 
2405  SelectObject (hdc, hOldFont);
2406 }
UINT uNumItem
Definition: tab.c:96
HFONT hFont
Definition: tab.c:105
#define TCS_BUTTONS
Definition: commctrl.h:3948
static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC hdc, INT iItem)
Definition: tab.c:1990
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
int32_t INT
Definition: typedefs.h:58
BOOL DoRedraw
Definition: tab.c:114
HDC hdc
Definition: main.c:9
INT iSelected
Definition: tab.c:111
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
DWORD dwStyle
Definition: tab.c:124
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static void TAB_DrawBorder(const TAB_INFO *infoPtr, HDC hdc)
Definition: tab.c:2337

Referenced by TAB_Paint().

◆ TAB_Register()

void TAB_Register ( void  )

Definition at line 3476 of file tab.c.

3477 {
3478  WNDCLASSW wndClass;
3479 
3480  ZeroMemory (&wndClass, sizeof(WNDCLASSW));
3482  wndClass.lpfnWndProc = TAB_WindowProc;
3483  wndClass.cbClsExtra = 0;
3484  wndClass.cbWndExtra = sizeof(TAB_INFO *);
3485  wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
3486  wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
3487  wndClass.lpszClassName = WC_TABCONTROLW;
3488 
3489  RegisterClassW (&wndClass);
3490 }
UINT style
Definition: winuser.h:3156
#define ZeroMemory
Definition: winbase.h:1667
#define CS_HREDRAW
Definition: winuser.h:648
int cbClsExtra
Definition: winuser.h:3158
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
WNDPROC lpfnWndProc
Definition: winuser.h:3157
LPCWSTR lpszClassName
Definition: winuser.h:3165
#define CS_VREDRAW
Definition: winuser.h:653
int cbWndExtra
Definition: winuser.h:3159
#define CS_GLOBALCLASS
Definition: winuser.h:647
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define COLOR_BTNFACE
Definition: winuser.h:922
#define WC_TABCONTROLW
Definition: commctrl.h:3935
#define CS_DBLCLKS
Definition: winuser.h:646
HCURSOR hCursor
Definition: winuser.h:3162
HBRUSH hbrBackground
Definition: winuser.h:3163
Definition: tab.c:92
#define IDC_ARROW
Definition: winuser.h:682
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static LRESULT WINAPI TAB_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: tab.c:3296

Referenced by DllMain().

◆ TAB_RelayEvent()

static void TAB_RelayEvent ( HWND  hwndTip,
HWND  hwndMsg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 186 of file tab.c.

188 {
189  MSG msg;
190 
191  msg.hwnd = hwndMsg;
192  msg.message = uMsg;
193  msg.wParam = wParam;
194  msg.lParam = lParam;
195  msg.time = GetMessageTime ();
196  msg.pt.x = (short)LOWORD(GetMessagePos ());
197  msg.pt.y = (short)HIWORD(GetMessagePos ());
198 
199  SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
200 }
#define TTM_RELAYEVENT
Definition: commctrl.h:1792
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
LONG WINAPI GetMessageTime(void)
Definition: message.c:1361
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
WPARAM wParam
Definition: combotst.c:138
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:247
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by TAB_LButtonDown(), and TAB_MouseMove().

◆ TAB_RemoveImage()

static LRESULT TAB_RemoveImage ( TAB_INFO infoPtr,
INT  image 
)
static

Definition at line 3170 of file tab.c.

3171 {
3172  TRACE("%p %d\n", infoPtr, image);
3173 
3174  if (ImageList_Remove (infoPtr->himl, image))
3175  {
3176  INT i, *idx;
3177  RECT r;
3178 
3179  /* shift indices, repaint items if needed */
3180  for (i = 0; i < infoPtr->uNumItem; i++)
3181  {
3182  idx = &TAB_GetItem(infoPtr, i)->iImage;
3183  if (*idx >= image)
3184  {
3185  if (*idx == image)
3186  *idx = -1;
3187  else
3188  (*idx)--;
3189 
3190  /* repaint item */
3191  if (TAB_InternalGetItemRect (infoPtr, i, &r, NULL))
3192  InvalidateRect (infoPtr->hwnd, &r, TRUE);
3193  }
3194  }
3195  }
3196 
3197  return 0;
3198 }
UINT uNumItem
Definition: tab.c:96
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int32_t INT
Definition: typedefs.h:58
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
unsigned int idx
Definition: utils.c:41
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI ImageList_Remove(HIMAGELIST himl, INT i)
Definition: imagelist.c:2568
INT iImage
Definition: tab.c:77
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HIMAGELIST himl
Definition: tab.c:107
HWND hwnd
Definition: tab.c:94
#define NULL
Definition: types.h:112

Referenced by TAB_WindowProc().

◆ TAB_SendSimpleNotify()

static BOOL TAB_SendSimpleNotify ( const TAB_INFO infoPtr,
UINT  code 
)
static

Definition at line 173 of file tab.c.

174 {
175  NMHDR nmhdr;
176 
177  nmhdr.hwndFrom = infoPtr->hwnd;
178  nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwnd, GWLP_ID);
179  nmhdr.code = code;
180 
181  return (BOOL) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
182  nmhdr.idFrom, (LPARAM) &nmhdr);
183 }
#define GetWindowLongPtrW
Definition: winuser.h:4809
UINT code
Definition: winuser.h:3139
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT_PTR idFrom
Definition: winuser.h:3138
HWND hwndNotify
Definition: tab.c:95
LONG_PTR LPARAM
Definition: windef.h:208
HWND hwndFrom
Definition: winuser.h:3137
int code
Definition: main.c:75
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hwnd
Definition: tab.c:94
#define GWLP_ID
Definition: winuser.h:854
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by TAB_LButtonDown(), TAB_LButtonUp(), TAB_RButtonUp(), and TAB_SetCurFocus().

◆ TAB_SetCurFocus()

static LRESULT TAB_SetCurFocus ( TAB_INFO infoPtr,
INT  iItem 
)
static

Definition at line 281 of file tab.c.

282 {
283  TRACE("(%p %d)\n", infoPtr, iItem);
284 
285  if (iItem < 0) {
286  infoPtr->uFocus = -1;
287  if (infoPtr->iSelected != -1) {
288 #ifdef __REACTOS__
289  TAB_GetItem(infoPtr, infoPtr->iSelected)->dwState &= ~TCIS_BUTTONPRESSED;
290 #endif
291  infoPtr->iSelected = -1;
293  TAB_InvalidateTabArea(infoPtr);
294  }
295  }
296  else if (iItem < infoPtr->uNumItem) {
297  if (infoPtr->dwStyle & TCS_BUTTONS) {
298  /* set focus to new item, leave selection as is */
299  if (infoPtr->uFocus != iItem) {
300  INT prev_focus = infoPtr->uFocus;
301  RECT r;
302 
303  infoPtr->uFocus = iItem;
304 
305  if (prev_focus != infoPtr->iSelected) {
306  if (TAB_InternalGetItemRect(infoPtr, prev_focus, &r, NULL))
307  InvalidateRect(infoPtr->hwnd, &r, FALSE);
308  }
309 
310  if (TAB_InternalGetItemRect(infoPtr, iItem, &r, NULL))
311  InvalidateRect(infoPtr->hwnd, &r, FALSE);
312 
314  }
315  } else {
316 #ifdef __REACTOS__
317  INT oldItem = infoPtr->iSelected;
318 #endif
319  INT oldFocus = infoPtr->uFocus;
320  if (infoPtr->iSelected != iItem || oldFocus == -1 ) {
321  infoPtr->uFocus = iItem;
322  if (oldFocus != -1) {
323  if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) {
324 #ifdef __REACTOS__
325  if (oldItem != -1)
326  TAB_GetItem(infoPtr, oldItem)->dwState &= ~TCIS_BUTTONPRESSED;
327 #endif
328  infoPtr->iSelected = iItem;
329 #ifdef __REACTOS__
330  TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED;
331 #endif
333  }
334  else
335  infoPtr->iSelected = iItem;
337  TAB_InvalidateTabArea(infoPtr);
338  }
339  }
340  }
341  }
342  return 0;
343 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define TCS_BUTTONS
Definition: commctrl.h:3948
DWORD dwState
Definition: tab.c:75
INT uFocus
Definition: tab.c:113
int32_t INT
Definition: typedefs.h:58
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define FALSE
Definition: types.h:117
#define TCIS_BUTTONPRESSED
Definition: commctrl.h:3977
static BOOL TAB_InternalGetItemRect(const TAB_INFO *, INT, RECT *, RECT *)
Definition: tab.c:372
static BOOL TAB_SendSimpleNotify(const TAB_INFO *infoPtr, UINT code)
Definition: tab.c:173
#define TCN_SELCHANGE
Definition: commctrl.h:4132
#define TRACE(s)
Definition: solgame.cpp:4
static void TAB_EnsureSelectionVisible(TAB_INFO *)
Definition: tab.c:2426
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static void TAB_InvalidateTabArea(const TAB_INFO *)
Definition: tab.c:2548
INT iSelected
Definition: tab.c:111
HWND hwnd
Definition: tab.c:94
DWORD dwStyle
Definition: tab.c:124
#define TCN_FOCUSCHANGE
Definition: commctrl.h:4135
#define NULL
Definition: types.h:112
#define TCN_SELCHANGING
Definition: commctrl.h:4133

Referenced by TAB_InsertItemT(), TAB_KeyDown(), and TAB_WindowProc().

◆ TAB_SetCurSel()

static LRESULT TAB_SetCurSel ( TAB_INFO infoPtr,
INT  iItem 
)
inlinestatic

Definition at line 249 of file tab.c.

250 {
251  INT prevItem = infoPtr->iSelected;
252 
253  TRACE("(%p %d)\n", infoPtr, iItem);
254 
255  if (iItem >= (INT)infoPtr->uNumItem)
256  return -1;
257 
258  if (prevItem != iItem) {
259  if (prevItem != -1)
260  TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED;
261 
262  if (iItem >= 0)
263  {
264  TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED;
265  infoPtr->iSelected = iItem;
266  infoPtr->uFocus = iItem;
267  }
268  else
269  {
270  infoPtr->iSelected = -1;
271  infoPtr->uFocus = -1;
272  }
273 
275  TAB_InvalidateTabArea(infoPtr);
276  }
277 
278  return prevItem;
279 }
UINT uNumItem
Definition: tab.c:96
DWORD dwState
Definition: tab.c:75
INT uFocus
Definition: tab.c:113
int32_t INT
Definition: typedefs.h:58
static TAB_ITEM * TAB_GetItem(const TAB_INFO *infoPtr, INT i)
Definition: tab.c:157
#define TCIS_BUTTONPRESSED
Definition: commctrl.h:3977
#define TRACE(s)
Definition: solgame.cpp:4
static void TAB_EnsureSelectionVisible(TAB_INFO *)
Definition: tab.c:2426
static void TAB_InvalidateTabArea(const TAB_INFO *)
Definition: tab.c:2548
INT iSelected
Definition: tab.c:111

Referenced by TAB_LButtonDown(), and TAB_WindowProc().

◆ TAB_SetExtendedStyle()

static LRESULT TAB_SetExtendedStyle ( TAB_INFO infoPtr,
DWORD  exMask,
DWORD  exStyle 
)
static

Definition at line 3201 of file tab.c.

3202 {
3203  DWORD prevstyle = infoPtr->exStyle;
3204 
3205  /* zero mask means all styles */
3206  if (exMask == 0) exMask = ~0;
3207 
3208  if (exMask & TCS_EX_REGISTERDROP)
3209  {
3210  FIXME("TCS_EX_REGISTERDROP style unimplemented\n");
3211  exMask &= ~TCS_EX_REGISTERDROP;
3212  exStyle &= ~TCS_EX_REGISTERDROP;
3213  }
3214 
3215  if (exMask & TCS_EX_FLATSEPARATORS)
3216  {
3217  if ((prevstyle ^ exStyle) & TCS_EX_FLATSEPARATORS)
3218  {
3219  infoPtr->exStyle ^= TCS_EX_FLATSEPARATORS;
3220  TAB_InvalidateTabArea(infoPtr);
3221  }
3222  }
3223 
3224  return prevstyle;
3225 }
#define TCS_EX_REGISTERDROP
Definition: commctrl.h:3960
#define TCS_EX_FLATSEPARATORS
Definition: commctrl.h:3959
#define FIXME(fmt,...)
Definition: debug.h:111
unsigned long DWORD
Definition: ntddk_ex.h:95
static void TAB_InvalidateTabArea(const TAB_INFO *)
Definition: tab.c:2548
DWORD exStyle
Definition: tab.c:122

Referenced by TAB_WindowProc().

◆ TAB_SetFont()

static LRESULT TAB_SetFont ( TAB_INFO infoPtr,
HFONT  hNewFont 
)
inlinestatic

Definition at line 2922 of file tab.c.

2923 {
2924  TRACE("(%p,%p)\n", infoPtr, hNewFont);
2925 
2926  infoPtr->hFont = hNewFont;
2927 
2928  TAB_SetItemBounds(infoPtr);
2929 
2930  TAB_InvalidateTabArea(infoPtr);
2931 
2932  return 0;
2933 }
HFONT hFont
Definition: tab.c:105
#define TRACE(s)