1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2025-04-21 12:27:27 +03:00

Make Link and IconButton inherit from Button privately

Each part of the code deals with either Links or IconButtons, but
not both: the base class is only used to share implementation and
not interface. Make this explicit by doing private inheritance.
This commit is contained in:
Maarten ter Huurne
2013-08-13 01:47:02 +02:00
parent 06ee35bb7a
commit 6378fcfcd7
6 changed files with 36 additions and 55 deletions

View File

@@ -8,25 +8,27 @@
class GMenu2X;
class Surface;
class IconButton : public Button {
class IconButton : private Button {
public:
IconButton(GMenu2X *gmenu2x, Touchscreen &ts,
const std::string &icon, const std::string &label = "");
virtual ~IconButton() {};
virtual void paint();
virtual bool paintHover();
virtual void setPosition(int x, int y);
void setAction(function_t action);
// Expose some Button functionality:
SDL_Rect getRect() { return Button::getRect(); }
bool handleTS() { return Button::handleTS(); }
private:
void updateSurfaces();
void recalcSize();
GMenu2X *gmenu2x;
std::string icon, label;
void recalcSize();
SDL_Rect iconRect, labelRect;
Surface *iconSurface;