コード例 #1
0
ファイル: menu.cpp プロジェクト: jonnymind/titanium_desktop
	void Menu::_AddCheckItem(const ValueList& args, SharedValue result)
	{
		UIBinding* binding = UIBinding::GetInstance();
		AutoMenuItem newItem = binding->__CreateCheckMenuItem(args);
		this->AppendItem(newItem);
		result->SetObject(newItem);
	}
コード例 #2
0
ファイル: ui_module.cpp プロジェクト: cfs051059/titanium
	void UIModule::Start()
	{
		SharedKMethod api = this->host->GetGlobalObject()->GetNS("API.fire")->ToMethod();
		api->Call("ti.UI.start", Value::Undefined);

#ifdef OS_WIN32
		UIBinding* binding = new Win32UIBinding(host);
#elif OS_OSX
		UIBinding* binding = new OSXUIBinding(host);
#elif OS_LINUX
		UIBinding* binding = new GtkUIBinding(host);
#endif

		AppConfig *config = AppConfig::Instance();
		if (config == NULL)
		{
			std::string msg = "Error loading tiapp.xml. Your application "
			                  "is not properly configured or packaged.";
			binding->ErrorDialog(msg);
			throw ValueException::FromString(msg.c_str());
			return;
		}
		WindowConfig *main_window_config = config->GetMainWindow();
		if (main_window_config == NULL)
		{
			std::string msg ="Error loading tiapp.xml. Your application "
			                 "window is not properly configured or packaged.";
			binding->ErrorDialog(msg);
			throw ValueException::FromString(msg.c_str());
			return;
		}

		binding->CreateMainWindow(main_window_config);
	}
コード例 #3
0
void MenuItem::_AddSeparatorItem(const ValueList& args, KValueRef result)
{
    UIBinding* binding = UIBinding::GetInstance();
    AutoMenuItem newItem = binding->__CreateSeparatorMenuItem(args);
    this->EnsureHasSubmenu();
    this->submenu->AppendItem(newItem);

    result->SetObject(newItem);
}
コード例 #4
0
void MenuItem::EnsureHasSubmenu()
{
    if (this->submenu.isNull())
    {
        UIBinding* binding = UIBinding::GetInstance();
        AutoMenu newSubmenu = binding->CreateMenu();
        this->SetSubmenuImpl(newSubmenu);
        this->submenu = newSubmenu;
    }
}
コード例 #5
0
ファイル: menu.cpp プロジェクト: jonnymind/titanium_desktop
	void Menu::_AddItem(const ValueList& args, SharedValue result)
	{
		args.VerifyException("addItem", "?s m|0 s|0");
		UIBinding* binding = UIBinding::GetInstance();

		// Create a menu item object and add it to this item's submenu
		AutoMenuItem newItem = binding->__CreateMenuItem(args);
		this->AppendItem(newItem);
		result->SetObject(newItem);
	}
コード例 #6
0
void MenuItem::_AddCheckItem(const ValueList& args, KValueRef result)
{
    UIBinding* binding = UIBinding::GetInstance();

    // Create a menu item object
    AutoMenuItem newItem = binding->__CreateCheckMenuItem(args);
    this->EnsureHasSubmenu();
    this->submenu->AppendItem(newItem);

    result->SetObject(newItem);
}