2
* Copyright (C) 2003,2004 Daniel Heck, Ralf Westram
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18
* $Id: help.cc,v 1.5 2004/05/22 13:04:31 dheck Exp $
28
using namespace enigma;
32
struct HelpMenuConfig {
33
int x0, x1; // x coordinates of first and second column
34
int y0; // y coordinate
38
HelpMenuConfig (int xoffset) {
43
fontname = "menufont";
47
class HelpMenu : public gui::Menu {
49
HelpMenu (const char **helptext_, int xoffset);
51
bool on_event (const SDL_Event &e);
52
void on_action (gui::Widget *w);
53
void draw_background (px::GC &gc);
55
const char **helptext;
60
/* -------------------- HelpMenu -------------------- */
62
HelpMenu::HelpMenu (const char **helptext_, int xoffset_) :
64
ok (new gui::StaticTextButton("Ok", this)),
67
add(ok, Rect(640-170,480-60,150,40));
70
bool HelpMenu::on_event (const SDL_Event &e)
72
if (e.type == SDL_MOUSEBUTTONDOWN && e.button.button == SDL_BUTTON_RIGHT)
80
void HelpMenu::on_action (gui::Widget *w)
86
void HelpMenu::draw_background (px::GC &gc)
88
blit(gc, 0,0, enigma::GetImage("menu_bg", ".jpg"));
89
Font *f = enigma::GetFont(cfg.fontname.c_str());
92
for (int i = 0; helptext[i]; i += 2)
94
f->render (gc, cfg.x0, y, _(helptext[i]));
95
f->render (gc, cfg.x1, y, _(helptext[i+1]));
100
/* -------------------- Functions -------------------- */
102
void enigma::displayHelp(const char **helptext, int xoffset)
104
FX_Fade (video::FADEOUT);
105
HelpMenu menu(helptext, xoffset);
107
FX_Fade (video::FADEIN);