2016-03-10 03:47:37 +00:00
|
|
|
#ifndef __URDE_CGUIWIDGET_HPP__
|
|
|
|
#define __URDE_CGUIWIDGET_HPP__
|
|
|
|
|
|
|
|
#include "IOStreams.hpp"
|
|
|
|
#include "CGuiObject.hpp"
|
2016-03-11 22:50:15 +00:00
|
|
|
#include "zeus/CColor.hpp"
|
2016-03-10 03:47:37 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
class CGuiFrame;
|
2016-03-15 23:23:45 +00:00
|
|
|
class CGuiTextSupport;
|
2016-12-16 04:35:49 +00:00
|
|
|
class CFinalInput;
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2016-03-11 05:32:18 +00:00
|
|
|
enum class ETraversalMode
|
|
|
|
{
|
2016-03-15 23:23:45 +00:00
|
|
|
ChildrenAndSiblings = 0,
|
|
|
|
Children = 1,
|
|
|
|
Single = 2
|
2016-03-11 05:32:18 +00:00
|
|
|
};
|
|
|
|
|
2016-03-12 04:58:56 +00:00
|
|
|
enum class EGuiTextureClampModeHorz
|
|
|
|
{
|
2016-03-17 22:19:25 +00:00
|
|
|
NoClamp = 0,
|
|
|
|
Right = 1,
|
|
|
|
Left = 2,
|
|
|
|
Center = 3
|
2016-03-12 04:58:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class EGuiTextureClampModeVert
|
|
|
|
{
|
2016-03-17 22:19:25 +00:00
|
|
|
NoClamp = 0,
|
|
|
|
Top = 1,
|
|
|
|
Bottom = 2,
|
|
|
|
Center = 3
|
2016-03-12 04:58:56 +00:00
|
|
|
};
|
|
|
|
|
2016-03-10 03:47:37 +00:00
|
|
|
class CGuiWidget : public CGuiObject
|
|
|
|
{
|
2016-03-14 00:58:19 +00:00
|
|
|
friend class CGuiFrame;
|
2016-03-10 03:47:37 +00:00
|
|
|
public:
|
2016-03-11 22:50:15 +00:00
|
|
|
enum class EGuiModelDrawFlags
|
|
|
|
{
|
2016-03-17 22:19:25 +00:00
|
|
|
Shadeless = 0,
|
|
|
|
Opaque = 1,
|
|
|
|
Alpha = 2,
|
|
|
|
Additive = 3,
|
|
|
|
AlphaAdditiveOverdraw = 4
|
2016-03-11 22:50:15 +00:00
|
|
|
};
|
2016-03-10 03:47:37 +00:00
|
|
|
struct CGuiWidgetParms
|
|
|
|
{
|
2016-03-11 22:50:15 +00:00
|
|
|
CGuiFrame* x0_frame;
|
2016-03-16 03:37:51 +00:00
|
|
|
bool x4_useAnimController;
|
2016-03-11 22:50:15 +00:00
|
|
|
s16 x6_selfId;
|
|
|
|
s16 x8_parentId;
|
2016-03-15 23:23:45 +00:00
|
|
|
bool xa_defaultVisible;
|
2016-03-14 00:58:19 +00:00
|
|
|
bool xb_defaultActive;
|
2016-03-17 02:18:01 +00:00
|
|
|
bool xc_cullFaces;
|
2016-03-11 22:50:15 +00:00
|
|
|
bool xd_g;
|
|
|
|
bool xe_h;
|
|
|
|
zeus::CColor x10_color;
|
|
|
|
EGuiModelDrawFlags x14_drawFlags;
|
2016-03-16 03:37:51 +00:00
|
|
|
CGuiWidgetParms(CGuiFrame* frame, bool useAnimController, s16 selfId, s16 parentId,
|
2016-03-17 02:18:01 +00:00
|
|
|
bool defaultVisible, bool defaultActive, bool cullFaces,
|
|
|
|
const zeus::CColor& color, EGuiModelDrawFlags drawFlags,
|
|
|
|
bool g, bool h)
|
2016-03-16 03:37:51 +00:00
|
|
|
: x0_frame(frame), x4_useAnimController(useAnimController), x6_selfId(selfId),
|
|
|
|
x8_parentId(parentId), xa_defaultVisible(defaultVisible), xb_defaultActive(defaultActive),
|
2016-03-17 02:18:01 +00:00
|
|
|
xc_cullFaces(cullFaces), xd_g(g), xe_h(h), x10_color(color), x14_drawFlags(drawFlags) {}
|
2016-03-10 03:47:37 +00:00
|
|
|
};
|
2016-03-15 23:23:45 +00:00
|
|
|
protected:
|
2016-12-15 22:37:34 +00:00
|
|
|
s16 x70_selfId;
|
|
|
|
s16 x72_parentId;
|
|
|
|
zeus::CTransform x74_transform;
|
|
|
|
zeus::CColor xa4_color;
|
|
|
|
zeus::CColor xa8_color2;
|
|
|
|
EGuiModelDrawFlags xac_drawFlags;
|
|
|
|
CGuiFrame* xb0_frame;
|
|
|
|
s16 xb4_workerId = -1;
|
|
|
|
bool xb6_24_pg : 1;
|
|
|
|
bool xb6_25_isVisible : 1;
|
|
|
|
bool xb6_26_isActive : 1;
|
2017-01-09 03:44:00 +00:00
|
|
|
bool xb6_27_isSelectable : 1;
|
2016-12-15 22:37:34 +00:00
|
|
|
bool xb6_28_eventLock : 1;
|
|
|
|
bool xb6_29_cullFaces : 1;
|
|
|
|
bool xb6_30_ : 1;
|
|
|
|
bool xb6_31_depthTest : 1;
|
|
|
|
bool xb7_24_depthWrite : 1;
|
|
|
|
bool xb7_25_ : 1;
|
2016-03-14 00:58:19 +00:00
|
|
|
|
2016-03-10 03:47:37 +00:00
|
|
|
public:
|
2016-03-11 22:50:15 +00:00
|
|
|
CGuiWidget(const CGuiWidgetParms& parms);
|
|
|
|
|
|
|
|
static CGuiWidgetParms ReadWidgetHeader(CGuiFrame* frame, CInputStream& in, bool);
|
|
|
|
static CGuiWidget* Create(CGuiFrame* frame, CInputStream& in, bool);
|
|
|
|
|
2016-12-15 22:37:34 +00:00
|
|
|
virtual void Update(float dt);
|
|
|
|
virtual void Draw(const CGuiWidgetDrawParms& drawParms) const;
|
2016-03-10 03:47:37 +00:00
|
|
|
virtual void Initialize();
|
2016-12-16 04:35:49 +00:00
|
|
|
virtual void ProcessUserInput(const CFinalInput& input);
|
2016-03-10 03:47:37 +00:00
|
|
|
virtual void Touch() const;
|
2016-03-15 04:55:57 +00:00
|
|
|
virtual bool GetIsVisible() const;
|
2016-03-14 00:58:19 +00:00
|
|
|
virtual bool GetIsActive() const;
|
2016-12-15 22:37:34 +00:00
|
|
|
virtual FourCC GetWidgetTypeID() const {return FOURCC('BWIG');}
|
2016-03-14 00:58:19 +00:00
|
|
|
virtual bool AddWorkerWidget(CGuiWidget* worker);
|
2016-03-15 23:23:45 +00:00
|
|
|
virtual bool GetIsFinishedLoadingWidgetSpecific() const;
|
2016-12-15 22:37:34 +00:00
|
|
|
virtual void OnVisibleChange();
|
|
|
|
virtual void OnActiveChange();
|
|
|
|
|
|
|
|
s16 GetSelfId() const {return x70_selfId;}
|
|
|
|
s16 GetParentId() const {return x72_parentId;}
|
|
|
|
s16 GetWorkerId() const {return xb4_workerId;}
|
|
|
|
const zeus::CTransform& GetTransform() const {return x74_transform;}
|
2016-12-16 04:35:49 +00:00
|
|
|
zeus::CTransform& GetTransform() {return x74_transform;}
|
2016-12-15 22:37:34 +00:00
|
|
|
const zeus::CVector3f& GetIdlePosition() const {return x74_transform.origin;}
|
2016-03-15 23:23:45 +00:00
|
|
|
void SetIdlePosition(const zeus::CVector3f& pos, bool reapply);
|
2016-03-11 05:32:18 +00:00
|
|
|
void ReapplyXform();
|
|
|
|
void SetIsVisible(bool);
|
2016-12-15 22:37:34 +00:00
|
|
|
void SetIsActive(bool);
|
2017-01-09 03:44:00 +00:00
|
|
|
bool GetIsSelectable() const { return xb6_27_isSelectable; }
|
|
|
|
void SetIsSelectable(bool v) { xb6_27_isSelectable = v; }
|
2016-12-15 22:37:34 +00:00
|
|
|
|
|
|
|
void ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms);
|
|
|
|
void AddChildWidget(CGuiWidget* widget, bool makeWorldLocal, bool atEnd);
|
2016-03-11 05:32:18 +00:00
|
|
|
void SetVisibility(bool, ETraversalMode);
|
|
|
|
void RecalcWidgetColor(ETraversalMode);
|
|
|
|
void SetColor(const zeus::CColor& color);
|
|
|
|
void InitializeRGBAFactor();
|
2016-03-12 04:58:56 +00:00
|
|
|
CGuiWidget* FindWidget(s16 id);
|
2016-03-11 05:32:18 +00:00
|
|
|
bool GetIsFinishedLoading() const;
|
2016-12-16 04:35:49 +00:00
|
|
|
void DispatchInitialize();
|
2016-03-10 03:47:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CGUIWIDGET_HPP__
|