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
|
||||
*/
|
||||
|
@ -38,10 +38,10 @@ BubbleWidget::BubbleWidget() : Widget(WTYPE_BUBBLE)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void BubbleWidget::add()
|
||||
{
|
||||
{
|
||||
m_shrinked_size = rect<s32>(m_x, m_y, m_x + m_w - BUBBLE_MARGIN_ON_RIGHT, m_y + m_h);
|
||||
stringw message = getText();
|
||||
|
||||
|
||||
EGUI_ALIGNMENT align = EGUIA_UPPERLEFT;
|
||||
if (m_properties[PROP_TEXT_ALIGN] == "center") align = EGUIA_CENTER;
|
||||
else if (m_properties[PROP_TEXT_ALIGN] == "right") align = EGUIA_LOWERRIGHT;
|
||||
|
@ -37,22 +37,23 @@ 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" );
|
||||
m_back_button = getWidget<ButtonWidget> ("cancel" );
|
||||
m_state = getWidget<LabelWidget> ("state" );
|
||||
|
||||
|
||||
if(m_progress)
|
||||
m_progress->setVisible(false);
|
||||
|
||||
@ -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…
Reference in New Issue
Block a user