forked from macroquest/eqlib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUI.h
6689 lines (5750 loc) · 242 KB
/
UI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* MacroQuest: The extension platform for EverQuest
* Copyright (C) 2002-2022 MacroQuest Authors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#pragma once
#include "ForwardDecls.h"
#include "Common.h"
#include "Constants.h"
#include "Containers.h"
#include "CXStr.h"
#include "CXWnd.h"
#include "Containers.h"
#include "Items.h"
#include "XMLData.h"
#include "UITemplates.h"
#include "EQData.h"
#include <list>
#include <functional>
#undef FindWindow
#undef InsertMenuItem
struct IShellFolder;
// from shtypes.h
struct _ITEMIDLIST;
using LPITEMIDLIST = _ITEMIDLIST *;
namespace eqlib {
//----------------------------------------------------------------------------
// Forward Declarations
class CAtlas;
class CButtonWnd;
class CChatContainerWindow;
class CChatWindow;
class CContextMenu;
class CConfirmationDialog;
class CEditWnd;
class CParamLayoutStrategy;
class CLabel;
class CLayoutStrategyTemplate;
class CStmlWnd;
class CUnSerializeBuffer;
class CVerticalLayoutWnd;
class CVivoxObserver;
using D3DCOLOR = DWORD;
using CPopDialogWnd = CConfirmationDialog;
//----------------------------------------------------------------------------
class WndEventHandler
{
public:
uint32_t lastUpdate;
};
//----------------------------------------------------------------------------
class CVivoxManager;
class CVivoxObserver
{
public:
virtual void Unknown00(bool) {}
CVivoxManager* VivoxManager;
};
//----------------------------------------------------------------------------
class CObservable;
class CNotification
{
public:
int Type;
};
class IObserver
{
public:
EQLIB_OBJECT virtual void Notify(CObservable* Src, const CNotification* const Notification) {}
};
class CObservable
{
public:
EQLIB_OBJECT void NotifyObservers(CNotification* notification = 0);
private:
// this will never work because of differences in stl between
// mq2 and eq. Don't use it.
std::list<IObserver*> ObserverList;
};
//============================================================================
// CTextureFont
//============================================================================
class [[offsetcomments]] CTextureFont
{
public:
virtual ~CTextureFont();
EQLIB_OBJECT CXStr GetName() const;
EQLIB_OBJECT int DrawWrappedText(const CXStr&, const CXRect&, const CXRect&, COLORREF, uint16_t, int) const;
EQLIB_OBJECT int DrawWrappedText(const CXStr& Str, int x, int y, int Width, const CXRect& BoundRect, COLORREF Color, uint16_t Flags = 0, int StartX = 0) const;
EQLIB_OBJECT int DrawWrappedText(CTextObjectInterface* Interface, const CXStr& Str, const CXRect& Rect, const CXRect& BoundRect, COLORREF Color, uint16_t Flags = 0, int StartX = 0) const;
EQLIB_OBJECT int GetHeight() const;
EQLIB_OBJECT int GetKerning(unsigned short, unsigned short) const;
EQLIB_OBJECT int GetTextExtent(const CXStr&);
EQLIB_OBJECT int GetWidth(unsigned short) const;
/*0x08*/ int FontStyle;
/*0x0c*/
};
//============================================================================
// CEQSuiteTextureLoader
//============================================================================
enum eBitmapType
{
eBitmapTypeNormal,
eBitmapTypeLayer,
eBitmapType_SingleDetail,
eBitmapTypePaletteDetailMain,
eBitmapTypePaletteDetailPalette,
eBitmapTypePaletteDetailDetail
};
class [[offsetcomments]] CEQGBitmap
: public CThreadLoader
, public TListNode<CEQGBitmap>
{
public:
/*0x40*/ eBitmapType eType;
/*0x44*/ MemPoolManagerType eMemoryPoolManagerType;
/*0x48*/ char* FileName;
/*0x50*/ uint32_t SourceWidth;
/*0x54*/ uint32_t SourceHeight;
/*0x58*/ float DetailScale;
/*0x5c*/ uint32_t GrassDensity;
/*0x60*/ uint32_t Width;
/*0x64*/ uint32_t Height;
/*0x68*/ bool bHasTexture;
union
{
/*0x70*/ IDirect3DBaseTexture9* pD3DTexture;
/*0x70*/ void* pRawBitmap;
};
/*0x78*/ uint32_t ObjectIndex;
/*0x7c*/ uint32_t Size;
/*0x80*/ bool bForceMipMap;
/*0x84*/ int TrackingType;
/*0x88*/ float SQDistanceToCamera;
/*0x8c*/ uint32_t LastDistanceTime;
/*0x90*/ uint32_t LastRenderTime;
/*0x94*/ uint32_t LoadedTime;
/*0x98*/
};
struct [[offsetcomments]] BMI
{
/*0x00*/ char* Name;
/*0x08*/ unsigned int Flags;
/*0x10*/ CEQGBitmap* pBmp;
/*0x18*/
};
struct [[offsetcomments]] _SuiteTexture
{
/*0x00*/ bool bUsed;
/*0x08*/ CXStr Name;
/*0x10*/ enDir Directory;
/*0x18*/ BMI* pBMInfo;
/*0x20*/
};
struct SWadFile;
class [[offsetcomments]] CEQSuiteTextureLoader
{
public:
/*0x00*/ SWadFile* pWadFile;
/*0x08*/ ArrayClass<_SuiteTexture> Textures;
/*0x20*/ CXStr UIPath[cUIDirectoryCount];
/*0x40*/ CXStr DefaultUIPath[cUIDirectoryCount];
/*0x60*/
EQLIB_OBJECT CEQSuiteTextureLoader();
EQLIB_OBJECT ~CEQSuiteTextureLoader();
EQLIB_OBJECT BMI* GetTexture(const CUITextureInfo& ti);
EQLIB_OBJECT unsigned int CreateTexture(const CUITextureInfo& ti);
EQLIB_OBJECT void DestroyTexture(const CUITextureInfo& ti);
EQLIB_OBJECT void UnloadAllTextures();
EQLIB_OBJECT const CXStr& GetDefaultUIPath(int DirType) const;
};
//============================================================================
// CRadioGroup
//============================================================================
class [[offsetcomments]] CRadioGroup
{
public:
EQLIB_OBJECT CRadioGroup(CXStr name = {});
EQLIB_OBJECT virtual ~CRadioGroup();
/*0x08*/ CXStr Name;
/*0x10*/ ArrayClass<CButtonWnd*> Buttons;
/*0x28*/ int CurSel = -1;
/*0x2c*/ bool bAllowMultiSelect = false;
/*0x30*/ int nSelectionLimit = -1;
/*0x34*/ bool bAllowNullable = false;
/*0x38*/
};
//============================================================================
// CButtonWnd
//============================================================================
// @sizeof(CButtonWnd) == 0x358 :: 2022-08-15 (live) @ 0x140537a3e
constexpr size_t CButtonWnd_size = 0x358;
class [[offsetcomments]] CButtonWnd : public CXWnd, public VeBaseReferenceCount
{
public:
//----------------------------------------------------------------------------
// constructor / destructor
EQLIB_OBJECT CButtonWnd(CXWnd* parent, uint32_t id, const CXRect& rect,
const CXPoint& decalOffset, const CXSize& decalSize,
CTextureAnimation* normal, CTextureAnimation* pressed,
CTextureAnimation* hover, CTextureAnimation* disabled,
CTextureAnimation* pressedHover, CTextureAnimation* pressedDisabled,
CTextureAnimation* normalDecal, CTextureAnimation* pressedDecal,
CTextureAnimation* hoverDecal, CTextureAnimation* pressedDisabledDecal);
//EQLIB_OBJECT CButtonWnd(CXWnd* parent, uint32_t id, const CXRect& rect);
//EQLIB_OBJECT CBUttonWnd(CXWnd* parent, uint32_t id, const CXRect& rect, const CXStr& label);
EQLIB_OBJECT virtual ~CButtonWnd();
//----------------------------------------------------------------------------
// virtual functions
EQLIB_OBJECT virtual void SetRadioGroup(CRadioGroup* group);
EQLIB_OBJECT virtual int DrawWndText(const CXRect& rect, const CXRect& clip);
EQLIB_OBJECT virtual int DrawCooldown();
EQLIB_OBJECT virtual void SetCheck(bool check, bool bNoSound = true);
EQLIB_OBJECT virtual void SetCoolDownCompletionTimeDelta(uint32_t delta, uint32_t total);
EQLIB_OBJECT virtual void SetCoolDownCompletionTime(uint32_t time, uint32_t total);
EQLIB_OBJECT virtual void SetCoolDownCompletionTime(eqtime_t time, uint32_t total);
EQLIB_OBJECT virtual void SetCoolDownBeginTime(uint32_t time, uint32_t total);
EQLIB_OBJECT virtual void SetCoolDownUpdatedBeginTime(uint32_t time, uint32_t total);
EQLIB_OBJECT virtual uint32_t GetCoolDownBeginTime() const;
EQLIB_OBJECT virtual uint32_t GetCoolDownTotalDuration() const;
EQLIB_OBJECT virtual uint32_t GetCoolDownTimeRemaining() const;
EQLIB_OBJECT virtual void ClearCoolDownCompletionTime();
//----------------------------------------------------------------------------
// inherited virtuals
EQLIB_OBJECT virtual int Draw() override;
EQLIB_OBJECT virtual int DrawTooltipAtPoint(const CXPoint& pos, const CXStr& tooltip) const override;
EQLIB_OBJECT virtual int HandleLButtonDown(const CXPoint&, uint32_t) override;
EQLIB_OBJECT virtual int HandleLButtonUp(const CXPoint&, uint32_t) override;
EQLIB_OBJECT virtual int HandleLButtonHeld(const CXPoint&, uint32_t) override;
EQLIB_OBJECT virtual int HandleLButtonUpAfterHeld(const CXPoint&, uint32_t) override;
EQLIB_OBJECT virtual int HandleRButtonDown(const CXPoint&, uint32_t) override;
EQLIB_OBJECT virtual int HandleRButtonUp(const CXPoint&, uint32_t) override;
EQLIB_OBJECT virtual int HandleRButtonHeld(const CXPoint&, uint32_t) override;
EQLIB_OBJECT virtual int HandleRButtonUpAfterHeld(const CXPoint&, uint32_t) override;
EQLIB_OBJECT virtual int HandleMouseMove(const CXPoint&, uint32_t) override;
EQLIB_OBJECT virtual int OnProcessFrame() override;
EQLIB_OBJECT virtual bool IsPointTransparent(const CXPoint& point) const override;
EQLIB_OBJECT virtual void SetAttributesFromSidl(CParamScreenPiece*) override;
//----------------------------------------------------------------------------
void SetDecalTint(COLORREF cr) { DecalTint = cr; }
void SetDecalTint(mq::MQColor color) { DecalTint = color.ToARGB(); }
//----------------------------------------------------------------------------
// data members
/*0x278*/ int MouseButtonState;
/*0x27c*/ bool bPicture;
/*0x280*/ CRadioGroup* pGroup;
/*0x288*/ bool Checked;
/*0x289*/ bool bMouseOverLastFrame;
/*0x28c*/ CXPoint DecalOffset;
/*0x294*/ CXSize DecalSize;
/*0x29c*/ COLORREF DecalTint; // Color
/*0x2a0*/ CXRect TextOffsets;
/*0x2b0*/ int TextModeBits;
/*0x2b4*/ COLORREF Mouseover;
/*0x2b8*/ COLORREF Pressed;
/*0x2bc*/ COLORREF Disabled;
/*0x2c0*/ unsigned int CoolDownBeginTime;
/*0x2c4*/ unsigned int CoolDownDuration;
/*0x2c8*/ CXStr Indicator;
/*0x2d0*/ unsigned int IndicatorVal;
/*0x2d8*/ CTextObjectInterface* pIndicatorTextObject;
/*0x2e0*/ unsigned int Unknown0x248;
/*0x2e8*/ CButtonDrawTemplate DrawTemplate;
/*0x350*/ bool bAllowButtonClickThrough;
/*0x351*/ bool bCoolDownDoDelayedStart;
/*0x352*/ bool bIsCheckbox;
/*0x353*/ bool bIsDrawLasso;
/*0x354*/ uint32_t ButtonStyle; // tbd
/*0x358*/
ALT_MEMBER_ALIAS(bool, Checked, bChecked);
struct VirtualFunctionTable : public CXWnd::VirtualFunctionTable
{
/*0x168*/ void* SetRadioGroup;
/*0x16c*/ void* DrawWndText;
/*0x170*/ void* DrawCooldown;
/*0x174*/ void* SetCheck;
/*0x178*/ void* SetCoolDownCompletionTimeDelta;
/*0x17c*/ void* SetCoolDownCompletionTime;
/*0x180*/ void* SetCoolDownCompletionTime2;
/*0x184*/ void* SetCoolDownBeginTime;
/*0x188*/ void* SetCoolDownUpdatedBeginTime;
/*0x18c*/ void* GetCoolDownBeginTime;
/*0x190*/ void* GetCoolDownTotalDuration;
/*0x194*/ void* GetCoolDownTimeRemaining;
/*0x198*/ void* ClearCoolDownCompletionTime;
};
// points to the eq instance of the virtual function table for this class
EQLIB_OBJECT static VirtualFunctionTable* sm_vftable;
};
SIZE_CHECK(CButtonWnd, CButtonWnd_size);
inline namespace deprecated {
using CBUTTONWND DEPRECATE("Use CButtonWnd instead of CBUTTONWND") = CButtonWnd;
using PCBUTTONWND DEPRECATE("Use CButtonWnd* instead of PCBUTTONWND") = CButtonWnd*;
}
//============================================================================
// CCheckBoxWnd
//============================================================================
class [[offsetcomments]] CCheckBoxWnd : public CButtonWnd
{
public:
CCheckBoxWnd(CXWnd*, uint32_t, const CXRect&, const CXPoint&, const CXSize&,
CTextureAnimation*, CTextureAnimation*, CTextureAnimation*, CTextureAnimation*,
CTextureAnimation*, CTextureAnimation*, CTextureAnimation*, CTextureAnimation*,
CTextureAnimation*, CTextureAnimation*);
virtual ~CCheckBoxWnd();
// virtual
int HandleLButtonDown(const CXPoint&, uint32_t) override;
int HandleLButtonUp(const CXPoint&, uint32_t) override;
int HandleMouseMove(const CXPoint&, uint32_t) override;
void SetRadioGroup(CRadioGroup*) override;
EQLIB_OBJECT void SetRadioLook();
// protected
/*0x358*/ bool bOrgState;
/*0x35c*/
};
//============================================================================
// CComboWnd
//============================================================================
class [[offsetcomments]] CComboWnd : public CXWnd
{
public:
CComboWnd(CXWnd*, uint32_t, const CXRect&, int height, const CButtonDrawTemplate&);
virtual ~CComboWnd();
//----------------------------------------------------------------------------
// virtuals
virtual CXSize GetMinSize() const;
// overrides
virtual int Draw() override;
virtual int HandleLButtonDown(const CXPoint&, uint32_t) override;
virtual int WndNotification(CXWnd*, uint32_t, void*) override;
virtual int OnMove(const CXRect&) override;
virtual int OnResize(int, int) override;
virtual int HitTest(const CXPoint&, int*) const override;
virtual void SetDrawTemplate(CXWndDrawTemplate*) override;
//----------------------------------------------------------------------------
// methods
EQLIB_OBJECT CXRect GetListRect(bool) const;
EQLIB_OBJECT void SetColors(COLORREF norm, COLORREF highlight, COLORREF selected);
EQLIB_OBJECT int InsertChoice(const CXStr& text, uint32_t data = 0);
EQLIB_OBJECT void SetChoice(int index);
EQLIB_OBJECT int GetItemCount();
EQLIB_OBJECT void DeleteAll();
EQLIB_OBJECT CXRect GetTextRect() const;
EQLIB_OBJECT CXRect GetButtonRect() const;
EQLIB_OBJECT int GetCurChoice() const;
EQLIB_OBJECT CXStr GetCurChoiceText() const;
//----------------------------------------------------------------------------
// data members
/*0x268*/ CListWnd* pListWnd;
/*0x270*/ int ListHeightMax;
/*0x274*/ int ListHeight;
/*0x278*/ CButtonDrawTemplate ButtonDrawTemplate;
/*0x2e0*/
};
//============================================================================
// CEditWnd
//============================================================================
enum eTextAlign
{
eta_Left,
eta_Center,
eta_Right,
};
constexpr int EDITWND_MAX_TAGS = 10;
enum EditWndStyle
{
ewsMultiline = 0x00010000,
ewsPassword = 0x00020000,
ewsWantReturn = 0x00040000,
ewsWantArrows = 0x00080000,
ewsWantTabs = 0x00100000,
ewsReadOnly = 0x00200000,
};
class [[offsetcomments]] CEditBaseWnd : public CXWnd
{
public:
CEditBaseWnd(CXWnd* parent, uint32_t id, const CXRect& rect);
virtual ~CEditBaseWnd();
//----------------------------------------------------------------------------
// virtuals
virtual int GetHorzOffset() = 0;
virtual CXStr GetDisplayString() const = 0;
virtual CXPoint GetCaretPt() const = 0;
virtual CXPoint PointFromPrintableChar(int charIndex) const = 0;
virtual int ResetWnd() = 0;
// overrides
virtual int Draw() override = 0;
virtual int DrawCaret() const override = 0;
virtual int HandleKeyboardMsg(uint32_t message, uint32_t flags, bool down) override = 0;
virtual int HandleLButtonDown(const CXPoint& pos, uint32_t flags) override = 0;
virtual int OnKillFocus(CXWnd*) override;
EQLIB_OBJECT void SetMaxChars(int);
EQLIB_OBJECT void SetSel(int, int);
//----------------------------------------------------------------------------
// data members
/*0x268*/ eTextAlign eAlign = eta_Left;
/*0x26c*/ int StartPos = 0;
/*0x270*/ int EndPos = 0;
/*0x274*/ int MaxChars = -1;
/*0x278*/ int MaxBytesUTF8 = -1;
/*0x280*/ CXStr InputText;
/*0x288*/ int TagPrintableStarts[EDITWND_MAX_TAGS];
/*0x2b0*/ int TagPrintableEnds[EDITWND_MAX_TAGS];
/*0x2d8*/ int TagOriginalStarts[EDITWND_MAX_TAGS];
/*0x300*/ int TagOriginalEnds[EDITWND_MAX_TAGS];
/*0x328*/ int TagDynamicSize[EDITWND_MAX_TAGS];
/*0x350*/ int TagCodes[EDITWND_MAX_TAGS];
/*0x378*/ CXStr TagStrings[EDITWND_MAX_TAGS];
/*0x3c8*/ int TagCount;
/*0x3cc*/ uint32_t EditStyle;
/*0x3d0*/
};
enum EditWndMode
{
ewmNormal,
ewmName,
ewmAlphaOnly,
ewmNumericOnly,
ewmAlphaNumOnly,
ewmCount
};
class [[offsetcomments]] CEditWnd : public CEditBaseWnd
{
public:
CEditWnd(CXWnd* parent, uint32_t id, const CXRect& rect, uint32_t style = 0);
virtual ~CEditWnd();
//----------------------------------------------------------------------------
// virtuals
virtual int DrawMultiline();
virtual CXStr GetWindowText() const;
virtual CXStr GetWindowPrefixText();
virtual CXStr GetWindowSuffixText();
// CEditBaseWnd
virtual int GetHorzOffset() override;
virtual CXStr GetDisplayString() const override;
virtual CXPoint GetCaretPt() const override;
virtual CXPoint PointFromPrintableChar(int charIndex) const override;
virtual int ResetWnd() override;
// CXWnd
virtual int Draw() override;
virtual int DrawCaret() const override;
virtual int HandleLButtonDown(const CXPoint&, uint32_t) override;
virtual int HandleLButtonUp(const CXPoint&, uint32_t) override;
virtual int HandleMouseMove(const CXPoint&, uint32_t) override;
virtual void SetWindowText(const CXStr& text) override;
virtual int OnMove(const CXRect& rect) override;
virtual int OnResize(int, int) override;
virtual int OnSetFocus(CXWnd*) override;
virtual int OnKillFocus(CXWnd*) override;
//----------------------------------------------------------------------------
// methods
EQLIB_OBJECT CXPoint GetCharIndexPt(int) const;
EQLIB_OBJECT CXPoint GetSelEndPt() const;
EQLIB_OBJECT CXPoint GetSelStartPt() const;
EQLIB_OBJECT CXStr GetSTMLSafeText();
EQLIB_OBJECT int ConvertIndexPrintableToTagged(int);
EQLIB_OBJECT int ConvertIndexTaggedToPrintable(int);
EQLIB_OBJECT int GetLineForPrintableChar(int) const;
EQLIB_OBJECT int GetLineLength(int) const;
EQLIB_OBJECT int SelectableCharFromPoint(CXPoint) const;
EQLIB_OBJECT void AddItemTag(int, char*, int);
EQLIB_OBJECT void CalculateScrollRange();
EQLIB_OBJECT void EnsureCaretVisible();
EQLIB_OBJECT void SetEditable(bool);
EQLIB_OBJECT void FillIndexArray(CXStr) const;
EQLIB_OBJECT void FilterInputStr(CXStr&);
EQLIB_OBJECT void ProcessText();
EQLIB_OBJECT bool ReplaceSelection(CXStr, bool bFilter = true);
inline bool ReplaceSelection(char ch, bool bFilter = true)
{
CXStr str(1, ch);
return ReplaceSelection(str, bFilter);
}
//----------------------------------------------------------------------------
// data members
/*0x3d0*/ bool bAnchorAtStart;
/*0x3d1*/ bool bCaretAtEnd;
/*0x3d2*/ bool bAutoVScrollCalc;
/*0x3d3*/ bool bEditable;
/*0x3d8*/ CXStr FilterChars;
/*0x3e0*/ int EditMode;
/*0x3e4*/ wchar_t PasswordChar;
/*0x3e8*/ ArrayClass2<uint32_t> LineIndices;
/*0x408*/
};
//============================================================================
// CEditLabelWnd
//============================================================================
class CEditLabelWnd : public CSidlScreenWnd, public WndEventHandler
{
public:
CEditLabelWnd(CXWnd*);
virtual ~CEditLabelWnd();
virtual int OnProcessFrame() override;
virtual int WndNotification(CXWnd*, uint32_t, void*) override;
EQLIB_OBJECT CXStr GetLabelText();
};
//============================================================================
// CGaugeWnd
//============================================================================
class [[offsetcomments]] CGaugeWnd : public CXWnd
{
public:
EQLIB_OBJECT CGaugeWnd(CXWnd*, uint32_t, const CXRect&, CTextureAnimation*, CTextureAnimation*, CTextureAnimation*, CTextureAnimation*, CTextureAnimation*, CTextureAnimation*, int, unsigned long, unsigned long, bool, int, int, int, int);
EQLIB_OBJECT void SpecialToolTip();
EQLIB_OBJECT CXRect CalcFillRect(CXRect rect, int value) const;
EQLIB_OBJECT CXRect CalcLinesFillRect(CXRect rect, int value) const;
// virtual
EQLIB_OBJECT ~CGaugeWnd();
EQLIB_OBJECT int Draw() const;
EQLIB_OBJECT int HandleLButtonUp(const CXPoint&, uint32_t);
EQLIB_OBJECT int OnProcessFrame();
EQLIB_OBJECT void SetAttributesFromSidl(CParamScreenPiece*);
//----------------------------------------------------------------------------
// data members
/*0x268*/ int EQType;
/*0x26c*/ D3DCOLOR FillTint;
/*0x270*/ D3DCOLOR LinesFillTint;
/*0x274*/ bool bDrawLinesFill;
/*0x278*/ int TextOffsetX;
/*0x27c*/ int TextOffsetY;
/*0x280*/ int GaugeOffsetX;
/*0x284*/ int GaugeOffsetY;
/*0x288*/ float LastFrameVal;
/*0x290*/ CXStr LastFrameName;
/*0x298*/ int LastFrameTime;
/*0x29c*/ int LastFrameTarget;
/*0x2a0*/ CXStr GaugeTooltip;
/*0x2a8*/ int TooltipVal;
/*0x2ac*/ int Unknown0x228;
/*0x2b0*/ CGaugeDrawTemplate DrawTemplate;
/*0x2e8*/ CTextObjectInterface* pTextObject;
/*0x2f0*/ CXStr NextDrawStr;
/*0x2f8*/ bool bSmooth;
/*0x2fc*/ int TargetVal;
/*0x300*/ bool bUseTargetVal;
/*0x304*/
};
//============================================================================
// CHotButton
//============================================================================
class [[offsetcomments]] CHotButton : public CXWnd
{
public:
CHotButton(CXWnd* parent, uint32_t id, const CXRect& rect, CButtonWnd* button,
CInvSlotWnd* invSlot, CSpellGemWnd* gemSlot);
virtual ~CHotButton();
EQLIB_OBJECT void SetButtonSize(int percent, bool bUpdateParent = true);
EQLIB_OBJECT void SetCheck(bool check);
//----------------------------------------------------------------------------
// data members
/*0x268*/ int BarIndex;
/*0x26c*/ int ButtonIndex;
/*0x270*/ uint32_t Timer;
/*0x278*/ CTextureAnimation* DecalIcon;
/*0x280*/ int LastButtonType;
/*0x284*/ int LastButtonSlot;
/*0x288*/ char LastButtonPage;
/*0x289*/ EqItemGuid LastItemGuid;
/*0x29c*/ int LastItemId;
/*0x2a0*/ int LastIconType;
/*0x2a4*/ int LastIconSlot;
/*0x2a8*/ CXStr LastLabel;
/*0x2b0*/ CXStr DefaultLabel;
/*0x2b8*/ bool bForceUpdate;
/*0x2c0*/ CTextObjectInterface* pKeyMapText;
/*0x2c8*/ int Unknown0x228;
/*0x2d0*/ CButtonWnd* pButtonWnd;
/*0x2d8*/ CInvSlotWnd* pInvSlotWnd;
/*0x2e0*/ CSpellGemWnd* pSpellGemWnd;
/*0x2e8*/ CXSize BaseSize;
/*0x2f0*/ int ButtonPercentSize;
/*0x2f4*/ CXSize BaseButtonSize;
/*0x2fc*/ CXSize BaseDecalSize;
/*0x304*/ CXSize BaseInvButtonSize;
/*0x30c*/ CXSize BaseSpellButtonSize;
/*0x314*/ int Unknown0x264;
/*0x318*/
};
//============================================================================
// CLabelWnd
//============================================================================
class [[offsetcomments]] CLabelWnd : public CXWnd
{
public:
// constructor / destructor
CLabelWnd(CXWnd* parent, uint32_t id, const CXRect& rect);
virtual ~CLabelWnd();
// virtual functions
virtual int Draw() override;
virtual void SetWindowText(const CXStr& Text) override;
virtual void UpdateText();
virtual void ResizeHeightToText();
// data members
/*0x268*/ bool bNoWrap;
/*0x269*/ bool bAlignRight;
/*0x26a*/ bool bAlignCenter;
/*0x26c*/ int xOffset;
/*0x270*/ bool bResizeHeightToText;
/*0x278*/ CXStr PrependText;
/*0x280*/ CXStr Text;
/*0x288*/ CXStr AppendText;
/*0x290*/ bool bTextDirty;
/*0x294*/
};
//============================================================================
// CLabel
//============================================================================
class [[offsetcomments]] CLabel : public CLabelWnd
{
public:
// constructor / destructor
CLabel(CXWnd* parent, uint32_t id, CXRect rect, int EQType);
virtual ~CLabel();
// virtual functions
virtual void UpdateText() override;
// data members
/*0x298*/ int EQType;
/*0x29c*/
};
inline namespace deprecated {
using CLABEL DEPRECATE("Use CLabel instead of CLABEL") = CLabel;
using PCLABEL DEPRECATE("Use CLabel* instead of PCLABEL") = CLabel*;
}
//============================================================================
// CListWnd
//============================================================================
struct [[offsetcomments]] STreeData
{
/*0x00*/ int Depth = 0;
/*0x04*/ bool bIsExpandable = false;
/*0x08*/
};
struct [[offsetcomments]] SListWndCell
{
/*0x00*/ const CTextureAnimation* pTA = nullptr;
/*0x08*/ CXStr Text;
/*0x10*/ COLORREF Color = RGB(255, 255, 255);
/*0x14*/ bool bOnlyDrawTexture = false;
/*0x18*/ CXWnd* pWnd = nullptr;
/*0x20*/ void* Unknown1 = nullptr;
/*0x28*/
};
struct [[offsetcomments]] SListWndLine
{
/*0x000*/ ArrayClass<SListWndCell> Cells;
/*0x018*/ uint64_t Data = 0;
/*0x020*/ int Height = -1;
/*0x024*/ bool bSelected = false;
/*0x025*/ bool bEnabled = true;
/*0x028*/ STreeData Treedata;
/*0x030*/ char TooltipText[256];
/*0x130*/ bool bVisible = true;
/*0x134*/ uint32_t bIsSeparator = 0;
/*0x138*/
};
class [[offsetcomments]] SListWndSortInfo
{
public:
/*0x00*/ int SortCol;
/*0x08*/ const SListWndLine& ListWndLine1;
/*0x10*/ CXStr StrLabel1;
/*0x18*/ uint64_t Data1;
/*0x20*/ const SListWndLine& ListWndLine2;
/*0x28*/ CXStr StrLabel2;
/*0x30*/ uint64_t Data2;
/*0x38*/ int SortResult;
/*0x3c*/
};
enum ECellType
{
CellTypeBasicText = 1,
CellTypeBasicIcon = 2,
CellTypeTextIcon = 3
};
struct [[offsetcomments]] SListWndColumn
{
/*0x00*/ int Width = 0;
/*0x04*/ int MinWidth = 10;
/*0x08*/ CXSize TextureSize;
/*0x10*/ CXPoint TextureOffset;
/*0x18*/ CXStr StrLabel;
/*0x20*/ uint64_t Data = 0;
/*0x28*/ uint32_t Flags = 0;
/*0x2c*/ uint32_t Type = CellTypeTextIcon; // ECellType
/*0x30*/ CTextureAnimation* pTextureAnim = nullptr;
/*0x38*/ CTextureAnimation* pSelected = nullptr;
/*0x40*/ CTextureAnimation* pMouseOver = nullptr;
/*0x48*/ CXStr Tooltip;
/*0x50*/ bool bResizable = false;
/*0x54*/
SListWndColumn(CXStr strLabel = "",
int width = 0,
CTextureAnimation* pta = nullptr,
uint32_t flags = 0,
uint32_t type = CellTypeTextIcon,
CTextureAnimation* pSelected = nullptr,
CTextureAnimation* pMouseOver = nullptr,
CXStr tooltip = "",
bool bResizable = false,
CXSize textureSize = {},
CXPoint textureOffset = {})
: StrLabel(strLabel)
, Width(width)
, pTextureAnim(pta)
, Flags(flags)
, Type(type)
, pSelected(pSelected)
, pMouseOver(pMouseOver)
, Tooltip(tooltip)
, bResizable(bResizable)
, TextureSize(textureSize)
, TextureOffset(textureOffset)
{}
};
class IListItemDataHandler
{
public:
virtual bool GetText(int index, int subItem, CXStr& text) const = 0;
};
// Size is 0x298 in eqgame Sep 11 2017 Test (see 8D1D4C)
class [[offsetcomments]] CListWnd : public CXWnd
{
public:
EQLIB_OBJECT CListWnd(CXWnd*, uint32_t, const CXRect&);
virtual ~CListWnd();
//----------------------------------------------------------------------------
// virtuals
EQLIB_OBJECT virtual int OnHeaderClick(CXPoint);
EQLIB_OBJECT virtual int DrawColumnSeparators() const;
EQLIB_OBJECT virtual int DrawSeparator(int index) const;
EQLIB_OBJECT virtual int DrawLine(int index) const;
EQLIB_OBJECT virtual int DrawHeader() const;
EQLIB_OBJECT virtual int DrawItem(int index, int, int) const;
EQLIB_OBJECT virtual void DeleteAll();
EQLIB_OBJECT virtual int Compare(const SListWndLine&, const SListWndLine&) const;
EQLIB_OBJECT virtual int Unknown0x188(int a, int b) const;
EQLIB_OBJECT virtual void Sort(bool unstable = true);
// overrides
EQLIB_OBJECT virtual int Draw() override;
EQLIB_OBJECT virtual int DrawBackground() const override;
EQLIB_OBJECT virtual int DrawTooltip(const CXWnd* wnd) const override;
EQLIB_OBJECT virtual HCURSOR GetCursorToDisplay() const override;
EQLIB_OBJECT virtual int HandleLButtonDown(const CXPoint& pos, uint32_t flags) override;
EQLIB_OBJECT virtual int HandleLButtonUp(const CXPoint& pos, uint32_t flags) override;
EQLIB_OBJECT virtual int HandleLButtonHeld(const CXPoint& pos, uint32_t flags) override;
EQLIB_OBJECT virtual int HandleLButtonUpAfterHeld(const CXPoint& pos, uint32_t flags) override;
EQLIB_OBJECT virtual int HandleRButtonDown(const CXPoint& pos, uint32_t flags) override;
EQLIB_OBJECT virtual int HandleRButtonUp(const CXPoint& pos, uint32_t flags) override;
EQLIB_OBJECT virtual int HandleRButtonHeld(const CXPoint& pos, uint32_t flags) override;
EQLIB_OBJECT virtual int HandleRButtonUpAfterHeld(const CXPoint& pos, uint32_t flags) override;
EQLIB_OBJECT virtual int HandleMouseMove(const CXPoint& pos, uint32_t flags) override;
EQLIB_OBJECT virtual int WndNotification(CXWnd* sender, uint32_t message, void* data) override;
EQLIB_OBJECT virtual void OnWndNotification() override;
EQLIB_OBJECT virtual int OnMove(const CXRect& rect) override;
EQLIB_OBJECT virtual int OnResize(int w, int h) override;
EQLIB_OBJECT virtual int OnVScroll(EScrollCode code, int pos) override;
EQLIB_OBJECT virtual int OnHScroll(EScrollCode code, int pos) override;
EQLIB_OBJECT virtual CXRect GetHitTestRect(int code) const override;
EQLIB_OBJECT virtual CXRect GetClientClipRect() const override;
EQLIB_OBJECT virtual CXWnd* GetChildWndAt(const CXPoint& pos, bool, bool) const override;
EQLIB_OBJECT virtual int SetVScrollPos(int pos) override;
//----------------------------------------------------------------------------
// methods
EQLIB_OBJECT bool IsLineEnabled(int) const;
EQLIB_OBJECT const CTextureAnimation* GetColumnAnimation(int) const;
EQLIB_OBJECT const CTextureAnimation* GetColumnAnimationMouseOver(int) const;
EQLIB_OBJECT const CTextureAnimation* GetColumnAnimationSelected(int) const;
EQLIB_OBJECT const CTextureAnimation* GetItemIcon(int, int) const;
EQLIB_OBJECT CXRect GetHeaderRect(int) const;
EQLIB_OBJECT CXRect GetItemRect(int, int) const;
EQLIB_OBJECT CXRect GetSeparatorRect(int) const;
EQLIB_OBJECT CXStr GetColumnLabel(int) const;
EQLIB_OBJECT int AddColumn(const CXStr& Label, CTextureAnimation* pTA, int Width, uint32_t Flags, CXStr Tooltip = "",
uint32_t Type = CellTypeTextIcon, CTextureAnimation* pTASelected = nullptr, CTextureAnimation* pTAMouseOver = nullptr,
bool bResizeable = false, CXSize TextureSize = {}, CXPoint TextureOffset = {});
EQLIB_OBJECT int AddColumn(const CXStr& Label, int Width, uint32_t Flags, uint32_t Type = CellTypeTextIcon);
EQLIB_OBJECT int AddLine(SListWndLine*);
EQLIB_OBJECT int AddString(const CXStr& Str, COLORREF Color, uint64_t Data = 0, const CTextureAnimation* pTa = nullptr, const char* TooltipStr = nullptr);
int AddString(const CXStr& str, mq::MQColor Color, uint64_t Data = 0, const CTextureAnimation* pTA = nullptr, const char* TooltipStr = nullptr)
{
return AddString(str, Color.ToARGB(), Data, pTA, TooltipStr);
}
EQLIB_OBJECT int AddString(const char* Str, COLORREF Color, uint64_t Data, const CTextureAnimation* pTa, const char* TooltipStr = nullptr);
EQLIB_OBJECT int GetColumnJustification(int) const;
EQLIB_OBJECT int GetColumnMinWidth(int) const;
EQLIB_OBJECT CXStr GetColumnTooltip(int) const;
EQLIB_OBJECT int GetColumnWidth(int) const;
EQLIB_OBJECT int GetCurCol() const;
EQLIB_OBJECT int GetCurSel() const;
EQLIB_OBJECT int GetItemHeight(int) const;
EQLIB_OBJECT uint32_t GetColumnFlags(int) const;
EQLIB_OBJECT uint64_t GetItemData(int) const;
EQLIB_OBJECT COLORREF GetItemColor(int, int) const;
EQLIB_OBJECT void CalculateFirstVisibleLine();
EQLIB_OBJECT void CalculateLineHeights();
EQLIB_OBJECT void CalculateVSBRange();
EQLIB_OBJECT void ClearAllSel();
EQLIB_OBJECT void ClearSel(int);
EQLIB_OBJECT void CloseAndUpdateEditWindow();
EQLIB_OBJECT void EnableLine(int Index, bool bVal);
EQLIB_OBJECT void EnsureVisible(int);
EQLIB_OBJECT void ExtendSel(int);
EQLIB_OBJECT void InsertLine(int ID, SListWndLine* rEntry);
EQLIB_OBJECT void RemoveLine(int);
EQLIB_OBJECT void RemoveString(int);
EQLIB_OBJECT void SetColors(unsigned long, unsigned long, unsigned long);
EQLIB_OBJECT void SetColumnJustification(int, int);
EQLIB_OBJECT void SetColumnLabel(int, const CXStr&);
EQLIB_OBJECT void SetColumnWidth(int, int);
EQLIB_OBJECT void SetCurSel(int);
EQLIB_OBJECT void SetItemColor(int, int, unsigned long);
void SetItemColor(int row, int col, mq::MQColor color) { SetItemColor(row, col, color.ToARGB()); }
EQLIB_OBJECT void SetItemData(int ID, uint64_t Data);
EQLIB_OBJECT void SetItemText(int ID, int SubID, const CXStr& Text);
EQLIB_OBJECT void ShiftColumnSeparator(int, int);
EQLIB_OBJECT void ToggleSel(int);
EQLIB_OBJECT void SetColumnsSizable(bool bColumnsSizable);
EQLIB_OBJECT void GetWndPosition(CXWnd* pWnd, int& ItemID, int& SubItemID) const;
EQLIB_OBJECT void SetItemWnd(int Index, int SubItem, CXWnd* pWnd);
EQLIB_OBJECT CXWnd* GetItemWnd(int Index, int SubItem = 0) const;
EQLIB_OBJECT void SetItemIcon(int Index, int SubItem, const CTextureAnimation* pTA);
EQLIB_OBJECT void CalculateCustomWindowPositions();
EQLIB_OBJECT int GetItemAtPoint(const CXPoint& pt) const;
EQLIB_OBJECT void GetItemAtPoint(const CXPoint& pt, int* ID, int* SubItem) const;
inline int GetColumnCount() const { return Columns.GetLength(); }
// Index of the first row in the list where the text in column matches predicate, or -1 if no row matches
EQLIB_OBJECT int IndexOf(int column, const std::function<bool(const CXStr)>& predicate);
// Index of the first row in the list where the text in the first column matches predicate, or -1 if no row matches
EQLIB_OBJECT int IndexOf(const std::function<bool(const CXStr)>& predicate);
// True if the list contains a row where the text in columns matches predicate
EQLIB_OBJECT bool Contains(int column, const std::function<bool(const CXStr)>& predicate);
// True if the list contains a row the text in the first column matches predicate
EQLIB_OBJECT bool Contains(const std::function<bool(const CXStr)>& predicate);
EQLIB_OBJECT CXStr GetItemText(int index, int subIndex = 0) const;
DEPRECATE("GetItemText: Passing in a pointer to CXStr for GetItemText is deprecated. It should return CXStr instead.")
void GetItemText(CXStr* pStr, int index, int subIndex = 0) const
{
*pStr = GetItemText(index, subIndex);
}
//----------------------------------------------------------------------------
// Sets the sorting column. If this is the current column it will flip its order.
inline void SetSortColumn(int column)
{
if (column < 0 || column >= Columns.GetCount())
return;
if (SortCol == column)
bSortAsc = !bSortAsc;
else
{
SortCol = column;
bSortAsc = true;