IWidgetCreator 控制項建立介面

2021-06-04 15:36:47 字數 4143 閱讀 4125

gui 與 pointermanger 繼承關係如下圖它們有乙個共同點是都繼承與iwidgetcreator

同樣為眾多基類的widget class 繼承與這兩個。如圖

而iwidgetcreator有乙個純虛函式(介面肯定是純虛的。)

protected:

virtual widget* basecreatewidget(

widgetstyle _style,

const std::string& _type,

const std::string& _skin,

const intcoord& _coord,

align _align,

const std::string& _layer,

const std::string& _name) = 0;

上述三個類的實現函式都呼叫了layermanager的

有介紹

if (!_layer.empty())

layermanager::getinstance().attachtolayernode(_layer, widget);

在widget 建立的時候渲染物件已經被新增到layermanager的layernode 中,

widget多重繼承其一是layeritem。這在渲染中起的角色重大。

另外有乙個疑問點是非基類中間接繼承widget中的message類

也對layermanager:: 其進行了顯式的呼叫

這裡先暫時做乙個小猜測,其他widget子類是通過其來呼叫建立widget?

通過模板

widget* createwidgett(const std::string& _type, const std::string& _skin, const intcoord& _coord, align _align, const std::string& _name = "");

/** see widget::createwidgett(const std::string& _type, const std::string& _skin, const intcoord& _coord, align _align, const std::string& _name = "") */

widget* createwidgett(const std::string& _type, const std::string& _skin, int _left, int _top, int _width, int _height, align _align, const std::string& _name = "");

/** create widget using coordinates relative to parent. see widget::createwidgett(const std::string& _type, const std::string& _skin, const intcoord& _coord, align _align, const std::string& _name = "") */

widget* createwidgetrealt(const std::string& _type, const std::string& _skin, const floatcoord& _coord, align _align, const std::string& _name = "");

/** create widget using coordinates relative to parent. see widget::createwidgett(const std::string& _type, const std::string& _skin, const intcoord& _coord, align _align, const std::string& _name = "") */

widget* createwidgetrealt(const std::string& _type, const std::string& _skin, float _left, float _top, float _width, float _height, align _align, const std::string& _name = "");

// templates for creating widgets by type

/** same as widget::createwidgett but return t pointer instead of widget* */

template t* createwidget(const std::string& _skin, const intcoord& _coord, align _align, const std::string& _name = "")

/** same as widget::createwidgett but return t pointer instead of widget* */

template t* createwidget(const std::string& _skin, int _left, int _top, int _width, int _height, align _align, const std::string& _name = "")

/** same as widget::createwidgetrealt but return t* instead of widget* */

template t* createwidgetreal(const std::string& _skin, const floatcoord& _coord, align _align, const std::string& _name = "")

/** same as widget::createwidgetrealt but return t* instead of widget* */

template t* createwidgetreal(const std::string& _skin, float _left, float _top, float _width, float _height, align _align, const std::string& _name = "")

/** create child widget

@param _type widget type

@param _skin widget skin

@param _coord int coordinates of widget (_left, _top, _width, _height)

@param _align widget align (possible values can be found in enum align)

@param _name if needed (you can use it for finding widget by name later)

*/widget* createwidgett(widgetstyle _style, const std::string& _type, const std::string& _skin, const intcoord& _coord, align _align, const std::string& _layer = "", const std::string& _name = "");

/** same as widget::createwidgett but return t* instead of widget* */

template t* createwidget(widgetstyle _style, const std::string& _skin, const intcoord& _coord, align _align, const std::string& _layer = "", const std::string& _name = "")

最終需要呼叫

widget* widget::basecreatewidget(widgetstyle _style, const std::string& _type, const std::string& _skin, const intcoord& _coord, align _align, const std::string& _layer, const std::string& _name)

進行建立!

不過需要進一步的進行分析;)

星空 控控控 上ke控 新浪部落格

摸不到的顏色是否叫彩虹 看不到的擁抱是否叫做微笑 乙個人想著乙個人 是否就叫寂寞 命運偷走如果只留下結果 時間偷走初衷只留下苦衷 你來過然後你走後 只留下星空 那一年我們望著星空 有那麼多的燦爛的夢 以為快樂會永久 像不變星空 陪著我獵戶天狼 侄女光年外的寂寞 回憶青春 夢想何時常常隱沒 我愛過然後...

A司密事 控控控 上ke控 新浪部落格

設計模式 1.學習方法 先看名字,後寫 2.總共23種設計模式 3.使用 a.第一次決定使用不使用,盡量大膽使用。b.第二次要修改 發現適用設計模式,使用它。如 頻繁改 c.不會的dm,則不用 codding style 1.文件注釋 2.不應有tab,行前 3.不應有space,行後 4.使用fo...

串列埠流控 軟體流控與硬體流控

在序列通訊處理中,常常看到rts cts和xon xoff這兩個選項,這就是兩個流控制的選項,目前流控制主要應用於數據機的資料通訊中。那麼,流控制在序列通訊中有何作用,在編制序列通訊程式怎樣應用呢?下面我們就談談這個問題。1.流控制在序列通訊中的作用 這裡講到的 流 當然指的是資料流。資料在兩個串列...