2 * This file is part of NumptyPhysics
3 * Copyright (C) 2008 Tim Edmonds
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 3 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
32 virtual void add( Widget
* w
)=0;
33 virtual void remove( Widget
* w
)=0;
40 virtual bool isDirty() {return false;}
41 virtual Rect
dirtyArea() {return Rect();};
42 virtual void onTick( int tick
) {}
43 virtual void draw( Canvas
& screen
, const Rect
& area
) {};
44 virtual bool handleEvent( SDL_Event
& ev
) {return false;};
45 virtual Window
* getWindow() {return NULL
;}
46 void setParent(WidgetParent
* p
) {m_parent
= p
;}
47 WidgetParent
* parent() { return m_parent
; }
49 WidgetParent
* m_parent
;
53 class Label
: public Widget
57 void text( std::string
& s
);
63 class Button
: public Widget
69 class Container
: public Widget
, public WidgetParent
74 virtual bool isDirty();
75 virtual Rect
dirtyArea();
76 virtual void onTick( int tick
);
77 virtual void draw( Canvas
& screen
, const Rect
& area
);
78 virtual bool handleEvent( SDL_Event
& ev
);
80 void add( Widget
* w
);
81 virtual void remove( Widget
* w
);
85 class Layer
: public Widget
88 virtual void onShow() {}
89 virtual void onHide() {}