Пример #1
0
/* Parses the XML Document for toolbars and instantiates them
 * Returns nothing, toolbars can be obtained via GetToolbar()
 */
void ToolbarManager::loadToolbars() {
	xml::NodeList toolbarList = GlobalRegistry().findXPath("//ui//toolbar");
	
	if (!toolbarList.empty()) {
		// Create a new tooltips element
		_tooltips = gtk_tooltips_new();
		gtk_tooltips_enable(_tooltips);
		
		for (std::size_t i = 0; i < toolbarList.size(); i++) {
			std::string toolbarName = toolbarList[i].getAttributeValue("name");
			
			if (toolbarExists(toolbarName)) {
				//globalOutputStream() << "This toolbar already exists: ";
				continue;
			}
			
			globalOutputStream() << "Found toolbar: " << toolbarName << std::endl;
			
			_toolbars.insert(toolbarName);
		}
	}
	else {
		throw std::runtime_error("No toolbars found.");
	}
}
Пример #2
0
	/*	Returns the toolbar that is named toolbarName
	 */
	GtkToolbar* ToolbarCreator::getToolbar(const std::string& toolbarName) {
		if (toolbarExists(toolbarName)) {
			return _toolbars[toolbarName];
		}
		else {
			return NULL;
		}
	}
Пример #3
0
/*	Returns the toolbar that is named toolbarName
 */
GtkToolbar* ToolbarManager::getToolbar(const std::string& toolbarName) {
	// Check if the toolbarName exists
	if (toolbarExists(toolbarName)) {
		
		// Instantiate the toolbar with buttons
		globalOutputStream() << "ToolbarManager: Instantiating toolbar: " << toolbarName << std::endl;
						
		// Build the path into the registry, where the toolbar should be found
		std::string toolbarPath = std::string("//ui//toolbar") + "[@name='"+ toolbarName +"']";
		xml::NodeList toolbarList = GlobalRegistry().findXPath(toolbarPath);
			
		if (toolbarList.size() > 0) {
			return createToolbar(toolbarList[0]);
		}
		else {
			globalErrorStream() << "ToolbarManager: Critical: Could not instantiate " << toolbarName << "!\n";
			return NULL;
		}		
	} 
	else {
		return NULL;
	}
}
Пример #4
0
	/* Parses the XML Document for toolbars and instantiates them
	 * Returns nothing, toolbars can be obtained via GetToolbar()
	 */
	void ToolbarCreator::loadToolbars() {
		xml::NodeList toolbarList = GlobalRegistry().findXPath("//ui//toolbar");

		if (toolbarList.size() > 0) {
			_tooltips = gtk_tooltips_new();
			gtk_tooltips_enable(_tooltips);

			for (unsigned int i = 0; i < toolbarList.size(); i++) {
				std::string toolbarName = toolbarList[i].getAttributeValue("name");

				if (toolbarExists(toolbarName)) {
					continue;
				}

				globalOutputStream() << "Found toolbar: " << toolbarName.c_str();
				globalOutputStream() << "\n";

				_toolbars[toolbarName] = createToolbar(toolbarList[i]);
			}
		}
		else {
			throw std::runtime_error("No toolbars found.");
		}
	}