listWidgetInternal.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  1. #ifndef _NULLSOFT_WINAMP_ML_DEVICES_LIST_WIDGET_INTERNAL_HEADER
  2. #define _NULLSOFT_WINAMP_ML_DEVICES_LIST_WIDGET_INTERNAL_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. #include <vector>
  8. #include "./imageCache.h"
  9. typedef enum ListWidgetItemState
  10. {
  11. ListWidgetItemState_Default = (0),
  12. ListWidgetItemState_Hovered = (1 << 0),
  13. ListWidgetItemState_Selected = (1 << 1),
  14. ListWidgetItemState_Interactive = (1 << 2),
  15. ListWidgetItemState_TextTruncated = (1 << 3),
  16. ListWidgetItemState_TextEdited = (1 << 4),
  17. } ListWidgetItemSate;
  18. DEFINE_ENUM_FLAG_OPERATORS(ListWidgetItemSate);
  19. #define ListWidgetItem_State(_item) (((ListWidgetItem*)(_item))->state)
  20. #define ListWidgetItem_SetState(_item, _state) (ListWidgetItem_State(_item) |= (_state))
  21. #define ListWidgetItem_UnsetState(_item, _state) (ListWidgetItem_State(_item) &= ~(_state))
  22. #define ListWidgetItem_IsHovered(_item) (0 != (ListWidgetItemState_Hovered & ListWidgetItem_State(_item)))
  23. #define ListWidgetItem_SetHovered(_item) ListWidgetItem_SetState(_item, ListWidgetItemState_Hovered)
  24. #define ListWidgetItem_UnsetHovered(_item) ListWidgetItem_UnsetState(_item, ListWidgetItemState_Hovered)
  25. #define ListWidgetItem_IsSelected(_item) (0 != (ListWidgetItemState_Selected & ListWidgetItem_State(_item)))
  26. #define ListWidgetItem_SetSelected(_item) ListWidgetItem_SetState(_item, ListWidgetItemState_Selected)
  27. #define ListWidgetItem_UnsetSelected(_item) ListWidgetItem_UnsetState(_item, ListWidgetItemState_Selected)
  28. #define ListWidgetItem_IsInteractive(_item) (0 != (ListWidgetItemState_Interactive & ListWidgetItem_State(_item)))
  29. #define ListWidgetItem_SetInteractive(_item) ListWidgetItem_SetState(_item, ListWidgetItemState_Interactive)
  30. #define ListWidgetItem_UnsetInteractive(_item) ListWidgetItem_UnsetState(_item, ListWidgetItemState_Interactive)
  31. #define ListWidgetItem_IsTextTruncated(_item) (0 != (ListWidgetItemState_TextTruncated & ListWidgetItem_State(_item)))
  32. #define ListWidgetItem_SetTextTruncated(_item) ListWidgetItem_SetState(_item, ListWidgetItemState_TextTruncated)
  33. #define ListWidgetItem_UnsetTextTruncated(_item) ListWidgetItem_UnsetState(_item, ListWidgetItemState_TextTruncated)
  34. #define ListWidgetItem_IsTextEdited(_item) (0 != (ListWidgetItemState_TextEdited & ListWidgetItem_State(_item)))
  35. #define ListWidgetItem_SetTextEdited(_item) ListWidgetItem_SetState(_item, ListWidgetItemState_TextEdited)
  36. #define ListWidgetItem_UnsetTextEdited(_item) ListWidgetItem_UnsetState(_item, ListWidgetItemState_TextEdited)
  37. typedef struct ListWidgetConnection ListWidgetConnection;
  38. typedef std::vector<ListWidgetConnection*> ListWidgetConnectionList;
  39. typedef struct ListWidgetTooltip ListWidgetTooltip;
  40. typedef enum ListWidgetCommandState
  41. {
  42. ListWidgetCommandState_Normal = (0),
  43. ListWidgetCommandState_Disabled = (1 << 0),
  44. ListWidgetCommandState_Primary = (1 << 1),
  45. ListWidgetCommandState_Pressed = (1 << 2),
  46. } ListWidgetCommandState;
  47. DEFINE_ENUM_FLAG_OPERATORS(ListWidgetCommandState);
  48. typedef struct ListWidgetCommand ListWidgetCommand;
  49. typedef struct ListWidgetActivity
  50. {
  51. unsigned int step;
  52. unsigned int percent;
  53. wchar_t *title;
  54. SIZE titleSize;
  55. BOOL cancelable;
  56. }
  57. ListWidgetActivity;
  58. typedef struct ListWidgetActivityMetric
  59. {
  60. long height;
  61. long width;
  62. long progressWidth;
  63. long progressHeight;
  64. long percentWidth;
  65. long percentHeight;
  66. long titleWidth;
  67. long titleHeight;
  68. long fontHeight;
  69. long offsetLeft;
  70. long offsetRight;
  71. long offsetTop;
  72. long offsetBottom;
  73. long spacing;
  74. } ListWidgetActivityMetric;
  75. typedef enum ListWidgetActivityChange
  76. {
  77. ListWidgetActivityChanged_Nothing = 0,
  78. ListWidgetActivityChanged_Percent = (1 << 0),
  79. ListWidgetActivityChanged_Title = (1 << 1),
  80. ListWidgetActivityChanged_Cancelable = (1 << 2),
  81. ListWidgetActivityChanged_All = (ListWidgetActivityChanged_Percent | ListWidgetActivityChanged_Title | ListWidgetActivityChanged_Cancelable ),
  82. }
  83. ListWidtetActivityChange;
  84. DEFINE_ENUM_FLAG_OPERATORS(ListWidtetActivityChange);
  85. typedef enum ListWidgetItemPart
  86. {
  87. ListWidgetItemPart_None = 0,
  88. ListWidgetItemPart_Frame = (1 << 0),
  89. ListWidgetItemPart_Image = (1 << 1),
  90. ListWidgetItemPart_Title = (1 << 2),
  91. ListWidgetItemPart_Activity = (1 << 3),
  92. ListWidgetItemPart_Command = (1 << 4),
  93. ListWidgetItemPart_Spacebar = (1 << 5),
  94. ListWidgetItemPart_Connection = (1 << 6),
  95. }ListWidgetItemPart;
  96. DEFINE_ENUM_FLAG_OPERATORS(ListWidgetItemPart);
  97. typedef struct ListWidgetItem
  98. {
  99. char *name;
  100. wchar_t *title;
  101. RECT rect;
  102. SIZE titleSize;
  103. DeviceImage *image;
  104. uint64_t spaceTotal;
  105. uint64_t spaceUsed;
  106. ListWidgetItemState state;
  107. ListWidgetConnection *connection;
  108. ListWidgetActivity *activity;
  109. }ListWidgetItem;
  110. typedef std::vector<ListWidgetItem*> ListWidgetItemList;
  111. typedef struct ListWidgetGroup
  112. {
  113. char *name;
  114. wchar_t *title;
  115. ListWidgetItemList items;
  116. } ListWidgetGroup;
  117. typedef std::vector<ListWidgetGroup*> ListWidgetGroupList;
  118. typedef struct ListWidgetCategory
  119. {
  120. char *name;
  121. wchar_t *title;
  122. BOOL collapsed;
  123. ListWidgetGroupList groups;
  124. RECT rect;
  125. long titleWidth;
  126. long countWidth;
  127. wchar_t *countString;
  128. wchar_t *emptyText;
  129. RECT emptyTextRect;
  130. }ListWidgetCategory;
  131. typedef std::vector<ListWidgetCategory*> ListWidgetCategoryList;
  132. typedef enum ListWidgetFlags
  133. {
  134. ListWidgetFlag_NoFocusSelect = (1 << 0),
  135. ListWidgetFlag_LButtonDownOnCommand = (1 << 1),
  136. } ListWidgetFlags;
  137. DEFINE_ENUM_FLAG_OPERATORS(ListWidgetFlags);
  138. typedef struct ListWidget
  139. {
  140. ListWidgetFlags flags;
  141. ListWidgetCategoryList categories;
  142. ListWidgetConnectionList connections;
  143. BackBuffer backBuffer;
  144. ListWidgetItem *hoveredItem;
  145. ListWidgetItem *selectedItem;
  146. ListWidgetItem *titleEditItem;
  147. ListWidgetCategory *pressedCategory;
  148. SIZE imageSize;
  149. long itemWidth;
  150. size_t itemsPerLine;
  151. size_t deviceHandler;
  152. ListWidgetCommand **commands;
  153. size_t commandsCount;
  154. size_t commandsMax;
  155. ListWidgetItemList activeItems;
  156. POINT previousMouse;
  157. HBITMAP spacebarBitmap;
  158. HBITMAP arrowsBitmap;
  159. HBITMAP hoverBitmap;
  160. HBITMAP selectBitmap;
  161. HBITMAP inactiveSelectBitmap;
  162. HBITMAP largeBadgeBitmap;
  163. HBITMAP smallBadgeBitmap;
  164. SIZE connectionSize;
  165. SIZE primaryCommandSize;
  166. SIZE secondaryCommandSize;
  167. DeviceImage *unknownCommandLargeImage;
  168. DeviceImage *unknownCommandSmallImage;
  169. ListWidgetActivityMetric activityMetrics;
  170. HFONT activityFont;
  171. HBITMAP activityBadgeBitmap;
  172. DeviceImage *activityProgressImage;
  173. BOOL activityTimerEnabled;
  174. HMENU activeMenu;
  175. ListWidgetTooltip *tooltip;
  176. unsigned int selectionStatus;
  177. HWND titleEditor;
  178. } ListWidget;
  179. typedef struct
  180. ListWidgetItemMetric
  181. {
  182. long titleMinWidth;
  183. long offsetLeft;
  184. long offsetTop;
  185. long offsetRight;
  186. long offsetBottom;
  187. long imageOffsetLeft;
  188. long imageOffsetTop;
  189. long imageOffsetRight;
  190. long imageOffsetBottom;
  191. long titleOffsetTop;
  192. long spacebarOffsetTop;
  193. long spacebarHeight;
  194. } ListWidgetItemMetric;
  195. typedef struct
  196. ListWidgetCategoryMetric
  197. {
  198. long offsetLeft;
  199. long offsetTop;
  200. long offsetRight;
  201. long offsetBottom;
  202. long lineHeight;
  203. long lineOffsetTop;
  204. long titleOffsetLeft;
  205. long minHeight;
  206. long iconWidth;
  207. long iconHeight;
  208. } ListWidgetCategoryMetric;
  209. HBITMAP
  210. ListWidget_GetSpacebarBitmap(ListWidget *self,
  211. WidgetStyle *style,
  212. HWND hwnd,
  213. long width,
  214. long height);
  215. HBITMAP
  216. ListWidget_GetHoverBitmap(ListWidget *self,
  217. WidgetStyle *style,
  218. HWND hwnd,
  219. long width,
  220. long height);
  221. HBITMAP
  222. ListWidget_GetSelectBitmap(ListWidget *self,
  223. WidgetStyle *style,
  224. HWND hwnd,
  225. long width,
  226. long height);
  227. HBITMAP
  228. ListWidget_GetInactiveSelectBitmap(ListWidget *self,
  229. WidgetStyle *style,
  230. HWND hwnd,
  231. long width,
  232. long height);
  233. HBITMAP
  234. ListWidget_GetLargeBadgeBitmap(ListWidget *self,
  235. WidgetStyle *style,
  236. HWND hwnd,
  237. long width,
  238. long height);
  239. HBITMAP
  240. ListWidget_GetSmallBadgeBitmap(ListWidget *self,
  241. WidgetStyle *style,
  242. HWND hwnd,
  243. long width,
  244. long height);
  245. HBITMAP
  246. ListWidget_GetUnknownCommandSmallBitmap(ListWidget *self,
  247. WidgetStyle *style,
  248. long width,
  249. long height);
  250. HBITMAP
  251. ListWidget_GetUnknownCommandLargeBitmap(ListWidget *self,
  252. WidgetStyle *style,
  253. long width,
  254. long height);
  255. HBITMAP
  256. ListWidget_GetArrowsBitmap(ListWidget *self,
  257. WidgetStyle *style,
  258. HWND hwnd);
  259. HBITMAP
  260. ListWidget_GetActivityProgressBitmap(ListWidget *self,
  261. WidgetStyle *style);
  262. HBITMAP
  263. ListWidget_GetActivityBadgeBitmap(ListWidget *self,
  264. WidgetStyle *style,
  265. HWND hwnd,
  266. long width,
  267. long height);
  268. BOOL
  269. ListWidget_GetViewOrigin(HWND hwnd,
  270. POINT *pt);
  271. BOOL
  272. ListWidget_UpdateHoverEx(ListWidget *self,
  273. HWND hwnd,
  274. const POINT *cursor);
  275. BOOL
  276. ListWidget_UpdateHover(ListWidget *self,
  277. HWND hwnd);
  278. BOOL
  279. ListWidget_RemoveHover(ListWidget *self,
  280. HWND hwnd,
  281. BOOL invalidate);
  282. BOOL
  283. ListWidget_SelectItem(ListWidget *self,
  284. HWND hwnd,
  285. ListWidgetItem *item,
  286. BOOL ensureVisible);
  287. BOOL
  288. ListWidget_SetImageSize(ListWidget *self,
  289. HWND hwnd,
  290. int imageWidth,
  291. int imageHeight,
  292. BOOL redraw);
  293. typedef enum ListWidgetLayoutFlags
  294. {
  295. ListWidgetLayout_Normal = 0,
  296. ListWidgetLayout_NoRedraw = (1 << 0),
  297. ListWidgetLayout_UpdateNow = (1 << 1),
  298. ListWidgetLayout_KeepStable = (1 << 2),
  299. }ListWidgetLayoutFlags;
  300. DEFINE_ENUM_FLAG_OPERATORS(ListWidgetLayoutFlags);
  301. BOOL
  302. ListWidget_UpdateLayout(HWND hwnd,
  303. ListWidgetLayoutFlags flags);
  304. BOOL
  305. ListWidget_DisplayContextMenu(ListWidget *self,
  306. HWND hostWindow,
  307. POINT pt);
  308. BOOL
  309. ListWidget_RegisterActiveItem(ListWidget *self,
  310. HWND hwnd,
  311. ListWidgetItem *item);
  312. BOOL
  313. ListWidget_UnregisterActiveItem(ListWidget *self,
  314. HWND hwnd,
  315. ListWidgetItem *item);
  316. double
  317. ListWidget_GetZoomRatio(ListWidget *self);
  318. void
  319. ListWidget_UpdateSelectionStatus(ListWidget *self,
  320. HWND hwnd,
  321. BOOL ensureVisible);
  322. void
  323. ListWidget_UpdateSelectionSpaceStatus(ListWidget *self,
  324. HWND hwnd,
  325. BOOL ensureVisible);
  326. void
  327. ListWidget_UpdateTitleEditorColors(HWND editor,
  328. WidgetStyle *style);
  329. /*
  330. <<<<<<<<<<<<<<<<<<<<<<<<< Category >>>>>>>>>>>>>>>>>>>>>>>>>
  331. */
  332. ListWidgetCategory *
  333. ListWidget_CreateCategory(const char *name,
  334. const wchar_t *title,
  335. BOOL collapsed);
  336. void
  337. ListWidget_DestroyCategory(ListWidgetCategory *category);
  338. ListWidgetCategory *
  339. ListWidget_GetCategoryFromPoint(ListWidget *self,
  340. POINT point);
  341. ListWidgetCategory *
  342. ListWidget_FindCategory(ListWidget *self,
  343. const char *name);
  344. BOOL
  345. ListWidget_GetCategoryMetrics(WidgetStyle *style,
  346. ListWidgetCategoryMetric *metrics);
  347. BOOL
  348. ListWidget_ToggleCategory(ListWidgetCategory *category,
  349. HWND hwnd);
  350. void
  351. ListWidget_ResetCategoryCounter(ListWidgetCategory *category);
  352. void
  353. ListWidget_SortCategory(ListWidgetCategory *category);
  354. BOOL
  355. ListWidget_SetCategoryEmptyText(ListWidgetCategory *category, const wchar_t *text);
  356. /*
  357. <<<<<<<<<<<<<<<<<<<<<<<<< Group >>>>>>>>>>>>>>>>>>>>>>>>>
  358. */
  359. ListWidgetGroup *
  360. ListWidget_CreateGroup(const char *name);
  361. ListWidgetGroup *
  362. ListWidget_CreateGroupEx(const char *name,
  363. const wchar_t *title);
  364. void
  365. ListWidget_DestroyGroup(ListWidgetGroup *group);
  366. BOOL
  367. ListWidget_AddGroup(ListWidgetCategory *category,
  368. ListWidgetGroup *group);
  369. ListWidgetGroup *
  370. ListWidget_FindGroup(ListWidgetCategory *category,
  371. const char *name);
  372. ListWidgetGroup *
  373. ListWidget_FindGroupEx(ListWidgetCategory *category,
  374. const char *name,
  375. size_t max);
  376. void
  377. ListWidget_SortGroup(ListWidgetGroup *group);
  378. /*
  379. <<<<<<<<<<<<<<<<<<<<<<<<< Item >>>>>>>>>>>>>>>>>>>>>>>>>
  380. */
  381. typedef enum ListWidgetVisibleFlags
  382. {
  383. VISIBLE_NORMAL = 0,
  384. VISIBLE_PARTIAL_OK = (1 << 0),
  385. VISIBLE_ALIGN_BOTTOM =(1 << 1),
  386. VISIBLE_ALIGN_TOP = (1 << 2),
  387. VISIBLE_ALIGN_ALWAYS = (1 << 3),
  388. } ListWidgetVisibleFlags;
  389. DEFINE_ENUM_FLAG_OPERATORS(ListWidgetVisibleFlags);
  390. ListWidgetItem*
  391. ListWidget_CreateItemFromDevice(ListWidget *self,
  392. ifc_device* device);
  393. void
  394. ListWidget_DestroyItem(ListWidgetItem *item);
  395. BOOL
  396. ListWidget_CalculateItemBaseSize(ListWidget *self,
  397. WidgetStyle *style,
  398. SIZE *baseSize,
  399. long *itemTextWidth);
  400. size_t // number of removed items
  401. ListWidget_RemoveItem(ListWidget *self,
  402. HWND hwnd,
  403. const char *name);
  404. ListWidgetItem *
  405. ListWidget_GetFirstItem(ListWidget *self);
  406. ListWidgetItem *
  407. ListWidget_GetLastItem(ListWidget *self);
  408. ListWidgetItem *
  409. ListWidget_GetNextItem(ListWidget *self,
  410. ListWidgetItem *baseItem);
  411. ListWidgetItem *
  412. ListWidget_GetPreviousItem(ListWidget *self,
  413. ListWidgetItem *baseItem);
  414. ListWidgetItem *
  415. ListWidget_GetNextCategoryItem(ListWidget *self,
  416. ListWidgetCategory *category,
  417. ListWidgetItem *baseItem);
  418. ListWidgetItem *
  419. ListWidget_GetPreviousCategoryItem(ListWidget *self,
  420. ListWidgetCategory *category,
  421. ListWidgetItem *baseItem);
  422. ListWidgetItem *
  423. ListWidget_GetNextGroupItem(ListWidget *self,
  424. ListWidgetGroup *group,
  425. ListWidgetItem *baseItem);
  426. ListWidgetItem *
  427. ListWidget_GetPreviousGroupItem(ListWidget *self,
  428. ListWidgetGroup *group,
  429. ListWidgetItem *baseItem);
  430. ListWidgetItem *
  431. ListWidget_GetNextLineItem(ListWidget *self,
  432. ListWidgetItem *baseItem);
  433. ListWidgetItem *
  434. ListWidget_GetPreviousLineItem(ListWidget *self,
  435. ListWidgetItem *baseItem);
  436. ListWidgetItem *
  437. ListWidget_GetNextPageItem(ListWidget *self,
  438. HWND hwnd,
  439. ListWidgetItem *baseItem);
  440. ListWidgetItem *
  441. ListWidget_GetPreviousPageItem(ListWidget *self,
  442. HWND hwnd,
  443. ListWidgetItem *baseItem);
  444. BOOL
  445. ListWidget_EnsureItemVisisble(ListWidget *self,
  446. HWND hwnd,
  447. ListWidgetItem *item,
  448. ListWidgetVisibleFlags flags);
  449. HBITMAP
  450. ListWidget_GetItemImage(ListWidget *self,
  451. WidgetStyle *style,
  452. ListWidgetItem *item);
  453. BOOL
  454. ListWidget_GetItemMetrics(WidgetStyle *style,
  455. ListWidgetItemMetric *metrics);
  456. ListWidgetItem *
  457. ListWidget_GetItemFromPointEx(ListWidget *self,
  458. POINT point,
  459. ListWidgetCategory **categoryOut, // optional
  460. ListWidgetGroup **groupOut); // optional
  461. ListWidgetItem *
  462. ListWidget_GetItemFromPoint(ListWidget *self,
  463. POINT point);
  464. BOOL
  465. ListWidget_AddItem(ListWidgetGroup *group,
  466. ListWidgetItem *item);
  467. ListWidgetItem *
  468. ListWidget_FindGroupItem(ListWidgetGroup *group,
  469. const char *name);
  470. ListWidgetItem *
  471. ListWidget_FindGroupItemEx(ListWidgetGroup *group,
  472. const char *name,
  473. size_t max);
  474. ListWidgetGroup *
  475. ListWidget_GetItemOwner(ListWidget *self,
  476. ListWidgetItem *baseItem,
  477. ListWidgetCategory **categoryOut);
  478. ListWidgetItem *
  479. ListWidget_FindItem(ListWidget *self,
  480. const char *name,
  481. ListWidgetCategory **categoryOut,
  482. ListWidgetGroup **groupOut);
  483. BOOL
  484. ListWidget_FindItemPos(ListWidget *self,
  485. ListWidgetItem *item,
  486. size_t *categoryOut,
  487. size_t *groupOut,
  488. size_t *itemOut);
  489. BOOL
  490. ListWidget_SetItemTitle(ListWidgetItem *item,
  491. const wchar_t *title);
  492. BOOL
  493. ListWidget_DisplayItemContextMenu(ListWidget *self,
  494. HWND hostWindow,
  495. ListWidgetItem *item,
  496. POINT pt);
  497. size_t
  498. ListWidget_GetItemCommands(ListWidgetItem *item,
  499. ListWidgetCommand **buffer,
  500. size_t bufferMax);
  501. BOOL
  502. ListWidget_SendItemCommand(const char *name,
  503. const char *command,
  504. HWND hostWindow,
  505. ULONG_PTR param,
  506. BOOL enableIntercept);
  507. BOOL
  508. ListWidget_CreateItemActivity(ListWidgetItem *item);
  509. BOOL
  510. ListWidget_DeleteItemActivity(ListWidgetItem *item);
  511. ListWidtetActivityChange
  512. ListWidget_UpdateItemActivity(ListWidgetItem *item,
  513. ifc_deviceactivity *activity);
  514. BOOL
  515. ListWidget_InvalidateItemImage(ListWidget *self,
  516. HWND hwnd,
  517. ListWidgetItem *item);
  518. BOOL
  519. ListWidget_InvalidateItemActivity(ListWidget *self,
  520. HWND hwnd,
  521. ListWidgetItem *item,
  522. ListWidgetActivityChange changes);
  523. BOOL
  524. ListWidget_GetItemFrameRect(ListWidget *self,
  525. ListWidgetItem *item,
  526. ListWidgetItemMetric *metrics,
  527. RECT *rect);
  528. BOOL
  529. ListWidget_GetItemImageRect(ListWidget *self,
  530. ListWidgetItem *item,
  531. ListWidgetItemMetric *metrics,
  532. RECT *rect);
  533. BOOL
  534. ListWidget_GetItemActivityRect(ListWidget *self,
  535. ListWidgetItem *item,
  536. ListWidgetItemMetric *metrics,
  537. RECT *rect);
  538. BOOL
  539. ListWidget_GetItemActivityProgressRect(ListWidget *self,
  540. HDC hdc,
  541. ListWidgetItem *item,
  542. ListWidgetItemMetric *metrics,
  543. RECT *rect);
  544. BOOL
  545. ListWidget_GetItemActivityPercentRect(ListWidget *self,
  546. HDC hdc,
  547. ListWidgetItem *item,
  548. ListWidgetItemMetric *metrics,
  549. RECT *rect);
  550. BOOL
  551. ListWidget_GetItemActivityTitleRect(ListWidget *self,
  552. HDC hdc,
  553. ListWidgetItem *item,
  554. ListWidgetItemMetric *metrics,
  555. RECT *rect);
  556. BOOL
  557. ListWidget_GetItemSpacebarRect(ListWidget *self,
  558. ListWidgetItem *item,
  559. ListWidgetItemMetric *metrics,
  560. RECT *rect);
  561. BOOL
  562. ListWidget_GetItemTitleRect(ListWidget *self,
  563. ListWidgetItem *item,
  564. ListWidgetItemMetric *metrics,
  565. BOOL exactSize,
  566. RECT *rect);
  567. BOOL
  568. ListWidget_GetItemConnectionRect(ListWidget *self,
  569. ListWidgetItem *item,
  570. ListWidgetItemMetric *metrics,
  571. RECT *rect);
  572. ListWidgetItemPart
  573. ListWidget_GetItemPartFromPoint(ListWidget *self,
  574. ListWidgetItem *item,
  575. ListWidgetItemMetric *metrics,
  576. POINT pt,
  577. ListWidgetItemPart mask,
  578. RECT *partRect);
  579. BOOL
  580. ListWidget_FormatItemTip(ListWidget *self,
  581. ListWidgetItem *item,
  582. wchar_t *buffer,
  583. size_t bufferMax);
  584. BOOL
  585. ListWidget_FormatItemTitleTip(ListWidget *self,
  586. ListWidgetItem *item,
  587. wchar_t *buffer,
  588. size_t bufferMax);
  589. BOOL
  590. ListWidget_FormatItemCommandTip(ListWidget *self,
  591. ListWidgetItem *item,
  592. const RECT *commandRect,
  593. wchar_t *buffer,
  594. size_t bufferMax);
  595. BOOL
  596. ListWidget_FormatItemSpaceTip(ListWidget *self,
  597. ListWidgetItem *item,
  598. wchar_t *buffer,
  599. size_t bufferMax);
  600. BOOL
  601. ListWidget_FormatItemStatus(ListWidget *self,
  602. ListWidgetItem *item,
  603. wchar_t *buffer,
  604. size_t bufferMax);
  605. BOOL
  606. ListWidget_FormatItemSpaceStatus(ListWidget *self,
  607. ListWidgetItem *item,
  608. wchar_t *buffer,
  609. size_t bufferMax);
  610. HWND
  611. ListWidget_BeginItemTitleEdit(ListWidget *self,
  612. HWND hwnd,
  613. ListWidgetItem *item);
  614. int
  615. ListWidget_CompareItemPos(ListWidget *self,
  616. ListWidgetItem *item1,
  617. ListWidgetItem *item2);
  618. BOOL
  619. ListWidget_GetViewItemPos(HWND hwnd,
  620. ListWidgetItem *item,
  621. POINT *pt);
  622. /*
  623. <<<<<<<<<<<<<<<<<<<<<<<<< Connection >>>>>>>>>>>>>>>>>>>>>>>>>
  624. */
  625. ListWidgetConnection *
  626. ListWidget_CreateConnection(const char *name);
  627. void
  628. ListWidget_DestroyConnection(ListWidgetConnection *connection);
  629. HBITMAP
  630. ListWidget_GetConnectionImage(WidgetStyle *style,
  631. ListWidgetConnection *connection,
  632. int width,
  633. int height);
  634. BOOL
  635. ListWidget_ConnectionResetColors(WidgetStyle *style,
  636. ListWidgetConnection *connection);
  637. void
  638. ListWidget_ResetConnnectionsColors(ListWidget *self,
  639. WidgetStyle *style);
  640. ListWidgetConnection *
  641. ListWidget_FindConnection(ListWidget *self,
  642. const char *name);
  643. BOOL
  644. ListWidget_AddConnection(ListWidget *self,
  645. ListWidgetConnection *connection);
  646. void
  647. ListWidget_RemoveConnection(ListWidget *self,
  648. const char *name);
  649. void
  650. ListWidget_RemoveAllConnections(ListWidget *self);
  651. BOOL
  652. ListWidget_UpdateConnectionImageSize(ListWidgetConnection *connection,
  653. int width,
  654. int height);
  655. /*
  656. <<<<<<<<<<<<<<<<<<<<<<<<< Command >>>>>>>>>>>>>>>>>>>>>>>>>
  657. */
  658. ListWidgetCommand *
  659. ListWidget_CreateCommand(const char *name,
  660. BOOL primary,
  661. BOOL disabled);
  662. void
  663. ListWidget_DestroyCommand(ListWidgetCommand *command);
  664. size_t
  665. ListWigdet_GetDeviceCommands(ListWidgetCommand **buffer,
  666. size_t bufferMax,
  667. ifc_device *device);
  668. void
  669. ListWidget_DestroyAllCommands(ListWidgetCommand** buffer,
  670. size_t bufferMax);
  671. const wchar_t *
  672. ListWidget_GetCommandTitle(ListWidgetCommand *command);
  673. const wchar_t *
  674. ListWidget_GetCommandDescription(ListWidgetCommand *command);
  675. HBITMAP
  676. ListWidget_GetCommandLargeBitmap(WidgetStyle *style,
  677. ListWidgetCommand *command,
  678. int width,
  679. int height);
  680. HBITMAP
  681. ListWidget_GetCommandSmallBitmap(WidgetStyle *style,
  682. ListWidgetCommand *command,
  683. int width,
  684. int height);
  685. BOOL
  686. ListWidget_ResetCommandImages(ListWidgetCommand *command);
  687. BOOL
  688. ListWidget_GetCommandRect(ListWidgetCommand *command,
  689. RECT *rect);
  690. BOOL
  691. ListWidget_SetCommandRect(ListWidgetCommand *command,
  692. const RECT *rect);
  693. BOOL
  694. ListWidget_GetCommandRectEqual(ListWidgetCommand *command,
  695. const RECT *rect);
  696. BOOL
  697. ListWidget_GetCommandPrimary(ListWidgetCommand *command);
  698. BOOL
  699. ListWidget_GetCommandDisabled(ListWidgetCommand *command);
  700. BOOL
  701. ListWidget_EnableCommand(ListWidgetCommand *command,
  702. BOOL enable);
  703. BOOL
  704. ListWidget_GetCommandPressed(ListWidgetCommand *command);
  705. BOOL
  706. ListWidget_SetCommandPressed(ListWidgetCommand *command,
  707. BOOL pressed);
  708. const char *
  709. ListWidget_GetCommandName(ListWidgetCommand *command);
  710. /*
  711. <<<<<<<<<<<<<<<<<<<<<<<<< Paint >>>>>>>>>>>>>>>>>>>>>>>>>
  712. */
  713. typedef struct ListWidgetPaintSpacebar
  714. {
  715. HBITMAP bitmap;
  716. long width;
  717. long height;
  718. long emptyBarOffset;
  719. long filledBarOffset;
  720. } ListWidgetPaintSpacebar;
  721. typedef struct ListWidgetPaintArrow
  722. {
  723. HBITMAP bitmap;
  724. long width;
  725. long height;
  726. long collapsedOffset;
  727. long expandedOffset;
  728. } ListWidgetPaintArrow;
  729. typedef struct ListWidgetPaint
  730. {
  731. ListWidget *widget;
  732. WidgetStyle *style;
  733. HWND hwnd;
  734. HDC hdc;
  735. BOOL erase;
  736. const RECT *paintRect;
  737. HDC sourceDC;
  738. ListWidgetPaintSpacebar spacebar;
  739. ListWidgetItemMetric itemMetrics;
  740. ListWidgetCategoryMetric categoryMetrics;
  741. ListWidgetPaintArrow arrow;
  742. RECT partRect;
  743. BOOL focused;
  744. } ListWidgetPaint;
  745. BOOL
  746. ListWidgetPaint_Initialize(ListWidgetPaint *self,
  747. ListWidget *widget,
  748. WidgetStyle *style,
  749. HWND hwnd,
  750. HDC hdc,
  751. const RECT *paintRect,
  752. BOOL erase);
  753. void
  754. ListWidgetPaint_Uninitialize(ListWidgetPaint *self);
  755. BOOL
  756. ListWidgetPaint_DrawItem(ListWidgetPaint *self,
  757. ListWidgetItem *item);
  758. BOOL
  759. ListWidgetPaint_DrawCategory(ListWidgetPaint *self,
  760. ListWidgetCategory *category);
  761. BOOL
  762. ListWidgetPaint_DrawEmptyCategoryText(ListWidgetPaint *self,
  763. ListWidgetCategory *category);
  764. /*
  765. <<<<<<<<<<<<<<<<<<<<<<<<< Tooltip >>>>>>>>>>>>>>>>>>>>>>>>>
  766. */
  767. ListWidgetTooltip*
  768. ListWidget_TooltipCreate(HWND hwnd);
  769. void
  770. ListWidget_TooltipDestroy(ListWidgetTooltip *tooltip);
  771. void
  772. ListWidget_TooltipFontChanged(ListWidgetTooltip *tooltip);
  773. BOOL
  774. ListWidget_TooltipActivate(ListWidgetTooltip *tooltip,
  775. const RECT *rect);
  776. BOOL
  777. ListWidget_TooltipUpdate(ListWidgetTooltip *tooltip,
  778. ListWidgetItem *item,
  779. ListWidgetItemPart part,
  780. const RECT *partRect);
  781. void
  782. ListWidget_TooltipHide(ListWidgetTooltip *tooltip);
  783. void
  784. ListWidget_TooltipRelayMouseMessage(ListWidgetTooltip *tooltip,
  785. unsigned int message,
  786. unsigned int vKeys,
  787. const POINT *cursor);
  788. BOOL
  789. ListWidget_TooltipProcessNotification(ListWidget *self,
  790. ListWidgetTooltip *tooltip,
  791. NMHDR *pnmh,
  792. LRESULT *result);
  793. ListWidgetItem *
  794. ListWidget_TooltipGetCurrent(ListWidgetTooltip *tooltip,
  795. ListWidgetItemPart *part,
  796. RECT *partRect);
  797. BOOL
  798. ListWidget_TooltipGetChanged(ListWidgetTooltip *tooltip,
  799. ListWidgetItem *item,
  800. ListWidgetItemPart part,
  801. const RECT *partRect);
  802. typedef enum TooltipUpdateReason
  803. {
  804. Tooltip_DeviceTitleChanged = 1,
  805. Tooltip_DeviceSpaceChanged = 2,
  806. Tooltip_DeviceActivityChanged = 3,
  807. Tooltip_DeviceModelChanged = 4,
  808. Tooltip_DeviceStatusChanged = 5,
  809. } TooltipUpdateReason;
  810. BOOL
  811. ListWidget_TooltipUpdateText(ListWidget *self,
  812. ListWidgetTooltip *tooltip,
  813. ListWidgetItem *item,
  814. TooltipUpdateReason reason);
  815. #endif //_NULLSOFT_WINAMP_ML_DEVICES_LIST_WIDGET_INTERNAL_HEADER