Root/
Source at commit cdf4ef1 created 9 years 8 months ago. By Zear, Introduced custom application launch text | |
---|---|
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 | |
21 | #ifndef LINK_H |
22 | #define LINK_H |
23 | |
24 | #include "delegate.h" |
25 | |
26 | #include <SDL.h> |
27 | #include <string> |
28 | |
29 | class GMenu2X; |
30 | class Surface; |
31 | class Touchscreen; |
32 | |
33 | |
34 | /** |
35 | Base class that represents a link on screen. |
36 | |
37 | @author Massimiliano Torromeo <massimiliano.torromeo@gmail.com> |
38 | */ |
39 | class Link { |
40 | public: |
41 | Link(GMenu2X *gmenu2x, function_t action); |
42 | virtual ~Link() {}; |
43 | |
44 | bool isPressed(); |
45 | bool handleTS(); |
46 | |
47 | virtual void paint(); |
48 | void paintHover(); |
49 | |
50 | virtual void loadIcon(); |
51 | |
52 | void setSize(int w, int h); |
53 | void setPosition(int x, int y); |
54 | |
55 | const std::string &getTitle(); |
56 | void setTitle(const std::string &title); |
57 | const std::string &getDescription(); |
58 | void setDescription(const std::string &description); |
59 | const std::string &getLaunchMsg(); |
60 | const std::string &getIcon(); |
61 | void setIcon(const std::string &icon); |
62 | const std::string &getIconPath(); |
63 | |
64 | void run(); |
65 | |
66 | protected: |
67 | GMenu2X *gmenu2x; |
68 | bool edited; |
69 | std::string title, description, launchMsg, icon, iconPath; |
70 | |
71 | Surface *iconSurface; |
72 | Surface *icon_hover; |
73 | |
74 | virtual const std::string &searchIcon(); |
75 | void setIconPath(const std::string &icon); |
76 | void updateSurfaces(); |
77 | |
78 | private: |
79 | void recalcCoordinates(); |
80 | |
81 | Touchscreen &ts; |
82 | function_t action; |
83 | |
84 | SDL_Rect rect; |
85 | uint iconX, padding; |
86 | int lastTick; |
87 | }; |
88 | |
89 | #endif |
90 |
Branches:
install_locations
master
opkrun
packages