SuperTuxKart
Public Member Functions | Private Member Functions | Private Attributes | List of all members
VoteDialog Class Reference

Dialog that allows a user to sign in. More...

#include <vote_dialog.hpp>

Inheritance diagram for VoteDialog:
Inheritance graph
[legend]

Public Member Functions

 VoteDialog (const std::string &addon_id)
 Constructor.
 
 ~VoteDialog ()
 Destructor, frees the various requests.
 
GUIEngine::EventPropagation processEvent (const std::string &eventSource)
 Callback when a user event is triggered. More...
 
virtual void onUpdate (float dt)
 Called every frame. More...
 
virtual bool onEscapePressed ()
 When escape is pressed, trigger a self destroy.
 
- Public Member Functions inherited from GUIEngine::ModalDialog
bool isInited ()
 Because C++ doesn't support constructor delegation... More...
 
irr::gui::IGUIWindow * getIrrlichtElement ()
 
virtual void beforeAddingWidgets ()
 Optional callback invoked very early, before widgets have been added (contrast with init(), which is invoked afer widgets were added)
 
virtual void load ()
 
virtual void init ()
 Optional callback invoked after widgets have been add()ed.
 
virtual int getWidth ()
 Implementing callback from AbstractTopLevelContainer.
 
virtual int getHeight ()
 Implementing callback from AbstractTopLevelContainer.
 
bool fadeBackground () const
 
bool isMyIrrChild (irr::gui::IGUIElement *widget) const
 
- Public Member Functions inherited from GUIEngine::AbstractTopLevelContainer
WidgetgetWidget (const char *name)
 This function returns a widget by name if that widget is found. More...
 
WidgetgetWidget (const int id)
 This function returns a widget by irrlicht ID if that widget is found. More...
 
template<typename T >
T * getWidget (const char *name)
 This function searches and returns a widget by name, cast as specified type, if that widget is found and the type is correct. More...
 
WidgetgetFirstWidget (PtrVector< Widget > *within_vector=NULL)
 This function returns the first widget found in within_vector. More...
 
WidgetgetLastWidget (PtrVector< Widget > *within_vector=NULL)
 This function returns the last widget found in within_vector. More...
 
void elementsWereDeleted (PtrVector< Widget > *within_vector=NULL)
 This function is called when screen is removed. More...
 
bool isMyChild (Widget *widget) const
 This function checks if a widget is a child of the container. More...
 

Private Member Functions

void updateFetchVote ()
 Updates a potentiall still outstanding fetch vote request.
 
void sendVote ()
 A request to the server, to perform a vote on an addon. More...
 

Private Attributes

const std::string m_addon_id
 Stores the id of the addon being voted on. More...
 
bool m_self_destroy
 True if the dialog should be removed (which needs to be done in the update call each frame). More...
 
std::shared_ptr< Online::XMLRequestm_fetch_vote_request
 The request to fetch the current vote, which is submitted immediately when this dialog is opened. More...
 
std::shared_ptr< Online::XMLRequestm_perform_vote_request
 The request to perform a vote. More...
 
GUIEngine::LabelWidgetm_info_widget
 Pointer to the info widget of this dialog. More...
 
GUIEngine::RatingBarWidgetm_rating_widget
 Pointer to the rating widget of this dialog.
 
GUIEngine::RibbonWidgetm_options_widget
 Pointer to the options widget, which contains the canel button. More...
 
GUIEngine::IconButtonWidgetm_cancel_widget
 Pointer to the cancel button. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GUIEngine::ModalDialog
static void dismiss ()
 
static void onEnterPressed ()
 
static ModalDialoggetCurrent ()
 
static bool isADialogActive ()
 
- Static Public Member Functions inherited from GUIEngine::AbstractTopLevelContainer
static WidgetgetWidget (const char *name, PtrVector< Widget > *within_vector)
 This function returns a widget by name if that widget is found in within_vector. More...
 
static WidgetgetWidget (const int id, PtrVector< Widget > *within_vector)
 This function returns a widget by irrlicht ID if that widget is found. More...
 
- Public Attributes inherited from GUIEngine::SkinWidgetContainer
int m_skin_x
 
int m_skin_y
 
int m_skin_w
 
int m_skin_h
 
bool m_skin_dest_areas_inited
 
bool m_skin_dest_areas_yflip_inited
 
int m_skin_dest_x
 
int m_skin_dest_y
 
int m_skin_dest_x2
 
int m_skin_dest_y2
 
core::rect< s32 > m_skin_dest_area_left
 
core::rect< s32 > m_skin_dest_area_center
 
core::rect< s32 > m_skin_dest_area_right
 
core::rect< s32 > m_skin_dest_area_top
 
core::rect< s32 > m_skin_dest_area_bottom
 
core::rect< s32 > m_skin_dest_area_top_left
 
core::rect< s32 > m_skin_dest_area_top_right
 
core::rect< s32 > m_skin_dest_area_bottom_left
 
core::rect< s32 > m_skin_dest_area_bottom_right
 
core::rect< s32 > m_skin_dest_area_left_yflip
 
core::rect< s32 > m_skin_dest_area_center_yflip
 
core::rect< s32 > m_skin_dest_area_right_yflip
 
core::rect< s32 > m_skin_dest_area_top_yflip
 
core::rect< s32 > m_skin_dest_area_bottom_yflip
 
core::rect< s32 > m_skin_dest_area_top_left_yflip
 
core::rect< s32 > m_skin_dest_area_top_right_yflip
 
core::rect< s32 > m_skin_dest_area_bottom_left_yflip
 
core::rect< s32 > m_skin_dest_area_bottom_right_yflip
 
short m_skin_r
 
short m_skin_g
 
short m_skin_b
 
- Protected Member Functions inherited from GUIEngine::ModalDialog
 ModalDialog (const float percentWidth, const float percentHeight, ModalDialogLocation location=MODAL_DIALOG_LOCATION_CENTER)
 Creates a modal dialog with given percentage of screen width and height.
 
void loadFromFile (const char *xmlFile)
 Load a XML file to create the dialog from. More...
 
virtual void onEnterPressedInternal ()
 
void clearWindow ()
 
virtual void loadedFromFile ()
 Callback invoked when the dialog was loaded from the XML file (if the constructor that takes a XML file as argument is used)
 
void doInit ()
 
- Protected Member Functions inherited from GUIEngine::AbstractTopLevelContainer
void addWidgetsRecursively (PtrVector< Widget > &widgets, Widget *parent=NULL)
 This function adds a list of widgets recursively, effectively creating the hierarchy of widgets. More...
 
- Protected Attributes inherited from GUIEngine::ModalDialog
irr::gui::IGUIWindow * m_irrlicht_window
 
irr::core::rect< irr::s32 > m_area
 
bool m_fade_background
 
InputManager::InputDriverMode m_previous_mode
 
- Protected Attributes inherited from GUIEngine::AbstractTopLevelContainer
PtrVector< Widget, HOLD > m_widgets
 the widgets in this screen
 
Widgetm_first_widget
 AbstractTopLevelContainer is generally able to determine its first widget just fine, but in highly complex screens (e.g. More...
 
Widgetm_last_widget
 AbstractTopLevelContainer is generally able to determine its last widget just fine, but in highly complex screens (e.g. More...
 

Detailed Description

Dialog that allows a user to sign in.

Member Function Documentation

◆ onUpdate()

void VoteDialog::onUpdate ( float  dt)
virtual

Called every frame.

Checks if any of the pending requests are finished.

Parameters
dtTime step size.

Reimplemented from GUIEngine::ModalDialog.

◆ processEvent()

GUIEngine::EventPropagation VoteDialog::processEvent ( const std::string &  event)
virtual

Callback when a user event is triggered.

Parameters
eventInformation about the event that was triggered.

Reimplemented from GUIEngine::ModalDialog.

◆ sendVote()

void VoteDialog::sendVote ( )
private

A request to the server, to perform a vote on an addon.

Parameters
ratingthe voted rating.

A vote request. The callback will update the addon manager with the new average. The VoteDialog polls this request till it is finished to inform the user about the new average.

Member Data Documentation

◆ m_addon_id

const std::string VoteDialog::m_addon_id
private

Stores the id of the addon being voted on.

◆ m_cancel_widget

GUIEngine::IconButtonWidget* VoteDialog::m_cancel_widget
private

Pointer to the cancel button.

◆ m_fetch_vote_request

std::shared_ptr<Online::XMLRequest> VoteDialog::m_fetch_vote_request
private

The request to fetch the current vote, which is submitted immediately when this dialog is opened.

◆ m_info_widget

GUIEngine::LabelWidget* VoteDialog::m_info_widget
private

Pointer to the info widget of this dialog.

◆ m_options_widget

GUIEngine::RibbonWidget* VoteDialog::m_options_widget
private

Pointer to the options widget, which contains the canel button.

◆ m_perform_vote_request

std::shared_ptr<Online::XMLRequest> VoteDialog::m_perform_vote_request
private

The request to perform a vote.

◆ m_self_destroy

bool VoteDialog::m_self_destroy
private

True if the dialog should be removed (which needs to be done in the update call each frame).


The documentation for this class was generated from the following files: