本文整理汇总了C++中AttachChild函数的典型用法代码示例。如果您正苦于以下问题:C++ AttachChild函数的具体用法?C++ AttachChild怎么用?C++ AttachChild使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AttachChild函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AttachChild
void CUICellItem::init()
{
CUIXml uiXml;
uiXml.Load( CONFIG_PATH, UI_PATH, "actor_menu_item.xml" );
m_text = xr_new<CUIStatic>();
m_text->SetAutoDelete ( true );
AttachChild ( m_text );
CUIXmlInit::InitStatic ( uiXml, "cell_item_text", 0, m_text );
m_text->Show ( false );
/* m_mark = xr_new<CUIStatic>();
m_mark->SetAutoDelete ( true );
AttachChild ( m_mark );
CUIXmlInit::InitStatic ( uiXml, "cell_item_mark", 0, m_mark );
m_mark->Show ( false );*/
m_upgrade = xr_new<CUIStatic>();
m_upgrade->SetAutoDelete( true );
AttachChild ( m_upgrade );
CUIXmlInit::InitStatic ( uiXml, "cell_item_upgrade", 0, m_upgrade );
m_upgrade_pos = m_upgrade->GetWndPos();
m_upgrade->Show ( false );
m_pConditionState = xr_new<CUIProgressBar>();
m_pConditionState->SetAutoDelete(true);
AttachChild(m_pConditionState);
CUIXmlInit::InitProgressBar(uiXml, "condition_progess_bar", 0, m_pConditionState);
m_pConditionState->Show(true);
}
示例2:
CUICustomSpin::CUICustomSpin()
{
m_pFrameLine = xr_new<CUIFrameLineWnd>();
m_pBtnUp = xr_new<CUI3tButton>();
m_pBtnDown = xr_new<CUI3tButton>();
m_pLines = xr_new<CUILines>();
m_pFrameLine->SetAutoDelete (true);
m_pBtnUp->SetAutoDelete (true);
m_pBtnDown->SetAutoDelete (true);
AttachChild (m_pFrameLine);
AttachChild (m_pBtnUp);
AttachChild (m_pBtnDown);
m_pLines->SetTextAlignment (CGameFont::alLeft);
m_pLines->SetVTextAlignment (valCenter);
m_pLines->SetFont (UI().Font().pFontLetterica16Russian);
m_pLines->SetTextColor (color_argb(255,235,219,185));
m_time_begin = 0;
m_p_delay = 500;
m_u_delay = 0;
m_textColor[0] = color_argb(255,235,219,185);
m_textColor[1] = color_argb(255,100,100,100);
}
示例3: m_research_info_panel
//////////////////////////////////////////////////
// ResearchWnd //
//////////////////////////////////////////////////
ResearchWnd::ResearchWnd(GG::X w, GG::Y h) :
GG::Wnd(GG::X0, GG::Y0, w, h, GG::INTERACTIVE | GG::ONTOP),
m_research_info_panel(0),
m_queue_lb(0),
m_tech_tree_wnd(0),
m_enabled(false)
{
m_research_info_panel = new ProductionInfoPanel(RESEARCH_INFO_AND_QUEUE_WIDTH, GG::Y(200), UserString("RESEARCH_INFO_PANEL_TITLE"), UserString("RESEARCH_INFO_RP"),
OUTER_LINE_THICKNESS, ClientUI::KnownTechFillColor(), ClientUI::KnownTechTextAndBorderColor());
m_queue_lb = new QueueListBox(GG::X(2), m_research_info_panel->LowerRight().y,
m_research_info_panel->Width() - 4, ClientSize().y - 4 - m_research_info_panel->Height(),
"RESEARCH_QUEUE_ROW");
GG::Connect(m_queue_lb->QueueItemMoved, &ResearchWnd::QueueItemMoved, this);
m_queue_lb->SetStyle(GG::LIST_NOSORT | GG::LIST_NOSEL | GG::LIST_USERDELETE);
GG::Pt tech_tree_wnd_size = ClientSize() - GG::Pt(m_research_info_panel->Width(), GG::Y0);
m_tech_tree_wnd = new TechTreeWnd(tech_tree_wnd_size.x, tech_tree_wnd_size.y);
m_tech_tree_wnd->MoveTo(GG::Pt(m_research_info_panel->Width(), GG::Y0));
GG::Connect(m_tech_tree_wnd->AddTechToQueueSignal, &ResearchWnd::AddTechToQueueSlot, this);
GG::Connect(m_tech_tree_wnd->AddMultipleTechsToQueueSignal, &ResearchWnd::AddMultipleTechsToQueueSlot, this);
GG::Connect(m_queue_lb->ErasedSignal, &ResearchWnd::QueueItemDeletedSlot, this);
GG::Connect(m_queue_lb->LeftClickedSignal, &ResearchWnd::QueueItemClickedSlot, this);
GG::Connect(m_queue_lb->DoubleClickedSignal, &ResearchWnd::QueueItemDoubleClickedSlot, this);
AttachChild(m_research_info_panel);
AttachChild(m_queue_lb);
AttachChild(m_tech_tree_wnd);
SetChildClippingMode(ClipToClient);
}
示例4: AttachChild
void About::CompleteConstruction() {
CUIWnd::CompleteConstruction();
m_done = Wnd::Create<CUIButton>(UserString("DONE"));
m_license = Wnd::Create<CUIButton>(UserString("LICENSE"));
m_vision = Wnd::Create<CUIButton>(UserString("VISION"));
m_info = GG::Wnd::Create<CUIMultiEdit>(UserString("FREEORION_VISION"), GG::MULTI_WORDBREAK | GG::MULTI_READ_ONLY);
AttachChild(m_info);
AttachChild(m_vision);
AttachChild(m_license);
AttachChild(m_done);
DoLayout();
// Read in the copyright info from a file
// this is not GetResourceDir() / "COPYING" because if a mod or scenario is loaded
// that changes the settings directory, the copyright notice should be unchanged
m_license_str = ReadFile(GetRootDataDir() / "default" / "COPYING").value_or("");
m_done->LeftClickedSignal.connect(
boost::bind(&GG::Wnd::EndRun, this));
m_license->LeftClickedSignal.connect(
boost::bind(&About::ShowLicense, this));
m_vision->LeftClickedSignal.connect(
boost::bind(&About::ShowVision, this));
}
示例5:
CUIQuestionItem::CUIQuestionItem(CUIXml* xml_doc, LPCSTR path)
{
m_text = xr_new<CUI3tButton>();
m_text->SetAutoDelete (true);
AttachChild (m_text);
string512 str;
CUIXmlInit xml_init;
xr_strcpy (str,path);
xml_init.InitWindow (*xml_doc, str, 0, this);
m_min_height = xml_doc->ReadAttribFlt(path,0,"min_height",15.0f);
strconcat (sizeof(str),str,path,":content_text");
xml_init.Init3tButton (*xml_doc, str, 0, m_text);
Register (m_text);
AddCallback (m_text,BUTTON_CLICKED,CUIWndCallback::void_function(this, &CUIQuestionItem::OnTextClicked));
m_num_text = xr_new<CUITextWnd>();
m_num_text->SetAutoDelete (true);
AttachChild (m_num_text);
strconcat (sizeof(str),str,path,":num_text");
xml_init.InitTextWnd (*xml_doc, str, 0, m_num_text);
}
示例6: CUIWnd
InGameMenu::InGameMenu():
CUIWnd(UserString("GAME_MENU_WINDOW_TITLE"), (GG::GUI::GetGUI()->AppWidth() - IN_GAME_OPTIONS_WIDTH) / 2,
(GG::GUI::GetGUI()->AppHeight() - IN_GAME_OPTIONS_HEIGHT) / 2, IN_GAME_OPTIONS_WIDTH, IN_GAME_OPTIONS_HEIGHT, GG::INTERACTIVE | GG::MODAL)
{
m_save_btn = new CUIButton(UserString("GAME_MENU_SAVE"));
m_load_btn = new CUIButton(UserString("GAME_MENU_LOAD"));
m_options_btn = new CUIButton(UserString("INTRO_BTN_OPTIONS"));
m_exit_btn = new CUIButton(UserString("GAME_MENU_RESIGN"));
m_done_btn = new CUIButton(UserString("DONE"));
AttachChild(m_save_btn);
AttachChild(m_load_btn);
AttachChild(m_options_btn);
AttachChild(m_exit_btn);
AttachChild(m_done_btn);
GG::Connect(m_save_btn->LeftClickedSignal, &InGameMenu::Save, this);
GG::Connect(m_load_btn->LeftClickedSignal, &InGameMenu::Load, this);
GG::Connect(m_options_btn->LeftClickedSignal, &InGameMenu::Options, this);
GG::Connect(m_exit_btn->LeftClickedSignal, &InGameMenu::Exit, this);
GG::Connect(m_done_btn->LeftClickedSignal, &InGameMenu::Done, this);
if (!HumanClientApp::GetApp()->SinglePlayerGame()) {
// need lobby to load a multiplayer game; menu load of a file is insufficient
m_load_btn->Disable();
}
if (!HumanClientApp::GetApp()->CanSaveNow()) {
m_save_btn->Disable();
}
DoLayout();
}
示例7: AttachChild
void CUIMessagesWindow::Init(float x, float y, float width, float height){
CUIXml xml;
u32 color;
CGameFont* pFont;
xml.Init(CONFIG_PATH, UI_PATH, "messages_window.xml");
m_pGameLog = xr_new<CUIGameLog>();m_pGameLog->SetAutoDelete(true);
m_pGameLog->Show(true);
AttachChild(m_pGameLog);
if ( IsGameTypeSingle() )
{
CUIXmlInit::InitScrollView(xml, "sp_log_list", 0, m_pGameLog);
}
else
{
m_pChatLog = xr_new<CUIGameLog>(); m_pChatLog->SetAutoDelete(true);
m_pChatLog->Show (true);
AttachChild (m_pChatLog);
m_pChatWnd = xr_new<CUIChatWnd>(m_pChatLog); m_pChatWnd->SetAutoDelete(true);
AttachChild (m_pChatWnd);
CUIXmlInit::InitScrollView(xml, "mp_log_list", 0, m_pGameLog);
CUIXmlInit::InitFont(xml, "mp_log_list:font", 0, color, pFont);
m_pGameLog->SetTextAtrib(pFont, color);
CUIXmlInit::InitScrollView(xml, "chat_log_list", 0, m_pChatLog);
CUIXmlInit::InitFont(xml, "chat_log_list:font", 0, color, pFont);
m_pChatLog->SetTextAtrib(pFont, color);
m_pChatWnd->Init (xml);
}
}
示例8: m_research_info_panel
//////////////////////////////////////////////////
// ResearchWnd //
//////////////////////////////////////////////////
ResearchWnd::ResearchWnd(GG::X w, GG::Y h) :
GG::Wnd(GG::X0, GG::Y0, w, h, GG::INTERACTIVE | GG::ONTOP),
m_research_info_panel(0),
m_queue_lb(0),
m_tech_tree_wnd(0),
m_enabled(false)
{
GG::X queue_width(GetOptionsDB().Get<int>("UI.queue-width"));
m_research_info_panel = new ProductionInfoPanel(UserString("RESEARCH_INFO_PANEL_TITLE"), UserString("RESEARCH_INFO_RP"),
GG::X0, GG::Y0, GG::X(queue_width), GG::Y(100), "research.InfoPanel");
m_queue_lb = new QueueListBox("RESEARCH_QUEUE_ROW", UserString("RESEARCH_QUEUE_PROMPT"));
m_queue_lb->SetStyle(GG::LIST_NOSORT | GG::LIST_NOSEL | GG::LIST_USERDELETE);
GG::Connect(m_queue_lb->QueueItemMovedSignal, &ResearchWnd::QueueItemMoved, this);
GG::Connect(m_queue_lb->QueueItemDeletedSignal, &ResearchWnd::DeleteQueueItem, this);
GG::Connect(m_queue_lb->LeftClickedSignal, &ResearchWnd::QueueItemClickedSlot, this);
GG::Connect(m_queue_lb->DoubleClickedSignal, &ResearchWnd::QueueItemDoubleClickedSlot, this);
GG::Pt tech_tree_wnd_size = ClientSize() - GG::Pt(GG::X(GetOptionsDB().Get<int>("UI.queue-width")), GG::Y0);
m_tech_tree_wnd = new TechTreeWnd(tech_tree_wnd_size.x, tech_tree_wnd_size.y);
GG::Connect(m_tech_tree_wnd->AddTechsToQueueSignal, &ResearchWnd::AddTechsToQueueSlot, this);
AttachChild(m_research_info_panel);
AttachChild(m_queue_lb);
AttachChild(m_tech_tree_wnd);
SetChildClippingMode(ClipToClient);
DoLayout();
}
示例9:
void CUIStalkerRankingInfoItem::Init (CUIXml* xml, LPCSTR path, int idx)
{
XML_NODE* _stored_root = xml->GetLocalRoot();
CUIXmlInit xml_init;
xml_init.InitWindow (*xml, path, idx, this);
xml->SetLocalRoot (xml->NavigateToNode(path,idx));
m_text1 = xr_new<CUIStatic>(); m_text1->SetAutoDelete(true);
AttachChild (m_text1);
xml_init.InitStatic (*xml, "text_1", 0, m_text1);
m_text2 = xr_new<CUIStatic>(); m_text2->SetAutoDelete(true);
AttachChild (m_text2);
xml_init.InitStatic (*xml, "text_2", 0, m_text2);
m_text3 = xr_new<CUIStatic>(); m_text3->SetAutoDelete(true);
AttachChild (m_text3);
xml_init.InitStatic (*xml, "text_3", 0, m_text3);
xml_init.InitAutoStaticGroup (*xml, "auto", 0, this);
m_stored_alpha = color_get_A(m_text2->GetTextColor());
xml->SetLocalRoot (_stored_root);
}
示例10: m_f_min
CUITrackBar::CUITrackBar()
: m_f_min(0),
m_f_max(1),
m_f_val(0),
m_f_back_up(0),
m_f_step(0.01f),
m_b_is_float(true),
m_b_invert(false)
{
m_pFrameLine = xr_new<CUIFrameLineWnd>();
AttachChild (m_pFrameLine);
m_pFrameLine->SetAutoDelete (true);
m_pFrameLine_d = xr_new<CUIFrameLineWnd>();
m_pFrameLine_d->SetVisible (false);
AttachChild (m_pFrameLine_d);
m_pFrameLine_d->SetAutoDelete (true);
m_pSlider = xr_new<CUI3tButton>();
AttachChild (m_pSlider);
m_pSlider->SetAutoDelete (true);
// Start.Real Wolf.06.11.14.
m_pSlider->m_bSetStateAfterFocusLost = false;
m_bState = false;
// Finish.Real Wolf.06.11.14.
//. m_pSlider->SetOwner (this);
}
示例11:
void CUIEventsWnd::Init ()
{
CUIXml uiXml;
bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, "pda_events.xml");
R_ASSERT3 (xml_result, "xml file not found", "pda_events.xml");
CUIXmlInit xml_init;
xml_init.InitWindow (uiXml, "main_wnd", 0, this);
m_UILeftFrame = xr_new<CUIFrameWindow>(); m_UILeftFrame->SetAutoDelete(true);
AttachChild (m_UILeftFrame);
xml_init.InitFrameWindow (uiXml, "main_wnd:left_frame", 0, m_UILeftFrame);
m_UILeftHeader = xr_new<CUIFrameLineWnd>(); m_UILeftHeader->SetAutoDelete(true);
m_UILeftFrame->AttachChild (m_UILeftHeader);
xml_init.InitFrameLine (uiXml, "main_wnd:left_frame:left_frame_header", 0, m_UILeftHeader);
//. xml_init.InitAutoStaticGroup (uiXml, "main_wnd:left_frame",m_UILeftFrame);
m_UIAnimation = xr_new<CUIAnimatedStatic>(); m_UIAnimation->SetAutoDelete(true);
xml_init.InitAnimatedStatic (uiXml, "main_wnd:left_frame:left_frame_header:anim_static", 0, m_UIAnimation);
m_UILeftHeader->AttachChild (m_UIAnimation);
m_UIRightWnd = xr_new<CUIWindow>(); m_UIRightWnd->SetAutoDelete(true);
AttachChild (m_UIRightWnd);
xml_init.InitWindow (uiXml, "main_wnd:right_frame", 0, m_UIRightWnd);
m_UIMapWnd = xr_new<CUIMapWnd>(); m_UIMapWnd->SetAutoDelete(false);
m_UIMapWnd->Init ("pda_events.xml","main_wnd:right_frame:map_wnd");
m_UITaskInfoWnd = xr_new<CUITaskDescrWnd>(); m_UITaskInfoWnd->SetAutoDelete(false);
m_UITaskInfoWnd->Init (&uiXml,"main_wnd:right_frame:task_descr_view");
m_ListWnd = xr_new<CUIScrollView>(); m_ListWnd->SetAutoDelete(true);
m_UILeftFrame->AttachChild (m_ListWnd);
xml_init.InitScrollView (uiXml, "main_wnd:left_frame:list", 0, m_ListWnd);
m_TaskFilter = xr_new<CUITabControl>(); m_TaskFilter->SetAutoDelete(true);
m_UILeftFrame->AttachChild (m_TaskFilter);
xml_init.InitTabControl (uiXml, "main_wnd:left_frame:filter_tab", 0, m_TaskFilter);
m_TaskFilter->SetWindowName ("filter_tab");
Register (m_TaskFilter);
AddCallback ("filter_tab",TAB_CHANGED,CUIWndCallback::void_function(this,&CUIEventsWnd::OnFilterChanged));
/*
m_primary_or_all_filter_btn = xr_new<CUI3tButton>(); m_primary_or_all_filter_btn->SetAutoDelete(true);
m_UILeftFrame->AttachChild (m_primary_or_all_filter_btn);
xml_init.Init3tButton (uiXml, "main_wnd:left_frame:primary_or_all", 0, m_primary_or_all_filter_btn);
Register (m_primary_or_all_filter_btn);
m_primary_or_all_filter_btn-> SetWindowName("btn_primary_or_all");
AddCallback ("btn_primary_or_all",BUTTON_CLICKED,boost::bind(&CUIEventsWnd::OnFilterChanged,this,_1,_2));
*/
m_currFilter = eActiveTask;
SetDescriptionMode (true);
m_ui_task_item_xml.Init (CONFIG_PATH, UI_PATH, "job_item.xml");
}
示例12: m_graphic
BuildingIndicator::BuildingIndicator(GG::X w, const std::string& building_type,
double turns_completed, double total_turns) :
GG::Wnd(GG::X0, GG::Y0, w, GG::Y(Value(w)), GG::INTERACTIVE),
m_graphic(0),
m_scrap_indicator(0),
m_progress_bar(0),
m_building_id(INVALID_OBJECT_ID),
m_order_issuing_enabled(true)
{
boost::shared_ptr<GG::Texture> texture = ClientUI::BuildingIcon(building_type);
const BuildingType* type = GetBuildingType(building_type);
const std::string& desc = type ? type->Description() : "";
SetBrowseInfoWnd(boost::shared_ptr<GG::BrowseInfoWnd>(
new IconTextBrowseWnd(texture, UserString(building_type), UserString(desc))));
m_graphic = new GG::StaticGraphic(texture, GG::GRAPHIC_FITGRAPHIC | GG::GRAPHIC_PROPSCALE);
AttachChild(m_graphic);
m_progress_bar = new MultiTurnProgressBar(total_turns, turns_completed, GG::LightColor(ClientUI::TechWndProgressBarBackgroundColor()),
ClientUI::TechWndProgressBarColor(), GG::LightColor(ClientUI::ResearchableTechFillColor()));
AttachChild(m_progress_bar);
Refresh();
}
示例13: InitBackground
void CUIFrags2::Init(CUIXml& xml_doc, LPCSTR path, LPCSTR backgrnd_path){
InitBackground(xml_doc, backgrnd_path);
CUIWindow* pTeam1 = NULL;
CUIWindow* pTeam2 = NULL;
Fvector2 pos;
pTeam1 = m_pStats->InitStats(xml_doc, path, 1);
AttachChild(pTeam1);
pTeam2 = m_pStats2->InitStats(xml_doc, path, 2);
AttachChild(pTeam2);
// team 2 list
float x = xml_doc.ReadAttribFlt(path, 0, "x2");
R_ASSERT(x);
pos = m_pStats2->GetWndPos();
pos.x = x; //
pos.y += 3;
m_pStats2->SetWndPos(pos);
// team2 statas
pos = pTeam2->GetWndPos();
pos.x += m_pStats2->GetWndPos().x;
pTeam2->SetWndPos(pos);
// team 1 list
pos = m_pStats->GetWndPos();
pos.y += 3;
m_pStats->SetWndPos(pos);
pos = pTeam1->GetWndPos();
pos.x += m_pStats->GetWndPos().x;
pTeam1->SetWndPos(pos);
}
示例14: AttachChild
CUIVotingCategory::CUIVotingCategory()
{
xml_doc = NULL;
kick = NULL;
change_weather = NULL;
change_map = NULL;
text_vote = NULL;
bkgrnd = xr_new<CUIStatic>(); bkgrnd->SetAutoDelete(true); AttachChild(bkgrnd);
header = xr_new<CUIStatic>(); header->SetAutoDelete(true); AttachChild(header);
btn_cancel = xr_new<CUI3tButton>();btn_cancel->SetAutoDelete(true); AttachChild(btn_cancel);
for (int i = 0; i<7; i++)
{
btn[i] = xr_new<CUI3tButton>();
btn[i]->SetAutoDelete(true);
AttachChild(btn[i]);
txt[i] = xr_new<CUIStatic>();
txt[i]->SetAutoDelete(true);
AttachChild(txt[i]);
}
Init();
}
示例15: SideBar
SideBar(const CombatSummary& combat_summary, const BarSizer& sizer):
GG::Wnd(GG::X0, GG::Y0, GG::X1, GG::Y1, GG::INTERACTIVE),
m_side_summary(combat_summary),
m_x_axis_label(0),
m_sizer(sizer){
GG::Clr axis_label_color = combat_summary.SideColor();
m_x_axis_label = new CUILabel( (boost::format( UserString("COMBAT_FLEET_HEALTH_AXIS_LABEL") )
% combat_summary.SideName()
% static_cast<int>(combat_summary.total_current_health)
% static_cast<int>(combat_summary.total_max_health)).str(), GG::FORMAT_LEFT);
m_x_axis_label->SetColor(axis_label_color);
AttachChild(m_x_axis_label);
m_y_axis_label = new CUILabel(UserString("COMBAT_UNIT_HEALTH_AXIS_LABEL"));
m_y_axis_label->SetColor(axis_label_color);
AttachChild(m_y_axis_label);
m_dead_label = new CUILabel( (boost::format(UserString("COMBAT_DESTROYED_LABEL")) % m_side_summary.DestroyedUnits() ).str(), GG::FORMAT_RIGHT);
m_dead_label->SetColor(axis_label_color);
AttachChild(m_dead_label);
MakeBars();
}