Code cleanup.

Removing usage of EDE_PANEL_APPLET_CLASS since there is no much usage of it. Also, marked all applet widgets as EDE_PANEL_WIDGET_TYPE so panel knows it is widget.

Added license info in some code, but whole ede2 tree needs to be revised for that.
This commit is contained in:
Sanel Zukan 2012-05-30 10:23:27 +00:00
parent fde927b627
commit 39ffa8406b
13 changed files with 56 additions and 16 deletions

View File

@ -26,6 +26,9 @@ class Fl_Widget;
/* stored version in each applet shared library in case interface get changed */
#define EDE_PANEL_APPLET_INTERFACE_VERSION 0x01
/* all panel widgets are marked with this type (make sure it is greater than FL_DOUBLE_WINDOW */
#define EDE_PANEL_WIDGET_TYPE 0xFA
/*
* Options assigned to each applet: how it will be resizable (horizontally or vertically)
* and how it will be aligned. Each applet is by default aligned left without resizing ability.
@ -58,10 +61,11 @@ typedef float (*applet_version_t)(void);
* The main macro each applet library must implement. It will assign apropriate values
* so applet loader can use them to load applet class with some common metadata.
*/
#define EDE_PANEL_APPLET_EXPORT(klass, aoptions, aname, aversion, aicon, aauthor) \
extern "C" Fl_Widget *ede_panel_applet_create(void) { \
return new klass; \
klass *k = new klass; \
k->type(EDE_PANEL_WIDGET_TYPE); \
return k; \
} \
\
extern "C" void ede_panel_applet_destroy(Fl_Widget *w) { \
@ -88,8 +92,4 @@ extern "C" int ede_panel_applet_get_iface_version(void) {
return EDE_PANEL_APPLET_INTERFACE_VERSION; \
}
/* each applet must use this so applets can be easily extended in the future */
#define EDE_PANEL_APPLET_CLASS(c, inherits) class c : public inherits
#endif

View File

@ -1,3 +1,23 @@
/*
* $Id$
*
* Copyright (C) 2012 Sanel Zukan
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/fl_draw.H>

View File

@ -1,3 +1,23 @@
/*
* $Id$
*
* Copyright (C) 2012 Sanel Zukan
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __PANEL_H__
#define __PANEL_H__

View File

@ -11,7 +11,7 @@ EDELIB_NS_USING(run_async)
static void clock_refresh(void *o);
EDE_PANEL_APPLET_CLASS(Clock, Fl_Box) {
class Clock : public Fl_Box {
private:
int hour;
char buf[64], tbuf[128];

View File

@ -19,7 +19,7 @@ enum {
IWM_STATES
};
EDE_PANEL_APPLET_CLASS(CPUMonitor, Fl_Box) {
class CPUMonitor : public Fl_Box {
private:
bool m_draw_label;
int m_old_samples;

View File

@ -4,7 +4,7 @@
#include <FL/Fl.H>
#include <stdio.h>
EDE_PANEL_APPLET_CLASS(MyButton, Fl_Button) {
class MyButton : public Fl_Button {
public:
MyButton() : Fl_Button(0, 0, 90, 25, "xxx") {
color(FL_RED);

View File

@ -41,7 +41,7 @@ EDELIB_NS_USING(RES_SYS_ONLY)
static Atom _XA_XKB_RF_NAMES_PROP_ATOM = 0;
EDE_PANEL_APPLET_CLASS(KeyLayout, Fl_Button) {
class KeyLayout : public Fl_Button {
private:
bool should_show_flag;
String path, curr_layout;

View File

@ -4,7 +4,7 @@
#include <FL/Fl_Box.H>
#include "Applet.h"
EDE_PANEL_APPLET_CLASS(MemMonitor, Fl_Box) {
class MemMonitor : public Fl_Box {
private:
int mem_usedp, swap_usedp;

View File

@ -18,7 +18,7 @@ EDELIB_NS_USING(netwm_callback_add)
EDELIB_NS_USING(netwm_callback_remove)
EDELIB_NS_USING(NETWM_CHANGED_CURRENT_WORKSPACE)
EDE_PANEL_APPLET_CLASS(Pager, Fl_Group) {
class Pager : public Fl_Group {
public:
Pager();
~Pager();

View File

@ -14,7 +14,7 @@
EDELIB_NS_USING(run_async)
EDE_PANEL_APPLET_CLASS(QuickLaunch, Fl_Input) {
class QuickLaunch : public Fl_Input {
private:
Fl_Image *img;
int img_x, img_y;

View File

@ -13,7 +13,7 @@ EDELIB_NS_USING(MenuBase)
/* some of this code was ripped from Fl_Menu_Button.cxx */
EDE_PANEL_APPLET_CLASS(StartMenu, MenuBase) {
class StartMenu : public MenuBase {
private:
MenuItem *mcontent;
public:

View File

@ -16,7 +16,7 @@ struct WinInfo {
typedef list<WinInfo> WinList;
typedef list<WinInfo>::iterator WinListIt;
EDE_PANEL_APPLET_CLASS(Tray, Fl_Group) {
class Tray : public Fl_Group {
private:
Atom opcode, message_data;
WinList win_list;

View File

@ -7,7 +7,7 @@
class TaskButton;
class Panel;
EDE_PANEL_APPLET_CLASS(Taskbar, Fl_Group) {
class Taskbar : public Fl_Group {
public:
TaskButton *curr_active, *prev_active;
Panel *panel;