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


C++ Container::GetMask方法代码示例

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


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

示例1: add

/** \brief add Widgets to a Container
 *  \details This accepts multiple Widgets.
 *
 */
int UI_Lua::add(lua_State *L){
	int n = lua_gettop(L);  // Number of arguments
	if (n >= 2){
		Container* outer = (Container*)checkWidget(L,1);
		luaL_argcheck(L, outer->GetMask() & WIDGET_CONTAINER, 1, "`Container' expected.");

		for(int i=2; i<=n; i++){
			Widget* inner = checkWidget(L,i);
			outer->AddChild( inner );
		}
	} else {
		luaL_error(L, "Got %d arguments expected 2 or more (self, widget [...])", n);
	}
	return 0;
}
开发者ID:rikus--,项目名称:Epiar,代码行数:19,代码来源:ui_lua.cpp

示例2: setFormButton

/** \brief Set the Form Button for 'Enter' keys to thie Container
 */
int UI_Lua::setFormButton(lua_State *L){
	int n = lua_gettop(L);  // Number of arguments
	if (n == 2){
		Container* container = (Container*)checkWidget(L,1);
		luaL_argcheck(L, container->GetMask() & WIDGET_CONTAINER, 1, "`Container' expected.");

		Button* button = (Button*)checkWidget(L,2);
		luaL_argcheck(L, button->GetMask() & WIDGET_BUTTON, 2, "`Button' expected.");

		container->SetFormButton( button );
	} else {
		luaL_error(L, "Got %d arguments expected 2 (self, picname)", n);
	}
	return 0;
}
开发者ID:rikus--,项目名称:Epiar,代码行数:17,代码来源:ui_lua.cpp

示例3: if

/**\brief Search this Container for a Widget
 *
 * \see Container::Search
 */
Widget *Container::Search( string full_query ) {
	int section = 0;
	char token;
	string subquery;
	string tokens = "/[]\"'(,)";
	vector<string> tokenized;
	vector<string>::iterator iter;
	list<Widget *>::iterator i;

	Container *current = this;

	// Temporary query values
	typedef struct {
		union {
			int flags;
			struct {
				int FOUND_COORD :1;
				int FOUND_TYPE  :1;
				int FOUND_NAME  :1;
				int FOUND_INDEX :1;
			};
		};
		int x,y;
		string type;
		string name;
		int index;
	} Query;
	Query query = {{0},0,0,"","",0};

	// Tokenize the String
	tokenized = TokenizedString( full_query, tokens );

	// Check the Start of the Query
	iter = tokenized.begin();
	if( (tokenized.size() >= 2) && (tokenized[0] == "") && (tokenized[1] == "/") ) {
		++iter; ++iter;
		++section;
	} else {
		LogMsg(ERR, "Query '%s' does not start with '/'.", full_query.c_str() );
		return NULL;
	}
	
	// Search all the tokens
	LogMsg(INFO, "QUERY: '%s'", full_query.c_str() );
	for(; iter != tokenized.end(); ++iter ) {
		subquery = (*iter);
		// LogMsg(INFO, "token: '%s'", (*iter).c_str() );
		token = subquery[0];
		if( subquery == "" ) { continue; }

		// If we're checking a Token, we need to be in a Container
		if( !( (current->GetMask()) & WIDGET_CONTAINER ) ) {
			LogMsg(INFO, "The query '%s' reached a non-container Widget and aborted at section %d.", full_query.c_str(), section );
			return NULL;
		}

		// If this is not a token then it is Widget Type
		if( subquery.find_first_of(tokens) != string::npos) {
			assert( subquery.size() == 1 );

			switch( token ) {
				// Boundary: Search the Children
				case '/':
				{
					int ind = 0;
					assert( (current->GetMask()) & WIDGET_CONTAINER );
					for( i = current->children.begin(); i != current->children.end(); ++i ) {
						// LogMsg(DEBUG1, "Checking %s %s (%d,%d) 0x%08X\n", (*i)->GetName().c_str(), (*i)->GetType().c_str(), (*i)->GetX(), (*i)->GetY(), (*i)->GetMask() );
						if( query.FOUND_NAME && (query.name != (*i)->GetName()) ) {
							continue;
						}
						if( query.FOUND_TYPE && (query.type != (*i)->GetType()) ) {
							continue;
						}
						if( query.FOUND_COORD && ((*i)->Contains(query.x, query.y) == false) ) {
							continue;
						}
						if( query.FOUND_INDEX && (query.index != ind) ) {
							ind++;
							continue;
						} 
						// Found a match!
						current = (Container*)(*i);
						// Forget about the current query
						query.flags = 0;
						break;
					}
					
					if( i == current->children.end() ) {
						LogMsg(INFO, "The query '%s' failed to find a widget at section %d", full_query.c_str(), section );
						return NULL;
					}
					++section;
					break;
				}

//.........这里部分代码省略.........
开发者ID:eoi,项目名称:Epiar,代码行数:101,代码来源:ui_container.cpp


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