summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2005-06-20 22:43:35 +0000
committerpixel <pixel>2005-06-20 22:43:35 +0000
commitc492bb95a2bb8f739b7c0a061090b9ad4549c975 (patch)
tree5f92707f321c4ec1dc53b48fe81f914481b8b000
parentd2977995ac37d8a2283a871aa0b3f04293d387c2 (diff)
Minor cosmetic changes.
-rw-r--r--include/widgets.h47
-rw-r--r--lib/widgets.cc6
2 files changed, 48 insertions, 5 deletions
diff --git a/include/widgets.h b/include/widgets.h
index 8865f9c..bf1cab1 100644
--- a/include/widgets.h
+++ b/include/widgets.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: widgets.h,v 1.10 2005-03-29 16:37:42 orphis Exp $ */
+/* $Id: widgets.h,v 1.11 2005-06-20 22:43:35 pixel Exp $ */
#ifndef __WIDGETS_H__
#define __WIDGETS_H__
@@ -118,16 +118,28 @@ namespace mogltk {
};
namespace widgets {
+ /*!
+ The drawer is mostly used inside the Root widget, to implement the
+ function to draw the background.
+ */
class drawer : public Base {
public:
virtual void draw(widget *) = 0;
};
+ /*!
+ The action class defines "what happens" when you activate a widget,
+ mostly used in buttons and co.
+ */
class action : public Base {
public:
virtual void do_action(widget *) = 0;
};
+ /*!
+ The Root widget is the father of all the widgets. It'll define the
+ background, as well as the whole tree of the visible widgets onscreen.
+ */
class Root : public widget {
public:
Root(shape *, drawer * = 0);
@@ -137,11 +149,19 @@ namespace mogltk {
drawer * dr;
};
+ /*!
+ The Panel widget is not visible. Its only usage is to hold several
+ other widgets at a relative position.
+ */
class Panel : public widget {
public:
Panel(shape *, widget * father, int x, int y, int w, int h);
};
+ /*!
+ The Button widget will draw a very simple button onscreen, and
+ react to all the necessary mouse events.
+ */
class Button : public widget {
public:
Button(action *, shape *, widget * father, int x, int y, int w, int h, const String & caption);
@@ -154,6 +174,9 @@ namespace mogltk {
action * a;
};
+ /*!
+ The Label widget is only a pure inactive chunk of text.
+ */
class Label : public widget {
public:
Label(shape *, widget * father, int x, int y, int w, int h, const String & caption, const ColorP & color = BLACK);
@@ -163,6 +186,9 @@ namespace mogltk {
ColorP color;
};
+ /*!
+ The SmartBox is a simple window with a title line.
+ */
class SmartBox : public widget {
public:
SmartBox(shape *, widget * father, int x, int y, int w, int h, const String & caption);
@@ -174,17 +200,28 @@ namespace mogltk {
int ox, oy, oax, oay;
};
+ /*!
+ The SmartBoxClose is a SmartBox with a close button at upper-left.
+ */
class SmartBoxClose : public SmartBox {
public:
SmartBoxClose(shape *, widget * father, int x, int y, int w, int h, const String & caption);
};
+ /*!
+ The MsgBox is a SmartBoxClose which holds a text, as well as a
+ 'Ok' button.
+ */
class MsgBox : public SmartBoxClose {
public:
MsgBox(shape *, widget * father, const String & caption, const String & text);
virtual ~MsgBox();
};
+ /*!
+ The Frame widget will act as a visible panel. It'll hold widgets
+ within a visible frame or fence.
+ */
class Frame : public widget {
public:
Frame(shape *, widget * father, int x, int y, int w, int h);
@@ -193,6 +230,10 @@ namespace mogltk {
virtual void draw();
};
+ /*!
+ The ContextMenu is a quite heavy widget which will display a kind of
+ popup menu, holding several buttons or submenus in nodes.
+ */
class ContextMenu : public widget {
public:
ContextMenu(shape *, widget * father, int x, int y);
@@ -240,6 +281,10 @@ namespace mogltk {
bool iin_click();
};
+ /*!
+ The Menu widget will be display ontop of the father widget, and its
+ submenus are simply sont ContextMenus.
+ */
class Menu : public widget {
public:
Menu(shape *, widget * father);
diff --git a/lib/widgets.cc b/lib/widgets.cc
index daec5ea..94cbd73 100644
--- a/lib/widgets.cc
+++ b/lib/widgets.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: widgets.cc,v 1.13 2005-03-29 17:33:34 pixel Exp $ */
+/* $Id: widgets.cc,v 1.14 2005-06-20 22:43:35 pixel Exp $ */
#include <SDL.h>
#include <vector>
@@ -1206,9 +1206,7 @@ void mogltk::widget::mainloop() {
mx = mogltk::engine::mouseX();
my = mogltk::engine::mouseY();
- mogltk::ColorP::Max.A = 50;
- Sprite::Cursor->draw(mx - 6, my - 3, BLACK);
- mogltk::ColorP::Max.A = 255;
+ Sprite::Cursor->draw(mx - 6, my - 3, Color(0, 0, 0, 50));
Sprite::Cursor->draw(mx - 8, my - 6);
if (w = root->find_widget(mx, my)) {