本文整理汇总了C++中CObjectManager::CloneObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CObjectManager::CloneObject方法的具体用法?C++ CObjectManager::CloneObject怎么用?C++ CObjectManager::CloneObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObjectManager
的用法示例。
在下文中一共展示了CObjectManager::CloneObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitObject
void CGUIContainer::InitObject(const char * strObjectName, const char * alignment, int x, int y, int width, int height)
{
CObjectManager *pOm = &CSingleton<CObjectManager>::Instance();
if (!pOm->IsExist("default_CGUIContainer")) {
CGUIContainer::StaticInit();
}
pOm->CloneObject("default_CGUIContainer", this);
CGUIBase::InitObject(strObjectName, alignment, x, y, width, height);
//initialize scrollbars
string str;
str = GetName() + ".vscrollbar";
// Modified 2007.4.10 LiXizhi, alignment type is changed.
//m_VScroll->InitObject(str.c_str(),"_rt",-m_nSBWidth-m_nBorder,m_nBorder,m_nSBWidth,RectHeight(m_objResource->GetDrawingRects(0)));
m_VScroll->InitObject(str.c_str(), "_mr", m_nBorder, m_nBorder, m_nSBWidth, m_nBorder);
m_VScroll->m_parent = this;
m_VScroll->SetLinkedObject(this);
// m_VScroll->UpdateRects();
str = GetName() + ".hscrollbar";
//m_HScroll->InitObject(str.c_str(),"_lb",m_nBorder,-m_nSBWidth-m_nBorder,RectWidth(m_objResource->GetDrawingRects(0)),m_nSBWidth);
m_HScroll->InitObject(str.c_str(), "_mb", m_nBorder, m_nBorder, m_nBorder + m_nSBWidth, m_nSBWidth);
m_HScroll->m_parent = this;
m_HScroll->SetLinkedObject(this);
// m_HScroll->UpdateRects();
SetSize(width, height);
}
示例2: InitObject
void CGUIListBox::InitObject(const char * strObjectName, const char * alignment, int x, int y, int width, int height)
{
CObjectManager *pOm = &CSingleton<CObjectManager>::Instance();
if (!pOm->IsExist("default_CGUIListBox")) {
CGUIListBox::StaticInit();
}
pOm->CloneObject("default_CGUIListBox", this);
CGUIBase::InitObject(strObjectName, alignment, x, y, width, height);
//initialize scrollbars
string str;
str = GetName() + ".vscrollbar";
m_VScroll->InitObject(str.c_str(), "_rt", -m_nSBWidth - m_nBorder, m_nBorder, m_nSBWidth, RectHeight(m_objResource->GetDrawingRects(0)));
m_VScroll->SetParent(this);
m_VScroll->SetLinkedObject(this);
m_VScroll->UpdateRects();
// str=GetName()+".hscrollbar";
// m_HScroll->InitObject(str.c_str(),"_lb",m_nBorder,-m_nSBWidth-m_nBorder,RectWidth(m_objResource->GetDrawingRects(0)),m_nSBWidth);
// m_HScroll->m_parent=this;
// m_HScroll->SetLinkedObject(this);
// m_HScroll->UpdateRects();
}
示例3: StaticInit
void CGUIListBox::StaticInit()
{
CObjectManager *pOm = &CSingleton<CObjectManager>::Instance();
if (!pOm->IsExist("default_CGUIContainer")) {
CGUIContainer::StaticInit();
}
//load the default CGUIBase object and copy all its value to the new button
CGUIListBox *pListbox = new CGUIListBox();
pOm->CloneObject("default_CGUIContainer", pListbox);
//pListbox->m_objType=CGUIBase::Type_GUIListBox|CGUIBase::GUIContainer;
pListbox->m_bMultiSelect = false;
pListbox->m_nSelected = -1;
pListbox->m_bAllowAdvObject = false;
pListbox->m_bNeedUpdate = true;
pListbox->m_deltaX = 0;
pListbox->m_deltaY = 0;
pListbox->m_SelBkColor = COLOR_ARGB(255, 40, 50, 92);
pListbox->m_ItemHeight = 0;
pListbox->m_nBorder = 2;
pListbox->m_nMargin = 6;
pListbox->m_bCanHasFocus = true;
pListbox->m_bDrag = false;
pListbox->m_nSelStart = 0;
pListbox->m_bFastRender = true;
pListbox->m_bWordBreak = false;
pListbox->m_bScrollable = true;
CEventBinding* pBinding = (CEventBinding*)pListbox->m_event->GetEventBindingObj();
pBinding->EnableKeyboard();
pBinding->EnableMouse();
// pBinding->MapEvent(EM_MOUSE_LEFTDOWN,EM_CTRL_CAPTUREMOUSE);
// pBinding->MapEvent(EM_MOUSE_LEFTDOWN,EM_LB_ACTIONBEGIN);
// pBinding->MapEvent(EM_MOUSE_LEFTUP,EM_CTRL_RELEASEMOUSE);
// pBinding->MapEvent(EM_MOUSE_LEFTUP,EM_LB_ACTIONEND);
// pBinding->MapEvent(EM_MOUSE_LEFTCLICK,EM_LB_ACTIONEND);
// pBinding->MapEvent(EM_MOUSE_LEFTCLICK,EM_CTRL_RELEASEMOUSE);
// pBinding->MapEvent(EM_MOUSE_LEFTDBCLICK,EM_CTRL_CHANGE);
// pBinding->MapEvent(EM_KEY_RETURN,EM_CTRL_CHANGE);
pBinding->MapEvent(EM_KEY_HOME, EM_CTRL_HOLDKEY);
pBinding->MapEvent(EM_KEY_END, EM_CTRL_HOLDKEY);
pBinding->MapEvent(EM_KEY_PAGE_DOWN, EM_CTRL_HOLDKEY);
pBinding->MapEvent(EM_KEY_PAGE_UP, EM_CTRL_HOLDKEY);
pBinding->MapEvent(EM_KEY_LEFT, EM_CTRL_HOLDKEY);
pBinding->MapEvent(EM_KEY_RIGHT, EM_CTRL_HOLDKEY);
pBinding->MapEvent(EM_KEY_DOWN, EM_CTRL_HOLDKEY);
pBinding->MapEvent(EM_KEY_UP, EM_CTRL_HOLDKEY);
pBinding->MapEvent(EM_KEY_RETURN, EM_CTRL_HOLDKEY);
pBinding->EnableEvent(EM_MOUSE_DBCLICK);
pBinding->EnableEvent(EM_MOUSE_CLICK);
using namespace ParaInfoCenter;
CICConfigManager *cm = CGlobals::GetICConfigManager();
string value0, value1;
int event0, event1, a;
DWORD b;
HRESULT hr;
hr = cm->GetSize("GUI_listbox_control_mapping", &b);
if (hr == E_INVALIDARG || hr == E_ACCESSDENIED) {
//error
}
else{
for (a = 0; a < (int)b; a += 2) {
hr = cm->GetTextValue("GUI_listbox_control_mapping", value0, a);
if (FAILED(hr)) {
break;
}
hr = cm->GetTextValue("GUI_listbox_control_mapping", value1, a + 1);
if (FAILED(hr)) {
break;
}
event0 = CEventBinding::StringToEventValue(value0);
event1 = CEventBinding::StringToEventValue(value1);
pBinding->MapEvent(event0, event1);
}
}
int tempint;
if (cm->GetIntValue("GUI_listbox_control_visible", &tempint) == S_OK) {
if (tempint == 0) {
pListbox->m_bIsVisible = false;
}
else
pListbox->m_bIsVisible = true;
}
if (cm->GetIntValue("GUI_listbox_control_enable", &tempint) == S_OK) {
if (tempint == 0) {
pListbox->m_bIsEnabled = false;
}
else
pListbox->m_bIsEnabled = true;
}
if (cm->GetIntValue("GUI_listbox_control_canhasfocus", &tempint) == S_OK) {
if (tempint == 0) {
pListbox->m_bCanHasFocus = false;
}
else
pListbox->m_bCanHasFocus = true;
}
if (cm->GetIntValue("GUI_listbox_control_candrag", &tempint) == S_OK) {
//.........这里部分代码省略.........
示例4: StaticInit
void CGUIContainer::StaticInit()
{
CObjectManager *pOm = &CSingleton<CObjectManager>::Instance();
if (!pOm->IsExist("default_CGUIBase")) {
CGUIBase::StaticInit();
}
//load the default CGUIBase object and copy all its value to the new button
CGUIContainer *pContainer = new CGUIContainer();
pContainer->m_bFastRender = true;
pContainer->m_bScrollable = false;
pContainer->m_nMargin = DEFAULT_CONTAINER_MARGIN_SIZE;
pContainer->m_nSBWidth = 16;
pContainer->m_nBorder = DEFAULT_CONTAINER_BORDER_SIZE;
pOm->CloneObject("default_CGUIBase", pContainer);
pContainer->m_bCanCaptureMouse = false;
// pContainer->m_objType=CGUIBase::GUIContainer;
CEventBinding* pBinding = pContainer->m_event->GetEventBindingObj();
//pBinding->DisableKeyboard();
pBinding->EnableKeyboard();
pBinding->EnableMouse();
//in button, i define that a click on the button will get the button key focus
// pBinding->MapEvent(EM_MOUSE_LEFTDOWN,EM_CTRL_CAPTUREMOUSE);
// pBinding->MapEvent(EM_MOUSE_LEFTUP,EM_CTRL_RELEASEMOUSE);
pBinding->DisableEvent(EM_MOUSE_DBCLICK);
pBinding->DisableEvent(EM_MOUSE_CLICK);
// pBinding->EnableEvent(EM_KEY);
// pBinding->EnableEvent(EM_KEY_PAGE_DOWN);
// pBinding->EnableEvent(EM_KEY_PAGE_UP);
// pContainer->m_event->SetEventBinding(pBinding);
if (!pOm->IsExist("default_CGUIScrollbar")) {
CGUIScrollBar::StaticInit();
}
pContainer->m_VScroll = (CGUIScrollBar*)pOm->CloneObject("default_CGUIScrollbar");
pContainer->m_VScroll->SetName("vscrollbar");
pContainer->m_HScroll = (CGUIScrollBar*)pOm->CloneObject("default_CGUIScrollbar");
pContainer->m_HScroll->SetName("hscrollbar");
// TODO: 2006.8.LXZ: when GUI object is reference counted, the default container should reference the default scroll bar, so that when
// the style of default scroll bar is changed, so does the container scroll bar. Right now, we clone the scroll bar.
//pContainer->m_VScroll = (CGUIScrollBar*)pOm->GetObject("default_CGUIScrollbar");
//pContainer->m_HScroll = (CGUIScrollBar*)pContainer->m_VScroll;
//TODO: we could add default texture or text here, load from config
using namespace ParaInfoCenter;
CICConfigManager *cm = CGlobals::GetICConfigManager();
string value0, value1;
int event0, event1, a;
DWORD b;
HRESULT hr;
hr = cm->GetSize("GUI_container_control_mapping", &b);
if (hr == E_INVALIDARG || hr == E_ACCESSDENIED) {
//error
}
else{
for (a = 0; a < (int)b; a += 2) {
hr = cm->GetTextValue("GUI_container_control_mapping", value0, a);
if (FAILED(hr)) {
break;
}
hr = cm->GetTextValue("GUI_container_control_mapping", value1, a + 1);
if (FAILED(hr)) {
break;
}
event0 = CEventBinding::StringToEventValue(value0);
event1 = CEventBinding::StringToEventValue(value1);
pBinding->MapEvent(event0, event1);
}
}
int tempint;;
if (cm->GetIntValue("GUI_container_control_fastrender", &tempint) == S_OK) {
if (tempint == 0) {
pContainer->m_bFastRender = false;
}
else
pContainer->m_bFastRender = true;
}
if (cm->GetIntValue("GUI_container_control_canhasfocus", &tempint) == S_OK) {
if (tempint == 0) {
pContainer->m_bCanHasFocus = false;
}
else
pContainer->m_bCanHasFocus = true;
}
if (cm->GetIntValue("GUI_container_control_visible", &tempint) == S_OK) {
if (tempint == 0) {
pContainer->m_bIsVisible = false;
}
else
pContainer->m_bIsVisible = true;
}
if (cm->GetIntValue("GUI_container_control_enable", &tempint) == S_OK) {
if (tempint == 0) {
pContainer->m_bIsEnabled = false;
}
else
pContainer->m_bIsEnabled = true;
//.........这里部分代码省略.........