Add method beforeAddingWidgets to dialogs too, use it to fix Joerg's problem
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8556 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
5d787ec0cb
commit
209911fa21
@ -69,6 +69,8 @@ void ModalDialog::loadFromFile(const char* xmlFile)
|
||||
|
||||
LayoutManager::calculateLayout( m_widgets, this );
|
||||
|
||||
beforeAddingWidgets();
|
||||
|
||||
addWidgetsRecursively(m_widgets);
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,12 @@ namespace GUIEngine
|
||||
/** Override to be notified of updates */
|
||||
virtual void onUpdate(float dt) { }
|
||||
|
||||
/**
|
||||
* \brief Optional callback invoked very early, before widgets have been added (contrast with
|
||||
* init(), which is invoked afer widgets were added)
|
||||
*/
|
||||
virtual void beforeAddingWidgets() {}
|
||||
|
||||
/**
|
||||
* \brief Implementing callback from AbstractTopLevelContainer
|
||||
*/
|
||||
|
@ -37,16 +37,17 @@ using namespace GUIEngine;
|
||||
using namespace irr::gui;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
AddonsLoading::AddonsLoading(const float w, const float h,
|
||||
const std::string &id)
|
||||
: ModalDialog(w, h)
|
||||
{
|
||||
loadFromFile("addons_view_dialog.stkgui");
|
||||
m_addon = *(addons_manager->getAddon(id));
|
||||
m_icon_shown = false;
|
||||
m_download_request = NULL;
|
||||
|
||||
/*Init the icon here to be able to load a single image*/
|
||||
loadFromFile("addons_view_dialog.stkgui");
|
||||
|
||||
m_icon = getWidget<IconButtonWidget> ("icon" );
|
||||
m_progress = getWidget<ProgressBarWidget>("progress");
|
||||
m_install_button = getWidget<ButtonWidget> ("install" );
|
||||
@ -64,6 +65,20 @@ AddonsLoading::AddonsLoading(const float w, const float h,
|
||||
getWidget<ButtonWidget>("install")->setLabel(_("Uninstall"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void AddonsLoading::beforeAddingWidgets()
|
||||
{
|
||||
/*Init the icon here to be able to load a single image*/
|
||||
m_icon = getWidget<IconButtonWidget> ("icon" );
|
||||
m_progress = getWidget<ProgressBarWidget>("progress");
|
||||
m_install_button = getWidget<ButtonWidget> ("install" );
|
||||
m_back_button = getWidget<ButtonWidget> ("cancel" );
|
||||
m_state = getWidget<LabelWidget> ("state" );
|
||||
|
||||
|
||||
getWidget<LabelWidget>("name")->setText(m_addon.getName().c_str(), false);
|
||||
|
||||
getWidget<BubbleWidget>("description")->setText(m_addon.getDescription().c_str());
|
||||
|
@ -63,7 +63,10 @@ public:
|
||||
*/
|
||||
AddonsLoading(const float percent_width, const float percent_height,
|
||||
const std::string &addon_name);
|
||||
GUIEngine::EventPropagation processEvent(const std::string& event_source);
|
||||
|
||||
virtual GUIEngine::EventPropagation processEvent(const std::string& event_source);
|
||||
|
||||
virtual void beforeAddingWidgets();
|
||||
|
||||
/** This function is called by the GUI, all the frame (or somthing like
|
||||
* that). It checks the flags (m_can_load_icon and
|
||||
|
Loading…
x
Reference in New Issue
Block a user