Root/
Source at commit a794a1c created 13 years 10 months ago. By Lars-Peter Clausen, Cache current icon surface. By doing so we safe a huge number of hash map lookups. | |
---|---|
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 | |
29 | using std::string; |
30 | |
31 | class GMenu2X; |
32 | |
33 | /** |
34 | Base class that represents a link on screen. |
35 | |
36 | @author Massimiliano Torromeo <massimiliano.torromeo@gmail.com> |
37 | */ |
38 | class Link : public Button { |
39 | private: |
40 | uint iconX, padding; |
41 | |
42 | protected: |
43 | bool edited; |
44 | string title, description, icon, iconPath; |
45 | |
46 | Surface *iconSurface; |
47 | Surface *icon_hover; |
48 | |
49 | void recalcCoordinates(); |
50 | void updateSurfaces(); |
51 | |
52 | public: |
53 | Link(GMenu2X *gmenu2x); |
54 | virtual ~Link() {}; |
55 | |
56 | virtual void paint(); |
57 | virtual bool paintHover(); |
58 | |
59 | void setSize(int w, int h); |
60 | void setPosition(int x, int y); |
61 | |
62 | string getTitle(); |
63 | void setTitle(string title); |
64 | string getDescription(); |
65 | void setDescription(string description); |
66 | string getIcon(); |
67 | void setIcon(string icon); |
68 | virtual string searchIcon(); |
69 | string getIconPath(); |
70 | void setIconPath(string icon); |
71 | |
72 | virtual void run(); |
73 | }; |
74 | |
75 | #endif |
76 |
Branches:
install_locations
master
opkrun
packages