create a lot of GUI source code files.
This commit is contained in:
21
inc/hgl/gui/Panel.h
Normal file
21
inc/hgl/gui/Panel.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef HGL_GUI_PANEL_INCLUDE
|
||||
#define HGL_GUI_PANEL_INCLUDE
|
||||
|
||||
#include<hgl/gui/Widget.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace gui
|
||||
{
|
||||
class Panel:public Widget
|
||||
{
|
||||
public:
|
||||
|
||||
Panel(Widget *p):Widget(p){}
|
||||
|
||||
virtual ~Panel()=default;
|
||||
|
||||
void Draw() override;
|
||||
};//class Panel:public Widget
|
||||
}//namespace gui
|
||||
}//namespace hgl
|
||||
#endif//HGL_GUI_PANEL_INCLUDE
|
28
inc/hgl/gui/ThemeEngine.h
Normal file
28
inc/hgl/gui/ThemeEngine.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef HGL_GUI_THEME_ENGINE_INCLUDE
|
||||
#define HGL_GUI_THEME_ENGINE_INCLUDE
|
||||
|
||||
#include<hgl/type/RectScope.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace gui
|
||||
{
|
||||
class Widget;
|
||||
|
||||
class ThemeEngine
|
||||
{
|
||||
public:
|
||||
|
||||
virtual bool Init()=0;
|
||||
virtual void Clear()=0;
|
||||
|
||||
virtual void DrawFrame(const Widget *)=0;
|
||||
//virtual void DrawButton(const Widget *)=0;
|
||||
//virtual void DrawCheckBox(const Widget *)=0;
|
||||
//virtual void DrawRadioBox(const Widget *)=0;
|
||||
};//class ThemeEngine
|
||||
|
||||
// ThemeEngine *CreateThemeEngine();
|
||||
ThemeEngine *GetDefaultThemeEngine(); ///<获取缺省主题引擎
|
||||
}//namespace gui
|
||||
}//namespace hgl
|
||||
#endif//HGL_GUI_THEME_ENGINE_INCLUDE
|
@@ -7,6 +7,8 @@ namespace hgl
|
||||
{
|
||||
namespace gui
|
||||
{
|
||||
class ThemeEngine;
|
||||
|
||||
enum Alignment
|
||||
{
|
||||
None =0x00,
|
||||
@@ -27,6 +29,7 @@ namespace hgl
|
||||
private:
|
||||
|
||||
Widget *parent_widget;
|
||||
ThemeEngine *theme_engine;
|
||||
|
||||
bool visible; ///<控件是否可看见
|
||||
bool recv_event; ///<控件是否接收事件
|
||||
@@ -46,14 +49,16 @@ namespace hgl
|
||||
void SetVisible (const bool);
|
||||
void SetRecvEvent(const bool);
|
||||
void SetAlign (const uint8);
|
||||
void SetPosition (const Rectscope2i &);
|
||||
void SetPosition (const RectScope2i &);
|
||||
void SetSize (const Vector2f &);
|
||||
|
||||
public:
|
||||
|
||||
Widget(Widget *parent=nullptr)
|
||||
Widget(Widget *parent=nullptr,ThemeEngine *te=nullptr)
|
||||
{
|
||||
parent_widget=parent;
|
||||
theme_engine=te;
|
||||
|
||||
//默认值
|
||||
visible=false; //不显示
|
||||
recv_event=false; //不接收事件
|
||||
@@ -61,6 +66,8 @@ namespace hgl
|
||||
position.Clear();
|
||||
}
|
||||
virtual ~Widget();
|
||||
|
||||
virtual void Draw(){}
|
||||
};//class Widget
|
||||
}//namespace gui
|
||||
}//namespace hgl
|
||||
|
Reference in New Issue
Block a user