Mercurial > fife-parpg
changeset 238:d76169461729
Removed HelpText from C++.
Moved helptext to base widget. Now all widgets may have a helptext.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 24 Mar 2009 16:06:02 +0000 |
parents | 45c63a621366 |
children | 3804348fe3fb |
files | engine/core/gui/widgets/togglebutton.cpp engine/core/gui/widgets/togglebutton.h engine/core/gui/widgets/twobutton.cpp engine/core/gui/widgets/twobutton.h engine/core/gui/widgets/widgets.i engine/extensions/pychan/widgets.py |
diffstat | 6 files changed, 7 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/core/gui/widgets/togglebutton.cpp Tue Mar 24 16:04:49 2009 +0000 +++ b/engine/core/gui/widgets/togglebutton.cpp Tue Mar 24 16:06:02 2009 +0000 @@ -51,7 +51,6 @@ m_hoverImage(hover_file), x_downoffset(0), y_downoffset(0), - m_helptext(""), m_group(group) { m_hoverImage = hover_file; @@ -255,13 +254,6 @@ return y_downoffset; } - void ToggleButton::setHelpText(const std::string& txt) { - m_helptext = txt; - } - - const std::string& ToggleButton::getHelpText() { - return m_helptext; - } } /* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */
--- a/engine/core/gui/widgets/togglebutton.h Tue Mar 24 16:04:49 2009 +0000 +++ b/engine/core/gui/widgets/togglebutton.h Tue Mar 24 16:06:02 2009 +0000 @@ -123,24 +123,6 @@ int getDownYOffset() const; /** - * Sets the help text for the button - * - * @param txt The help text - * - * @see getHelpText - */ - void setHelpText(const std::string& txt); - - /** - * Gets the help text for the button - * - * @return The help text - * - * @see setHelpText - */ - const std::string& getHelpText(); - - /** * Checks if the radio button is selected. * * @return True if the radio button is selecte, false otherwise. @@ -200,9 +182,6 @@ int x_downoffset; int y_downoffset; - // Help text for the button - std::string m_helptext; - /** * Whether the button is toggled or not. */
--- a/engine/core/gui/widgets/twobutton.cpp Tue Mar 24 16:04:49 2009 +0000 +++ b/engine/core/gui/widgets/twobutton.cpp Tue Mar 24 16:06:02 2009 +0000 @@ -38,8 +38,7 @@ m_downImage(down_file), m_hoverImage(hover_file), x_downoffset(0), - y_downoffset(0), - m_helptext("") { + y_downoffset(0) { m_hoverImage = hover_file; setFrameSize(0); adjustSize();
--- a/engine/core/gui/widgets/twobutton.h Tue Mar 24 16:04:49 2009 +0000 +++ b/engine/core/gui/widgets/twobutton.h Tue Mar 24 16:06:02 2009 +0000 @@ -52,16 +52,12 @@ int getDownXOffset() { return x_downoffset; } int getDownYOffset() { return y_downoffset; } - void setHelpText(const std::string& txt) { m_helptext = txt; } - const std::string& getHelpText() { return m_helptext; } - private: Image *m_upImage; Image *m_downImage; Image *m_hoverImage; int x_downoffset; int y_downoffset; - std::string m_helptext; }; }
--- a/engine/core/gui/widgets/widgets.i Tue Mar 24 16:04:49 2009 +0000 +++ b/engine/core/gui/widgets/widgets.i Tue Mar 24 16:06:02 2009 +0000 @@ -198,8 +198,6 @@ void setDownOffset(int x, int y); int getDownXOffset(); int getDownYOffset(); - void setHelpText(const std::string& txt); - const std::string& getHelpText(); }; %feature("notabstract") ToggleButton; @@ -221,9 +219,6 @@ void setToggled(bool toggled); void setGroup(const std::string &group); const std::string &getGroup() const; - - void setHelpText(const std::string& txt); - const std::string& getHelpText(); }; %feature("notabstract") ScrollArea;
--- a/engine/extensions/pychan/widgets.py Tue Mar 24 16:04:49 2009 +0000 +++ b/engine/extensions/pychan/widgets.py Tue Mar 24 16:06:02 2009 +0000 @@ -73,6 +73,7 @@ - foreground_color: Color - selection_color: Color - font: String: This should identify a font that was loaded via L{loadFonts} before. + - helptext: Unicode: Text which can be used for e.g. tooltips. - border_size: Integer: The size of the border in pixels. - position_technique: This can be either "automatic" or "explicit" - only L{Window} has this set to "automatic" which results in new windows being centered on screen (for now). @@ -102,6 +103,7 @@ PointAttr('min_size'), PointAttr('size'), PointAttr('max_size'), ColorAttr('base_color'),ColorAttr('background_color'),ColorAttr('foreground_color'),ColorAttr('selection_color'), Attr('style'), Attr('font'),IntAttr('border_size'),Attr('position_technique'), + UnicodeAttr('helptext') ] DEFAULT_NAME = '__unnamed__' @@ -113,6 +115,7 @@ def __init__(self,parent = None, name = DEFAULT_NAME, size = (-1,-1), min_size=(0,0), max_size=(5000,5000), + helptext=u"", style = None, **kwargs): assert( hasattr(self,'real_widget') ) @@ -139,6 +142,7 @@ style = parent.style self.style = style or "default" + self.helptext = helptext # Not needed as attrib assignment will trigger manager.stylize call #manager.stylize(self,self.style) @@ -1165,7 +1169,7 @@ - hover_image: String: The source location of the Image for the B{unpressed hovered} state. """ - ATTRIBUTES = BasicTextWidget.ATTRIBUTES + [Attr('up_image'),Attr('down_image'),PointAttr('offset'),UnicodeAttr('helptext'),Attr('hover_image')] + ATTRIBUTES = BasicTextWidget.ATTRIBUTES + [Attr('up_image'),Attr('down_image'),PointAttr('offset'),Attr('hover_image')] def __init__(self,up_image="",down_image="",hover_image="",offset=(0,0),**kwargs): self.real_widget = fife.TwoButton() @@ -1240,12 +1244,6 @@ return (self.real_widget.getDownXOffset(), self.real_widget.getDownYOffset()) offset = property(_getOffset,_setOffset) - def _setHelpText(self, txt): - self.real_widget.setHelpText(txt) - def _getHelpText(self): - return self.real_widget.getHelpText() - helptext = property(_getHelpText,_setHelpText) - def resizeToContent(self): self.height = max(self._upimage.getHeight(),self._downimage.getHeight(),self._hoverimage.getHeight()) + self.margins[1]*2 self.width = max(self._upimage.getWidth(),self._downimage.getWidth(),self._hoverimage.getWidth()) + self.margins[1]*2 @@ -1265,8 +1263,7 @@ ATTRIBUTES = BasicTextWidget.ATTRIBUTES + [ Attr('up_image'),Attr('down_image'),Attr('hover_image'), - PointAttr('offset'), - UnicodeAttr('helptext'),Attr('group') + PointAttr('offset'),Attr('group') ] def __init__(self,up_image="",down_image="",hover_image="",offset=(0,0),group="",**kwargs): @@ -1333,12 +1330,6 @@ return (self.real_widget.getDownXOffset(), self.real_widget.getDownYOffset()) offset = property(_getOffset,_setOffset) - def _setHelpText(self, txt): - self.real_widget.setHelpText(_text2gui(txt)) - def _getHelpText(self): - return _gui2text(self.real_widget.getHelpText()) - helptext = property(_getHelpText,_setHelpText) - def resizeToContent(self): self.height = max(self._upimage.getHeight(),self._downimage.getHeight(),self._hoverimage.getHeight()) + self.margins[1]*2 self.width = max(self._upimage.getWidth(),self._downimage.getWidth(),self._hoverimage.getWidth()) + self.margins[1]*2