Root/src/link.h

1/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20#ifndef LINK_H
21#define LINK_H
22
23#include <string>
24#include <iostream>
25
26#include "button.h"
27#include "surface.h"
28
29using std::string;
30
31class GMenu2X;
32
33/**
34Base class that represents a link on screen.
35
36    @author Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
37*/
38class Link : public Button {
39private:
40    uint iconX, padding;
41
42protected:
43    GMenu2X *gmenu2x;
44    bool edited;
45    string title, description, icon, iconPath;
46
47    Surface *iconSurface;
48    Surface *icon_hover;
49
50    void recalcCoordinates();
51    void updateSurfaces();
52
53public:
54    Link(GMenu2X *gmenu2x);
55    virtual ~Link() {};
56
57    virtual void paint();
58    virtual bool paintHover();
59
60    void setSize(int w, int h);
61    void setPosition(int x, int y);
62
63    const string &getTitle();
64    void setTitle(const string &title);
65    const string &getDescription();
66    void setDescription(const string &description);
67    const string &getIcon();
68    void setIcon(const string &icon);
69    virtual const string &searchIcon();
70    const string &getIconPath();
71    void setIconPath(const string &icon);
72
73    virtual void run();
74};
75
76#endif
77

Archive Download this file



interactive