Use OVERRIDE macro in more member functions (onProcessMessage, etc.).

This commit is contained in:
David Capello 2011-03-27 20:42:16 -03:00
parent 682e7152b7
commit df01255b51
29 changed files with 152 additions and 127 deletions

View File

@ -22,6 +22,7 @@
#include "app/color.h"
#include "app/color_utils.h"
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "commands/command.h"
#include "commands/params.h"
#include "console.h"
@ -67,7 +68,7 @@ public:
void setColor(const Color& color);
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onExit();
void onCloseFrame();

View File

@ -19,6 +19,7 @@
#ifndef COMMANDS_FILTERS_COLOR_CURVE_EDITOR_H_INCLUDED
#define COMMANDS_FILTERS_COLOR_CURVE_EDITOR_H_INCLUDED
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "gfx/point.h"
#include "gui/widget.h"
@ -35,7 +36,7 @@ public:
Signal0<void> CurveEditorChange;
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
gfx::Point* getClosestPoint(int x, int y, int** edit_x, int** edit_y);

View File

@ -19,6 +19,7 @@
#ifndef COMMANDS_FILTERS_FILTER_PREVIEW_H_INCLUDED
#define COMMANDS_FILTERS_FILTER_PREVIEW_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/widget.h"
class FilterManagerImpl;
@ -35,7 +36,7 @@ public:
FilterManagerImpl* getFilterManager() const;
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
FilterManagerImpl* m_filterMgr;

View File

@ -7,19 +7,9 @@
#ifndef GUI_BASE_H_INCLUDED
#define GUI_BASE_H_INCLUDED
/* get the system's definition of NULL */
// Get the system's definition of NULL
#include <stddef.h>
/* get bool, false and true definitions for C */
#ifndef __cplusplus
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#undef bool
#define bool unsigned char
#endif
#ifndef TRUE
#define TRUE (-1)
#define FALSE (0)
@ -51,7 +41,7 @@ class Frame;
class Theme;
class Widget;
/* alignment */
// Alignment.
#define JI_HORIZONTAL 0x0001
#define JI_VERTICAL 0x0002
#define JI_LEFT 0x0004
@ -63,27 +53,27 @@ class Widget;
#define JI_HOMOGENEOUS 0x0100
#define JI_WORDWRAP 0x0200
/* widget flags */
#define JI_HIDDEN 0x0001 /* is hidden (not visible, not clickeable) */
#define JI_SELECTED 0x0002 /* is selected */
#define JI_DISABLED 0x0004 /* is disabled (not usable) */
#define JI_HASFOCUS 0x0008 /* has the input focus */
#define JI_HASMOUSE 0x0010 /* has the mouse */
#define JI_HASCAPTURE 0x0020 /* captured the mouse */
#define JI_FOCUSREST 0x0040 /* want the focus (is a rest for focus) */
#define JI_MAGNETIC 0x0080 /* attract the focus */
#define JI_EXPANSIVE 0x0100 /* is expansive (want more space) */
#define JI_DECORATIVE 0x0200 /* to decorate windows */
#define JI_INITIALIZED 0x0400 /* the widget was already initialized by a theme */
#define JI_NOTEXT 0x0800 /* the widget does not have text */
#define JI_DIRTY 0x1000 /* the widget (or one child) is dirty (update_region != empty) */
// Widget flags.
#define JI_HIDDEN 0x0001 // Is hidden (not visible, not clickeable).
#define JI_SELECTED 0x0002 // Is selected.
#define JI_DISABLED 0x0004 // Is disabled (not usable).
#define JI_HASFOCUS 0x0008 // Has the input focus.
#define JI_HASMOUSE 0x0010 // Has the mouse.
#define JI_HASCAPTURE 0x0020 // Captured the mouse .
#define JI_FOCUSREST 0x0040 // Want the focus (is a rest for focus).
#define JI_MAGNETIC 0x0080 // Attract the focus.
#define JI_EXPANSIVE 0x0100 // Is expansive (want more space).
#define JI_DECORATIVE 0x0200 // To decorate windows.
#define JI_INITIALIZED 0x0400 // The widget was already initialized by a theme.
#define JI_NOTEXT 0x0800 // The widget does not have text.
#define JI_DIRTY 0x1000 // The widget (or one child) is dirty (update_region != empty).
/* widget types */
// Widget types.
enum {
/* undefined (or anonymous) widget type */
// Undefined (or anonymous) widget type.
JI_WIDGET,
/* known widgets */
// Known widgets.
JI_BOX,
JI_BUTTON,
JI_CHECK,
@ -110,51 +100,51 @@ enum {
JI_VIEW_VIEWPORT,
JI_FRAME,
/* user widgets */
// User widgets.
JI_USER_WIDGET,
};
/* Jinete Message types */
// JINETE Message types.
enum {
/* general messages */
JM_OPEN, /* windows is open */
JM_CLOSE, /* windows is closed */
JM_DESTROY, /* widget is destroyed */
JM_DRAW, /* widget needs be repainted */
JM_SIGNAL, /* signal from some widget */
JM_TIMER, /* a timer timeout */
JM_REQSIZE, /* request size */
JM_SETPOS, /* set position */
JM_WINMOVE, /* window movement */
JM_DEFERREDFREE, /* deferred jwidget_free call */
JM_DIRTYCHILDREN, /* dirty children */
JM_QUEUEPROCESSING, /* only sent to manager which indicate
the last message in the queue */
// General messages.
JM_OPEN, // Windows is open.
JM_CLOSE, // Windows is closed.
JM_DESTROY, // Widget is destroyed.
JM_DRAW, // Widget needs be repainted.
JM_SIGNAL, // Signal from some widget.
JM_TIMER, // A timer timeout.
JM_REQSIZE, // Request size.
JM_SETPOS, // Set position.
JM_WINMOVE, // Window movement.
JM_DEFERREDFREE, // Deferred jwidget_free call.
JM_DIRTYCHILDREN, // Dirty children.
JM_QUEUEPROCESSING, // Only sent to manager which indicate
// the last message in the queue.
/* keyboard related messages */
JM_KEYPRESSED, /* when a any key is pressed */
JM_KEYRELEASED, /* when a any key is released */
JM_FOCUSENTER, /* widget gets the focus */
JM_FOCUSLEAVE, /* widget losts the focus */
// Keyboard related messages.
JM_KEYPRESSED, // When a any key is pressed.
JM_KEYRELEASED, // When a any key is released.
JM_FOCUSENTER, // Widget gets the focus.
JM_FOCUSLEAVE, // Widget losts the focus.
/* mouse related messages */
JM_BUTTONPRESSED, /* user makes click inside a widget */
JM_BUTTONRELEASED, /* user releases mouse button in a widget */
JM_DOUBLECLICK, /* user makes double click in some widget */
JM_MOUSEENTER, /* a widget gets mouse pointer */
JM_MOUSELEAVE, /* a widget losts mouse pointer */
JM_MOTION, /* user moves the mouse on some widget */
JM_SETCURSOR, /* a widget needs to setup the mouse cursor */
JM_WHEEL, /* user moves the wheel */
// Mouse related messages.
JM_BUTTONPRESSED, // User makes click inside a widget.
JM_BUTTONRELEASED, // User releases mouse button in a widget.
JM_DOUBLECLICK, // User makes double click in some widget.
JM_MOUSEENTER, // A widget gets mouse pointer.
JM_MOUSELEAVE, // A widget losts mouse pointer.
JM_MOTION, // User moves the mouse on some widget.
JM_SETCURSOR, // A widget needs to setup the mouse cursor.
JM_WHEEL, // User moves the wheel.
/* XXX drag'n'drop operation? */
/* JM_DND_, */
// xxx drag'n'drop operation?.
// JM_DND_
/* other messages */
// Other messages.
JM_REGISTERED_MESSAGES
};
/* signals */
// Signals.
enum {
// Generic signals
JI_SIGNAL_ENABLE,
@ -185,9 +175,9 @@ enum {
JI_SIGNAL_WINDOW_RESIZE,
};
/* flags for jwidget_get_drawable_region */
#define JI_GDR_CUTTOPWINDOWS 1 /* cut areas where are windows on top */
#define JI_GDR_USECHILDAREA 2 /* use areas where are children */
// Flags for jwidget_get_drawable_region.
#define JI_GDR_CUTTOPWINDOWS 1 // Cut areas where are windows on top.
#define JI_GDR_USECHILDAREA 2 // Use areas where are children.
typedef unsigned int JID;
@ -218,4 +208,4 @@ public:
~Jinete();
};
#endif
#endif // GUI_BASE_H_INCLUDED

View File

@ -7,6 +7,7 @@
#ifndef GUI_BOX_H_INCLUDED
#define GUI_BOX_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/widget.h"
class Box : public Widget
@ -16,9 +17,9 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
private:
void box_set_position(JRect rect);

View File

@ -7,8 +7,10 @@
#ifndef GUI_BUTTON_H_INCLUDED
#define GUI_BUTTON_H_INCLUDED
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "gui/widget.h"
#include <vector>
struct BITMAP;
@ -53,9 +55,9 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
// New events
virtual void onClick(Event& ev);
@ -99,7 +101,7 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
int m_radioGroup;

View File

@ -6,12 +6,13 @@
#include "config.h"
#include <allegro.h>
#include "base/compiler_specific.h"
#include "gfx/size.h"
#include "gui/gui.h"
#include "gui/preferred_size_event.h"
#include <allegro.h>
using namespace gfx;
class ComboBoxButton : public Button
@ -19,7 +20,7 @@ class ComboBoxButton : public Button
public:
ComboBoxButton() : Button("") { }
void onPaint(PaintEvent& ev)
void onPaint(PaintEvent& ev) OVERRIDE
{
getTheme()->paintComboBoxButton(ev);
}

View File

@ -7,9 +7,11 @@
#ifndef GUI_COMBOBOX_H_INCLUDED
#define GUI_COMBOBOX_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/widget.h"
#include <vector>
#include <string>
#include <vector>
class Button;
class Entry;
@ -55,8 +57,8 @@ public:
JRect getListBoxPos();
protected:
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
private:
void onButtonClick(Event& ev);

View File

@ -7,6 +7,7 @@
#ifndef GUI_CUSTOM_LABEL_H_INCLUDED
#define GUI_CUSTOM_LABEL_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/label.h"
class CustomLabel : public Label
@ -15,7 +16,7 @@ public:
CustomLabel(const char *text);
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
};

View File

@ -7,6 +7,7 @@
#ifndef GUI_ENTRY_H_INCLUDED
#define GUI_ENTRY_H_INCLUDED
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "gui/widget.h"
@ -37,9 +38,9 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
// New Events
void onEntryChange();

View File

@ -7,6 +7,7 @@
#ifndef GUI_FRAME_H_INCLUDED
#define GUI_FRAME_H_INCLUDED
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "gui/widget.h"
@ -55,9 +56,9 @@ public:
Signal1<void, CloseEvent&> Close;
protected:
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
private:
void window_set_position(JRect rect);

View File

@ -7,7 +7,9 @@
#ifndef GUI_GRID_H_INCLUDED
#define GUI_GRID_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/widget.h"
#include <vector>
class Grid : public Widget
@ -20,9 +22,9 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
private:
struct Cell {

View File

@ -7,6 +7,7 @@
#ifndef GUI_IMAGE_VIEW_H_INCLUDED
#define GUI_IMAGE_VIEW_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/widget.h"
struct BITMAP;
@ -17,8 +18,8 @@ public:
ImageView(BITMAP* bmp, int align);
protected:
bool onProcessMessage(JMessage msg);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
private:
BITMAP* m_bmp;

View File

@ -7,6 +7,7 @@
#ifndef GUI_LABEL_H_INCLUDED
#define GUI_LABEL_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/widget.h"
class Label : public Widget
@ -18,8 +19,8 @@ public:
void setTextColor(int color);
protected:
bool onProcessMessage(JMessage msg);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
private:
int m_textColor;

View File

@ -7,8 +7,10 @@
#ifndef GUI_LINK_LABEL_H_INCLUDED
#define GUI_LINK_LABEL_H_INCLUDED
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "gui/custom_label.h"
#include <string>
class LinkLabel : public CustomLabel
@ -22,8 +24,8 @@ public:
Signal0<void> Click;
protected:
bool onProcessMessage(JMessage msg);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
};

View File

@ -7,6 +7,7 @@
#ifndef GUI_POPUP_FRAME_H_INCLUDED
#define GUI_POPUP_FRAME_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/frame.h"
class PopupFrame : public Frame
@ -18,9 +19,9 @@ public:
void setHotRegion(JRegion region);
protected:
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
private:
bool m_close_on_buttonpressed;

View File

@ -7,6 +7,7 @@
#ifndef GUI_SCROLL_BAR_H_INCLUDED
#define GUI_SCROLL_BAR_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/widget.h"
class ScrollBar : public Widget
@ -25,7 +26,7 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
void getScrollBarInfo(int* _pos, int* _len, int* _bar_size, int* _viewport_size);

View File

@ -7,6 +7,7 @@
#ifndef GUI_SLIDER_H_INCLUDED
#define GUI_SLIDER_H_INCLUDED
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "gui/widget.h"
@ -30,9 +31,9 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
// New events
virtual void onChange();

View File

@ -7,6 +7,7 @@
#ifndef GUI_TOOLTIPS_H_INCLUDED
#define GUI_TOOLTIPS_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/base.h"
#include "gui/frame.h"
@ -22,9 +23,9 @@ public:
void setArrowAlign(int arrowAlign);
protected:
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
private:
bool m_close_on_buttonpressed;

View File

@ -7,6 +7,7 @@
#ifndef GUI_VIEW_H_INCLUDED
#define GUI_VIEW_H_INCLUDED
#include "base/compiler_specific.h"
#include "gfx/point.h"
#include "gfx/size.h"
#include "gui/scroll_bar.h"
@ -45,7 +46,7 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
static void displaceWidgets(Widget* widget, int x, int y);

View File

@ -7,6 +7,7 @@
#ifndef GUI_VIEWPORT_H_INCLUDED
#define GUI_VIEWPORT_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/widget.h"
class Viewport : public Widget
@ -18,7 +19,7 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
void set_position(JRect rect);

View File

@ -20,6 +20,7 @@
#define WIDGETS_COLOR_BAR_H_INCLUDED
#include "app/color.h"
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "gui/box.h"
#include "gui/button.h"
@ -62,7 +63,7 @@ private:
public:
ScrollableView();
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
};
Button m_paletteButton;

View File

@ -20,6 +20,7 @@
#define WIDGETS_COLOR_BUTTON_H_INCLUDED
#include "app/color.h"
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "gui/button.h"
@ -42,9 +43,9 @@ public:
protected:
// Events
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
void onPaint(PaintEvent& ev);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
private:
void openSelectorDialog();

View File

@ -20,6 +20,7 @@
#define WIDGETS_EDITOR_H_INCLUDED
#include "app/color.h"
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "document.h"
#include "gui/base.h"
@ -205,7 +206,7 @@ public:
int editor_click_cancel();
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
void onCurrentToolChange();
private:

View File

@ -19,11 +19,12 @@
#ifndef WIDGETS_PALETTE_VIEW_H_INCLUDED
#define WIDGETS_PALETTE_VIEW_H_INCLUDED
#include <allegro/color.h>
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "gui/widget.h"
#include <allegro/color.h>
// TODO use some JI_SIGNAL_USER
#define SIGNAL_PALETTE_EDITOR_CHANGE 0x10005
@ -59,7 +60,7 @@ public:
Signal1<void, int> IndexChange;
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
void request_size(int* w, int* h);

View File

@ -22,6 +22,7 @@
#include <vector>
#include "app/color.h"
#include "base/compiler_specific.h"
#include "gui/base.h"
#include "gui/widget.h"
@ -72,7 +73,7 @@ public:
void removeProgress(Progress* progress);
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
void onCurrentToolChange();

View File

@ -19,7 +19,9 @@
#ifndef WIDGETS_TABS_H_INCLUDED
#define WIDGETS_TABS_H_INCLUDED
#include "base/compiler_specific.h"
#include "gui/widget.h"
#include <vector>
class Tabs;
@ -83,7 +85,7 @@ public:
void stopScrolling();
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
void startAni(Ani ani);

View File

@ -18,12 +18,11 @@
#include "config.h"
#include <allegro.h>
#include <map>
#include <string>
#include "widgets/toolbar.h"
#include "app.h"
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/signal.h"
#include "commands/command.h"
#include "commands/commands.h"
@ -36,7 +35,10 @@
#include "ui_context.h"
#include "widgets/groupbut.h"
#include "widgets/statebar.h"
#include "widgets/toolbar.h"
#include <allegro.h>
#include <map>
#include <string>
using namespace gfx;
@ -75,7 +77,7 @@ public:
void closeTipWindow();
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
int getToolGroupIndex(ToolGroup* group);
@ -104,7 +106,7 @@ public:
Signal1<void, Tool*> ToolSelected;
protected:
bool onProcessMessage(JMessage msg);
bool onProcessMessage(JMessage msg) OVERRIDE;
private:
Rect getToolBounds(int index);

View File

@ -21,6 +21,8 @@
#include "gui/base.h"
class Tool;
JWidget toolbar_new();
bool toolbar_is_tool_visible(JWidget toolbar, Tool* tool);