void Menu::LoadMenu(Profile * profile, const xmlNode * rootMenuNode) { LoadBackground(profile, rootMenuNode); LoadWidget(profile, rootMenuNode, &widgets); widgets.Pack(); }
void Menu::LoadWidget(Profile * profile, const xmlNode * rootMenuNode, WidgetList * container) { XmlReader * xmlFile = profile->GetXMLDocument(); uint widgetCount = xmlFile->GetNbChildren(rootMenuNode); const xmlNode * currentNode = xmlFile->GetFirstChild(rootMenuNode); std::string currentNodeName; // For each sub-node ... for ( ; widgetCount > 0; --widgetCount) { currentNodeName = xmlFile->GetNodeName(currentNode); Widget * newWidget = CreateWidget(profile, currentNode, currentNodeName); if (newWidget) { if ("GridBox" == currentNodeName || "HorizontalBox" == currentNodeName || "VerticalBox" == currentNodeName) { LoadWidget(profile, currentNode, (WidgetList*)newWidget); } container->AddWidget(newWidget); } currentNode = xmlFile->GetNextSibling(currentNode); } if (container) { container->Pack(); } }
void PawsManager::CreateWarningBox( const char* message, pawsWidget* notify, bool modal ) { pawsOkBox* ok = (pawsOkBox*)FindWidget("OkWindow"); if ( !ok ) { LoadWidget("ok.xml"); ok = (pawsOkBox*)FindWidget("OkWindow"); if ( !ok ) { Error1("Cannot load the ok window!"); return; } } ok->Show(); ok->SetText( message ); ok->MoveTo( (graphics2D->GetWidth() - ok->GetActualWidth(512) ) / 2, (graphics2D->GetHeight() - ok->GetActualHeight(256))/2 ); if ( notify ) ok->SetNotify( notify ); if ( modal ) SetModalWidget( ok ); }
void PawsManager::CreateYesNoBox( const char* message, pawsWidget* notify, bool modal ) { pawsYesNoBox* yesNoBox = (pawsYesNoBox*)FindWidget("YesNoWindow"); if ( !yesNoBox ) { LoadWidget("yesno.xml"); yesNoBox = (pawsYesNoBox*)FindWidget("YesNoWindow"); if ( !yesNoBox ) { Error1("Cannot Load YesNo Window"); return; } } yesNoBox->MoveTo( (graphics2D->GetWidth() - yesNoBox->GetActualWidth(512) ) / 2, (graphics2D->GetHeight() - yesNoBox->GetActualHeight(256))/2 ); yesNoBox->SetText( Translate(message) ); yesNoBox->Show(); if ( modal ) SetModalWidget(yesNoBox); if ( notify ) yesNoBox->SetNotify(notify); }
bool PawsManager::LoadChildWidgets( const char* widgetFile, csArray<pawsWidget *> &loadedWidgets ) { bool errors=false; loadedWidgets.DeleteAll(); csString fullPath = localization->FindLocalizedFile(widgetFile); csRef<iDocumentNode> topNode = ParseWidgetFile( fullPath ); if (!topNode) return false; csRef<iDocumentNodeIterator> iter = topNode->GetNodes(); while ( iter->HasNext() ) { csRef<iDocumentNode> node = iter->Next(); if ( node->GetType() != CS_NODE_ELEMENT ) continue; // This is a widget so read it's factory to create it. pawsWidget * widget = LoadWidget(node); if (widget) loadedWidgets.Push(widget); else errors = true; } return (!errors); }
wxDllWidget::wxDllWidget(wxWindow *parent, wxWindowID id, const wxString& dllName, const wxString& className, const wxPoint& pos, const wxSize& size, long style) : wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL | wxNO_BORDER, className + wxT("_container")), m_widget(NULL), m_lib(NULL), m_controlAdded(false) { SetBackgroundColour(wxColour(255, 0, 255)); if ( !!className ) LoadWidget(dllName, className, style); }
pawsWidget *PawsManager::LoadWidgetFromString(const char* widgetDefinition) { csRef<iDocument> doc; const char* error; doc=xml->CreateDocument(); error=doc->Parse(widgetDefinition); if ( error ) { Error3("Parse error in %s: %s", widgetDefinition, error); return NULL; } csRef<iDocumentNode> root,node; root = doc->GetRoot(); node = root->GetNode("widget"); pawsWidget *widget = LoadWidget(node); if (widget) widget->PostSetup(); return widget; }
bool PawsManager::LoadWidget( const char* widgetFile ) { // check for file in skin zip, then localized, then /data/gui, then /this csString fullPath; fullPath = vfsPathToSkin + widgetFile; if (!localization->FileExists(fullPath) ) { fullPath = localization->FindLocalizedFile(widgetFile); } csRef<iDocumentNode> topNode = ParseWidgetFile( fullPath ); if (!topNode) { Error2("Error parsing xml in file: %s", fullPath.GetDataSafe() ); return false; } csRef<iDocumentNodeIterator> iter = topNode->GetNodes(); while ( iter->HasNext() ) { csRef<iDocumentNode> node = iter->Next(); if ( node->GetType() != CS_NODE_ELEMENT ) continue; // This is a widget so read it's factory to create it. pawsWidget * widget = LoadWidget(node); if (widget) { widget->SetFilename(widgetFile); mainWidget->AddChild(widget); } else { Error2("Could not load child widget in file %s",fullPath.GetDataSafe()); return false; } } return true; }
XmasWidget::XmasWidget(std::string &_theme, Evas *_evas, ModuleDef &_mdef, std::string _id, Evas_Object *_parent, ActivityWidgetsView *_view): Widget(_theme, _evas, _mdef, _id, _parent, _view), animator(NULL), clip(NULL) { LoadWidget("xmas", 0.0, 0.0, _id); }