ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
list.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) by Fred Klaus *
3  * development@fkweb.de *
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 SDLTK_LIST_H
21 #define SDLTK_LIST_H
22 
23 #include "listitem.h"
24 #include "gui.h"
25 #include "clock.h"
26 #include <list>
27 
28 namespace sdltk
29 {
30 
31  class Color;
32  class Point;
33 
35  class List : public Widget, public std::list<ListItem*>
36  {
37 
38  public:
40  List(Gui * gui) : mGui(gui) {init();}
42  virtual ~List() ROLAND_DEFAULT
43 
45  void init();
46 
48  virtual void onMouseButton(SDL_MouseButtonEvent * event);
49 
51  virtual bool onKeyboard(SDL_KeyboardEvent * event);
52 
54  virtual bool onUser(SDL_UserEvent * event);
55 
57  ListItem * selected() const {return (*mSelected);}
58 
60  void add(ListItem * item);
62  void reposition(Sint16 val);
63 
65  void draw();
66 
67  protected:
68  Sint8 mSpeed;
69  Uint8 mMotion;
70  Uint16 mPosH;
71  Gui * mGui;
74  std::list<ListItem*>::iterator mSelected;
75  };
76 
77 } // sdltk
78 
79 #endif // SDLTK_LIST_H
virtual bool onKeyboard(SDL_KeyboardEvent *event)
This member catches keyboard events.
Definition: list.cpp:68
Gui * mGui
Definition: list.h:71
author Fred Klaus development@fkweb.de
Definition: gui.h:34
void init()
Definition: roland.cpp:97
virtual void onMouseButton(SDL_MouseButtonEvent *event)
This member catches mousebutton events.
Definition: list.cpp:47
virtual bool onUser(SDL_UserEvent *event)
Tis member catches user events.
Definition: list.cpp:130
void reposition(Sint16 val)
Manages the scrolling.
Definition: list.cpp:179
Represents an item which can be hold by a List.
Definition: listitem.h:31
Clock mClock
Definition: list.h:72
void add(ListItem *item)
Adds a ListItem to the List.
Definition: list.cpp:161
Uint8 mMotion
Definition: list.h:69
Sint8 mSpeed
Definition: list.h:68
Time measurement in ms.
Definition: clock.h:29
List(Gui *gui)
Some initialization.
Definition: list.h:40
Uint16 mPosH
Definition: list.h:70
sdltk::Gui * gui
Definition: roland.cpp:79
Color mTmpColor
Definition: list.h:73
std::list< ListItem * >::iterator mSelected
Definition: list.h:74
#define ROLAND_DEFAULT
Definition: compspec.h:46
Baseclass for all Widgets.
Definition: widget.h:37
virtual ~List() ROLAND_DEFAULT void init()
Deafault destructor.
RGBA Color Type.
Definition: color.h:30
void draw()
Draw the List and visible elements.
Definition: list.cpp:236
A list that can hold several ListItem s.
Definition: list.h:35
the SDL based Stuff
Definition: audio.cpp:22
ListItem * selected() const
Returns a pointer to the selected Item.
Definition: list.h:57