ReactOS 0.4.15-dev-8138-g1e75ea8
treelist.c File Reference
#include "reactos.h"
#include "treelist.h"
Include dependency graph for treelist.c:

Go to the source code of this file.

Classes

struct  BaseItem
 
struct  ExtraItem
 
struct  ColumnData
 
struct  TreeListData
 

Macros

#define new(TYPE, numElems)    HeapAlloc(GetProcessHeap(), 0, (numElems) * sizeof(TYPE))
 
#define delete(ptr)    HeapFree(GetProcessHeap(), 0, (ptr))
 
#define GWLP_USERDATA   GWL_USERDATA
 
#define GWLP_WNDPROC   GWL_WNDPROC
 
#define SetWindowLongPtr   SetWindowLong
 
#define GetWindowLongPtr   GetWindowLong
 
#define DWORD_PTR   DWORD
 
#define LONG_PTR   LONG
 
#define str_len   (unsigned)strlen
 
#define str_cmp   strcmp
 
#define str_ncpy   strncpy
 
#define str_ncmp   strncmp
 
#define str_icmp   _stricmp
 
#define WM_MOUSEWHEEL   0x020A
 
#define WHEEL_DELTA   120
 
#define MAX_COLUMNS   32
 
#define MAX_COLORS   16
 
#define EN_SETTEXT   0x1000
 
#define EN_RETURN   0x1578
 
#define EN_ESCAPE   0x1579
 
#define ID_TOOLTIPCHECK   0x3912
 
#define SORT_NOUPDATE   1234567
 
#define VK_ISACHAR   0x01000000
 
#define FIRST_LINE   0xFFFFFFFE
 
#define FROM_HEADER   0x88776655
 
#define I_CCB   I_CHILDRENCALLBACK
 
#define U(h)   ((unsigned)(ULONG_PTR)(h))
 
#define THEMEIMGLIST   ((HIMAGELIST)1)
 
#define GetHandle(h)   ((TreeListData*)GetWindowLongPtr(h,0))
 
#define TVIF_ALL   (TVIF_CHILDREN|TVIF_HANDLE|TVIF_IMAGE|TVIF_PARAM|TVIF_SELECTEDIMAGE|TVIF_STATE|TVIF_TEXT)
 
#define UNLOCK(d)   ReleaseSemaphore(d->hSem,1,NULL)
 
#define LOCK(d)   WaitForSingleObject(d->hSem,INFINITE)
 
#define TVIS_EDIT(m)   ((1<<m)&((1<<TVAX_EDIT)|(1<<TVAX_COMBO)|(1<<TVAX_STEPED)|(1<<TVAX_CHECKED)))
 
#define TVIS_BASEFLAGS   (TVIS_EXPANDED|TVIS_EXPANDEDONCE|TVIS_EXPANDPARTIAL|TVIS_SELECTED)
 
#define TVIS_TRACKED   (TVIX_TRACKED<<16)
 
#define TVIS_BKCOLOR   (TVIX_BKCOLOR<<16)
 
#define TVIS_FOCUSED   (TVIX_FOCUSED<<16)
 
#define TVIS_TEXTCOLOR   (TVIX_TEXTCOLOR<<16)
 
#define TVC_ONLYFOCUS   TVIF_ONLYFOCUS
 
#define TVC_UNSELECT   0x4000
 
#define TVC_DESELECT   0x8000
 
#define DEFAULT_IDENT   19
 
#define DEFAULT_SHIFT   7
 
#define BPBF_COMPATIBLEBITMAP   0
 
#define TVP_GLYPH   2
 
#define GLPS_CLOSED   1
 
#define GLPS_OPENED   2
 
#define BP_CHECKBOX   3
 
#define CBS_UNCHECKEDNORMAL   1
 
#define CBS_CHECKEDNORMAL   5
 
#define TVAX_NONE   (TVAE_NONE >>TVAE_MODEPOS)
 
#define TVAX_EDIT   (TVAE_EDIT >>TVAE_MODEPOS)
 
#define TVAX_COMBO   (TVAE_COMBO >>TVAE_MODEPOS)
 
#define TVAX_CBLIST   (TVAE_CBLIST >>TVAE_MODEPOS)
 
#define TVAX_STEP   (TVAE_STEP >>TVAE_MODEPOS)
 
#define TVAX_STEPED   (TVAE_STEPED >>TVAE_MODEPOS)
 
#define TVAX_CHECK   (TVAE_CHECK >>TVAE_MODEPOS)
 
#define TVAX_CHECKED   (TVAE_CHECKED>>TVAE_MODEPOS)
 
#define TVIX_VARBUTTON   0x01
 
#define TVIX_HASBUTTON   0x02
 
#define TVIX_HASIMAGE   0x04
 
#define TVIX_TRACKED   0x08
 
#define TVIX_TEXTCOLOR   0x10
 
#define TVIX_BKCOLOR   0x20
 
#define TVIX_FOCUSED   0x40
 
#define XCHANGE_MEM(a, b)   uTemp=pItemList[a];pItemList[a]=pItemList[b];pItemList[b]=uTemp;
 
#define XCHANGE_MEM(a, b)   uTemp=pItemList[a];pItemList[a]=pItemList[b];pItemList[b]=uTemp;
 
#define XCHANGE_MEM(a, b)   uTemp=pItemList[a];pItemList[a]=pItemList[b];pItemList[b]=uTemp;
 

Typedefs

typedef HRESULT(WINAPISetWindowThemeT) (HWND, LPCWSTR, LPCWSTR)
 
typedef HRESULT(WINAPIEndBufferedPtT) (HANDLE, BOOL)
 
typedef HANDLE(WINAPIBeginBufferedPnT) (HDC, RECT *, DWORD, LPVOID, HDC *)
 
typedef HRESULT(WINAPIBufferedPtInitT) (VOID)
 
typedef LPVOID(WINAPIOpenThemeDataT) (HWND hwnd, LPCWSTR pszClassList)
 
typedef HRESULT(WINAPICloseThemeDataT) (LPVOID)
 
typedef HRESULT(WINAPIDrawThemeBackgT) (LPVOID, HDC, int, int, const RECT *, const RECT *)
 
typedef HRESULT(WINAPIGetThemeBackgRcT) (LPVOID, HDC, int, int, LPCRECT, LPRECT)
 
typedef BOOL(WINAPIIsAppThemedT) ()
 
typedef BOOL(WINAPIIsThemeActiveT) ()
 

Functions

static void TreeListDraw (HWND hWnd, HDC hDc, RECT *pRect)
 
static LRESULT CALLBACK TreeListProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static int TreeListSelectItem (TreeListData *pData, unsigned uItem, unsigned uSubItem, int iMode)
 
static int TreeListGetItemRect (TreeListData *pData, unsigned uItem, unsigned uFlags, RECT *pRect)
 
static int TreeListStartNotifyEdit (TreeListData *pData, unsigned uItem, unsigned uSub, WPARAM wParam, LPARAM lParam)
 
static int TreeListStartAutoEdit (TreeListData *pData, unsigned uColumn, WPARAM wParam, LPARAM lParam)
 
static int TreeListEndLabelEdit (TreeListData *pData, int iMode)
 
int TreeListRegister (HINSTANCE hInstance)
 
BOOL TreeListUnregister (HINSTANCE hInstance)
 
static void GlobalInit ()
 
static void GlobalDeinit ()
 
static LRESULT SendNotify (TreeListData *pData, NMHDR *pNotify)
 
static void CallbackEntry (TreeListData *pData, BaseItem *pEntry, unsigned uItem, unsigned uFlags, int *iImage, unsigned *uTextSize, LPCTSTR *pText)
 
static void CallbackExtra (TreeListData *pData, BaseItem *pEntry, ExtraItem *pExtra, unsigned uItem, unsigned uSub, unsigned uFlags, int *iImage, unsigned *uTextSize, LPCTSTR *pText)
 
static LRESULT CALLBACK EditProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK ToolProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void ChangeColSize (TreeListData *pData, int iDelta)
 
static void CreateToolTip (TreeListData *pData)
 
static void CreateStateImageList (TreeListData *pData, int iMode)
 
static HIMAGELIST CreateDragImage (TreeListData *pData, unsigned uItem, unsigned uSub)
 
static void UpdateColorsList (TreeListData *pData)
 
static int UpdateHeight (TreeListData *pData)
 
static int UpdateRect (TreeListData *pData, unsigned uItem, unsigned uSub)
 
static int UpdateColRect (TreeListData *pData, unsigned uColumn)
 
static int UpdateRow (TreeListData *pData, unsigned uItem)
 
static void UpdateView (TreeListData *pData)
 
static void UpdateScrollX (TreeListData *pData)
 
static void UpdateScrollY (TreeListData *pData)
 
static void UpdateToolTip (TreeListData *pData, unsigned uItem, unsigned uFlags)
 
static int CreateFontset (TreeListData *pData, HFONT hFont)
 
static int UpdateFont (TreeListData *pData)
 
static void UpdateItems (TreeListData *pData, unsigned uItem)
 
static int UpdateColumns (TreeListData *pData)
 
static int TreeListSetOrderArray (TreeListData *pData, unsigned uItems, unsigned *pArray)
 
static int TreeListToggleItem (TreeListData *pData, unsigned uItem, unsigned uAddFlags)
 
static int TreeListEnsureVisible (TreeListData *pData, unsigned uItem, unsigned uSub)
 
static int TreeListIsVisible (TreeListData *pData, unsigned uItem, unsigned uSub)
 
static int TreeListDeleteItem (TreeListData *pData, unsigned uItem, int iMode)
 
static int TreeListXorSelectItem (TreeListData *pData, unsigned uItem, int iMode)
 
static void TreeListRemoveFocus (TreeListData *pData)
 
static int TreeListSetFocus (TreeListData *pData, unsigned uItem, unsigned uSub)
 
static int TreeListSelectChilds (TreeListData *pData, unsigned uItem, int iMode)
 
static unsigned TreeListInsertItem (TreeListData *pData, TV_INSERTSTRUCT *pInsert)
 
static int TreeListSetItem (TreeListData *pData, const TV_ITEM *pItem)
 
static unsigned TreeListGetItem (TreeListData *pData, TV_ITEM *pItem)
 
static int TreeListDeleteColumn (TreeListData *pData, unsigned uCol)
 
static int TreeListInsertColumn (TreeListData *pData, unsigned uCol, TV_COLUMN *pColumn)
 
static int TreeListScanColumn (TreeListData *pData, unsigned uSub)
 
static unsigned TreeListHitTest (TreeListData *pData, TV_HITTESTINFO *pInfo)
 
static unsigned TreeListSetInsertMark (TreeListData *pData, unsigned uItem, int iMode)
 
static LRESULT TreeListGetItemColor (TreeListData *pData, unsigned uItem, unsigned uSub, int iMode)
 
static COLORREF TreeListSetItemColor (TreeListData *pData, unsigned uItem, unsigned uSub, COLORREF uColor, int iMode)
 
static int TreeListSetTrackItem (TreeListData *pData, unsigned uItem, unsigned uSub)
 
static unsigned TreeListGetNextItem (TreeListData *pData, unsigned uItem, unsigned uFlags)
 
static unsigned TreeListFindItem (TreeListData *pData, unsigned uItem, TVFIND *pFind)
 
static unsigned TreeListNextSelUntil (TreeListData *pData, unsigned uItem, unsigned uStop)
 
static unsigned TreeListNextUnselUntil (TreeListData *pData, unsigned uItem, unsigned uStop)
 
static void TreeListChangeCheckbox (TreeListData *pData, UINT uItem, int iPosX, int iPosY)
 
static void TreeListMouseNotify (TreeListData *pData, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void TreeListMouseClick (TreeListData *pData, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void TreeListChar (TreeListData *pData, UINT nChar, LPARAM lParam)
 
static void TreeListKeyDown (TreeListData *pData, WPARAM wParam, LPARAM lParam)
 
static int TreeListSortItemsEx (TreeListData *pData, TV_SORTEX *pSortData, int iMode)
 
static int TreeListSortItemsCb (TreeListData *pData, TV_SORTCB *pSortData, int iMode)
 
static int TreeListSortItems (TreeListData *pData, unsigned uParent, int iMode)
 
static HWND TreeListEditLabel (TreeListData *pData, unsigned uItem, unsigned uSub)
 

Variables

static HMODULE hUxThemeDll = NULL
 
static SetWindowThemeT pSetWindowTheme = NULL
 
static EndBufferedPtT pEndBufferedPt = NULL
 
static BeginBufferedPnT pBeginBufferedPt = NULL
 
static BufferedPtInitT pBufferedPtInit = NULL
 
static BufferedPtInitT pBufferedPtExit = NULL
 
static OpenThemeDataT pOpenThemeData = NULL
 
static CloseThemeDataT pCloseThemeData = NULL
 
static DrawThemeBackgT pDrawThemeBackg = NULL
 
static GetThemeBackgRcT pGetThemeBackgRc = NULL
 
static IsAppThemedT pIsAppThemed = NULL
 
static IsThemeActiveT pIsThemeActive = NULL
 
static HPEN hPatternPen = NULL
 
static HFONT hDefaultFontN = NULL
 
static HFONT hDefaultFontB = NULL
 
static LONG lWindowCount = -1
 
static RECT sToolRect = { -2, 0, 2, 64}
 
static TCHAR cKeyData [16]
 
static unsigned uKeyLast
 
static unsigned uKeyPos
 
static BOOL bDrawWithTheme = FALSE
 

Macro Definition Documentation

◆ BP_CHECKBOX

#define BP_CHECKBOX   3

Definition at line 145 of file treelist.c.

◆ BPBF_COMPATIBLEBITMAP

#define BPBF_COMPATIBLEBITMAP   0

Definition at line 133 of file treelist.c.

◆ CBS_CHECKEDNORMAL

#define CBS_CHECKEDNORMAL   5

Definition at line 151 of file treelist.c.

◆ CBS_UNCHECKEDNORMAL

#define CBS_UNCHECKEDNORMAL   1

Definition at line 148 of file treelist.c.

◆ DEFAULT_IDENT

#define DEFAULT_IDENT   19

Definition at line 130 of file treelist.c.

◆ DEFAULT_SHIFT

#define DEFAULT_SHIFT   7

Definition at line 131 of file treelist.c.

◆ delete

#define delete (   ptr)     HeapFree(GetProcessHeap(), 0, (ptr))

Definition at line 56 of file treelist.c.

◆ DWORD_PTR

typedef DWORD_PTR   DWORD

Definition at line 76 of file treelist.c.

Referenced by __delayLoadHelper2(), __mingw_GetSectionForAddress(), _SetOperationTexts(), add_unformatted_text_to_control(), CNotifyToolbar::AddButton(), AddJob(), CTaskSwitchWnd::AddTaskItemButton(), ADPCM_StreamOpen(), CKsProxy::AdvisePeriodic(), CKsProxy::AdviseTime(), alarmThreadMain(), alloc_device(), alloc_serverprotoseq(), BackgroundCopyJobConstructor(), BaseRenderer_Init(), bDDCreateSurface(), Binding_Create(), BitmapClipper_Create(), BitmapImpl_Create(), BitmapScaler_Create(), BmpDecoder_Create(), buffer_process_converted_attribute(), CalculateNextStartTime(), CheckThreadState(), chm_dup(), chm_openW(), ComponentEnum_Clone(), ContextPropertyList_Create(), create_binding_protocol(), CreateComponentEnumerator(), CreateIProp(), CISFBand::CreateSimpleToolbar(), CreateTextServices(), CRYPT_CollectionOpenStore(), CRYPT_MemOpenStore(), CRYPT_RegOpenStore(), CryptInitOIDFunctionSet(), custom_action_server(), DdeCallback(), DirectSoundCaptureDevice_Create(), DirectSoundDevice_Create(), do_error_dialog(), DoOpenFile(), DoSaveFile(), dplay_create(), dplobby_create(), dump_exception_info(), dwarf2_virtual_unwind(), DxEngGetDCState(), DxEngGetHdevData(), EnumObjects(), EventsQueue_Init(), field_format_public_key(), FileAsyncReader_Construct(), FilterGraph_create(), FlipRotator_Create(), FormatConverter_CreateInstance(), FTP_Connect(), FTP_FtpFindFirstFileW(), FTP_FtpOpenFileW(), FTP_ReceiveRequestData(), G711_StreamOpen(), get_or_create_threaddata(), get_rtf_text(), GetTimeAsJobTime(), GetWindowThreadProcessId(), GifDecoder_CreateInstance(), GifEncoder_CreateInstance(), handle_create(), HTTP_HttpOpenRequestW(), i386_stack_walk(), IcoDecoder_CreateInstance(), IDirectSoundCaptureBufferImpl_GetCurrentPosition(), IDirectSoundCaptureBufferImpl_Start(), IFileDialogCustomize_fnAddMenu(), Imm32AssignNewLayout(), Imm32CheckImcProcess(), Imm32IsCrossProcessAccess(), INET_QueryOption(), init_handle_table(), initialize_directinput_instance(), InitializeTestImage(), IntFlashWindowEx(), IsBlockFromHeap(), IWICStreamImpl_InitializeFromIStreamRegion(), IWICStreamImpl_InitializeFromMemory(), MCI_MapMsgAtoW(), MCI_SendCommandAsync(), MCIAVI_drvOpen(), MCIAVI_mciStatus(), MCICDA_drvOpen(), mciSendStringW(), MCIWndProc(), ME_StreamInRTFString(), MetadataReader_Create(), midiStreamOpen(), MimeInternational_Construct(), mixerOpen(), MMDevice_Create(), MMDRV_Open(), MmeOpenDevice(), modOpen(), msi_scrolltext_add_text(), MyCompare(), NBCmdQueueCreate(), NBNameCacheCreate(), NetBIOSInit(), NetBIOSRegisterAdapter(), NetBTCall(), NetGroupEnum(), NetGroupGetUsers(), NetLocalGroupEnum(), NtUserCallNoParam(), NtUserCallOneParam(), NtUserCallTwoParam(), NtUserGetThreadState(), NtUserQueryInputContext(), NtUserQueryWindow(), OleUIAddVerbMenuW(), OnControl(), OutputQueue_Construct(), PaletteImpl_Create(), ParseImageSymbols(), paste_rtf(), paste_text(), PCM_StreamOpen(), pdb_virtual_unwind(), PosPassThru_Construct(), PrepareWaveHeader(), ProcessIdToHandle(), promptdisk_init(), PropertyStorage_BaseConstruct(), PropertyStore_CreateInstance(), PullPin_Init(), QCAP_createCaptureGraphBuilder2(), QUARTZ_CreateSystemClock(), query_option(), queue_task(), QueueWaveBuffer(), RegQueryMultipleValuesA(), RegQueryMultipleValuesW(), revoke_class_object_thread(), RpcAssoc_Alloc(), rpcrt4_ncacn_http_alloc(), RunCommand(), RuntimeHost_Construct(), SeekPlayback(), CToolbar< TItemData >::SetItemData(), SetPrinterA(), SetPrinterW(), SHELL_ConfirmDialogW(), SHGetFileInfoW(), show_cursor_thread(), StartPlayback(), StdMemAllocator_create(), STGMEDIUM_UserMarshal(), StopPlayback(), SystemClockImpl_AdvisePeriodic(), SystemClockImpl_AdviseTime(), test_AbortWaitCts(), test_affinity(), test_alignment_style(), test_cf_dataobject(), test_EM_GETMODIFY(), test_EM_SETTEXTEX(), test_EM_STREAMIN(), test_EM_STREAMOUT(), test_EM_STREAMOUT_empty_para(), test_EM_STREAMOUT_FONTTBL(), test_eop_char_fmt(), test_FakeDLL(), test_mciParser(), test_openCloseWAVE(), test_para_numbering(), test_play(), test_query_process(), test_recordWAVE(), test_rtf(), test_SysAllocString(), test_WaitBreak(), test_WaitCts(), test_WaitDcd(), test_WaitDsr(), test_WaitRing(), TgaDecoder_CreateInstance(), timer_queue_cb5(), TogglePlaybackState(), TransformFilter_Init(), TREEVIEW_SendCustomDrawItemNotify(), TREEVIEW_SetCursor(), VerifyObjectOwner(), WahOpenCurrentThread(), wave_out_test_deviceOut(), WbemPath_create(), WbemServices_create(), widCallback(), widOpen(), widPrepare(), WINHELP_SetupText(), WinHttpOpen(), WinHttpRequest_create(), wodOpen(), wodPrepare(), and WPUQueryBlockingCallback().

◆ EN_ESCAPE

#define EN_ESCAPE   0x1579

Definition at line 107 of file treelist.c.

◆ EN_RETURN

#define EN_RETURN   0x1578

Definition at line 106 of file treelist.c.

◆ EN_SETTEXT

#define EN_SETTEXT   0x1000

Definition at line 105 of file treelist.c.

◆ FIRST_LINE

#define FIRST_LINE   0xFFFFFFFE

Definition at line 111 of file treelist.c.

◆ FROM_HEADER

#define FROM_HEADER   0x88776655

Definition at line 112 of file treelist.c.

◆ GetHandle

#define GetHandle (   h)    ((TreeListData*)GetWindowLongPtr(h,0))

Definition at line 116 of file treelist.c.

◆ GetWindowLongPtr

#define GetWindowLongPtr   GetWindowLong

Definition at line 73 of file treelist.c.

◆ GLPS_CLOSED

#define GLPS_CLOSED   1

Definition at line 139 of file treelist.c.

◆ GLPS_OPENED

#define GLPS_OPENED   2

Definition at line 142 of file treelist.c.

◆ GWLP_USERDATA

#define GWLP_USERDATA   GWL_USERDATA

Definition at line 63 of file treelist.c.

◆ GWLP_WNDPROC

#define GWLP_WNDPROC   GWL_WNDPROC

Definition at line 66 of file treelist.c.

◆ I_CCB

Definition at line 113 of file treelist.c.

◆ ID_TOOLTIPCHECK

#define ID_TOOLTIPCHECK   0x3912

Definition at line 108 of file treelist.c.

◆ LOCK

#define LOCK (   d)    WaitForSingleObject(d->hSem,INFINITE)

Definition at line 119 of file treelist.c.

◆ LONG_PTR

◆ MAX_COLORS

#define MAX_COLORS   16

Definition at line 104 of file treelist.c.

◆ MAX_COLUMNS

#define MAX_COLUMNS   32

Definition at line 102 of file treelist.c.

◆ new

#define new (   TYPE,
  numElems 
)     HeapAlloc(GetProcessHeap(), 0, (numElems) * sizeof(TYPE))

Definition at line 54 of file treelist.c.

◆ SetWindowLongPtr

#define SetWindowLongPtr   SetWindowLong

Definition at line 70 of file treelist.c.

◆ SORT_NOUPDATE

#define SORT_NOUPDATE   1234567

Definition at line 109 of file treelist.c.

◆ str_cmp

#define str_cmp   strcmp

Definition at line 90 of file treelist.c.

◆ str_icmp

#define str_icmp   _stricmp

Definition at line 93 of file treelist.c.

◆ str_len

#define str_len   (unsigned)strlen

Definition at line 89 of file treelist.c.

◆ str_ncmp

#define str_ncmp   strncmp

Definition at line 92 of file treelist.c.

◆ str_ncpy

#define str_ncpy   strncpy

Definition at line 91 of file treelist.c.

◆ THEMEIMGLIST

#define THEMEIMGLIST   ((HIMAGELIST)1)

Definition at line 115 of file treelist.c.

◆ TVAX_CBLIST

#define TVAX_CBLIST   (TVAE_CBLIST >>TVAE_MODEPOS)

Definition at line 158 of file treelist.c.

◆ TVAX_CHECK

#define TVAX_CHECK   (TVAE_CHECK >>TVAE_MODEPOS)

Definition at line 161 of file treelist.c.

◆ TVAX_CHECKED

#define TVAX_CHECKED   (TVAE_CHECKED>>TVAE_MODEPOS)

Definition at line 162 of file treelist.c.

◆ TVAX_COMBO

#define TVAX_COMBO   (TVAE_COMBO >>TVAE_MODEPOS)

Definition at line 157 of file treelist.c.

◆ TVAX_EDIT

#define TVAX_EDIT   (TVAE_EDIT >>TVAE_MODEPOS)

Definition at line 156 of file treelist.c.

◆ TVAX_NONE

#define TVAX_NONE   (TVAE_NONE >>TVAE_MODEPOS)

Definition at line 155 of file treelist.c.

◆ TVAX_STEP

#define TVAX_STEP   (TVAE_STEP >>TVAE_MODEPOS)

Definition at line 159 of file treelist.c.

◆ TVAX_STEPED

#define TVAX_STEPED   (TVAE_STEPED >>TVAE_MODEPOS)

Definition at line 160 of file treelist.c.

◆ TVC_DESELECT

#define TVC_DESELECT   0x8000

Definition at line 129 of file treelist.c.

◆ TVC_ONLYFOCUS

#define TVC_ONLYFOCUS   TVIF_ONLYFOCUS

Definition at line 127 of file treelist.c.

◆ TVC_UNSELECT

#define TVC_UNSELECT   0x4000

Definition at line 128 of file treelist.c.

◆ TVIF_ALL

◆ TVIS_BASEFLAGS

Definition at line 121 of file treelist.c.

◆ TVIS_BKCOLOR

#define TVIS_BKCOLOR   (TVIX_BKCOLOR<<16)

Definition at line 123 of file treelist.c.

◆ TVIS_EDIT

#define TVIS_EDIT (   m)    ((1<<m)&((1<<TVAX_EDIT)|(1<<TVAX_COMBO)|(1<<TVAX_STEPED)|(1<<TVAX_CHECKED)))

Definition at line 120 of file treelist.c.

◆ TVIS_FOCUSED

#define TVIS_FOCUSED   (TVIX_FOCUSED<<16)

Definition at line 125 of file treelist.c.

◆ TVIS_TEXTCOLOR

#define TVIS_TEXTCOLOR   (TVIX_TEXTCOLOR<<16)

Definition at line 126 of file treelist.c.

◆ TVIS_TRACKED

#define TVIS_TRACKED   (TVIX_TRACKED<<16)

Definition at line 122 of file treelist.c.

◆ TVIX_BKCOLOR

#define TVIX_BKCOLOR   0x20

Definition at line 169 of file treelist.c.

◆ TVIX_FOCUSED

#define TVIX_FOCUSED   0x40

Definition at line 170 of file treelist.c.

◆ TVIX_HASBUTTON

#define TVIX_HASBUTTON   0x02

Definition at line 165 of file treelist.c.

◆ TVIX_HASIMAGE

#define TVIX_HASIMAGE   0x04

Definition at line 166 of file treelist.c.

◆ TVIX_TEXTCOLOR

#define TVIX_TEXTCOLOR   0x10

Definition at line 168 of file treelist.c.

◆ TVIX_TRACKED

#define TVIX_TRACKED   0x08

Definition at line 167 of file treelist.c.

◆ TVIX_VARBUTTON

#define TVIX_VARBUTTON   0x01

Definition at line 164 of file treelist.c.

◆ TVP_GLYPH

#define TVP_GLYPH   2

Definition at line 136 of file treelist.c.

◆ U

#define U (   h)    ((unsigned)(ULONG_PTR)(h))

Definition at line 114 of file treelist.c.

◆ UNLOCK

#define UNLOCK (   d)    ReleaseSemaphore(d->hSem,1,NULL)

Definition at line 118 of file treelist.c.

◆ VK_ISACHAR

#define VK_ISACHAR   0x01000000

Definition at line 110 of file treelist.c.

◆ WHEEL_DELTA

#define WHEEL_DELTA   120

Definition at line 99 of file treelist.c.

◆ WM_MOUSEWHEEL

#define WM_MOUSEWHEEL   0x020A

Definition at line 96 of file treelist.c.

◆ XCHANGE_MEM [1/3]

#define XCHANGE_MEM (   a,
  b 
)    uTemp=pItemList[a];pItemList[a]=pItemList[b];pItemList[b]=uTemp;

◆ XCHANGE_MEM [2/3]

#define XCHANGE_MEM (   a,
  b 
)    uTemp=pItemList[a];pItemList[a]=pItemList[b];pItemList[b]=uTemp;

◆ XCHANGE_MEM [3/3]

#define XCHANGE_MEM (   a,
  b 
)    uTemp=pItemList[a];pItemList[a]=pItemList[b];pItemList[b]=uTemp;

Typedef Documentation

◆ BeginBufferedPnT

typedef HANDLE(WINAPI * BeginBufferedPnT) (HDC, RECT *, DWORD, LPVOID, HDC *)

Definition at line 346 of file treelist.c.

◆ BufferedPtInitT

typedef HRESULT(WINAPI * BufferedPtInitT) (VOID)

Definition at line 347 of file treelist.c.

◆ CloseThemeDataT

typedef HRESULT(WINAPI * CloseThemeDataT) (LPVOID)

Definition at line 350 of file treelist.c.

◆ DrawThemeBackgT

typedef HRESULT(WINAPI * DrawThemeBackgT) (LPVOID, HDC, int, int, const RECT *, const RECT *)

Definition at line 351 of file treelist.c.

◆ EndBufferedPtT

typedef HRESULT(WINAPI * EndBufferedPtT) (HANDLE, BOOL)

Definition at line 345 of file treelist.c.

◆ GetThemeBackgRcT

typedef HRESULT(WINAPI * GetThemeBackgRcT) (LPVOID, HDC, int, int, LPCRECT, LPRECT)

Definition at line 352 of file treelist.c.

◆ IsAppThemedT

typedef BOOL(WINAPI * IsAppThemedT) ()

Definition at line 353 of file treelist.c.

◆ IsThemeActiveT

typedef BOOL(WINAPI * IsThemeActiveT) ()

Definition at line 354 of file treelist.c.

◆ OpenThemeDataT

typedef LPVOID(WINAPI * OpenThemeDataT) (HWND hwnd, LPCWSTR pszClassList)

Definition at line 349 of file treelist.c.

◆ SetWindowThemeT

typedef HRESULT(WINAPI * SetWindowThemeT) (HWND, LPCWSTR, LPCWSTR)

Definition at line 344 of file treelist.c.

Function Documentation

◆ CallbackEntry()

static void CallbackEntry ( TreeListData pData,
BaseItem pEntry,
unsigned  uItem,
unsigned  uFlags,
int iImage,
unsigned uTextSize,
LPCTSTR pText 
)
static

Definition at line 550 of file treelist.c.

550 {
551
552 NMTVDISPINFO sInfo;
553
554 sInfo.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | uFlags;
555 sInfo.item.lParam = pEntry->lParam;
556 sInfo.item.hItem = (HTREEITEM)(ULONG_PTR)uItem;
557 sInfo.item.state = pEntry->uState;
558 sInfo.item.stateMask = 0xFFFFFFFF;
559 sInfo.item.iImage = I_IMAGECALLBACK;
560 sInfo.item.iSelectedImage = I_IMAGECALLBACK;
561 sInfo.item.cChildren = I_CHILDRENCALLBACK;
562
563 if(uFlags & TVIF_TEXT) {
564 if(*uTextSize) {
565 pData->cTempText2[sizeof(pData->cTempText2) / sizeof(TCHAR) - 1] = 0;
566 pData->cTempText2[0] = 0;
567 sInfo.item.pszText = pData->cTempText2;
568 sInfo.item.cchTextMax = sizeof(pData->cTempText2) / sizeof(TCHAR) - 1;
569 } else {
570 pData->cTempText1[sizeof(pData->cTempText1) / sizeof(TCHAR) - 1] = 0;
571 pData->cTempText1[0] = 0;
572 sInfo.item.pszText = pData->cTempText1;
573 sInfo.item.cchTextMax = sizeof(pData->cTempText1) / sizeof(TCHAR) - 1;
574 }
575 } else {
576 sInfo.item.pszText = 0;
577 sInfo.item.cchTextMax = 0;
578 }
579
580 sInfo.hdr.hwndFrom = pData->hWnd;
581 sInfo.hdr.idFrom = GetWindowLong(pData->hWnd, GWL_ID);
582 sInfo.hdr.code = TVN_GETDISPINFO;
583
584 UNLOCK(pData);
585 SendMessage(GetParent(sInfo.hdr.hwndFrom), WM_NOTIFY, sInfo.hdr.idFrom, (LPARAM)&sInfo);
586 LOCK(pData);
587
588 if(uFlags & TVIF_IMAGE) {
589 if(!(pEntry->uState & TVIS_SELECTED))
590 *iImage = sInfo.item.iImage;
591 } else
593 if(pEntry->uState & TVIS_SELECTED)
594 *iImage = sInfo.item.iSelectedImage;
595 }
596
597 if(uFlags & TVIF_CHILDREN) {
598 switch(sInfo.item.cChildren) {
599 case 0:
600 pEntry->bFlags &= ~TVIX_HASBUTTON;
601 pEntry->bFlags |= TVIX_VARBUTTON;
602 break;
603
604 case 1:
605 pEntry->bFlags &= ~TVIX_VARBUTTON;
606 pEntry->bFlags |= TVIX_HASBUTTON;
607 break;
608
609 default
610 :
611 pEntry->bFlags |= TVIX_VARBUTTON;
612
613 if(pEntry->uFirstChild)
614 pEntry->bFlags |= TVIX_HASBUTTON;
615 else
616 pEntry->bFlags &= ~TVIX_HASBUTTON;
617 }
618 }
619
620 if(uFlags & TVIF_TEXT) {
621 *pText = sInfo.item.pszText;
622 *uTextSize = str_len(sInfo.item.pszText);
623 pEntry->iTextPixels = 0;
624 }
625
626}
UINT uFlags
Definition: api.c:59
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
#define I_IMAGECALLBACK
Definition: commctrl.h:2385
#define TVIF_TEXT
Definition: commctrl.h:3266
#define NMTVDISPINFO
Definition: commctrl.h:3675
#define TVIF_IMAGE
Definition: commctrl.h:3267
#define TVIS_SELECTED
Definition: commctrl.h:3280
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3264
#define I_CHILDRENCALLBACK
Definition: commctrl.h:3293
#define TVIF_HANDLE
Definition: commctrl.h:3270
#define TVIF_PARAM
Definition: commctrl.h:3268
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define TVN_GETDISPINFO
Definition: commctrl.h:3736
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3271
#define TVIF_STATE
Definition: commctrl.h:3269
#define WM_NOTIFY
Definition: richedit.h:61
#define TVIX_VARBUTTON
Definition: treelist.c:164
#define LOCK(d)
Definition: treelist.c:119
#define str_len
Definition: treelist.c:89
#define TVIX_HASBUTTON
Definition: treelist.c:165
#define UNLOCK(d)
Definition: treelist.c:118
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
LPCSTR pText
Definition: txtscale.cpp:79
uint32_t ULONG_PTR
Definition: typedefs.h:65
LONG_PTR LPARAM
Definition: windef.h:208
#define GWL_ID
Definition: winuser.h:859
#define SendMessage
Definition: winuser.h:5843
#define GetWindowLong
Definition: winuser.h:5796
HWND WINAPI GetParent(_In_ HWND)
char TCHAR
Definition: xmlstorage.h:189

Referenced by CreateDragImage(), TreeListDraw(), TreeListEditLabel(), TreeListFindItem(), TreeListInsertItem(), TreeListSortItems(), and UpdateToolTip().

◆ CallbackExtra()

static void CallbackExtra ( TreeListData pData,
BaseItem pEntry,
ExtraItem pExtra,
unsigned  uItem,
unsigned  uSub,
unsigned  uFlags,
int iImage,
unsigned uTextSize,
LPCTSTR pText 
)
static

Definition at line 639 of file treelist.c.

639 {
640
641 NMTVDISPINFO sInfo;
642
643 sInfo.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | uFlags;
644 sInfo.item.lParam = pEntry->lParam;
645 sInfo.item.hItem = (HTREEITEM)(ULONG_PTR)uItem;
646 sInfo.item.state = pExtra->uState;
647 sInfo.item.state |= (pEntry->uState & TVIS_BASEFLAGS);
648 sInfo.item.stateMask = 0xFFFFFFFF;
649 sInfo.item.iImage = I_IMAGECALLBACK;
650 sInfo.item.iSelectedImage = I_IMAGECALLBACK;
651 sInfo.item.cChildren = uSub;
652
653 if(uFlags & TVIF_TEXT) {
654 pData->cTempText1[sizeof(pData->cTempText1) / sizeof(TCHAR) - 1] = 0;
655 pData->cTempText1[0] = 0;
656 sInfo.item.pszText = pData->cTempText1;
657 sInfo.item.cchTextMax = sizeof(pData->cTempText1) / sizeof(TCHAR) - 1;
658 } else {
659 sInfo.item.pszText = 0;
660 sInfo.item.cchTextMax = 0;
661 }
662
663 sInfo.hdr.hwndFrom = pData->hWnd;
664 sInfo.hdr.idFrom = GetWindowLong(pData->hWnd, GWL_ID);
665 sInfo.hdr.code = TVN_GETDISPINFO;
666
667 UNLOCK(pData);
668 SendMessage(GetParent(sInfo.hdr.hwndFrom), WM_NOTIFY, sInfo.hdr.idFrom, (LPARAM)&sInfo);
669 LOCK(pData);
670
671
672 if(uFlags & TVIF_IMAGE)
673 *iImage = sInfo.item.iImage;
674 if(uFlags & TVIF_TEXT) {
675 *pText = sInfo.item.pszText;
676 *uTextSize = str_len(sInfo.item.pszText);
677 }
678
679}
UINT uState
Definition: treelist.c:195
#define TVIS_BASEFLAGS
Definition: treelist.c:121
#define TVIF_SUBITEM
Definition: treelist.h:102

Referenced by CreateDragImage(), TreeListDraw(), TreeListEditLabel(), and UpdateToolTip().

◆ ChangeColSize()

static void ChangeColSize ( TreeListData pData,
int  iDelta 
)
static

Definition at line 862 of file treelist.c.

862 {
863
864 unsigned uPos;
865 HDITEM sItem;
866 RECT sRect;
867 TV_COLSIZE sNotify;
868 int iWeight;
869 int iValue;
870 int iPoint;
871 int iStart;
872 int iSize;
873 int iRest;
874 int iOff;
875 int iNum;
876 int iCnt;
877 int iAll;
878 int iVar;
879 int iFix;
880
881 sItem.mask = HDI_WIDTH;
882 iAll = pData->iAllWeight;
883 iCnt = pData->uColumnCountVar;
884
885 if(iCnt <= 1) { // Nur eine variable Spalte
886 for(uPos = 0; uPos < pData->uColumnCount; uPos++) {
887 iWeight = pData->aColumn[uPos].bWeight;
888 if(!iWeight)
889 continue;
890
891 iValue = pData->aColumn[uPos].sSize;
892 iValue += iDelta;
893 sItem.cxy = iValue;
894
895 pData->aColumn[uPos].sSize = (short)iValue;
896 pData->iVarSize = iValue;
897
898 if(sItem.cxy < pData->aColumn[uPos].sMin) {
899 sItem.cxy = pData->aColumn[uPos].sMin;
900 }
901
902 if(pData->aColumn[uPos].sReal != sItem.cxy) { // Ändert sich die Breite
903 pData->aColumn[uPos].sReal = (short)sItem.cxy;
904 Header_SetItem(pData->hHeader, uPos, &sItem);
905
906 if(pData->uStyleEx & TVS_EX_HEADERCHGNOTIFY) {
907 sNotify.hdr.code = TVN_COLUMNCHANGED;
908 sNotify.uColumn = uPos;
909 sNotify.uIndex = pData->aColumn[uPos].bIndex;
910 sNotify.uPosX = pData->aColumnXpos[uPos];
911 sNotify.iSize = sItem.cxy;
912
913 UNLOCK(pData);
914 SendNotify(pData, &sNotify.hdr);
915 LOCK(pData);
916 }
917 }
918
919 break;
920 }
921
922 return;
923 }
924
925 if(iDelta > 0)
926 iStart = (pData->uSizeX) % iAll;
927 else
928 iStart = (pData->uSizeX - iDelta) % iAll;
929
930 iOff = 0;
931
932 for(uPos = 0;; uPos++) { // Suchen die Anfangsspalte
933 iWeight = pData->aColumn[uPos].bWeight;
934 if(!iWeight)
935 continue;
936
937 iOff += iWeight;
938 if(iOff > iStart)
939 break;
940 }
941
942
943 iPoint = 0;
944 iSize = iDelta / iAll;
945 iRest = iDelta % iAll;
946 iNum = iRest;
947 iOff -= iStart;
948
949 iWeight = iOff;
950 iValue = pData->aColumn[uPos].sSize;
951 iValue += iSize * iWeight;
952 iPoint += iRest * iWeight;
953 iValue += iPoint / iAll;
954 iNum -= iPoint / iAll;
955 iPoint %= iAll;
956
957 pData->aColumn[uPos].sSize = (short)iValue;
958
959
960 if(iWeight >= pData->aColumn[uPos].bWeight) { // Wurde die ganze Spalte berechnet
961 iCnt--;
962 iOff = 0;
963 }
964
965 while(iCnt > 0) {
966 uPos++;
967
968 if(uPos >= pData->uColumnCount)
969 uPos = 0;
970 iWeight = pData->aColumn[uPos].bWeight;
971 if(!iWeight)
972 continue;
973
974 iValue = pData->aColumn[uPos].sSize;
975
976 iCnt--;
977 if(iCnt) {
978 iValue += iSize * iWeight;
979 iPoint += iRest * iWeight;
980 iValue += iPoint / iAll;
981 iNum -= iPoint / iAll;
982 iPoint %= iAll;
983 } else {
984 iWeight -= iOff;
985 iValue += iSize * iWeight;
986 iValue += iNum;
987 }
988
989 pData->aColumn[uPos].sSize = (short)iValue;
990 }
991
992 iVar = 0;
993 iFix = 0;
994 iCnt = pData->uColumnCountVar;
995
996 for(uPos = 0; iCnt > 0; uPos++) { // Ausgeben der neuen Breiten
997 iWeight = pData->aColumn[uPos].bWeight;
998 if(!iWeight) {
999 iFix += pData->aColumn[uPos].sSize;
1000 continue;
1001 }
1002
1003 iVar += pData->aColumn[uPos].sSize;
1004 sItem.cxy = pData->aColumn[uPos].sSize;
1005
1006 if(sItem.cxy < pData->aColumn[uPos].sMin) {
1007 sItem.cxy = pData->aColumn[uPos].sMin;
1008 }
1009
1010 if(pData->aColumn[uPos].sReal != sItem.cxy) { // Ändert sich die Breite
1011 pData->aColumn[uPos].sReal = (short)sItem.cxy;
1012 Header_SetItem(pData->hHeader, uPos, &sItem);
1013
1014 if(pData->uStyleEx & TVS_EX_HEADERCHGNOTIFY) {
1015 sNotify.hdr.code = TVN_COLUMNCHANGED;
1016 sNotify.uColumn = uPos;
1017 sNotify.uIndex = pData->aColumn[uPos].bIndex;
1018 sNotify.uPosX = pData->aColumnXpos[uPos];
1019 sNotify.iSize = sItem.cxy;
1020
1021 UNLOCK(pData);
1022 SendNotify(pData, &sNotify.hdr);
1023 LOCK(pData);
1024 }
1025 }
1026
1027 iCnt--;
1028 }
1029
1030 pData->iFixSize = iFix;
1031 pData->iVarSize = iVar;
1032
1033 if(iDelta > 0) {
1034 GetClientRect(pData->hHeader, &sRect);
1035 InvalidateRect(pData->hHeader, NULL, FALSE);
1036 }
1037
1038}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
_In_ UINT iPoint
Definition: ntgdi.h:2197
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:758
#define HDI_WIDTH
Definition: commctrl.h:702
#define HDITEM
Definition: commctrl.h:697
NMHDR hdr
Definition: treelist.h:73
UINT uPosX
Definition: treelist.h:76
INT iSize
Definition: treelist.h:77
UINT uColumn
Definition: treelist.h:74
UINT uIndex
Definition: treelist.h:75
UINT code
Definition: winuser.h:3159
static LRESULT SendNotify(TreeListData *pData, NMHDR *pNotify)
Definition: treelist.c:530
#define TVS_EX_HEADERCHGNOTIFY
Definition: treelist.h:264
#define TVN_COLUMNCHANGED
Definition: treelist.h:300
_In_ UINT iStart
Definition: wingdi.h:3620
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by TreeListDeleteColumn(), TreeListInsertColumn(), and TreeListProc().

◆ CreateDragImage()

static HIMAGELIST CreateDragImage ( TreeListData pData,
unsigned  uItem,
unsigned  uSub 
)
static

Definition at line 1204 of file treelist.c.

1204 {
1205
1206 ExtraItem *pExtra;
1209 BITMAPINFO sInfo;
1210 BYTE *pMem;
1211 HDC hDcSrc;
1212 HDC hDc;
1213 HBITMAP hBmp;
1214 HBITMAP hBmpNew;
1215 RECT sRect;
1216 unsigned uTSize;
1217 int iAdd;
1218 int iBits;
1219 int iWidth;
1220 int iHeigh;
1221 int iImage;
1222 int iYpos;
1223 LPCTSTR pText;
1224
1225 if(uItem > pData->uTreeItemsMax)
1226 return NULL;
1227
1228 pEntry = pData->pTreeItems[uItem];
1229 if(!pEntry)
1230 return 0;
1231
1232 iHeigh = pData->iFontHeight;
1233
1234 if(uSub) { // Image für Extraeintrag erzeugen
1235 if(uSub >= pData->uColumnCount)
1236 return 0;
1237
1238 pExtra = pData->pExtraItems[uSub - 1][uItem];
1239 if(!pExtra) {
1240 pText = _T("????");
1241 uTSize = 4;
1242 iImage = -1;
1243 iWidth = pData->iFontHeight * 4;
1244 } else {
1245 pText = pExtra->pText;
1246 uTSize = pExtra->uTextSize;
1247 iImage = pExtra->iImage;
1248 iWidth = pExtra->iTextPixels;
1249
1250 if(pExtra->bCallback & (TVIF_IMAGE | TVIF_TEXT)) {
1251 CallbackExtra(pData, pEntry, pExtra, uItem, uSub, pExtra->bCallback, &iImage, &uTSize, &pText);
1252 }
1253 }
1254 } else { // Image für Haupteintrag erzeugen
1255 pText = pEntry->pText;
1256 uTSize = pEntry->uTextSize;
1257 iImage = pEntry->iImage;
1258 iWidth = pEntry->iTextPixels;
1259
1260 if(pEntry->bCallback & (TVIF_IMAGE | TVIF_TEXT)) {
1261 CallbackEntry(pData, pEntry, uItem, pEntry->bCallback, &iImage, &uTSize, &pText);
1262 }
1263 }
1264
1265 if(pData->hImages && iImage >= 0) { // Größen für Images anpassen
1266 if(iHeigh < pData->iImagesYsize)
1267 iHeigh = pData->iImagesYsize;
1268 iAdd = pData->iImagesXsize + 2;
1269 iWidth += iAdd;
1270 } else {
1271 iAdd = 0;
1272 iImage = 1;
1273 }
1274
1275 if(iWidth > 240)
1276 iWidth = 240;
1277 if(iHeigh > 32)
1278 iHeigh = 32;
1279
1280 pMem = new(BYTE, iHeigh * (iWidth + 4) * 4 + 1024);
1281 if(!pMem)
1282 return NULL;
1283
1284 hDcSrc = GetDC(NULL);
1285 hDc = CreateCompatibleDC(NULL);
1286 hBmp = CreateCompatibleBitmap(hDcSrc, iWidth, iHeigh);
1287
1288 SelectObject(hDc, hBmp);
1290 SelectObject(hDc, (pEntry->uState & TVIS_BOLD) ? pData->hFontB : pData->hFontN);
1291 SetTextColor(hDc, pData->uColors[TVC_TEXT]);
1292 SetBkColor(hDc, RGB(123, 77, 91));
1293
1294 sRect.top = 0;
1295 sRect.bottom = iHeigh;
1296 sRect.left = 0;
1297 sRect.right = iWidth;
1298 iYpos = (iHeigh - pData->iFontHeight) / 2;
1299
1300 ExtTextOut(hDc, iAdd, iYpos, ETO_OPAQUE | ETO_CLIPPED, &sRect, pText, uTSize, NULL);
1301
1302 if(iImage >= 0) {
1304 ImageList_Draw(pData->hImages, iImage, hDc, 0, 0, ILD_TRANSPARENT);
1305 }
1306
1307 iBits = GetDeviceCaps(hDc, BITSPIXEL);
1308
1309 sInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1310 sInfo.bmiHeader.biWidth = iWidth;
1311 sInfo.bmiHeader.biHeight = iHeigh;
1312 sInfo.bmiHeader.biPlanes = 1;
1313 sInfo.bmiHeader.biBitCount = (WORD)iBits;
1315 sInfo.bmiHeader.biSizeImage = 0;
1316 sInfo.bmiHeader.biXPelsPerMeter = 0;
1317 sInfo.bmiHeader.biYPelsPerMeter = 0;
1318 sInfo.bmiHeader.biClrUsed = (iBits > 8) ? 0 : 1 << iBits;;
1319 sInfo.bmiHeader.biClrImportant = (iBits > 8) ? 0 : 1 << iBits;;
1320
1321 GetDIBits(hDc, hBmp, 0, 0 , NULL, &sInfo, (iBits > 8) ? DIB_RGB_COLORS : DIB_PAL_COLORS);
1322 GetDIBits(hDc, hBmp, 0, iHeigh, pMem, &sInfo, (iBits > 8) ? DIB_RGB_COLORS : DIB_PAL_COLORS);
1323
1324 hBmpNew = CreateCompatibleBitmap(hDc, iWidth, iHeigh);
1325
1326 SetDIBits(hDc, hBmpNew, 0, iHeigh, pMem, &sInfo, (iBits > 8) ? DIB_RGB_COLORS : DIB_PAL_COLORS);
1327
1328 hList = ImageList_Create(iWidth, iHeigh, ILC_COLORDDB | ILC_MASK, 1, 0);
1329
1330 ImageList_AddMasked(hList, hBmpNew, RGB(123, 77, 91));
1331
1332 DeleteObject(hBmpNew);
1333 DeleteObject(hBmp);
1334 DeleteDC(hDc);
1335 ReleaseDC(NULL, hDcSrc);
1336
1337 delete(pMem);
1338
1339 return hList;
1340}
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define BI_RGB
Definition: precomp.h:56
#define RGB(r, g, b)
Definition: precomp.h:71
unsigned short WORD
Definition: ntddk_ex.h:93
pKey DeleteObject()
HWND hList
Definition: livecd.c:10
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
#define ILC_COLORDDB
Definition: commctrl.h:353
#define TVIS_BOLD
Definition: commctrl.h:3283
#define ILD_TRANSPARENT
Definition: commctrl.h:418
#define ILC_MASK
Definition: commctrl.h:351
int iTextPixels
Definition: treelist.c:197
int iImage
Definition: treelist.c:196
WORD uTextSize
Definition: treelist.c:198
LPTSTR pText
Definition: treelist.c:194
BYTE bCallback
Definition: treelist.c:199
ULONG biClrImportant
Definition: precomp.h:52
USHORT biBitCount
Definition: precomp.h:46
LONG biYPelsPerMeter
Definition: precomp.h:50
ULONG biCompression
Definition: precomp.h:47
LONG biXPelsPerMeter
Definition: precomp.h:49
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
static void CallbackExtra(TreeListData *pData, BaseItem *pEntry, ExtraItem *pExtra, unsigned uItem, unsigned uSub, unsigned uFlags, int *iImage, unsigned *uTextSize, LPCTSTR *pText)
Definition: treelist.c:639
static void CallbackEntry(TreeListData *pData, BaseItem *pEntry, unsigned uItem, unsigned uFlags, int *iImage, unsigned *uTextSize, LPCTSTR *pText)
Definition: treelist.c:550
#define TVC_TEXT
Definition: treelist.h:141
#define _T(x)
Definition: vfdio.h:22
#define DIB_RGB_COLORS
Definition: wingdi.h:367
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
int WINAPI SetDIBits(_In_opt_ HDC, _In_ HBITMAP, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define DIB_PAL_COLORS
Definition: wingdi.h:366
#define ETO_CLIPPED
Definition: wingdi.h:648
#define ExtTextOut
Definition: wingdi.h:4454
#define ETO_OPAQUE
Definition: wingdi.h:647
#define NULL_PEN
Definition: wingdi.h:904
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define BITSPIXEL
Definition: wingdi.h:720
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
BOOL WINAPI DeleteDC(_In_ HDC)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_WINDOW
Definition: winuser.h:918
HDC WINAPI GetDC(_In_opt_ HWND)
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
unsigned char BYTE
Definition: xxhash.c:193

Referenced by TreeListProc().

◆ CreateFontset()

static int CreateFontset ( TreeListData pData,
HFONT  hFont 
)
static

Definition at line 2121 of file treelist.c.

2121 {
2122 LOGFONT sLog;
2123 HFONT hBold;
2124 int iRet = 0;
2125
2126 if(GetObject(hFont, sizeof(sLog), &sLog)){
2127 sLog.lfWeight = FW_BOLD;
2128 if((hBold = CreateFontIndirect(&sLog))){
2129 pData->hFontN = hFont; //store the given font
2130 if(pData->hFontB != hDefaultFontB){
2131 //if the current bold is not the default bold, free it
2132 DeleteObject(pData->hFontB);
2133 }
2134 pData->hFontB = hBold; //store the created bold
2135 iRet = 1;
2136 }
2137 }
2138 return iRet;
2139}
HFONT hFont
Definition: main.c:53
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG lfWeight
Definition: dimm.idl:46
static HFONT hDefaultFontB
Definition: treelist.c:370
#define FW_BOLD
Definition: wingdi.h:378
#define GetObject
Definition: wingdi.h:4468
#define CreateFontIndirect
Definition: wingdi.h:4444

Referenced by TreeListProc().

◆ CreateStateImageList()

static void CreateStateImageList ( TreeListData pData,
int  iMode 
)
static

Definition at line 1080 of file treelist.c.

1080 {
1081
1082 BITMAPINFO sInfo;
1083 BYTE aMem[0x1000];
1084 HDC hDcSrc;
1085 HDC hDc;
1086 HBITMAP hBmp;
1087 HBITMAP hBmpNew;
1088 RECT sRect;
1089 int iBits;
1090
1091 if(pOpenThemeData) { // Über Thema zeichnen
1092 if(!pData->hThemeBt) {
1093 pData->hThemeBt = pOpenThemeData(pData->hWnd, L"BUTTON");
1094 }
1095
1096 if(pData->hThemeBt) {
1097 if(iMode) {
1098 if(pData->hChecks && pData->hChecks != THEMEIMGLIST) {
1099 ImageList_Destroy(pData->hChecks);
1100 }
1101
1102 pData->hChecks = THEMEIMGLIST;
1103 pData->iChecksXsize = 16;
1104 pData->iChecksYsize = 16;
1105 pData->iChecksMode = 1;
1106 } else {
1107 if(pData->hStates && pData->hStates != THEMEIMGLIST) {
1108 ImageList_Destroy(pData->hStates);
1109 }
1110
1111 pData->hStates = THEMEIMGLIST;
1112 pData->iStatesXsize = 16;
1113 pData->iStatesYsize = 16;
1114 pData->iStatesMode = 1;
1115 }
1116
1117 return;
1118 }
1119 }
1120
1121 if(iMode) {
1122 if(pData->hChecks && pData->hChecks != THEMEIMGLIST)
1123 return;
1124 } else {
1125 if(pData->hStates && pData->hStates != THEMEIMGLIST)
1126 return;
1127 }
1128
1129 hDcSrc = GetDC(NULL);
1130 hDc = CreateCompatibleDC(NULL);
1131 hBmp = CreateCompatibleBitmap(hDcSrc, 16 * 3, 16);
1132
1133 SelectObject(hDc, hBmp);
1135 SetBkMode(hDc, OPAQUE);
1138 Rectangle(hDc, -1, -1, 16 * 3 + 2, 16 + 2);
1139
1140 sRect.top = 8 - 6;
1141 sRect.bottom = 8 + 7;
1142 sRect.left = 16 * 1 + 8 - 7;
1143 sRect.right = 16 * 1 + 8 + 6;
1144
1146
1147 sRect.left = 16 * 2 + 8 - 7;
1148 sRect.right = 16 * 2 + 8 + 6;
1149
1151
1152 iBits = GetDeviceCaps(hDc, BITSPIXEL);
1153
1154 sInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1155 sInfo.bmiHeader.biWidth = 16 * 3;
1156 sInfo.bmiHeader.biHeight = 16;
1157 sInfo.bmiHeader.biPlanes = 1;
1158 sInfo.bmiHeader.biBitCount = (WORD)iBits;
1160 sInfo.bmiHeader.biSizeImage = 0;
1161 sInfo.bmiHeader.biXPelsPerMeter = 0;
1162 sInfo.bmiHeader.biYPelsPerMeter = 0;
1163 sInfo.bmiHeader.biClrUsed = (iBits > 8) ? 0 : 1 << iBits;;
1164 sInfo.bmiHeader.biClrImportant = (iBits > 8) ? 0 : 1 << iBits;;
1165
1166 GetDIBits(hDc, hBmp, 0, 0 , NULL, &sInfo, (iBits > 8) ? DIB_RGB_COLORS : DIB_PAL_COLORS);
1167 GetDIBits(hDc, hBmp, 0, 16, aMem, &sInfo, (iBits > 8) ? DIB_RGB_COLORS : DIB_PAL_COLORS);
1168
1169 hBmpNew = CreateCompatibleBitmap(hDc, 16 * 3, 16);
1170
1171 SetDIBits(hDc, hBmpNew, 0, 16, aMem, &sInfo, (iBits > 8) ? DIB_RGB_COLORS : DIB_PAL_COLORS);
1172
1173 if(iMode == 0) {
1174 pData->hStates = ImageList_Create(16, 16, ILC_COLORDDB | ILC_MASK, 3, 14);
1175 pData->iStatesXsize = 16;
1176 pData->iStatesYsize = 16;
1177 pData->iStatesMode = 1;
1178
1180 } else {
1181 pData->hChecks = ImageList_Create(16, 16, ILC_COLORDDB | ILC_MASK, 3, 14);
1182 pData->iChecksXsize = 16;
1183 pData->iChecksYsize = 16;
1184 pData->iChecksMode = 1;
1185
1187 }
1188
1189 DeleteObject(hBmpNew);
1190 DeleteObject(hBmp);
1191 DeleteDC(hDc);
1192 ReleaseDC(NULL, hDcSrc);
1193}
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define L(x)
Definition: ntvdm.h:50
#define THEMEIMGLIST
Definition: treelist.c:115
static OpenThemeDataT pOpenThemeData
Definition: treelist.c:362
_In_ ULONG iMode
Definition: winddi.h:3520
#define OPAQUE
Definition: wingdi.h:949
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_FLAT
Definition: winuser.h:510
#define COLOR_HIGHLIGHT
Definition: winuser.h:926
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define DFCS_BUTTONCHECK
Definition: winuser.h:496
#define DFC_BUTTON
Definition: winuser.h:476
#define DFCS_CHECKED
Definition: winuser.h:504

Referenced by TreeListProc().

◆ CreateToolTip()

static void CreateToolTip ( TreeListData pData)
static

Definition at line 1047 of file treelist.c.

1047 {
1048
1049 TOOLINFO sInfo;
1050
1051 if(pData->hToolTip)
1052 return;
1053
1055 pData->pToolProc = (WNDPROC)GetWindowLongPtr(pData->hToolTip, GWLP_WNDPROC);
1056
1057 sInfo.cbSize = sizeof(TOOLINFO);
1058 sInfo.uFlags = TTF_ABSOLUTE | TTF_TRACK | TTF_IDISHWND;
1059 sInfo.hwnd = pData->hWnd;
1060 sInfo.hinst = NULL;
1061 sInfo.uId = (LPARAM)(pData->hWnd);
1062 sInfo.lpszText = LPSTR_TEXTCALLBACK;
1063
1064 GetClientRect(pData->hWnd, &sInfo.rect);
1065 SendMessage(pData->hToolTip, TTM_ADDTOOL, 0, (LPARAM)&sInfo);
1066 SendMessage(pData->hToolTip, TTM_SETMAXTIPWIDTH, 0, 10000);
1067 SetWindowLong(pData->hToolTip, GWL_ID, 2);
1070}
#define WS_POPUP
Definition: pedump.c:616
#define LPSTR_TEXTCALLBACK
Definition: commctrl.h:2383
#define TOOLTIPS_CLASS
Definition: commctrl.h:1710
#define TTF_IDISHWND
Definition: commctrl.h:1764
#define TTF_ABSOLUTE
Definition: commctrl.h:1769
#define TTM_ADDTOOL
Definition: commctrl.h:1839
#define TTF_TRACK
Definition: commctrl.h:1768
#define TOOLINFO
Definition: commctrl.h:1718
#define TTM_SETMAXTIPWIDTH
Definition: commctrl.h:1819
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_WNDPROC
Definition: treelist.c:66
static LRESULT CALLBACK ToolProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: treelist.c:826
#define GWLP_USERDATA
Definition: treelist.c:63
#define SetWindowLong
Definition: winuser.h:5853
#define CreateWindow
Definition: winuser.h:5754
#define CW_USEDEFAULT
Definition: winuser.h:225
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906

Referenced by TreeListProc().

◆ EditProc()

static LRESULT CALLBACK EditProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 687 of file treelist.c.

687 {
688
690 WNDPROC pProc;
691 DWORD dwStop;
692 DWORD dwStart;
693 DWORD dwCount;
694 LRESULT lResult;
695 HWND hParent;
696 HWND hCombo;
697 int iDelta;
698 int iState;
699 int iPos;
700 int iId;
701
702
703 hParent = GetParent(hWnd);
704 iId = GetWindowLong(hWnd, GWL_ID);
705
706 if(iId == 3) {
707 hCombo = hWnd;
708 pData = GetHandle(hParent);
709 pProc = pData->pProcId3;
710 } else {
711 hCombo = hParent;
712 hParent = GetParent(hParent);
713 pData = GetHandle(hParent);
715 }
716
717 if(uMsg == WM_KEYDOWN) {
718 if(wParam == VK_RETURN) {
720 return 0;
721 }
722
723 if(wParam == VK_ESCAPE) {
725 return 0;
726 }
727
728 if((pData->uStyleEx & TVS_EX_STEPOUT) && !(GetAsyncKeyState(VK_SHIFT) & 0x8000)) {
729 switch(wParam) { // Aus Fenster springen
730
731 case VK_UP:
732 if(pData->uEditMode)
733 break;
735 PostMessage(hParent, WM_KEYDOWN, VK_UP , 0x00500001);
736 PostMessage(hParent, WM_KEYUP , VK_UP , 0x00500001);
737 return 0;
738
739 case VK_DOWN:
740 if(pData->uEditMode)
741 break;
743 PostMessage(hParent, WM_KEYDOWN, VK_DOWN, 0x00500001);
744 PostMessage(hParent, WM_KEYUP , VK_DOWN, 0x00500001);
745 return 0;
746
747 case VK_LEFT:
748 if(pData->uEditMode && iId == 3)
749 break;
750 SendMessage(hWnd, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwStop);
751 if(dwStart || dwStop)
752 break;
754 PostMessage(hParent, WM_KEYDOWN, VK_LEFT, 0x00500001);
755 PostMessage(hParent, WM_KEYUP , VK_LEFT, 0x00500001);
756 return 0;
757
758 case VK_RIGHT:
759 if(pData->uEditMode && iId == 3)
760 break;
761 SendMessage(hWnd, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwStop);
762 dwCount = (DWORD)SendMessage(hWnd, EM_LINELENGTH, 0, 0);
763 if(dwCount > dwStart)
764 break;
765 if(dwCount > dwStop)
766 break;
767
769 PostMessage(hParent, WM_KEYDOWN, VK_RIGHT, 0x00500001);
770 PostMessage(hParent, WM_KEYUP , VK_RIGHT, 0x00500001);
771 return 0;
772 }
773 }
774
775 if(wParam == VK_DOWN && pData->uEditMode) {
776 if(!SendMessage(hCombo, CB_GETDROPPEDSTATE, 0, 0)) {
777 SendMessage(hCombo, CB_SHOWDROPDOWN, 1, 0);
778 return 0;
779 }
780 }
781 } else
782 if(uMsg == WM_CHAR) {
783 if(wParam == VK_RETURN) {
784 return 0;
785 }
786
787 if(wParam == VK_ESCAPE) {
788 return 0;
789 }
790 } else
791 if(uMsg == WM_COMMAND) {
792 if(wParam == MAKELONG(3, EN_ESCAPE) || wParam == MAKELONG(3, EN_RETURN)) {
794 return 0;
795 }
796 } else
797 if(uMsg == WM_MOUSEWHEEL) {
798 iState = (int)CallWindowProc(pProc, hWnd, CB_GETDROPPEDSTATE, 0, 0);
799 if(iState) {
800 iDelta = (short)HIWORD(wParam);
801 iDelta /= WHEEL_DELTA;
802 iPos = (int)CallWindowProc(pProc, hWnd, CB_GETTOPINDEX, 0, 0);
803 iPos -= iDelta;
804 CallWindowProc(pProc, hWnd, CB_SETTOPINDEX, iPos, 0);
805 return 0;
806 }
807 } else
808 if(uMsg == WM_GETDLGCODE) { // Welche Tasten werden im Dialog benutzt
809 return DLGC_WANTALLKEYS;
810 } else
811 if(uMsg == WM_SETTEXT) {
812 lResult = CallWindowProc(pProc, hWnd, uMsg, wParam, lParam);;
814 return lResult;
815 }
816
817 return CallWindowProc(pProc, hWnd, uMsg, wParam, lParam);
818}
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DWORD
Definition: nt_native.h:44
#define GetHandle(h)
Definition: treelist.c:116
#define WHEEL_DELTA
Definition: treelist.c:99
#define EN_SETTEXT
Definition: treelist.c:105
#define EN_RETURN
Definition: treelist.c:106
#define EN_ESCAPE
Definition: treelist.c:107
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define TVS_EX_STEPOUT
Definition: treelist.h:267
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_KEYUP
Definition: winuser.h:1716
#define CallWindowProc
Definition: winuser.h:5735
#define CB_SETTOPINDEX
Definition: winuser.h:1969
#define CB_SHOWDROPDOWN
Definition: winuser.h:1970
#define EM_GETSEL
Definition: winuser.h:1997
#define DLGC_WANTALLKEYS
Definition: winuser.h:2612
#define WM_COMMAND
Definition: winuser.h:1740
#define VK_UP
Definition: winuser.h:2225
#define WM_SETTEXT
Definition: winuser.h:1617
#define EM_LINELENGTH
Definition: winuser.h:2003
#define VK_RETURN
Definition: winuser.h:2201
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1945
#define WM_CHAR
Definition: winuser.h:1717
#define PostMessage
Definition: winuser.h:5832
#define VK_LEFT
Definition: winuser.h:2224
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DOWN
Definition: winuser.h:2227
#define CB_GETTOPINDEX
Definition: winuser.h:1955
#define VK_SHIFT
Definition: winuser.h:2202
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define WM_KEYDOWN
Definition: winuser.h:1715
#define VK_ESCAPE
Definition: winuser.h:2214
#define WM_GETDLGCODE
Definition: winuser.h:1689

Referenced by TreeListEditLabel().

◆ GlobalDeinit()

static void GlobalDeinit ( )
static

Definition at line 491 of file treelist.c.

491 {
492
493 int lCount;
494
496 if(lCount >= 0)
497 return;
498
499 if(hDefaultFontN) {
502 }
503
504 if(hDefaultFontB) {
507 }
508
509 if(hPatternPen) {
512 }
513
514 if(pBufferedPtExit) {
516 }
517
518}
#define InterlockedDecrement
Definition: armddk.h:52
static HPEN hPatternPen
Definition: treelist.c:368
static LONG lWindowCount
Definition: treelist.c:371
static HFONT hDefaultFontN
Definition: treelist.c:369
static BufferedPtInitT pBufferedPtExit
Definition: treelist.c:361

Referenced by TreeListProc().

◆ GlobalInit()

static void GlobalInit ( )
static

Definition at line 438 of file treelist.c.

438 {
439
440 LOGBRUSH sLog;
441 long lCount;
442
443
444
446 if(lCount > 0)
447 return;
448
450 sLog.lbStyle = PS_SOLID;
451 sLog.lbHatch = 0;
453
454 if(!hPatternPen) {
455 hPatternPen = CreatePen(PS_DOT, 1, RGB(0, 0, 0));
456 }
457
458
459 if(!hUxThemeDll) {
460 hUxThemeDll = LoadLibrary(_T("UxTheme.dll"));
461 if(hUxThemeDll) {
470 pGetThemeBackgRc = (GetThemeBackgRcT)GetProcAddress(hUxThemeDll, "GetThemeBackgroundContentRect");
473
476 }
477 }
478
479 if(pBufferedPtInit) {
481 }
482
483}
#define InterlockedIncrement
Definition: armddk.h:53
#define GetProcAddress(x, y)
Definition: compat.h:753
UINT lbStyle
Definition: wingdi.h:1747
ULONG_PTR lbHatch
Definition: wingdi.h:1749
COLORREF lbColor
Definition: wingdi.h:1748
static BeginBufferedPnT pBeginBufferedPt
Definition: treelist.c:359
LPVOID(WINAPI * OpenThemeDataT)(HWND hwnd, LPCWSTR pszClassList)
Definition: treelist.c:349
static IsAppThemedT pIsAppThemed
Definition: treelist.c:366
static GetThemeBackgRcT pGetThemeBackgRc
Definition: treelist.c:365
static IsThemeActiveT pIsThemeActive
Definition: treelist.c:367
BOOL(WINAPI * IsAppThemedT)()
Definition: treelist.c:353
static CloseThemeDataT pCloseThemeData
Definition: treelist.c:363
HRESULT(WINAPI * EndBufferedPtT)(HANDLE, BOOL)
Definition: treelist.c:345
HRESULT(WINAPI * SetWindowThemeT)(HWND, LPCWSTR, LPCWSTR)
Definition: treelist.c:344
HRESULT(WINAPI * BufferedPtInitT)(VOID)
Definition: treelist.c:347
static HMODULE hUxThemeDll
Definition: treelist.c:356
HRESULT(WINAPI * CloseThemeDataT)(LPVOID)
Definition: treelist.c:350
HRESULT(WINAPI * GetThemeBackgRcT)(LPVOID, HDC, int, int, LPCRECT, LPRECT)
Definition: treelist.c:352
static BOOL bDrawWithTheme
Definition: treelist.c:385
BOOL(WINAPI * IsThemeActiveT)()
Definition: treelist.c:354
static BufferedPtInitT pBufferedPtInit
Definition: treelist.c:360
HRESULT(WINAPI * DrawThemeBackgT)(LPVOID, HDC, int, int, const RECT *, const RECT *)
Definition: treelist.c:351
static DrawThemeBackgT pDrawThemeBackg
Definition: treelist.c:364
HANDLE(WINAPI * BeginBufferedPnT)(HDC, RECT *, DWORD, LPVOID, HDC *)
Definition: treelist.c:346
static SetWindowThemeT pSetWindowTheme
Definition: treelist.c:357
static EndBufferedPtT pEndBufferedPt
Definition: treelist.c:358
#define LoadLibrary
Definition: winbase.h:3862
#define PS_ALTERNATE
Definition: wingdi.h:585
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)
#define PS_DOT
Definition: wingdi.h:588
#define PS_COSMETIC
Definition: wingdi.h:584
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586
#define COLOR_BTNSHADOW
Definition: winuser.h:930

Referenced by AtapiChipInit(), and TreeListProc().

◆ SendNotify()

◆ ToolProc()

static LRESULT CALLBACK ToolProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 826 of file treelist.c.

826 {
827
829 POINT sPoint;
830 UINT uPos;
831
832 if(uMsg == WM_SETFOCUS) {
834 return 0;
835 }
836
838
839 if(uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) { // Mausklicks auf Tooltip zum Elternfenster
840 sPoint.x = LOWORD(lParam);
841 sPoint.y = HIWORD(lParam);
842
843 ClientToScreen(hWnd , &sPoint);
844 ScreenToClient(pData->hWnd, &sPoint);
845
846 uPos = MAKELONG(sPoint.x, sPoint.y);
847
848 return TreeListProc(pData->hWnd, uMsg, wParam, uPos);
849 }
850
851 return CallWindowProc(pData->pToolProc, hWnd, uMsg, wParam, lParam);
852}
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static LRESULT CALLBACK TreeListProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: treelist.c:10028
#define WM_MOUSEFIRST
Definition: winuser.h:1774
#define WM_MOUSELAST
Definition: winuser.h:1801
#define WM_SETFOCUS
Definition: winuser.h:1613
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by CreateToolTip().

◆ TreeListChangeCheckbox()

static void TreeListChangeCheckbox ( TreeListData pData,
UINT  uItem,
int  iPosX,
int  iPosY 
)
static

Definition at line 6798 of file treelist.c.

6798 {
6799
6800 BaseItem *pTemp;
6802 NMTREEVIEW sNotify;
6803 TV_ITEM sItem;
6804 UINT uBits;
6805
6806 sNotify.itemOld.mask = 0;
6807 sNotify.itemOld.hItem = 0;
6808
6809 pEntry = pData->pTreeItems[uItem];
6810 uBits = pEntry->uState & TVIS_STATEIMAGEMASK;
6811
6812 if(pData->uStyleEx & TVS_EX_SINGLECHECKBOX) { // Einzelauswahl
6813 pTemp = pData->pTreeItems[pData->uSingleSel];
6814
6815 if(pData->uSingleSel == uItem) {
6816 if(pData->uStyleEx & TVS_EX_BITCHECKBOX) {
6817 if(uBits & 0x1000)
6818 return;
6819 } else {
6820 if(uBits == 0x2000)
6821 return;
6822 }
6823 } else
6824 if(pData->uSingleSel && pTemp) { // Anderer Eintrag gewählt
6825 sItem.hItem = (HTREEITEM)(ULONG_PTR)pData->uSingleSel;
6826 sItem.mask = TVIF_STATE;
6827 sItem.stateMask = TVIS_STATEIMAGEMASK;
6828 sItem.state = (pData->uStyleEx & TVS_EX_BITCHECKBOX) ? 0x0000 : 0x1000;
6829
6830 TreeListSetItem(pData, &sItem);
6831
6832 sNotify.itemOld.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT;
6833 sNotify.itemOld.hItem = (HTREEITEM)(ULONG_PTR)pData->uSingleSel;
6834 sNotify.itemOld.stateMask = 0xFFFFFFFF;
6835 sNotify.itemOld.state = pTemp->uState;
6836 sNotify.itemOld.lParam = pTemp->lParam;
6837 sNotify.itemOld.pszText = pTemp->pText;
6838 sNotify.itemOld.cchTextMax = pTemp->uTextSize;
6839 sNotify.itemOld.cChildren = 0;
6840 }
6841 }
6842
6843 sItem.hItem = (HTREEITEM)(ULONG_PTR)uItem;
6844 sItem.mask = TVIF_STATE;
6845 sItem.stateMask = TVIS_STATEIMAGEMASK;
6846
6847 if(pData->uStyleEx & TVS_EX_BITCHECKBOX)
6848 sItem.state = (uBits ^ 0x1000);
6849 else
6850 sItem.state = (uBits & 0x1000) ? 0x2000 : 0x1000;
6851
6852 TreeListSetItem(pData, &sItem);
6853 pData->uSingleSel = uItem;
6854
6855 sNotify.hdr.code = TVN_CBSTATECHANGED;
6856 sNotify.action = VK_DBLCLK;
6857 sNotify.itemNew.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT;
6858 sNotify.itemNew.hItem = (HTREEITEM)(ULONG_PTR)uItem;
6859 sNotify.itemNew.stateMask = 0xFFFFFFFF;
6860 sNotify.itemNew.state = pEntry->uState;
6861 sNotify.itemNew.lParam = pEntry->lParam;
6862 sNotify.itemNew.pszText = pEntry->pText;
6863 sNotify.itemNew.cchTextMax = pEntry->uTextSize;
6864 sNotify.itemNew.cChildren = 0;
6865 sNotify.ptDrag.x = iPosX;
6866 sNotify.ptDrag.y = iPosY;
6867
6868 UNLOCK(pData);
6869 SendNotify(pData, &sNotify.hdr);
6870 LOCK(pData);
6871}
#define NMTREEVIEW
Definition: commctrl.h:3642
#define TV_ITEM
Definition: commctrl.h:3300
#define TVIS_STATEIMAGEMASK
Definition: commctrl.h:3288
UINT uState
Definition: treelist.c:175
LPTSTR pText
Definition: treelist.c:174
WORD uTextSize
Definition: treelist.c:186
LPARAM lParam
Definition: treelist.c:173
static int TreeListSetItem(TreeListData *pData, const TV_ITEM *pItem)
Definition: treelist.c:4628
#define TVS_EX_SINGLECHECKBOX
Definition: treelist.h:266
#define TVS_EX_BITCHECKBOX
Definition: treelist.h:268
#define TVN_CBSTATECHANGED
Definition: treelist.h:295
#define VK_DBLCLK
Definition: treelist.h:120

Referenced by TreeListKeyDown(), and TreeListMouseClick().

◆ TreeListChar()

static void TreeListChar ( TreeListData pData,
UINT  nChar,
LPARAM  lParam 
)
static

Definition at line 7491 of file treelist.c.

7491 {
7492
7493 LPTSTR pName;
7494 ExtraItem *pExtra;
7496 unsigned uDelta;
7497 unsigned uItem;
7498 unsigned uTick;
7499 unsigned uSub;
7500 unsigned uPos;
7501 unsigned uVal;
7502 int iNum;
7503 int iMax;
7504 int i;
7505
7506 if(nChar >= ' ') {
7507 if(pData->cKeyIgnore)
7508 return; // Taste soll ignoriert werden
7509
7510 iMax = pData->uItemPosCount;
7511 uSub = pData->uSelectedSub;
7512 i = 0;
7513
7514 if(TVIS_EDIT(pData->aColumn[uSub].bEdit)) // Bei AutoEdit keine Auswahl
7515 if(!(pData->aColumn[uSub].bFlags & TVAE_ONLYRETURN)) {
7516 TreeListStartAutoEdit(pData, uSub, nChar, 0);
7517 return;
7518 }
7519
7520 if(TreeListStartNotifyEdit(pData, pData->uSelectedItem, uSub, nChar | VK_ISACHAR, lParam)) {
7521 return;
7522 }
7523
7524 if(iMax <= 0)
7525 return;
7526
7527 iNum = pData->uSelectedItem; // Hole die Startzeile
7528 if(iNum > 0) {
7529 iNum = pData->pTreeItems[iNum]->uShowPos - 1;
7530 if(iNum < 0)
7531 iNum = 0;
7532 }
7533
7534 if((nChar >= 'a' && nChar <= 'z') || // In Grosbuchstaben umwandeln
7535 (nChar >= 224 && nChar <= 254)) {
7536 nChar -= 'a' - 'A';
7537 }
7538
7539 if(!(pData->uStyleEx & TVS_EX_NOCHARSELCET))
7540 for(;;) { // Suche Anfangsbuchstaben
7541 uTick = GetTickCount();
7542 uDelta = (uKeyPos > 0) ? 750 : 500;
7543
7544 if(uKeyPos >= 3)
7545 uDelta = 1000;
7546 if(uTick - uKeyLast > uDelta)
7547 uKeyPos = 0;
7548 if(uKeyPos >= 16)
7549 uKeyPos = 0;
7550 if(uKeyPos == 1 && cKeyData[0] == (TCHAR)nChar) {
7551 uKeyPos = 0;
7552 }
7553
7554 cKeyData[uKeyPos] = (TCHAR)nChar;
7555 uKeyLast = uTick;
7556 uKeyPos += 1;
7557
7558 if(uKeyPos > 1) {
7559 iNum--;
7560 if(iNum < 0)
7561 iNum = iMax - 1;
7562 }
7563
7564 if(iMax <= 0)
7565 break;
7566
7567 for(i = iNum + 1; i != iNum; i++) { // Suche Übereinstimmung
7568 if(i >= iMax) {i = -1; continue;}
7569 uItem = pData->pItemPos[i];
7570
7571 if(uSub) {
7572#ifndef __REACTOS__
7573 pExtra = pExtra = pData->pExtraItems[uSub - 1][uItem];
7574#else
7575 pExtra = pData->pExtraItems[uSub - 1][uItem];
7576#endif
7577 pName = (pExtra && pExtra->pText) ? pExtra->pText : _T("");
7578 } else {
7579 pEntry = pData->pTreeItems[uItem];
7580 pName = (pEntry && pEntry->pText) ? pEntry->pText : _T("");
7581 }
7582
7583 for(uPos = 0; uPos < uKeyPos; uPos++) { // Vergleiche die Texte
7584#if UNICODE
7585 uVal = pName[uPos];
7586#else
7587 uVal = ((unsigned char *)pName)[uPos];
7588#endif
7589
7590 if((uVal >= 'a' && uVal <= 'z') || // In Grosbuchstaben umwandeln
7591 (uVal >= 224 && uVal <= 254)) {
7592 uVal -= 'a' - 'A';
7593 }
7594
7595 if(cKeyData[uPos] != (TCHAR)uVal) {
7596 break;
7597 }
7598 }
7599
7600 if(uPos < uKeyPos)
7601 continue;
7602
7603 if(TreeListSelectItem(pData, uItem, uSub, TVC_UNKNOWN | TVC_DESELECT)) {
7604 TreeListEnsureVisible(pData, uItem, uSub);
7605 }
7606
7607 return;
7608 }
7609
7610 if(i != iNum)
7611 break;
7612 if(uKeyPos <= 1)
7613 break;
7614
7615 iNum++;
7616 if(iNum >= iMax)
7617 iNum = iMax - 1;
7618
7619 uKeyPos = 0;
7620 }
7621 }
7622
7623}
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static LPSTR pName
Definition: security.c:75
#define TVC_UNKNOWN
Definition: commctrl.h:3650
static TCHAR cKeyData[16]
Definition: treelist.c:375
#define TVIS_EDIT(m)
Definition: treelist.c:120
static int TreeListStartNotifyEdit(TreeListData *pData, unsigned uItem, unsigned uSub, WPARAM wParam, LPARAM lParam)
Definition: treelist.c:9479
#define VK_ISACHAR
Definition: treelist.c:110
static unsigned uKeyPos
Definition: treelist.c:377
static int TreeListSelectItem(TreeListData *pData, unsigned uItem, unsigned uSubItem, int iMode)
Definition: treelist.c:3587
static unsigned uKeyLast
Definition: treelist.c:376
#define TVC_DESELECT
Definition: treelist.c:129
static int TreeListStartAutoEdit(TreeListData *pData, unsigned uColumn, WPARAM wParam, LPARAM lParam)
Definition: treelist.c:9695
static int TreeListEnsureVisible(TreeListData *pData, unsigned uItem, unsigned uSub)
Definition: treelist.c:2861
#define TVS_EX_NOCHARSELCET
Definition: treelist.h:275
#define TVAE_ONLYRETURN
Definition: treelist.h:205
CHAR * LPTSTR
Definition: xmlstorage.h:192

Referenced by TreeListProc().

◆ TreeListDeleteColumn()

static int TreeListDeleteColumn ( TreeListData pData,
unsigned  uCol 
)
static

Definition at line 5119 of file treelist.c.

5119 {
5120
5121 ExtraItem **pList;
5122 ExtraItem *pExtra;
5123 RECT sRect;
5124 BYTE bItem;
5125 BYTE bByte;
5126 unsigned uPos;
5127 unsigned uSub;
5128 unsigned uItem;
5129 unsigned uIndex;
5130 int iDelta;
5131 int iXoff;
5132 int iNum;
5133 int iCnt;
5134 int iVar;
5135 int iSub;
5136 int iAll;
5137 int iFix;
5138
5139 if(uCol >= pData->uColumnCount)
5140 return 0;
5141
5142 if(uCol && uCol == pData->uSelectedSub) { // Ist die Auswahl in der Spalte
5143 TreeListSelectItem(pData, pData->uSelectedItem, 0, TVC_UNKNOWN);
5144 }
5145
5146 if(uCol && uCol == pData->uEditSub) {
5147 pData->uEditSub = 0;
5148 pData->uEditItem = 0;
5150 }
5151
5152 if(uCol && uCol == pData->uFocusSub) {
5153 pData->uFocusSub = 0;
5154 pData->uFocusItem = 0;
5155 }
5156
5157 if(uCol == pData->uTrackedSub) {
5158 pData->uTrackedSub = 0;
5159 pData->uTrackedItem = 0;
5160 }
5161
5162 GetClientRect(pData->hWnd, &sRect);
5163
5164 iDelta = pData->aColumn[uCol].sSize;
5165 iSub = pData->aColumn[uCol].bWeight;
5166 iCnt = 0;
5167 iVar = 0;
5168 iFix = 0;
5169 iAll = 0;
5170
5171 for(uPos = 0; uPos < pData->uColumnCount; uPos++) { // Zählern der variablen Spalten
5172 if(uPos == uCol)
5173 continue;
5174 if(pData->aColumn[uPos].bWeight == 0) {
5175 iFix += pData->aColumn[uPos].sSize;
5176 continue;
5177 }
5178
5179 iVar += pData->aColumn[uPos].sSize;
5180 iAll += pData->aColumn[uPos].bWeight;
5181 iCnt += 1;
5182 }
5183
5184 Header_DeleteItem(pData->hHeader, uCol);
5185 pData->uColumnCount--;
5186
5187 if(pData->uColumnCount > 0) { // Liste mit Extraeinträgen löschen
5188 iNum = uCol - 1;
5189 if(iNum < 0)
5190 iNum = 0;
5191
5192 pList = pData->pExtraItems[iNum];
5193 if(pList) {
5194 for(uItem = 0; uItem <= pData->uTreeItemsMax; uItem++) { // Alle Einträge aus der Liste löschen
5195 pExtra = pList[uItem];
5196 if(!pExtra)
5197 continue;
5198
5199 if(pExtra->pText) {
5200 pExtra->uTextSize = 0;
5201 delete(pExtra->pText);
5202 }
5203
5204 delete(pExtra);
5205 }
5206
5207 memmove(pData->pExtraItems + iNum, pData->pExtraItems + iNum + 1, sizeof(pList) * (MAX_COLUMNS - 1 - iNum));
5208 pData->pExtraItems[pData->uColumnCount] = NULL;
5209 delete(pList);
5210 }
5211 } else {
5212 iNum = MAX_COLUMNS;
5213 }
5214
5215 if(pData->aColumn[uCol].bWeight) {
5216 pData->uColumnCountVar--;
5217 }
5218
5219 if(pData->aColumn[uCol].bMark) {
5220 pData->uMarkedCols--;
5221 }
5222
5223 uSub = pData->aColumnPos[uCol];
5224
5225 memmove(pData->aColumn + uCol, pData->aColumn + uCol + 1, (MAX_COLUMNS - 1 - uCol)*sizeof(ColumnData));
5226
5227 for(uIndex = 0; uIndex < uSub; uIndex++) { // Zuordnungs-Array anpassen
5228 bItem = pData->aColumnPos[uIndex - 1];
5229 if(bItem < uCol)
5230 continue;
5231
5232 bItem++;
5233 pData->aColumnPos[uIndex] = bItem;
5234 }
5235
5236 for(; uIndex <= pData->uColumnCount; uIndex++) { // Spaltenpositionen verschieben
5237 bItem = pData->aColumnPos[uIndex + 1];
5238
5239 if(bItem >= uCol) {
5240 uCol--;
5241 }
5242
5243 pData->aColumnPos[uIndex] = bItem;
5244 }
5245
5246 for(uIndex = pData->uColumnCount; uIndex > 0;) {
5247 uIndex--;
5248 bByte = pData->aColumn[uIndex].bIndex;
5249
5250 if(bByte >= uSub) {
5251 bByte--;
5252 pData->aColumn[uIndex].bIndex = bByte;
5253 }
5254
5255 pData->aColumn[uIndex].bNext = pData->aColumnPos[bByte + 1];
5256 }
5257
5258 pData->iFixSize = iFix;
5259 pData->iAllWeight = iAll;
5260 pData->aColumn[pData->uColumnCount].bWeight = 0;
5261
5262 if(iCnt && iDelta) { // Variable Breiten anpassen
5263 ChangeColSize(pData, iDelta);
5264 } else {
5265 if(iSub && !iCnt) {
5266 pData->iVarSize = 0;
5267 }
5268 }
5269
5270 if(pData->uSelectedSub > uCol) { // Ist die Auswahl vor der Spalte
5271 pData->uSelectedSub--;
5272 }
5273
5274 if(pData->uEditSub > uCol) {
5275 pData->uEditSub--;
5276 }
5277
5278 if(pData->uFocusSub > uCol) {
5279 pData->uFocusSub--;
5280 }
5281
5282 if(pData->uTrackedSub > uCol) {
5283 pData->uTrackedSub--;
5284 }
5285
5286 if(!pData->uColumnCount) { // Den Header löschen
5287 DestroyWindow(pData->hHeader);
5288 pData->hHeader = NULL;
5289 pData->uStartPixel = 0;
5290 pData->iRowHeight = 1;
5292 InvalidateRect(pData->hWnd, &sRect, FALSE);
5293 }
5294
5295 iXoff = UpdateColumns(pData); // Hat sich die Spaltenbreiten verändert
5296 if(iXoff < 0x10000) {
5297 sRect.left = iXoff;
5298 sRect.left -= pData->uScrollX;
5299 sRect.top = pData->uStartPixel;
5300 InvalidateRect(pData->hWnd, &sRect, FALSE);
5301 }
5302
5304
5305 return 1;
5306}
FxChildList * pList
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define Header_DeleteItem(hwndHD, i)
Definition: commctrl.h:744
static int UpdateHeight(TreeListData *pData)
Definition: treelist.c:1470
#define MAX_COLUMNS
Definition: treelist.c:102
static void UpdateScrollX(TreeListData *pData)
Definition: treelist.c:1658
static void ChangeColSize(TreeListData *pData, int iDelta)
Definition: treelist.c:862
static int TreeListEndLabelEdit(TreeListData *pData, int iMode)
Definition: treelist.c:8889
static int UpdateColumns(TreeListData *pData)
Definition: treelist.c:2391
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by TreeListProc().

◆ TreeListDeleteItem()

static int TreeListDeleteItem ( TreeListData pData,
unsigned  uItem,
int  iMode 
)
static

Definition at line 3072 of file treelist.c.

3072 {
3073
3074 NMTREEVIEW sNotify;
3075 ExtraItem **pList;
3076 ExtraItem *pExtra;
3078 BaseItem *pTemp;
3079 unsigned uPos;
3080 int iOff;
3081 int iMax;
3082
3083 if(pData->cLockChanges)
3084 return 0;
3085
3086 if(uItem > pData->uTreeItemsMax) { // Prüfe den Eintrag
3087 if(uItem != U(TVI_ROOT))
3088 return 0; // Alles löschen
3089 if(pData->uLastChild == 0)
3090 return 0;
3091
3092 while(pData->uLastChild) {
3093 TreeListDeleteItem(pData, pData->uLastChild, 0);
3094 }
3095
3096 pData->uItemPosCount = 0;
3097
3100
3101 return 1;
3102 }
3103
3104 pEntry = pData->pTreeItems[uItem];
3105 if(!pEntry) { // Prüfe den Eintrag
3106 if(uItem != 0)
3107 return 0; // Alles löschen
3108 if(pData->uLastChild == 0)
3109 return 0;
3110
3111 while(pData->uLastChild) {
3112 TreeListDeleteItem(pData, pData->uLastChild, 0);
3113 }
3114
3115 pData->uItemPosCount = 0;
3116
3119
3120 return 1;
3121 }
3122
3123 if(iMode == 2) { // Nur Kindereinträge löschen
3124 if(!pEntry->uFirstChild) {
3125 return 0;
3126 }
3127
3128 while(pEntry->uLastChild) { // Alle Kinder löschen
3129 TreeListDeleteItem(pData, pEntry->uLastChild, 0);
3130 }
3131
3132 uPos = pEntry->uShowPos;
3133 if(uPos) {
3134 UpdateItems(pData, uItem);
3135 }
3136
3137 return 1;
3138 }
3139
3140 while(pEntry->uLastChild) { // Alle Kinder löschen
3141 TreeListDeleteItem(pData, pEntry->uLastChild, 0);
3142 }
3143
3144 if(uItem == pData->uSelectedItem) { // Einen ausgewählten Eintrag löschen
3145 sNotify.hdr.code = TVN_SELCHANGED;
3146 sNotify.action = TVC_UNKNOWN;
3147 sNotify.itemOld.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | TVIF_PARAM;
3148 sNotify.itemOld.hItem = (HTREEITEM)(ULONG_PTR)uItem;
3149 sNotify.itemOld.stateMask = 0xFFFFFFFF;
3150 sNotify.itemOld.state = pEntry->uState&~TVIS_SELECTED;
3151 sNotify.itemOld.lParam = pEntry->lParam;
3152 sNotify.itemOld.cChildren = 0;
3153 sNotify.itemOld.pszText = (LPTSTR) - 1;
3154 sNotify.itemOld.cchTextMax = -1;
3155 sNotify.itemNew.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | TVIF_PARAM;
3156 sNotify.itemNew.hItem = NULL;
3157 sNotify.itemNew.stateMask = 0xFFFFFFFF;
3158 sNotify.itemNew.state = 0;
3159 sNotify.itemNew.lParam = 0;
3160 sNotify.itemNew.cChildren = 0;
3161 sNotify.itemNew.pszText = (LPTSTR) - 1;
3162 sNotify.itemNew.cchTextMax = -1;
3163 sNotify.ptDrag.x = 0;
3164 sNotify.ptDrag.y = 0;
3165
3166 UNLOCK(pData);
3167 SendNotify(pData, &sNotify.hdr); // Bekant geben das der Eintrag nicht mehr ausgewählt ist
3168 LOCK(pData);
3169
3170 pData->uSelectedItem = 0;
3171 pData->uSelectedSub = 0;
3172 }
3173
3174 sNotify.hdr.code = TVN_DELETEITEM;
3175 sNotify.itemNew.mask = 0;
3176 sNotify.itemOld.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
3177 sNotify.itemOld.hItem = (HTREEITEM)(ULONG_PTR)uItem;
3178 sNotify.itemOld.lParam = pEntry->lParam;
3179 sNotify.itemOld.pszText = (LPTSTR) - 1;
3180 sNotify.itemNew.stateMask = 0xFFFFFFFF;
3181 sNotify.itemNew.state = pEntry->uState;
3182 sNotify.itemOld.cchTextMax = -1;
3183 sNotify.ptDrag.x = 0;
3184 sNotify.ptDrag.y = 0;
3185
3186 UNLOCK(pData);
3187 SendNotify(pData, &sNotify.hdr);
3188 LOCK(pData);
3189
3190 pEntry = pData->pTreeItems[uItem]; // Prüfen ob der Eintrag noch existiert
3191 if(!pEntry)
3192 return 0;
3193
3194 if(uItem == pData->uTrackedItem) { // Einen unterstrichenen Eintrag löschen
3195 pData->uTrackedItem = 0;
3196 pData->uTrackedSub = 0;
3197 }
3198
3199 if(pData->uInsertMark == uItem) {
3200 pData->uInsertMark = 0;
3201 }
3202
3203 if(pData->uSingleSel == uItem) {
3204 pData->uSingleSel = 0;
3205 }
3206
3207 if(pEntry->uPrevItem) { // Gibt es einen vorherigen Eintrag
3208 pTemp = pData->pTreeItems[pEntry->uPrevItem];
3209 pTemp->uNextItem = pEntry->uNextItem;
3210 } else {
3211 if(pEntry->uParent) { // Neues erstes Kind in Elterneintrag
3212 pTemp = pData->pTreeItems[pEntry->uParent];
3213 pTemp->uFirstChild = pEntry->uNextItem;
3214 } else {
3215 pData->uFirstChild = pEntry->uNextItem;
3216 }
3217 }
3218
3219 if(pEntry->uNextItem) { // Gibt es einen vorherigen Eintrag
3220 pTemp = pData->pTreeItems[pEntry->uNextItem];
3221 pTemp->uPrevItem = pEntry->uPrevItem;
3222 } else {
3223 if(pEntry->uParent) { // Neues letztes Kind in Elterneintrag
3224 pTemp = pData->pTreeItems[pEntry->uParent];
3225 pTemp->uLastChild = pEntry->uPrevItem;
3226
3227 if(pTemp->uFirstChild == 0 && pTemp->uLastChild == 0) {
3228 pTemp->bFlags &= ~TVIX_HASBUTTON;
3229 }
3230 } else {
3231 pData->uLastChild = pEntry->uPrevItem;
3232 }
3233 }
3234
3235 for(uPos = 1; uPos < pData->uColumnCount; uPos++) { // Alle Extraeinträge löschen
3236 pList = pData->pExtraItems[uPos - 1];
3237
3238 pExtra = pList[uItem];
3239 if(!pExtra)
3240 continue;
3241
3242 pList[uItem] = NULL;
3243
3244 if(pExtra->pText) {
3245 pExtra->uTextSize = 0;
3246 delete(pExtra->pText);
3247 }
3248
3249 delete(pExtra);
3250 }
3251
3252
3253 pData->pTreeItems[uItem] = NULL; // Den Eintrag löschen
3254
3255 if(pEntry->pText) {
3256 pEntry->uTextSize = 0;
3257 delete(pEntry->pText);
3258 }
3259
3260 if(iMode) { // Den Eintrag neuzeichnen
3261 uItem = pEntry->uPrevItem;
3262 if(!uItem && !pEntry->uNextItem) {
3263 uItem = pEntry->uParent;
3264 if(!uItem)
3265 uPos = 1;
3266 else
3267 uPos = pData->pTreeItems[uItem]->uShowPos;
3268 } else {
3269 uPos = pEntry->uShowPos;
3270 }
3271
3272 if(uPos) {
3273 UpdateItems(pData, uItem);
3274 }
3275 }
3276
3277 if(pEntry->uState & TVIS_SELECTED) // Ausgewählte Einträge runterzählen
3278 if(pData->uSelectedCount > 0) {
3279 pData->uSelectedCount--;
3280 }
3281
3282 delete(pEntry);
3283
3284 pData->uTreeItemsCount--;
3285
3286 iOff = pData->uScrollY; // Prüfe die Scrollposition
3287 iMax = pData->uItemPosCount;
3288 iMax -= pData->uPageEnties - 1;
3289
3290 if(iOff >= iMax)
3291 iOff = iMax;
3292 if(iOff < 0)
3293 iOff = 0;
3294 if(iOff != (int)pData->uScrollY) {
3295 pData->uScrollY = iOff;
3296 SetScrollPos(pData->hWnd, SB_VERT, iOff, TRUE);
3298 }
3299
3300 return 1;
3301}
#define TRUE
Definition: types.h:120
#define TVN_DELETEITEM
Definition: commctrl.h:3742
#define TVN_SELCHANGED
Definition: commctrl.h:3735
#define TVI_ROOT
Definition: commctrl.h:3368
unsigned uNextItem
Definition: treelist.c:182
unsigned uPrevItem
Definition: treelist.c:181
unsigned uFirstChild
Definition: treelist.c:179
unsigned uLastChild
Definition: treelist.c:180
BYTE bFlags
Definition: treelist.c:188
static void UpdateScrollY(TreeListData *pData)
Definition: treelist.c:1724
static void UpdateView(TreeListData *pData)
Definition: treelist.c:1636
static int TreeListDeleteItem(TreeListData *pData, unsigned uItem, int iMode)
Definition: treelist.c:3072
static void UpdateItems(TreeListData *pData, unsigned uItem)
Definition: treelist.c:2249
#define U(h)
Definition: treelist.c:114
#define SB_VERT
Definition: winuser.h:553
int WINAPI SetScrollPos(_In_ HWND, _In_ int, _In_ int, _In_ BOOL)

Referenced by TreeListDeleteItem(), TreeListProc(), and TreeListSetInsertMark().

◆ TreeListDraw()

static void TreeListDraw ( HWND  hWnd,
HDC  hDc,
RECT pRect 
)
static

Definition at line 12681 of file treelist.c.

12681 {
12682
12683 COLORREF uEcColor;
12684 COLORREF uEvColor;
12685 COLORREF uBkColor;
12686 COLORREF uBtColor;
12687 COLORREF uOdColor;
12688 COLORREF uOcColor;
12689 COLORREF uFrColor;
12690 COLORREF uInColor;
12691 COLORREF uOldColor;
12692 COLORREF uOutColor;
12693 COLORREF uNextColor;
12694 COLORREF uTempColor;
12695 HRGN hRgnMain;
12696 HRGN aRgn[MAX_COLUMNS + 1];
12697 SIZE sSize;
12698 RECT sRect;
12699 RECT sArea;
12700 RECT sButton;
12702 BaseItem *pTemp;
12704 ExtraItem *pExtra;
12705 LPCTSTR pText;
12706 HIMAGELIST hImgList;
12707 unsigned uTextSize;
12708 unsigned uRgnCount;
12709 unsigned uAutoMask;
12710 unsigned uFirstPos;
12711 unsigned uStyleEx;
12712 unsigned uColMark;
12713 unsigned uColumn;
12714 unsigned uState;
12715 unsigned uStyle;
12716 unsigned uExtra;
12717 unsigned uNext;
12718 unsigned uMark;
12719 unsigned uItem;
12720 unsigned uBits;
12721 unsigned uPos;
12722 unsigned uMax;
12723 int *pOffsets;
12724 int iRnType[MAX_COLUMNS + 1];
12725 int iXscroll;
12726 int iHeight;
12727 int iIndent;
12728 int iDelta;
12729 int iImage;
12730 int iShift;
12731 int iStart;
12732 int iCount;
12733 int iLevel;
12734 int iLast;
12735 int iSize;
12736 int iXpos;
12737 int iYpos;
12738 int iMaxX;
12739 int iAdd;
12740 int i;
12741
12742 pData = GetHandle(hWnd);
12743
12744 LOCK(pData);
12745
12746 GetClientRect(hWnd, &sRect);
12747
12748 if(!pRect)
12749 pRect = &sRect;
12750
12751 iXscroll = -(int)pData->uScrollX;
12752 pOffsets = pData->aColumnXpos;
12753 hRgnMain = CreateRectRgn(pRect->left, pRect->top, pRect->right, pRect->bottom);
12754
12755 uMax = pData->uColumnCount;
12756 if(!uMax) {
12757 aRgn [ 0 ] = CreateRectRgn(sRect.left, sRect.top, sRect.right, sRect.bottom);
12758 iRnType[ 0 ] = CombineRgn(aRgn[0], aRgn[0], hRgnMain, RGN_AND);
12759 uRgnCount = 1;
12760 } else {
12761 for(uPos = 0; uPos < uMax; uPos++) {
12762 uExtra = pData->aColumnPos[uPos ];
12763 uNext = pData->aColumnPos[uPos + 1];
12764 aRgn [uExtra] = CreateRectRgn(sRect.left + pOffsets[uExtra] + iXscroll, sRect.top, sRect.left + pOffsets[uNext] + iXscroll, sRect.bottom);
12765 iRnType[uExtra] = CombineRgn(aRgn[uExtra], aRgn[uExtra], hRgnMain, RGN_AND);
12766 }
12767
12768 aRgn [uPos] = CreateRectRgn(sRect.left + pOffsets[uPos] + iXscroll, sRect.top, sRect.right, sRect.bottom);
12769 iRnType[uPos] = CombineRgn(aRgn[uPos], aRgn[uPos], hRgnMain, RGN_AND);
12770
12771 uRgnCount = uMax + 1;
12772 }
12773
12774 iHeight = pData->iRowHeight;
12775 uStyleEx = pData->uStyleEx;
12776 uStyle = pData->uStyle;
12777 iIndent = pData->iIndent;
12778 iShift = pData->iShift;
12779 uPos = pData->uScrollY;
12780 uMax = pData->uMaxEnties + uPos;
12781 uNext = (pData->uColumnCount <= 1) ? 1 : pData->aColumn[1].bIndex;
12782 uFirstPos = pData->aColumnXpos[uNext];
12783
12784 if(iRnType[0] == NULLREGION)
12785 iMaxX = pData->iMaxSizeX;
12786 else
12787 iMaxX = uFirstPos - 1;
12788
12789 if(uStyleEx & TVS_EX_ITEMLINES) {
12790 iHeight--;
12791 }
12792
12793 if(uStyleEx & TVS_EX_AUTOEXPANDICON) {
12794 uAutoMask = TVIS_EXPANDED;
12795 } else {
12796 uAutoMask = 0;
12797 }
12798
12799 if(uMax > pData->uItemPosCount) {
12800 uMax = pData->uItemPosCount;
12801 }
12802
12803 uBkColor = pData->uColors[TVC_BK ];
12804 uFrColor = pData->uColors[TVC_FRAME];
12805
12806 if(pData->uStyleEx & TVS_EX_ALTERNATECOLOR) { // Abwechselnde Farben
12807 uOdColor = pData->uColors[TVC_ODD ];
12808 uEvColor = pData->uColors[TVC_EVEN ];
12809 uOcColor = pData->uColors[TVC_COLODD ];
12810 uEcColor = pData->uColors[TVC_COLEVEN];
12811 } else {
12812 uOdColor = uBkColor;
12813 uEvColor = uBkColor;
12814 uOcColor = pData->uColors[TVC_COLBK];
12815 uEcColor = pData->uColors[TVC_COLBK];
12816 }
12817
12818 if(!pData->cIsEnabled) // Wenn Fenster gessperrt grau zeichnen
12819 if(pData->uStyleEx & TVS_EX_GRAYEDDISABLE) {
12820 uBkColor = pData->uColors[TVC_GRAYED];
12821 uEvColor = uEcColor;
12822 uOdColor = uOcColor;
12823 }
12824
12825 uInColor = pData->uColors[TVC_LINE];
12826 uBtColor = pData->uColors[TVC_BOX ];
12827 iStart = 0;
12828 iLast = 0;
12829
12830 sArea.top = sRect.top + pData->uStartPixel;
12831 SelectObject(hDc, pData->hFontN);
12833 SetBkColor(hDc, uBkColor);
12834 SetBkMode(hDc, TRANSPARENT);
12835 SetTextAlign(hDc, TA_LEFT | TA_TOP);
12836 SetTextColor(hDc, pData->uColors[TVC_TEXT]);
12837
12838//******************** Einträge zeichnen **************************************
12839 for(; uPos < uMax; uPos++) { // Alle Einträge ausgeben
12840 uItem = pData->pItemPos[uPos];
12841
12842 pEntry = pData->pTreeItems[uItem];
12843 if(!pEntry)
12844 break;
12845
12846 if((pEntry->uState & TVIS_SELECTED) && (uStyleEx & TVS_EX_FULLROWMARK)) {
12847 if(uStyleEx & TVS_EX_ALTERNATECOLOR)
12848 uOutColor = (uPos & 1) ? pData->uColors[TVC_MARKODD] : pData->uColors[TVC_MARKEVEN];
12849 else
12850 uOutColor = pData->uColors[TVC_MARK];
12851
12852 uMark = (unsigned)~TVIS_BKCOLOR;
12853 uColMark = 0;
12854 } else
12855 if(uPos & 1) { // Farbe wechselweise ändern
12856 uColMark = pData->aColumn[0].bMark;
12857 uOutColor = (uColMark) ? uOcColor : uOdColor;
12858 uMark = 0xFFFFFFFF;
12859 } else {
12860 uColMark = pData->aColumn[0].bMark;
12861 uOutColor = (uColMark) ? uEcColor : uEvColor;
12862 uMark = 0xFFFFFFFF;
12863 }
12864
12865 sArea.bottom = sArea.top + pData->iRowHeight;
12866 sArea.left = iXscroll;
12867 iLevel = pEntry->uLevel;
12868
12869 if(iRnType[0] == NULLREGION) {
12870 goto ExtraDraw;
12871 }
12872
12873 uBits = pEntry->uState & 0xFFFF;
12874 uBits |= pEntry->bFlags << 16;
12875 uBits &= uMark;
12876 iImage = (uBits & LVIS_SELECTED) ? pEntry->iSelectedImage : pEntry->iImage;
12877 pText = pEntry->pText;
12878 uTextSize = pEntry->uTextSize;
12879
12880 if(pData->uSelectedSub && uItem == pData->uSelectedItem) {
12881 if(pData->uSelectedCount <= 1 || !(pData->uStyleEx & TVS_EX_SUBSELECT)) {
12882 uBits &= ~TVIS_SELECTED;
12883 }
12884 }
12885
12886 if(pEntry->bCallback) {
12887 CallbackEntry(pData, pEntry, uItem, pEntry->bCallback, &iImage, &uTextSize, &pText);
12888
12889 pEntry = pData->pTreeItems[uItem];
12890 if(!pEntry)
12891 break;
12892 }
12893
12894 SelectObject(hDc, aRgn[0]);
12895
12897 sButton.left = 0;
12898 sButton.right = iIndent * (iLevel + 1) + 2;
12899 sButton.bottom = sArea.bottom + 1;
12900 sButton.top = sArea.bottom - 2;
12901
12902 SetBkColor(hDc, uFrColor);
12903 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sButton, NULL, 0, NULL);
12904 }
12905
12906 if(pData->aColumn[0].bMark) { // Ist die erste Spalte markiert
12907 uBkColor = pData->uColors[TVC_COLBK];
12908 }
12909
12910 SetBkColor(hDc, (uStyleEx & TVS_EX_FULLROWITEMS) ? uOutColor : uBkColor);
12911
12912 if(pData->cHasRootRow)
12913 iLevel++;
12914
12915 if(iLevel <= 0)
12916 goto NoRootLines;
12917
12918 if(uStyle & (TVS_HASBUTTONS | TVS_HASLINES)) {
12919 iLevel--;
12920 }
12921
12922 if(uStyleEx & TVS_EX_FULLROWITEMS) {
12923 sArea.bottom--;
12924 iAdd = 1;
12925 } else {
12926 iAdd = 0;
12927 }
12928
12929 if(uStyle & TVS_HASLINES) {
12930 pTemp = pData->pTreeItems[pEntry->uParent];
12931 sArea.right = sArea.left + 1; // Eine leerer Pixelreihe am Anfang
12932 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
12933 sArea.left += iIndent * iLevel + 1;
12934
12935 for(i = iLevel; i > 0; i--) { // Bereich vor Schaltflächen
12936 sArea.right = sArea.left;
12937 sArea.left -= iIndent;
12938
12939 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
12940
12941 iXpos = sArea.left + iShift;
12942
12943 if(pTemp) {
12944 if(pTemp->uNextItem) { // Zeichne vertikale Linien
12945 MoveToEx(hDc, iXpos, sArea.top | 1, NULL);
12946 LineTo(hDc, iXpos, sArea.bottom + iAdd);
12947 }
12948
12949 pTemp = pData->pTreeItems[pTemp->uParent];
12950 }
12951 }
12952
12953 sArea.left += iIndent * iLevel;
12954 } else { // Ohne Linien zeichnen
12955 if(iLevel > 0) {
12956 sArea.right = sArea.left + iIndent * iLevel;
12957 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
12958 sArea.left += sArea.right;
12959 }
12960 }
12961
12962 if(uStyle & TVS_HASBUTTONS) { // Fenster mit Schaltflächen ?
12963 sArea.right = sArea.left + iIndent;
12964 iXpos = sArea.left + iShift;
12965 iYpos = sArea.top + pData->iRowHeight / 2;
12966
12967 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
12968
12969 if(uStyle & TVS_HASLINES) { // Linien unter Schaltflächen
12970 MoveToEx(hDc, iXpos, sArea.top | 1, NULL);
12971
12972 if(pEntry->uNextItem)
12973 LineTo(hDc, iXpos, sArea.bottom + iAdd);
12974 else
12975 LineTo(hDc, iXpos, iYpos + 1);
12976
12977 MoveToEx(hDc, iXpos + 1 + (iYpos & 1), iYpos, NULL);
12978 LineTo(hDc, sArea.right , iYpos);
12979 }
12980
12981 if(pEntry->bFlags & TVIX_HASBUTTON) { // Schaltflächen zeichnen
12982 sButton.left = iXpos - 4;
12983 sButton.top = iYpos - 4;
12984 sButton.right = iXpos + 5;
12985 sButton.bottom = iYpos + 5;
12986
12987 if(pData->cGlyphOk) { // Thema benutzen
12989 pDrawThemeBackg(pData->hTheme, hDc, TVP_GLYPH, uState, &sButton, 0);
12990 } else {
12991 SetBkColor(hDc, uBtColor);
12992 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sButton, NULL, 0, NULL);
12993
12994 sButton.left += 1;
12995 sButton.top += 1;
12996 sButton.right -= 1;
12997 sButton.bottom -= 1;
12998
12999 SetBkColor(hDc, pData->uColors[TVC_BOXBG]);
13000 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sButton, NULL, 0, NULL);
13001
13002 sButton.left = iXpos - 2;
13003 sButton.top = iYpos ;
13004 sButton.right = iXpos + 3;
13005 sButton.bottom = iYpos + 1;
13006
13007 SetBkColor(hDc, uInColor);
13008 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sButton, NULL, 0, NULL);
13009
13010 // '+' statt '-' Schaltfläsche zeichnenen
13011 if((uBits ^ TVIS_EXPANDED) & (TVIS_EXPANDED | TVIS_EXPANDPARTIAL)) {
13012 sButton.left = iXpos ;
13013 sButton.top = iYpos - 2;
13014 sButton.right = iXpos + 1;
13015 sButton.bottom = iYpos + 3;
13016 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sButton, NULL, 0, NULL);
13017 }
13018 }
13019
13020 SetBkColor(hDc, uBkColor);
13021 }
13022
13023 sArea.left += iIndent;
13024 } else
13025 if(uStyle & TVS_HASLINES) { // Nur Linien zeichnen ohne Schaltflächen
13026 sArea.right = sArea.left + iIndent;
13027 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13028
13029 iYpos = sArea.top + pData->iRowHeight / 2;
13030 iXpos = sArea.left + iShift;
13031 MoveToEx(hDc, iXpos, sArea.top | 1, NULL);
13032
13033 if(pEntry->uNextItem)
13034 LineTo(hDc, iXpos, sArea.bottom);
13035 else
13036 LineTo(hDc, iXpos, iYpos + 1);
13037
13038 MoveToEx(hDc, iXpos + 1 + (iYpos & 1), iYpos, NULL);
13039 LineTo(hDc, sArea.right , iYpos);
13040
13041 sArea.left += iIndent;
13042 }
13043
13044 if(uStyleEx & TVS_EX_FULLROWITEMS)
13045 sArea.bottom++;
13046
13047NoRootLines:
13048
13049 if(uStyleEx & TVS_EX_ITEMLINES) { // Linien um den Eintrag zeichnen
13050 iAdd = 1;
13051 sArea.right = sArea.left + 1;
13052
13053 if(uStyleEx & TVS_EX_FULLROWITEMS) {
13054 iStart = sArea.left;
13055 iAdd = 0;
13056 } else
13057 if(iLevel >= 0) {
13058 SetBkColor(hDc, uFrColor);
13059 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13060
13061 sArea.left++;
13062 sArea.bottom--;
13063 iStart = sArea.left;
13064 } else {
13065 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13066
13067 sArea.left++;
13068 sArea.bottom--;
13069 iStart = sArea.left - 1;
13070 }
13071 } else {
13072 iAdd = 0;
13073 }
13074
13075 SetBkColor(hDc, (uBits & TVIS_BKCOLOR) ? pEntry->uColorBk : uOutColor);
13076 SelectObject(hDc, (uBits & TVIS_BOLD) ? pData->hFontB : pData->hFontN);
13077
13078 if(pData->hStates) { // State-Icons anzeigen
13079 sArea.right = sArea.left + pData->iStatesXsize;
13080 iYpos = sArea.top + (iHeight - pData->iStatesYsize) / 2;
13081 i = (uBits & LVIS_STATEIMAGEMASK) >> 12;
13082
13083 sArea.right += iAdd;
13084 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13085 sArea.left += iAdd;
13086
13087 if(pData->hStates == THEMEIMGLIST) { // Mit Thema zeichnen
13088 if(pData->uStyleEx & TVS_EX_BITCHECKBOX)
13089 i++;
13090
13091 if(i >= 1 && i <= 2) {
13092 uState = (i == 1) ? CBS_UNCHECKEDNORMAL : CBS_CHECKEDNORMAL;
13093 pDrawThemeBackg(pData->hThemeBt, hDc, BP_CHECKBOX, uState, &sArea, 0);
13094 }
13095 } else {
13096 ImageList_Draw(pData->hStates, i, hDc, sArea.left, iYpos, ILD_TRANSPARENT);
13097 }
13098
13099 sArea.left += pData->iStatesXsize;
13100 iAdd = 0;
13101 }
13102
13103 if(pData->hImages && iImage != TV_NOIMAGE) { // Icon zeichnen vom Haupteintrag
13104 if(iImage >= TV_SECONDICON) { // Sub-Image-Liste verwenden
13105 if(iImage & TV_NOAUTOEXPAND) {
13106 iImage &= ~TV_NOAUTOEXPAND; // Kein Auto-Expant bei diesem Icon
13107 } else
13108 if((pEntry->uState & uAutoMask) && pEntry->uFirstChild) {
13109 iImage += 1; // Auto-Expant aktivieren
13110 }
13111
13112 iImage -= TV_SECONDICON;
13113 sArea.right = sArea.left + pData->iSubImgXsize;
13114 iYpos = sArea.top + (iHeight - pData->iSubImgYsize) / 2;
13115 pEntry->bFlags |= TVIX_HASIMAGE;
13116
13117 sArea.right += iAdd;
13118 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13119 sArea.left += iAdd;
13120 ImageList_Draw(pData->hSubImg, iImage, hDc, sArea.left, iYpos, ILD_TRANSPARENT | (uBits & (TVIS_OVERLAYMASK | LVIS_CUT)));
13121
13122 sArea.left += pData->iSubImgXsize;
13123 iAdd = 0;
13124 } else { // Haup-Image-Liste verwenden
13125 if(iImage & TV_NOAUTOEXPAND) {
13126 iImage &= ~TV_NOAUTOEXPAND; // Kein Auto-Expant bei diesem Icon
13127 } else
13128 if((pEntry->uState & uAutoMask) && pEntry->uFirstChild) {
13129 iImage += pData->iAutoAdd; // Auto-Expant aktivieren
13130 }
13131
13132 sArea.right = sArea.left + pData->iImagesXsize;
13133 iYpos = sArea.top + (iHeight - pData->iImagesYsize) / 2;
13134 pEntry->bFlags |= TVIX_HASIMAGE;
13135
13136 sArea.right += iAdd;
13137 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13138 sArea.left += iAdd;
13139 ImageList_Draw(pData->hImages, iImage, hDc, sArea.left, iYpos, ILD_TRANSPARENT | (uBits & (TVIS_OVERLAYMASK | LVIS_CUT)));
13140
13141 sArea.left += pData->iImagesXsize;
13142 iAdd = 0;
13143 }
13144 } else {
13145 pEntry->bFlags &= ~TVIX_HASIMAGE;
13146 }
13147
13148 sArea.right = uFirstPos; // Text ausgeben vom Haupteintrag
13149 iYpos = sArea.top + (iHeight - pData->iFontHeight) / 2;
13150
13152 // Das Feld speziel zeichnen
13153 TCHAR *pPtr = (TCHAR *)new(TCHAR, uTextSize + 4);
13154 INT *pPos = (INT *)new(INT, uTextSize + 4);
13155
13156 ExtTextOut(hDc, 0, 0, ETO_OPAQUE | ETO_CLIPPED, &sArea, NULL, 0, NULL);
13157
13158 sButton.top = iYpos;
13159 sButton.left = sArea.left + 4;
13160 sButton.right = sArea.right;
13161 sButton.bottom = iYpos + pData->iFontHeight + 2;
13162
13163 if(!uTextSize) { // Feld ohne Text ?
13164 sButton.right -= 2;
13165 sButton.bottom--;
13166 pEntry->iTextPixels = 0;
13167 } else {
13168 if(pData->uStyleEx & TVS_EX_FULLROWMARK)
13169 if(pData->cHasFocus == 0 || uItem != pData->uSelectedItem || pData->uSelectedSub)
13170 if((uBits & TVIS_SELECTED) && !(uBits & (TVIS_DROPHILITED | TVIS_FOCUSED))) {
13171 sButton.left -= 1;
13172 }
13173
13174 DrawText(hDc, pText, uTextSize, &sButton, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT);
13175 pEntry->iTextPixels = sButton.right - sButton.left;
13176 }
13177
13178 // Passt der Text in die Spalte
13179 if(sButton.left + pEntry->iTextPixels >= (int)(sArea.right - pData->uScrollX)) {
13180 iSize = sArea.right - pData->uScrollX - sButton.left - 2;
13181 iSize -= (uBits & TVIS_BOLD) ? pData->uTrippleB : pData->uTrippleN;
13182 if(iSize < 3) {
13183 iCount = 0;
13184 } else {
13185 GetTextExtentExPoint(hDc, pText, uTextSize, iSize, &iCount, pPos, &sSize);
13186 }
13187 // Temporären Text mit "..." erzeugen
13188 memcpy(pPtr , pText, iCount * sizeof(TCHAR));
13189 memcpy(pPtr + iCount, _T("..."), 4 * sizeof(TCHAR));
13190
13191 pText = pPtr;
13192 uTextSize = iCount + 3;
13193 sButton.right = sArea.right - 2;
13194 }
13195
13196 // Das Feld selektiert zeichnen
13197 if((uBits & TVIS_SELECTED) && pData->cHasFocus && uItem == pData->uSelectedItem && !pData->uSelectedSub) {
13198 uTempColor = GetSysColor(COLOR_HIGHLIGHTTEXT);
13200 Rectangle(hDc, sButton.left - 2, sButton.top - 1, sButton.right + 2, sButton.bottom + 1);
13201 } else {
13202 if(uBits & TVIS_DROPHILITED) {
13203 uTempColor = GetSysColor(COLOR_HIGHLIGHTTEXT);
13206 Rectangle(hDc, sButton.left - 2, sButton.top - 1, sButton.right + 2, sButton.bottom + 1);
13207 } else
13208 if(uBits & TVIS_SELECTED) { // Ist das Feld ohne Focus ausgewählt
13209 if(pData->cHasFocus) {
13210 uTempColor = GetSysColor(COLOR_HIGHLIGHTTEXT);
13213 } else {
13214 if(uBits & TVIS_TEXTCOLOR)
13215 uTempColor = pEntry->uColorText;
13216 else
13217 uTempColor = pData ->uColors[TVC_TEXT];
13218
13219 if(pData->uStyleEx & TVS_EX_FULLROWMARK)
13221 else
13223
13225 }
13226
13227 Rectangle(hDc, sButton.left - 2, sButton.top - 1, sButton.right + 2, sButton.bottom + 1);
13228 } else { // Das Feld normal zeichnen
13229 if(uBits & TVIS_TRACKED)
13230 uTempColor = pData ->uColors[TVC_TRACK];
13231 else
13232 if(uBits & TVIS_TEXTCOLOR)
13233 uTempColor = pEntry->uColorText;
13234 else
13235 uTempColor = pData ->uColors[TVC_TEXT ];
13236 sButton.right--;
13237 sButton.left --;
13238 }
13239
13241
13242 if(uBits & TVIS_FOCUSED) { // Einen punktierten Rahmen um den Text zeichnen
13244 Rectangle(hDc, sButton.left - 2, sButton.top - 1, sButton.right + 2, sButton.bottom + 1);
13245 }
13246 }
13247
13248 SetTextColor(hDc, uTempColor);
13249 sButton.left += pData->iFontOff;
13250 DrawText(hDc, pText, uTextSize, &sButton, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
13251
13252 if(uBits & (TVIS_UNDERLINE | TVIS_TRACKED)) // Text unterstreichen
13253 if(pText && *pText) {
13254 sButton.left -= pData->iFontOff;
13255 sButton.right -= pData->iFontOff + 1;
13256 sButton.top += pData->iFontLine;
13257 sButton.bottom = sButton.top + 1;
13258 uOldColor = SetBkColor(hDc, uTempColor);
13259 ExtTextOut(hDc, 0, 0, ETO_OPAQUE | ETO_CLIPPED, &sButton, NULL, 0, NULL);
13260 SetBkColor(hDc, uOldColor);
13261 }
13262
13263 SetTextColor(hDc, pData->uColors[TVC_TEXT]);
13264
13265 delete(pPos);
13266 delete(pPtr);
13267 } else { // Das Feld normal ausgeben
13268 if(!pEntry->iTextPixels && uTextSize) {
13269 sButton.top = iYpos;
13270 sButton.left = sArea.left + 4;
13271 sButton.right = sArea.right;
13272 sButton.bottom = iYpos + pData->iFontHeight + 2;
13273 // Textbreite berechen
13274 DrawText(hDc, pText, uTextSize, &sButton, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT);
13275
13276 pEntry->iTextPixels = sButton.right - sButton.left;
13277 }
13278
13279 // Ist der Text größer als die Spalte
13280 if(sArea.left + pEntry->iTextPixels >= (int)(sArea.right - pData->uScrollX)) {
13281 INT *pPos = (INT *)new(INT, uTextSize);
13282
13283 iSize = sArea.right - sArea.left - pData->uScrollX;
13284 iSize -= (uBits & TVIS_BOLD) ? pData->uTrippleB : pData->uTrippleN;
13285 if(iSize < 3) {
13286 iCount = 0;
13287 } else {
13288 GetTextExtentExPoint(hDc, pText, uTextSize, iSize, &iCount, pPos, &sSize);
13289 }
13290
13291 if(iCount > 0) { // Passen noch Buchstaben vor "..."
13292 sButton.right = sArea.right;
13293 sArea.right = sArea.left + 2 + pPos[iCount - 1];
13294
13295 ExtTextOut(hDc, sArea.left + 2, iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, pText, iCount, NULL);
13296
13297 sArea.left = sArea.right;
13298 sArea.right = sButton.right;
13299
13300 ExtTextOut(hDc, sArea.left , iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, _T("..."), 3, NULL);
13301 } else {
13302 ExtTextOut(hDc, sArea.left + 2, iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, _T("..."), 3, NULL);
13303 }
13304
13305 delete(pPos);
13306 } else {
13307 ExtTextOut(hDc, sArea.left + 2, iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, pText, uTextSize, NULL);
13308 }
13309 }
13310
13311 i = sArea.left - iXscroll;
13312 i += pEntry->iTextPixels + 5;
13313 if(i > iMaxX)
13314 iMaxX = i;
13315
13316 if(uStyleEx & TVS_EX_ITEMLINES) { // Linien um den Eintrag zeichnen
13317 SetBkColor(hDc, uFrColor);
13318
13319 if(iLast > iStart) { // Ist das Feld nach links eingerückt gegenüber dem oberen
13320 sArea.top--;
13321 sArea.bottom = sArea.top + 1;
13322 sArea.left = iStart - 1;
13323 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13324 sArea.top++;
13325 }
13326
13327 iLast = iStart; // Linie unter Feld zeichnen
13328 sArea.top += iHeight;
13329 sArea.left = iStart;
13330 sArea.bottom = sArea.top + 1;
13331
13332 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13333
13334 sArea.top -= iHeight;
13335 }
13336
13337 //************ Extraeinträge zeichnen *********************************
13338
13339ExtraDraw:
13340
13341 uNextColor = uOutColor; // Hintergrundfarbe für die nächste Spalte
13342
13343 if(pData->aColumn[0].bMark) { // Ist die erste Spalte markiert
13344 uBkColor = pData->uColors[TVC_BK];
13345 }
13346
13347 for(uColumn = 1; uColumn <= pData->uColumnCount; uColumn++) { // Extra Spalten zeichnen
13348 uExtra = pData->aColumnPos[uColumn ];
13349 uNext = pData->aColumnPos[uColumn + 1];
13350
13351 if(pData->aColumn[uExtra].sReal == 0) // Ist die Spalte sichtbar
13352 if(uColumn < pData->uColumnCount) {
13353 continue;
13354 }
13355
13356 if(uColMark != pData->aColumn[uExtra].bMark) // Ist die Spalte anderst markiert
13357 if(!(pEntry->uState & TVIS_SELECTED) || !(uStyleEx & TVS_EX_FULLROWMARK)) {
13358 if(uPos & 1) {
13359 uColMark = pData->aColumn[uExtra].bMark;
13360 uOutColor = (uColMark) ? uOcColor : uOdColor;
13361 } else {
13362 uColMark = pData->aColumn[uExtra].bMark;
13363 uOutColor = (uColMark) ? uEcColor : uEvColor;
13364 }
13365 }
13366
13367 GetRgnBox(aRgn[uExtra], &sButton);
13368
13369 if(iRnType[uExtra] == NULLREGION)
13370 continue;
13371
13372 SelectObject(hDc, aRgn[uExtra]);
13373
13374 sArea.left = pData->aColumnXpos[uExtra];
13375 sArea.left += iXscroll;
13376
13377 if(uStyleEx & TVS_EX_ITEMLINES) { // Linie um den Eintrag zeichnen
13378 SetBkColor(hDc, uFrColor);
13379 // Linke Linie
13380 sArea.right = sArea.left + 1;
13381 sArea.bottom += 1;
13382
13383 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13384
13385 sArea.left += 1; // Untere Linie
13386 sArea.top += iHeight;
13387 sArea.bottom = sArea.top + 1;
13388 sArea.right = pData->aColumnXpos[uNext];
13389 if(uColumn < pData->uColumnCount)
13390 sArea.right += iXscroll;
13391
13392 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13393
13394 sArea.top -= iHeight;
13395 sArea.bottom -= 1;
13396 iAdd = 1;
13397 }
13398
13399 if(sArea.left > (int)pData->uSizeX)
13400 break; // Noch im sichtbaren Bereich
13401
13402 sArea.right = pData->aColumnXpos[uNext];
13403
13404 if(uColumn < pData->uColumnCount) { // Ist es die letze Spalte ?
13405 sArea.right += iXscroll;
13406 pExtra = pData->pExtraItems[uExtra - 1][uItem];
13407 if(!pExtra)
13408 uNextColor = uOutColor;
13409 } else {
13410 pExtra = 0;
13411 }
13412
13413 if(!pExtra) { // Leeres Feld zeichnen
13414 SetBkColor(hDc, uNextColor);
13415 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13416 } else {
13417 iSize = pData->iSubImgXsize;
13418 hImgList = pData->hSubImg;
13419 iImage = pExtra->iImage;
13420 pText = pExtra->pText;
13421 uTextSize = pExtra->uTextSize;
13422 uBits = (pExtra->uState & 0xFFFF);
13423 uBits |= (pExtra->bFlags << 16);
13424 uBits |= pEntry->uState & TVIS_BASEFLAGS;
13425 uBits &= uMark;
13426
13427 if(uExtra != pData->uSelectedSub) {
13428 uBits &= ~TVIS_SELECTED;
13429 }
13430
13431 if(pExtra->bCallback) { // Text über Callback holen
13432 CallbackExtra(pData, pEntry, pExtra, uItem, uExtra, pExtra->bCallback, &iImage, &uTextSize, &pText);
13433 pExtra = pData->pExtraItems[uExtra - 1][uItem];
13434 if(!pExtra)
13435 break;
13436 }
13437
13438 uNextColor = (uBits & TVIS_BKCOLOR) ? pExtra->uColorBk : uOutColor;
13439 SetBkColor(hDc, uNextColor);
13440
13441 if(pData->aColumn[uExtra].bEdit >= TVAX_CHECK) { // Checkboxen statt Icons
13442 hImgList = pData->hChecks;
13443 iSize = pData->iChecksXsize;
13444 iImage = (pExtra->uState & TVIS_STATEIMAGEMASK) >> 12;
13445 uBits &= ~TVIS_OVERLAYMASK;
13446
13447 if(iImage & 8)
13448 if(pData->aColumn[uExtra].bFlags & TVAE_STATEENABLE) {
13449 iImage &= 7;
13450 }
13451 }
13452
13453 if(hImgList && iImage > TV_NOIMAGE) { // Icon zeichnen
13454 sArea.right = sArea.left + iSize + 2;
13455 iYpos = sArea.top + (iHeight - iSize) / 2;
13456 pExtra->bFlags |= TVIX_HASIMAGE;
13457
13458 SelectObject(hDc, (uBits & TVIS_BOLD) ? pData->hFontB : pData->hFontN);
13459 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sArea, NULL, 0, NULL);
13460
13461 if(hImgList == THEMEIMGLIST) { // Mit Thema zeichnen
13462 if(pData->uStyleEx & TVS_EX_BITCHECKBOX)
13463 iImage++;
13464
13465 if(iImage == 1 || iImage == 2) {
13466 uState = (iImage == 1) ? CBS_UNCHECKEDNORMAL : CBS_CHECKEDNORMAL;
13467 pDrawThemeBackg(pData->hThemeBt, hDc, BP_CHECKBOX, uState, &sArea, 0);
13468 }
13469 } else {
13470 ImageList_Draw(hImgList, iImage, hDc, sArea.left + 1, iYpos, ILD_TRANSPARENT | (uBits & (TVIS_OVERLAYMASK | LVIS_CUT)));
13471 }
13472
13473 sArea.left += iSize + 1;
13474 sArea.right = pData->aColumnXpos[uNext];
13475 sArea.right += iXscroll;
13476 } else {
13477 pExtra->bFlags &= ~TVIX_HASIMAGE;
13478 }
13479
13480 iYpos = sArea.top + (iHeight - pData->iFontHeight) / 2;
13481 SelectObject(hDc, (uBits & TVIS_BOLD) ? pData->hFontB : pData->hFontN);
13482
13484 // Text ausgeben in spezilem Format
13485 TCHAR *pPtr = (TCHAR *)new(TCHAR, uTextSize + 4);
13486 INT *pPos = (INT *)new(INT, uTextSize + 4);
13487
13488 ExtTextOut(hDc, 0, 0, ETO_OPAQUE | ETO_CLIPPED, &sArea, NULL, 0, NULL);
13489
13490 sButton.top = iYpos;
13491 sButton.left = sArea.left + 4;
13492 sButton.right = sArea.right;
13493 sButton.bottom = iYpos + pData->iFontHeight + 2;
13494
13495 if(!uTextSize) {
13496 sButton.left--;
13497 sButton.right -= 2;
13498 sButton.bottom--;
13499 pExtra->iTextPixels = 0;
13500 } else {
13501 if(pData->uStyleEx & TVS_EX_FULLROWMARK)
13502 if(pData->cHasFocus == 0 || uItem != pData->uSelectedItem)
13503 if((uBits & TVIS_SELECTED) && !(uBits & (TVIS_DROPHILITED | TVIS_FOCUSED))) {
13504 sButton.left -= 2;
13505 }
13506
13507 DrawText(hDc, pText, uTextSize, &sButton, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT);
13508 pExtra->iTextPixels = sButton.right - sButton.left;
13509 }
13510
13511 // Passt der Text in die Spalte
13512 if(sButton.left + pExtra->iTextPixels >= sArea.right) {
13513 if(uTextSize > 253)
13514 uTextSize = 253;
13515
13516 iSize = sArea.right - sButton.left - 2;
13517 iSize -= (uBits & TVIS_BOLD) ? pData->uTrippleB : pData->uTrippleN;
13518 if(iSize < 3) {
13519 iCount = 0;
13520 } else {
13521 GetTextExtentExPoint(hDc, pText, uTextSize, iSize, &iCount, pPos, &sSize);
13522 }
13523
13524 memcpy(pPtr , pText, iCount * sizeof(TCHAR));
13525 memcpy(pPtr + iCount, _T("..."), 4 * sizeof(TCHAR));
13526
13527 pText = pPtr;
13528 uTextSize = iCount + 3;
13529 sButton.right = sArea.right - 2;
13530 }
13531
13532 switch(pData->aColumn[uExtra].bAlign) { // Textausrichtung ausgleichen
13533 case DT_CENTER:
13534 iDelta = sArea .right - sArea .left;
13535 iDelta -= sButton.right - sButton.left;
13536 iDelta -= 6;
13537 iDelta /= 2;
13538 sButton.right += iDelta;
13539 sButton.left += iDelta;
13540 break;
13541
13542 case DT_RIGHT:
13543 iDelta = sArea .right - sArea .left;
13544 iDelta -= sButton.right - sButton.left;
13545 iDelta -= 6;
13546 sButton.right += iDelta;
13547 sButton.left += iDelta;
13548 break;
13549
13550 }
13551 // Ist das Feld ohne Focus ausgewählt
13552 if((uBits & TVIS_SELECTED) && pData->cHasFocus && uItem == pData->uSelectedItem) {
13553 uTempColor = GetSysColor(COLOR_HIGHLIGHTTEXT);
13555 Rectangle(hDc, sButton.left - 2, sButton.top - 1, sButton.right + 2, sButton.bottom + 1);
13556 } else {
13557 if(uBits & TVIS_DROPHILITED) {
13558 uTempColor = GetSysColor(COLOR_HIGHLIGHTTEXT);
13561 Rectangle(hDc, sButton.left - 2, sButton.top - 1, sButton.right + 2, sButton.bottom + 1);
13562 } else
13563 if(uBits & TVIS_SELECTED && uItem == pData->uSelectedItem) {
13564 if(uBits & TVIS_TEXTCOLOR)
13565 uTempColor = pEntry->uColorText;
13566 else
13567 uTempColor = pData->uColors[TVC_TEXT];
13568
13569 if(pData->uStyleEx & TVS_EX_FULLROWMARK)
13571 else
13573
13575 Rectangle(hDc, sButton.left - 2, sButton.top - 1, sButton.right + 2, sButton.bottom + 1);
13576 } else {
13577 if(uBits & TVIS_TRACKED)
13578 uTempColor = pData ->uColors[TVC_TRACK];
13579 else
13580 if(uBits & TVIS_TEXTCOLOR)
13581 uTempColor = pExtra->uColorText;
13582 else
13583 uTempColor = pData ->uColors[TVC_TEXT ];
13584 sButton.right--;
13585 sButton.left --;
13586 }
13587
13589
13590 if(uBits & TVIS_FOCUSED) { // Punktierten Rahmen um Text zeichnen
13592 Rectangle(hDc, sButton.left - 2, sButton.top - 1, sButton.right + 2, sButton.bottom + 1);
13593 }
13594 }
13595
13596 SetTextColor(hDc, uTempColor);
13597 sButton.left += pData->iFontOff;
13598
13599 DrawText(hDc, pText, uTextSize, &sButton, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
13600
13601 if(uBits & (TVIS_UNDERLINE | TVIS_TRACKED)) // Text unterstreichen
13602 if(pText && *pText) {
13603 sButton.left -= pData->iFontOff;
13604 sButton.right -= pData->iFontOff + 1;
13605 sButton.top += pData->iFontLine;
13606 sButton.bottom = sButton.top + 1;
13607 uOldColor = SetBkColor(hDc, uTempColor);
13608 ExtTextOut(hDc, 0, 0, ETO_OPAQUE | ETO_CLIPPED, &sButton, NULL, 0, NULL);
13609 SetBkColor(hDc, uOldColor);
13610 }
13611
13612 SetTextColor(hDc, pData->uColors[TVC_TEXT]);
13613
13614 delete(pPos);
13615 delete(pPtr);
13616 } else { // Den Text ganz normal ausgeben
13617 if(!pExtra->iTextPixels) {
13618 sButton.top = iYpos;
13619 sButton.left = sArea.left + 4;
13620 sButton.right = sArea.right;
13621 sButton.bottom = iYpos + pData->iFontHeight + 2;
13622
13623 if(uTextSize) { // Textbreite berechen
13624 DrawText(hDc, pText, uTextSize, &sButton, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT);
13625 pExtra->iTextPixels = sButton.right - sButton.left;
13626 } else {
13627 pExtra->iTextPixels = 0;
13628 }
13629 }
13630 // Ist der Text größer als die Spalte
13631 if(sArea.left + pExtra->iTextPixels >= sArea.right) {
13632 INT *pPos = (INT *)new(INT, uTextSize);
13633
13634 iSize = sArea.right - sArea.left;
13635 iSize -= (uBits & TVIS_BOLD) ? pData->uTrippleB : pData->uTrippleN;
13636 if(iSize < 3) {
13637 iCount = 0;
13638 } else {
13639 GetTextExtentExPoint(hDc, pText, uTextSize, iSize, &iCount, pPos, &sSize);
13640 }
13641
13642 if(iCount > 0) { // Passen noch Buchstaben vor "..."
13643 sButton.right = sArea.right;
13644 sArea.right = sArea.left + 2 + pPos[iCount - 1];
13645
13646 ExtTextOut(hDc, sArea.left + 2, iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, pText, iCount, NULL);
13647
13648 sArea.left = sArea.right;
13649 sArea.right = sButton.right;
13650
13651 ExtTextOut(hDc, sArea.left , iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, _T("..."), 3, NULL);
13652 } else {
13653 ExtTextOut(hDc, sArea.left + 2, iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, _T("..."), 3, NULL);
13654 }
13655
13656 delete(pPos);
13657 } else {
13658 switch(pData->aColumn[uExtra].bAlign) { // Textausrichtung
13659 case DT_CENTER:
13661 ExtTextOut(hDc, (sArea.right + sArea.left) / 2, iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, pText, uTextSize, NULL);
13662 SetTextAlign(hDc, TA_LEFT | TA_TOP);
13663 break;
13664
13665 case DT_RIGHT:
13667 ExtTextOut(hDc, sArea.right - 2, iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, pText, uTextSize, NULL);
13668 SetTextAlign(hDc, TA_LEFT | TA_TOP);
13669 break;
13670
13671 default
13672 :
13673 ExtTextOut(hDc, sArea.left + 2, iYpos, ETO_OPAQUE | ETO_CLIPPED, &sArea, pText, uTextSize, NULL);
13674 break;
13675 }
13676 }
13677 }
13678 }
13679 }
13680
13681 sArea.top += pData->iRowHeight;
13682 }
13683
13684 if(sArea.top < sRect.bottom) { // Untere Fläche ohne Einträge füllen
13685 SelectObject(hDc, hRgnMain);
13686
13687 // Gibt es markierte Spalten
13688 if(pData->uMarkedCols > 0 && (pData->cIsEnabled || !(pData->uStyleEx & TVS_EX_GRAYEDDISABLE))) {
13689 sRect.right = 0 - pData->uScrollX;
13690
13691 for(uColumn = 0; uColumn < pData->uColumnCount; uColumn++) {
13692 uExtra = pData->aColumnPos[uColumn ];
13693 uNext = pData->aColumnPos[uColumn + 1];
13694 uMark = pData->aColumn[uExtra].bMark;
13695 sRect.top = sArea.top;
13696 sRect.left = sRect.right;
13697 sRect.right = pData->aColumnXpos[uNext] + uMark;
13698 sRect.right -= pData->uScrollX;
13699 if(sRect.right == sRect.left + 1)
13700 uMark = 0;
13701 SetBkColor(hDc, (uMark) ? pData->uColors[TVC_COLBK] : uBkColor);
13702 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sRect, NULL, 0, NULL);
13703 }
13704
13705 sRect.top = sArea.top;
13706 sRect.left = sRect.right;
13707 sRect.right = pData->uSizeX;
13708 SetBkColor(hDc, uBkColor);
13709 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sRect, NULL, 0, NULL);
13710 } else { // Keine markierten Spalten
13711 sRect.top = sArea.top;
13712 SetBkColor(hDc, uBkColor);
13713 ExtTextOut(hDc, 0, 0, ETO_OPAQUE, &sRect, NULL, 0, NULL);
13714 }
13715 }
13716
13717 if(pData->iMaxSizeX != iMaxX) { // X-Scrollbar aktuallisieren
13718 pData->iMaxSizeX = iMaxX;
13719 if(pData->uColumnCount == 0)
13720 if(pData->iMaxSizeX != (int)pData->uOldXCount) {
13722 }
13723 }
13724
13725 UNLOCK(pData);
13726
13727 DeleteObject(hRgnMain);
13728
13729 for(uPos = 0; uPos < uRgnCount; uPos++) {
13730 DeleteObject(aRgn[uPos]);
13731 }
13732
13733}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TVS_HASLINES
Definition: commctrl.h:3248
#define TVIS_DROPHILITED
Definition: commctrl.h:3282
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define TVIS_EXPANDED
Definition: commctrl.h:3284
#define TVIS_EXPANDPARTIAL
Definition: commctrl.h:3286
#define TVIS_OVERLAYMASK
Definition: commctrl.h:3287
#define TVS_HASBUTTONS
Definition: commctrl.h:3247
#define LVIS_STATEIMAGEMASK
Definition: commctrl.h:2326
#define LVIS_CUT
Definition: commctrl.h:2320
unsigned uParent
Definition: treelist.c:183
COLORREF uColorBk
Definition: treelist.c:202
BYTE bFlags
Definition: treelist.c:200
COLORREF uColorText
Definition: treelist.c:201
#define CBS_UNCHECKEDNORMAL
Definition: treelist.c:148
#define TVIS_TRACKED
Definition: treelist.c:122
#define CBS_CHECKEDNORMAL
Definition: treelist.c:151
#define TVIS_FOCUSED
Definition: treelist.c:125
#define BP_CHECKBOX
Definition: treelist.c:145
#define TVIX_HASIMAGE
Definition: treelist.c:166
#define GLPS_OPENED
Definition: treelist.c:142
#define TVP_GLYPH
Definition: treelist.c:136
#define TVAX_CHECK
Definition: treelist.c:161
#define TVIS_BKCOLOR
Definition: treelist.c:123
#define GLPS_CLOSED
Definition: treelist.c:139
#define TVIS_TEXTCOLOR
Definition: treelist.c:126
#define TVC_FRAME
Definition: treelist.h:140
#define TVC_MARK
Definition: treelist.h:145
#define TV_SECONDICON
Definition: treelist.h:91
#define TVS_EX_SUBSELECT
Definition: treelist.h:271
#define TVC_ODD
Definition: treelist.h:138
#define TVC_TRACK
Definition: treelist.h:144
#define TVC_COLEVEN
Definition: treelist.h:152
#define TVC_BK
Definition: treelist.h:137
#define TVC_LINE
Definition: treelist.h:142
#define TVS_EX_ITEMLINES
Definition: treelist.h:269
#define TV_NOIMAGE
Definition: treelist.h:88
#define TVS_EX_ALTERNATECOLOR
Definition: treelist.h:270
#define TVIS_UNDERLINE
Definition: treelist.h:104
#define TVC_MARKODD
Definition: treelist.h:146
#define TVAE_STATEENABLE
Definition: treelist.h:206
#define TVC_BOX
Definition: treelist.h:143
#define TVC_COLBK
Definition: treelist.h:150
#define TVC_MARKEVEN
Definition: treelist.h:147
#define TVS_EX_FULLROWMARK
Definition: treelist.h:272
#define TV_NOAUTOEXPAND
Definition: treelist.h:90
#define TVS_EX_GRAYEDDISABLE
Definition: treelist.h:278
#define TVC_COLODD
Definition: treelist.h:151
#define TVC_EVEN
Definition: treelist.h:139
#define TVC_BOXBG
Definition: treelist.h:149
#define TVS_EX_FULLROWITEMS
Definition: treelist.h:279
#define TVS_EX_AUTOEXPANDICON
Definition: treelist.h:274
#define TVC_GRAYED
Definition: treelist.h:153
int32_t INT
Definition: typedefs.h:58
DWORD COLORREF
Definition: windef.h:300
#define GetTextExtentExPoint
Definition: wingdi.h:4471
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define NULLREGION
Definition: wingdi.h:361
UINT WINAPI SetTextAlign(_In_ HDC, _In_ UINT)
Definition: text.c:883
#define TA_RIGHT
Definition: wingdi.h:933
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define TA_LEFT
Definition: wingdi.h:932
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
#define TRANSPARENT
Definition: wingdi.h:950
#define RGN_AND
Definition: wingdi.h:356
#define NULL_BRUSH
Definition: wingdi.h:901
#define TA_TOP
Definition: wingdi.h:930
#define TA_CENTER
Definition: wingdi.h:931
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
int WINAPI GetRgnBox(_In_ HRGN, _Out_ LPRECT)
#define DT_NOPREFIX
Definition: winuser.h:537
#define DT_CENTER
Definition: winuser.h:527
#define DT_SINGLELINE
Definition: winuser.h:540
#define DrawText
Definition: winuser.h:5771
#define DT_LEFT
Definition: winuser.h:534
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:927
#define DT_VCENTER
Definition: winuser.h:543
#define DT_RIGHT
Definition: winuser.h:538
#define DT_CALCRECT
Definition: winuser.h:526
#define COLOR_3DFACE
Definition: winuser.h:929

Referenced by TreeListProc().

◆ TreeListEditLabel()

static HWND TreeListEditLabel ( TreeListData pData,
unsigned  uItem,
unsigned  uSub 
)
static

Definition at line 9109 of file treelist.c.

9109 {
9110
9111 HDC hDc;
9112 HWND hWnd;
9113 LRESULT lRet;
9114 WNDPROC pProc;
9115 char cTemp;
9116 LPARAM lParam;
9117 ExtraItem *pExtra;
9119 NMTVDISPINFO sNotify;
9120 LPCTSTR pText;
9121 RECT sRect;
9122 SIZE sSize;
9123 HFONT hFont;
9124 unsigned uCol;
9125 unsigned uSel;
9126 unsigned uNext;
9127 unsigned uBits;
9128 unsigned uSize;
9129 unsigned uStart;
9130 unsigned uState;
9131 unsigned uFlags;
9132 unsigned uHeight;
9133 int iPixels;
9134 int iWidth;
9135 int iTemp;
9136
9137 uBits = uSub >> 29;
9138 uSel = (uSub >> 8) & 0x0FFFFF;
9139 uSub &= 0xFF;
9140
9141 if(uSub >= pData->uColumnCount)
9142 return NULL;
9143 if(uItem > pData->uTreeItemsMax)
9144 return NULL;
9145 pEntry = pData->pTreeItems[uItem];
9146 if(!pEntry)
9147 return NULL;
9148
9149 if(uItem != pData->uSelectedItem || uSub != pData->uSelectedSub) {
9150 uCol = (pData->uStyleEx & TVS_EX_SUBSELECT) ? uSub : 0;
9151 iTemp = TreeListSelectItem(pData, uItem, uCol, TVC_UNKNOWN);
9152 }
9153
9154 TreeListEnsureVisible(pData, uItem, uSub);
9155
9156 if(pData->hEdit) { // Editfenster löschen
9157 DestroyWindow(pData->hEdit);
9158 pData->hEdit = 0;
9159 }
9160
9161 switch(uBits & 3) { // Editfenster neu erzeugen
9162 case 1:
9163 pData->hEdit = CreateWindow(_T("COMBOBOX"), NULL, WS_BORDER | WS_CHILD | CBS_AUTOHSCROLL | CBS_DROPDOWN | WS_VSCROLL, 0, 0, 0, 0, pData->hWnd, (HMENU)3, NULL, NULL);
9164 pData->uEditMode = 1;
9165 SendMessage(pData->hEdit, CB_LIMITTEXT, 2048, 0);
9166 break;
9167
9168 case 2:
9169 pData->hEdit = CreateWindow(_T("COMBOBOX"), NULL, WS_BORDER | WS_CHILD | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST | WS_VSCROLL, 0, 0, 0, 0, pData->hWnd, (HMENU)3, NULL, NULL);
9170 pData->uEditMode = 2;
9171 SendMessage(pData->hEdit, CB_LIMITTEXT, 2048, 0);
9172 break;
9173
9174 default
9175 :
9176 uFlags = ES_LEFT;
9177
9178 if(uBits & 4) {
9179 if(pData->aColumn[uSub].bAlign == DT_RIGHT)
9180 uFlags = ES_RIGHT;
9181 if(pData->aColumn[uSub].bAlign == DT_CENTER)
9182 uFlags = ES_CENTER;
9183 }
9184
9185 pData->hEdit = CreateWindow(_T("EDIT"), NULL, WS_BORDER | WS_CHILD | ES_AUTOHSCROLL | uFlags, 0, 0, 0, 0, pData->hWnd, (HMENU)3, NULL, NULL);
9186 pData->uEditMode = 0;
9187 SendMessage(pData->hEdit, EM_SETLIMITTEXT, 2048, 0);
9188 break;
9189 }
9190
9191 if(!pData->hEdit)
9192 return NULL;
9193
9194 if(pSetWindowTheme) { // Remove the Visual-Styles (XP+)
9195 pSetWindowTheme(pData->hEdit, L"", L"");
9196 }
9197
9198 pData->pProcId3 = (WNDPROC)GetWindowLongPtr(pData->hEdit, GWLP_WNDPROC);
9201
9202 hWnd = GetWindow(pData->hEdit, GW_CHILD);
9203
9204 while(hWnd) {
9209 }
9210
9211 pData->cEditCb = 0;
9212
9213 if(pData->uEditMode >= 1) { // ComboBox leeren
9214 SendMessage(pData->hEdit, CB_RESETCONTENT, 0, 0);
9215 }
9216
9217 if(uSub == 0) { // Haupteintrag bearbeiten
9219
9220 pText = pEntry->pText;
9221 uSize = pEntry->uTextSize;
9222 iPixels = pEntry->iTextPixels + 10;
9223 lParam = pEntry->lParam;
9224 uState = pEntry->uState;
9225 hFont = (uState & TVIS_BOLD) ? pData->hFontB : pData->hFontN;
9226
9227 if(pEntry->bCallback & TVIF_TEXT) {
9228 CallbackEntry(pData, pEntry, uItem, TVIF_TEXT, &iTemp, &uSize, &pText);
9229 hDc = GetDC(pData->hWnd);
9230 SelectObject(hDc, hFont);
9232 ReleaseDC(pData->hWnd, hDc);
9233 iPixels = sRect.right - sRect.left + 10;
9234 pData->cEditCb = 1;
9235 }
9236
9237 if(uBits & 4) { // Volle Spaltenbreite
9238 if(pEntry->iImage != TV_NOIMAGE) {
9239 uNext = pData->aColumnPos[1];
9240 sRect.right = pData->aColumnXpos[uNext];
9241 sRect.right -= pData->uScrollX;
9242 }
9243
9244 iPixels = sRect.right - sRect.left - 2;
9245 } else {
9246 if(pData->uEditMode) {
9247 if(iPixels < 60)
9248 iPixels = 60;
9249 } else {
9250 if(iPixels < 48)
9251 iPixels = 48;
9252 }
9253
9254 if(pText && *pText) {
9255 iPixels += str_len(pText);
9256 }
9257
9258 if(pData->uEditMode) {
9259 iPixels += GetSystemMetrics(SM_CXHSCROLL);
9260 }
9261 }
9262 } else { // Extraeintrag bearbeiten
9263 if(uBits & 4) {
9264 TreeListGetItemRect(pData, uItem, TVIR_GETCOLUMN | TVIR_COLTOSUB(uSub), &sRect);
9265
9266 if(pData->aColumn[uSub].bEdit >= TVAX_CHECK) {
9267 sRect.left += pData->iChecksXsize;
9268 if(sRect.right < sRect.left)
9269 sRect.right = sRect.left + 1;
9270 }
9271 } else {
9273 }
9274
9275 pExtra = pData->pExtraItems[uSub - 1][uItem];
9276 if(!pExtra) {
9277 pData->cTempText1[0] = 0;
9278 pText = pData->cTempText1;
9279 uSize = sizeof(pData->cTempText1) / sizeof(pData->cTempText1[0]);
9280 iPixels = sRect.right - sRect.left + 10;
9281 hFont = pData->hFontN;
9282 uState = pEntry->uState & TVIS_BASEFLAGS;
9283 lParam = 0;
9284 } else {
9285 pText = pExtra->pText;
9286 uSize = pExtra->uTextSize;
9287 iPixels = pExtra->iTextPixels + 10;
9288 lParam = pEntry->lParam;
9289 uState = pExtra->uState;
9290 uState |= pEntry->uState & TVIS_BASEFLAGS;
9291 hFont = (uState & TVIS_BOLD) ? pData->hFontB : pData->hFontN;
9292
9293 if(pExtra->bCallback & TVIF_TEXT) {
9294 CallbackExtra(pData, pEntry, pExtra, uItem, uSub, TVIF_TEXT, &iTemp, &uSize, &pText);
9295 hDc = GetDC(pData->hWnd);
9296 SelectObject(hDc, hFont);
9298 ReleaseDC(pData->hWnd, hDc);
9299 iPixels = sRect.right - sRect.left;
9300 pData->cEditCb = 1;
9301 }
9302 }
9303
9304 if(uBits & 4) { // Volle Spaltenbreite
9305 if(pExtra && pExtra->iImage != TV_NOIMAGE) {
9306 sRect.left += pData->iImagesXsize + 1;
9307 }
9308
9309 iPixels = sRect.right - sRect.left - 2;
9310 } else {
9311 if(pData->uEditMode) {
9312 if(iPixels < 60)
9313 iPixels = 60;
9314 } else {
9315 if(iPixels < 48)
9316 iPixels = 48;
9317 }
9318
9319 if(pText && *pText) {
9320 iPixels += str_len(pText);
9321 }
9322
9323 if(pData->uEditMode) {
9324 iPixels += GetSystemMetrics(SM_CXHSCROLL);
9325 }
9326
9327 switch(pData->aColumn[uSub].bAlign) {
9328 case DT_RIGHT:
9329 iWidth = sRect.right - sRect.left;
9330 sRect.left += iWidth - iPixels;
9331 break;
9332
9333 case DT_CENTER:
9334 iWidth = sRect.right - sRect.left;
9335 sRect.left += (iWidth - iPixels) / 2;
9336 break;
9337 }
9338 }
9339 }
9340
9341 UNLOCK(pData);
9342
9343 sNotify.hdr.code = TVN_BEGINLABELEDIT;
9344 sNotify.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT | TVIF_SUBITEM;
9345 sNotify.item.hItem = (HTREEITEM)(ULONG_PTR)uItem;
9346 sNotify.item.pszText = (LPTSTR)pText;
9347 sNotify.item.lParam = lParam;
9348 sNotify.item.state = uState;
9349 sNotify.item.cchTextMax = uSize;
9350 sNotify.item.stateMask = 0xFFFFFFFF;
9351 sNotify.item.cChildren = uSub;
9352
9353 lRet = SendNotify(pData, &sNotify.hdr);
9354
9355 LOCK(pData);
9356
9357 if(lRet) { // Das Editieren abbrechen
9359 return NULL;
9360 }
9361
9362 pEntry = pData->pTreeItems[uItem];
9363 if(!pEntry)
9364 return NULL;
9365
9366 if(pData->uToolTipItem) { // Ein offenes Tooltip verstecken
9367 UpdateToolTip(pData, 0, 0);
9368 }
9369
9370 UNLOCK(pData);
9371 SetFocus(pData->hEdit);
9372 LOCK(pData);
9373
9374 if(pData->uEditMode) {
9375 sRect.top--;
9376 uHeight = 260;
9377 } else {
9378 uHeight = pData->iFontHeight + 4;
9379 }
9380
9381 if(pData->uEditMode) {
9382 if(iPixels < 60)
9383 iPixels = 60;
9384 } else {
9385 if(iPixels < 48)
9386 iPixels = 48;
9387 }
9388
9389 cTemp = pData->cColumnStart;
9390 SetWindowPos(pData->hEdit, HWND_TOP, sRect.left + 2, sRect.top + 1, iPixels, uHeight, SWP_SHOWWINDOW);
9391 SendMessage(pData->hEdit, WM_SETFONT, (WPARAM)hFont, 0);
9392 SetWindowText(pData->hEdit, pText);
9393 pData->cColumnStart = cTemp;
9394
9395 switch(uSel >> 18) { // Welche Textauswahl
9396 case 3:
9397 uStart = (uSel) & 0x01FF; // Einen Textbereich markieren
9398 uSize = (uSel >> 9) & 0x01FF;
9399 break;
9400
9401 case 2:
9402 uStart = uSel & 0x3FFFF; // Cursor auf eine bestimmte Stelle
9403 uSize = uStart;
9404 break;
9405
9406 case 1:
9407 uSel &= 0x3FFFF;
9408 if(uSel > 4)
9409 uSel -= 4;
9410 hDc = GetDC(pData->hEdit);
9411 SelectObject(hDc, hFont);
9412 GetTextExtentExPoint(hDc, pText, uSize, uSel, &iWidth, NULL, &sSize);
9413
9414 if(uSize > 0 && iWidth < (int)uSize - 1) { // Halben Buchstaben addieren
9415 GetTextExtentExPoint(hDc, pText + iWidth, 1, uSel, NULL, NULL, &sSize);
9416 uSel += sSize.cx / 2;
9417 GetTextExtentExPoint(hDc, pText, uSize, uSel, &iWidth, NULL, &sSize);
9418 }
9419
9420 ReleaseDC(pData->hEdit, hDc);
9421
9422 if(sSize.cx <= (int)uSel) {
9423 uStart = 0;
9424 break;
9425 }
9426
9427 uStart = iWidth;
9428 uSize = iWidth;
9429 break;
9430
9431 default
9432 :
9433 uStart = 0; // Alles markieren
9434 break;
9435 }
9436
9437 switch(pData->uEditMode) {
9438 case 0:
9439 SendMessage(pData->hEdit, EM_SETSEL, uStart, uSize);
9440 break;
9441 case 1:
9442 SendMessage(pData->hEdit, CB_SETEDITSEL, 0, MAKELPARAM(uStart, uSize));
9443 break;
9444 default
9445 :
9446 uStart = 0;
9447 uSize = 0xFFFF;
9448 break;
9449 }
9450
9452
9453 pData->uLastSel = MAKELPARAM(uStart, uSize);
9454 pData->uEditItem = uItem;
9455 pData->uEditSub = uSub;
9456
9457 return pData->hEdit;
9458}
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define WS_CHILD
Definition: pedump.c:617
#define WS_BORDER
Definition: pedump.c:625
#define WS_VSCROLL
Definition: pedump.c:627
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define ES_LEFT
Definition: pedump.c:664
#define ES_CENTER
Definition: pedump.c:665
#define ES_RIGHT
Definition: pedump.c:666
#define TVN_BEGINLABELEDIT
Definition: commctrl.h:3743
LONG cx
Definition: kdterminal.h:27
static LRESULT CALLBACK EditProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: treelist.c:687
static int TreeListGetItemRect(TreeListData *pData, unsigned uItem, unsigned uFlags, RECT *pRect)
Definition: treelist.c:2755
static void UpdateToolTip(TreeListData *pData, unsigned uItem, unsigned uFlags)
Definition: treelist.c:1771
#define TVIR_GETCOLUMN
Definition: treelist.h:229
#define TVIR_COLTOSUB(u)
Definition: treelist.h:228
#define TVIR_TEXT
Definition: treelist.h:230
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
#define CBS_AUTOHSCROLL
Definition: winuser.h:281
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define RDW_UPDATENOW
Definition: winuser.h:1220
#define RDW_ERASE
Definition: winuser.h:1211
#define CB_RESETCONTENT
Definition: winuser.h:1959
#define GW_HWNDNEXT
Definition: winuser.h:761
#define HWND_TOP
Definition: winuser.h:1207
#define EM_SETLIMITTEXT
Definition: winuser.h:2011
#define WM_SETFONT
Definition: winuser.h:1650
#define SWP_SHOWWINDOW
Definition: winuser.h:1248
#define EM_SETSEL
Definition: winuser.h:2018
#define CBS_DROPDOWN
Definition: winuser.h:283
#define CB_SETEDITSEL
Definition: winuser.h:1963
#define GetNextWindow(h, c)
Definition: winuser.h:4727
#define SM_CXHSCROLL
Definition: winuser.h:982
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define CB_LIMITTEXT
Definition: winuser.h:1958
#define SetWindowText
Definition: winuser.h:5857
#define GW_CHILD
Definition: winuser.h:763
int WINAPI GetSystemMetrics(_In_ int)
#define RDW_INVALIDATE
Definition: winuser.h:1214

Referenced by TreeListProc(), TreeListStartAutoEdit(), and TreeListStartNotifyEdit().

◆ TreeListEndLabelEdit()

static int TreeListEndLabelEdit ( TreeListData pData,
int  iMode 
)
static

Definition at line 8889 of file treelist.c.

8889 {
8890 TCHAR cText[2052];
8891 NMTVDISPINFO sNotify;
8892 TV_ITEM sSet;
8893 LRESULT lRet;
8894 unsigned uSub;
8895 unsigned uItem;
8896 ExtraItem *pExtra;
8898 LPCTSTR *pList;
8899 LPCTSTR pText;
8900 LPTSTR pGetT;
8901 TCHAR cChar;
8902 int iAuto;
8903 int iIcon;
8904 int iLine;
8905 int iPos;
8906 int iLen;
8907 int iMax;
8908 int iSel;
8909 char cCb;
8910
8911 uItem = pData->uEditItem;
8912 uSub = pData->uEditSub;
8913 cCb = pData->cEditCb;
8914
8915 pData->uEditItem = 0;
8916 pData->uEditSub = 0;
8917 pData->cEditCb = 0;
8918
8919 if(uItem > pData->uTreeItemsMax || uSub >= pData->uColumnCount) {
8920 return 0;
8921 }
8922
8923 pEntry = pData->pTreeItems[uItem];
8924 if(!pEntry) {
8925 return 0;
8926 }
8927
8928 if(iMode) { // Eingabe
8929 GetWindowText(pData->hEdit, cText, sizeof(cText) / sizeof(cText[0]));
8930 cText[sizeof(cText) / sizeof(cText[0]) - 1] = 0;
8931 sNotify.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT | TVIF_SUBITEM;
8932 sNotify.item.cchTextMax = sizeof(cText) / sizeof(cText[0]) - 1;
8933 sNotify.item.pszText = cText;
8934
8935 if(pData->cColumnStart) { // Wurde ein Text eingegeben
8936 sNotify.item.mask |= TVIF_TEXTCHANGED;
8937 }
8938
8939 if(iMode == 2) { // Wurde der Text mit RETURN eingegeben
8940 sNotify.item.mask |= TVIF_RETURNEXIT;
8941 }
8942 } else { // Abbruch
8943 sNotify.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_CANCELED | TVIF_SUBITEM;
8944 sNotify.item.pszText = NULL;
8945 sNotify.item.cchTextMax = 0;
8946 }
8947
8948 sNotify.hdr.code = TVN_ENDLABELEDIT;
8949 sNotify.item.hItem = (HTREEITEM)(ULONG_PTR)uItem;
8950 sNotify.item.stateMask = 0xFFFFFFFF;
8951 sNotify.item.cChildren = uSub;
8952
8953 if(uSub) { // Wurde der Text in einer Sub-Spalte geändert
8954 pExtra = pData->pExtraItems[uSub - 1][uItem];
8955 if(!pExtra) {
8956 sNotify.item.state = 0;
8957 sNotify.item.lParam = 0;
8958 } else {
8959 sNotify.item.state = pEntry->uState & TVIS_BASEFLAGS;
8960 sNotify.item.state |= pExtra->uState;
8961 sNotify.item.lParam = pEntry->lParam;
8962 }
8963 } else {
8964 sNotify.item.state = pEntry->uState;
8965 sNotify.item.lParam = pEntry->lParam;
8966 }
8967
8968 UNLOCK(pData);
8969