24,854
社区成员
发帖
与我相关
我的任务
分享
#pragma once
#include "CEGUIBase.h"
#include "CEGUIWindow.h"
#include "CEGUITestWindowProperties.h"
namespace CEGUI
{
namespace TestWindowProperties
{
class SelectedTextColor: public CEGUI::Property
{
public:
SelectedTextColor() : Property(
"SelectedTextColor",
"设置或者获取选择状态下的文字颜色",
"FFFFFFFF")
{}
//设置和获取属性的函数
String get(const PropertyReceiver* receiver) const;
void set(PropertyReceiver* receiver, const String& value);
};
}
class CEGUIEXPORT TestWindow:public Window
{
public:
static const String EventNamespace; //全局事件的事件空间
static const String WidgetTypeName; //窗口类厂的名称
static const String EventLeftClicked;
public:
TestWindow(const String& type, const String& name);
~TestWindow(void){};
void setSelectedTextColour(colour& c);
colour getSelectTextColour();
void addTestWindowProperties(void);
virtual bool testClassName_impl(const String& class_name) const
{
if (class_name=="Combobox") return true;
return Window::testClassName_impl(class_name);
}
private:
colour d_selectTextColor;
static TestWindowProperties::SelectedTextColor d_selectedTextColourProperty;
};
}
#include "elements/CEGUITestWindow.h"
#include "CEGUIPropertyHelper.h"
#include "CEGUIPropertyHelper.h"
namespace CEGUI
{
const String TestWindow::EventNamespace("TestWindow");
const String TestWindow::WidgetTypeName("CEGUI/TestWindow");
const String TestWindow::EventLeftClicked( "LeftClicked" );
TestWindow::TestWindow(const String& type, const String& name) :
Window(type, name)
{}
void TestWindow::setSelectedTextColour(colour& c)
{
d_selectTextColor = c;
}
colour TestWindow::getSelectTextColour()
{
return d_selectTextColor;
}
void TestWindow::addTestWindowProperties(void)
{
addProperty(&d_selectedTextColourProperty);
}
namespace TestWindowProperties
{
String SelectedTextColor::get (const PropertyReceiver* receiver) const
{
return static_cast<const TestWindow*>(receiver)->getSelectTextColour();//这里出错
}
void SelectedTextColor::set(PropertyReceiver* receiver, const String& value)
{
static_cast<TestWindow*>(receiver)->setSelectedTextColour(PropertyHelper::stringToColour(value));//stringToColour(value));
}
}
}