/*!
   * @if jp
   * @brief NamingContext を bind する
   * @else
   * @brief Bind NamingContext
   * @endif
   */
  void CorbaNaming::bindContext(const char* string_name,
				CosNaming::NamingContext_ptr name_cxt,
				const bool force)
    throw (SystemException, NotFound, CannotProceed, InvalidName, AlreadyBound)
  {
    bindContext(toName(string_name), name_cxt, force);
  }
Example #2
0
static int updateGL(struct engine* engine) {
	GK_BOOL init = engine->context == EGL_NO_CONTEXT;
    EGLint w, h;
	
	if (init) {
		initDisplay(engine);
		createSurface(engine);
		engine->context = eglCreateContext(engine->display, engine->config, NULL, NULL);
	}else {
		createSurface(engine);
	}

	if (!bindContext(engine, GK_TRUE))
		return -1;
	
	GLEE_EXT_framebuffer_object = (strstr((const char*)glGetString(GL_EXTENSIONS), "OES_framebuffer_object")?GK_TRUE:GK_FALSE);

    eglQuerySurface(engine->display, engine->surface, EGL_WIDTH, &w);
    eglQuerySurface(engine->display, engine->surface, EGL_HEIGHT, &h);

	if (init) {
		gkScreenSize.width = w;
		gkScreenSize.height = h;
	} else {
		onWindowSizeChanged(GK_SIZE(w, h));
	}
	
	engine->initialized = GK_TRUE;
	engine->animating = GK_TRUE;
	
    return 0;
}
Example #3
0
//
// 函数:open(YCLuaParameter* context)
//
// 目的: 创建一个窗口新实例
//        同时绑定窗口打开的数据上下文
//
// 注释:
//       每次从YCUIManager请求一个窗口,都创建一个窗口新实例
//       保证YCUIDOM的初始不变性
//
bool YCIContainer::open(YCLuaParameter* context)
{
	if (!preload())
	{
		throw YCException(2002, "YCIContainer::open打开窗口preload失败!");
	}

	//////////////////////////////////////////////
	// 首先绑定上下文
	//////////////////////////////////////////////
	bindContext(context);

	//////////////////////////////////////////////
	// 创建自身DynamicUIDOM
	//////////////////////////////////////////////
	myDynamicUIDOM = YCDynamicUIDOM::build(myUIDOM);
	if (myDynamicUIDOM == NULL)
	{
		LOG_WARNING("YCIContainer::open " << myWindowName << " 构建DynamicUIDOM失败!");
	}
	
	//////////////////////////////////////////////
	//创建控件集
	//////////////////////////////////////////////
	myContainer = this;
	if (!createSubTags(myUIDOM))
	{
		LOG_WARNING("YCIContainer::open创建子控件集失败,窗口无法打开:" << myWindowName);
		throw YCException(2002, "YCIContainer::initialize创建子控件集失败,窗口无法打开");
	}

	//////////////////////////////////////////////
	//绑定属性事件
	//////////////////////////////////////////////	
	if (!initialTagAttribute())
	{
		LOG_ERROR("YCIContainer::open初始化标签属性出错!");
		return false;
	}

	//////////////////////////////////////////////
	// 初始化CSS
	//////////////////////////////////////////////
	char theBasePath[MAX_PATH] ={0};
	if (!YCFileUtil::GetFilePath(myUIDOM->getFilename(), theBasePath, MAX_PATH))
	{
		throw YCException(2002, "YCIContainer::initialize无法取得Layout文件路径");
	}

	YCCSSContext * theLayoutContext = new YCCSSContext();
	const YCDList* layouts = myUIDOM->getLayouts();
	for (const Item_List_T* item = layouts->begin();
		 item != layouts->end();
		 item = layouts->next(item))
	{
		const char* filename = (const char*)layouts->payload(item);
		if (filename != NULL)
		{
			try 
			{
				char theFullPath[MAX_PATH] ={0};
				int len = strlen(filename) + strlen(theBasePath);
				if (len >= MAX_PATH)
				{
					throw YCException(2002, "YCIContainer::initialize中CSS文件路径长度大于MAX_PATH");
				}
				sprintf_s(theFullPath, "%s\\%s", theBasePath, filename);

				if (!YCCSSParser::parse(theLayoutContext, theFullPath))
				{
					LOG_WARNING("YCIContainer::initialize处理CSS文件出错:" << filename);
				}
			}
			catch (YCException& e)
			{
				LOG_FATAL("YCIContainer::initialize处理CSS文件" << filename << "异常:" << e.what());
			}
		}
	}

	//////////////////////////////////////////////
	// 绑定CSS
	//////////////////////////////////////////////
	bind2CSS(theLayoutContext);

	//////////////////////////////////////////////
	// 校验窗口位置
	//////////////////////////////////////////////
	if (myPositionX == INT_MIN && myPositionY == INT_MIN)
	{
		setPosition(YCUITagHelper::getSpecialValue("HALF_SCREEN_WIDTH") - myWidthWithMargin, 
		            YCUITagHelper::getSpecialValue("HALF_SCREEN_HEIGHT") - myHeightWithMargin);
	}

	//////////////////////////////////////////////
	// 完成窗口布局
	//////////////////////////////////////////////
	layout(false);

	//////////////////////////////////////////////
	//窗口进入动画
	//////////////////////////////////////////////
	const char* onOpen = getListener(UITAG_OPEN_EVENT);
	if (onOpen != NULL)
	{
		YCLua* lua = (YCLua*)YCRegistry::get("lua");
		if (lua == NULL)
		{
			LOG_ERROR("YCIContainer::initialize查询YCLua环境失败,请确认注册YCLua!");
			throw YCException(2002, "YCIContainer::initialize查询YCLua环境失败,请确认注册YCLua!");
		}

		// 构建Lua上下文
		YCLuaContext context;
		context.addContext("container", this);
		context.addContext("this", this);
		lua->execute(&context, onOpen, myWindowName);
	}
	else
	{
		finalOpen();
	}

	myComponentStatus = STATUS_OPEN;

	return true;
}