当前位置: 首页>>代码示例>>C++>>正文


C++ CL_DomElement::get_attribute_bool方法代码示例

本文整理汇总了C++中CL_DomElement::get_attribute_bool方法的典型用法代码示例。如果您正苦于以下问题:C++ CL_DomElement::get_attribute_bool方法的具体用法?C++ CL_DomElement::get_attribute_bool怎么用?C++ CL_DomElement::get_attribute_bool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CL_DomElement的用法示例。


在下文中一共展示了CL_DomElement::get_attribute_bool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if


//.........这里部分代码省略.........
		}
		else if (tag == "statusbar")
		{
			CL_StatusBar *co = new CL_StatusBar(parent);
			new_comp = co;
		}
		else if (tag == "menubar")
		{
			CL_MenuBar *co = new CL_MenuBar(parent);
			new_comp = co;
		}
		else if (tag == "combobox")
		{
			CL_ComboBox *co = new CL_ComboBox(parent);
			new_comp = co;
		}
		else if (tag == "scrollbar")
		{
			CL_ScrollBar *co = new CL_ScrollBar(parent);
			new_comp = co;
		}
		else if (tag == "spin")
		{
			CL_Spin *co = new CL_Spin(parent);
			new_comp = co;
		}
		else if (tag == "imageview")
		{
			CL_ImageView *co = new CL_ImageView(parent);
			new_comp = co;
		}
		else if (tag == "frame")
		{
			CL_Frame *co = new CL_Frame(parent);
			if (e.has_attribute("text"))
				co->set_header_text(e.get_attribute("text"));
			new_comp = co;
			CL_GUILayoutCorners layout_corners;
			co->set_layout(layout_corners);
			load(e, co);
		}
		else if (tag == "dialog")
		{
			dialog_width = CL_StringHelp::text_to_int(e.get_attribute("width"));
			dialog_height = CL_StringHelp::text_to_int(e.get_attribute("height"));
		}
		else // unknown tag... try create a custom_component
		{
			CL_GUIComponent *co = 0;
			if (create_custom_callback && !create_custom_callback->is_null())
			{
				co = create_custom_callback->invoke(parent, tag);
			}
			new_comp = co;
		}

		if (new_comp)
		{
			new_comp->set_id_name(e.get_attribute("id"));
			new_comp->set_class_name(e.get_attribute("class"));
			new_comp->set_enabled(e.get_attribute_bool("enabled", true));

			CL_String str = e.get_attribute("geom");
			std::vector<CL_String> split = CL_StringHelp::split_text(str, ",");

			CL_Rect g;
			g.left = CL_StringHelp::text_to_int(split[0]);
			g.top = CL_StringHelp::text_to_int(split[1]);
			g.right = CL_StringHelp::text_to_int(split[2]);
			g.bottom = CL_StringHelp::text_to_int(split[3]);
			new_comp->set_geometry(g);

			CL_GUILayout parent_layout = parent->get_layout();
			if (!parent_layout.is_null())
			{
				parent_layout.get_provider();
				CL_GUILayoutProvider_Corners *corner_provider_layout = dynamic_cast<CL_GUILayoutProvider_Corners*>(parent_layout.get_provider());
				if (corner_provider_layout)
				{
					int dist_tl_x = CL_StringHelp::text_to_int(e.get_attribute("dist_tl_x"));
					int dist_tl_y = CL_StringHelp::text_to_int(e.get_attribute("dist_tl_y"));
					int dist_rb_x = CL_StringHelp::text_to_int(e.get_attribute("dist_br_x"));
					int dist_rb_y = CL_StringHelp::text_to_int(e.get_attribute("dist_br_y"));
					CL_ComponentAnchorPoint ap_tl = (CL_ComponentAnchorPoint)CL_StringHelp::text_to_int(e.get_attribute("anchor_tl"));
					CL_ComponentAnchorPoint ap_br = (CL_ComponentAnchorPoint)CL_StringHelp::text_to_int(e.get_attribute("anchor_br"));

					corner_provider_layout->add_component(new_comp, ap_tl, dist_tl_x, dist_tl_y, ap_br, dist_rb_x, dist_rb_y);
				}
			}
		}

		e = e.get_next_sibling().to_element();
	}

	CL_GUILayout parent_layout = parent->get_layout();
	if (!parent_layout.is_null())
	{
		parent_layout.set_geometry(parent->get_size());
	}
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:101,代码来源:gui_xml_loader_version_1_0.cpp


注:本文中的CL_DomElement::get_attribute_bool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。