prime/include/GuiSys/CGuiWidget.hpp

95 lines
2.5 KiB
C++
Raw Normal View History

2022-11-07 17:06:11 +00:00
#ifndef _CGUIWIDGET
#define _CGUIWIDGET
#include "GuiSys/CGuiObject.hpp"
2022-12-31 19:59:30 +00:00
#include "Kyoto/Graphics/CColor.hpp"
2022-11-07 17:06:11 +00:00
#include "Kyoto/SObjectTag.hpp"
2023-01-14 00:53:27 +00:00
#include "rstl/string.hpp"
2022-11-07 17:06:11 +00:00
class CFinalInput;
2023-01-14 00:53:27 +00:00
class CGuiFrame;
2022-11-07 17:06:11 +00:00
2022-12-31 19:59:30 +00:00
enum ETraversalMode {
kTM_ChildrenAndSiblings = 0,
kTM_Children = 1,
kTM_Single = 2,
};
2022-11-07 17:06:11 +00:00
class CGuiWidget : public CGuiObject {
public:
2022-12-31 19:59:30 +00:00
enum EGuiModelDrawFlags {
kGMDF_Shadeless = 0,
kGMDF_Opaque = 1,
kGMDF_Alpha = 2,
kGMDF_Additive = 3,
kGMDF_AlphaAdditiveOverdraw = 4
};
2023-01-14 00:53:27 +00:00
class CGuiWidgetParms {
public:
CGuiWidgetParms(CGuiFrame*, const rstl::string&, bool, short, short, bool, bool, bool,
const CColor&, CGuiWidget::EGuiModelDrawFlags, bool, bool);
CGuiFrame* x0_frame;
bool x4_useAnimController;
short x6_selfId;
short x8_parentId;
bool xa_defaultVisible;
bool xb_defaultActive;
bool xc_cullFaces;
bool xd_g;
bool xe_h;
CColor x10_color;
EGuiModelDrawFlags x14_drawFlags;
};
2022-11-07 17:06:11 +00:00
2023-01-14 00:53:27 +00:00
CGuiWidget(const CGuiWidgetParms& parms);
~CGuiWidget();
void Update(float dt);
void Draw(const CGuiWidgetDrawParms& drawParms) const;
void Initialize();
2022-11-07 17:06:11 +00:00
virtual void ProcessUserInput(const CFinalInput& input);
2023-01-14 00:53:27 +00:00
virtual void Touch() const;
2022-11-07 17:06:11 +00:00
virtual bool GetIsVisible() const;
virtual bool GetIsActive() const;
virtual FourCC GetWidgetTypeID() const { return 'BWIG'; }
virtual bool AddWorkerWidget(CGuiWidget* worker);
2023-01-14 00:53:27 +00:00
virtual bool GetIsFinishedLoadingWidgetSpecific() const;
virtual void OnVisible();
virtual void OnActivate();
2022-12-31 19:59:30 +00:00
2023-01-14 00:53:27 +00:00
void SetIsVisible(bool visible);
2022-11-07 17:06:11 +00:00
void SetColor(const CColor& color);
2023-01-14 00:53:27 +00:00
const CColor& GetColor() const { return xa4_color; }
2022-11-07 17:06:11 +00:00
void SetVisibility(bool visible, ETraversalMode mode);
2023-01-14 00:53:27 +00:00
void ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms);
static CGuiWidgetParms ReadWidgetHeader(CGuiFrame* frame, CInputStream& in);
CGuiFrame* GetFrame() { return xb0_frame; }
2022-12-31 19:59:30 +00:00
2022-11-07 17:06:11 +00:00
private:
short x70_selfId;
short x72_parentId;
CTransform4f x74_transform;
CColor xa4_color;
CColor xa8_color2;
EGuiModelDrawFlags xac_drawFlags;
CGuiFrame* xb0_frame;
short xb4_workerId;
bool xb6_24_pg : 1;
bool xb6_25_isVisible : 1;
bool xb6_26_isActive : 1;
bool xb6_27_isSelectable : 1;
bool xb6_28_eventLock : 1;
bool xb6_29_cullFaces : 1;
bool xb6_30_depthGreater : 1;
bool xb6_31_depthTest : 1;
bool xb7_24_depthWrite : 1;
bool xb7_25_ : 1;
};
CHECK_SIZEOF(CGuiWidget, 0xb8)
2022-12-31 19:59:30 +00:00
CGuiWidget* FGuiWidgetFactoryInGame(uint type, CGuiFrame* parent, CInputStream& in);
2022-11-07 17:06:11 +00:00
#endif // _CGUIWIDGET