mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Moving all class declarations to EDE_PANEL_APPLET_CLASS macro.
This change should make base applet code easier to modify without modifying applets itself. This is also a starting point for implementation of better routing netwm messages to applets without adding specific listener to each applet.
This commit is contained in:
parent
9a664ddb92
commit
eb175fa89f
@ -1,10 +1,35 @@
|
||||
/*
|
||||
* $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 __APPLET_H__
|
||||
#define __APPLET_H__
|
||||
|
||||
#define EDE_PANEL_APPLET_INTERFACE_VERSION 0x01
|
||||
|
||||
class Fl_Widget;
|
||||
|
||||
/* stored version in each applet shared library in case interface get changed */
|
||||
#define EDE_PANEL_APPLET_INTERFACE_VERSION 0x01
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
enum {
|
||||
EDE_PANEL_APPLET_OPTION_RESIZABLE_H = (1 << 1),
|
||||
EDE_PANEL_APPLET_OPTION_RESIZABLE_V = (1 << 2),
|
||||
@ -29,7 +54,10 @@ typedef void (*applet_destroy_info_t)(AppletInfo *a);
|
||||
|
||||
typedef float (*applet_version_t)(void);
|
||||
|
||||
/* the main macro each applet library must implement */
|
||||
/*
|
||||
* 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) { \
|
||||
@ -60,4 +88,8 @@ 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
|
||||
|
@ -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 <dlfcn.h>
|
||||
#include <string.h>
|
||||
#include <edelib/Debug.h>
|
||||
|
@ -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 __APPLETMANAGER_H__
|
||||
#define __APPLETMANAGER_H__
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
#define DEFAULT_PANEL_H 35
|
||||
|
||||
#undef MIN
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
#undef MAX
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
#define MAX(x,y) ((x) > (y) ? (x) : (y))
|
||||
|
||||
EDELIB_NS_USING_LIST(10, (list,
|
||||
|
@ -11,7 +11,7 @@ EDELIB_NS_USING(run_async)
|
||||
|
||||
static void clock_refresh(void *o);
|
||||
|
||||
class Clock : public Fl_Box {
|
||||
EDE_PANEL_APPLET_CLASS(Clock, Fl_Box) {
|
||||
private:
|
||||
int hour;
|
||||
char buf[64], tbuf[128];
|
||||
|
@ -41,7 +41,6 @@
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "Applet.h"
|
||||
#include "CpuMonitor.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define __CPUMONITOR_H__
|
||||
|
||||
#include <FL/Fl_Box.H>
|
||||
#include "Applet.h"
|
||||
|
||||
/*
|
||||
#ifdef HAVE_KSTAT_H
|
||||
@ -18,7 +19,7 @@ enum {
|
||||
IWM_STATES
|
||||
};
|
||||
|
||||
class CPUMonitor : public Fl_Box {
|
||||
EDE_PANEL_APPLET_CLASS(CPUMonitor, Fl_Box) {
|
||||
private:
|
||||
bool m_draw_label;
|
||||
int m_old_samples;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <FL/Fl.H>
|
||||
#include <stdio.h>
|
||||
|
||||
class MyButton : public Fl_Button {
|
||||
EDE_PANEL_APPLET_CLASS(MyButton, Fl_Button) {
|
||||
public:
|
||||
MyButton() : Fl_Button(0, 0, 90, 25, "xxx") {
|
||||
color(FL_RED);
|
||||
|
@ -41,7 +41,7 @@ EDELIB_NS_USING(RES_SYS_ONLY)
|
||||
|
||||
static Atom _XA_XKB_RF_NAMES_PROP_ATOM = 0;
|
||||
|
||||
class KeyLayout : public Fl_Button {
|
||||
EDE_PANEL_APPLET_CLASS(KeyLayout, Fl_Button) {
|
||||
private:
|
||||
bool should_show_flag;
|
||||
String path, curr_layout;
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <FL/fl_draw.H>
|
||||
#include <edelib/Color.h>
|
||||
#include <edelib/Missing.h>
|
||||
#include "Applet.h"
|
||||
#include "MemMonitor.h"
|
||||
|
||||
EDELIB_NS_USING(color_rgb_to_fltk)
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define __MEMMONITOR_H__
|
||||
|
||||
#include <FL/Fl_Box.H>
|
||||
#include "Applet.h"
|
||||
|
||||
class MemMonitor : public Fl_Box {
|
||||
EDE_PANEL_APPLET_CLASS(MemMonitor, Fl_Box) {
|
||||
private:
|
||||
int mem_usedp, swap_usedp;
|
||||
|
||||
|
@ -18,7 +18,7 @@ EDELIB_NS_USING(netwm_callback_add)
|
||||
EDELIB_NS_USING(netwm_callback_remove)
|
||||
EDELIB_NS_USING(NETWM_CHANGED_CURRENT_WORKSPACE)
|
||||
|
||||
class Pager : public Fl_Group {
|
||||
EDE_PANEL_APPLET_CLASS(Pager, Fl_Group) {
|
||||
public:
|
||||
Pager();
|
||||
~Pager();
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
EDELIB_NS_USING(run_async)
|
||||
|
||||
class QuickLaunch : public Fl_Input {
|
||||
EDE_PANEL_APPLET_CLASS(QuickLaunch, Fl_Input) {
|
||||
private:
|
||||
Fl_Image *img;
|
||||
int img_x, img_y;
|
||||
|
@ -13,7 +13,7 @@ EDELIB_NS_USING(MenuBase)
|
||||
|
||||
/* some of this code was ripped from Fl_Menu_Button.cxx */
|
||||
|
||||
class StartMenu : public MenuBase {
|
||||
EDE_PANEL_APPLET_CLASS(StartMenu, MenuBase) {
|
||||
private:
|
||||
MenuItem *mcontent;
|
||||
public:
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <edelib/Debug.h>
|
||||
|
||||
#include "Applet.h"
|
||||
#include "Panel.h"
|
||||
#include "Tray.h"
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/x.H>
|
||||
#include <edelib/List.h>
|
||||
#include "Applet.h"
|
||||
|
||||
EDELIB_NS_USING(list)
|
||||
|
||||
@ -15,7 +16,7 @@ struct WinInfo {
|
||||
typedef list<WinInfo> WinList;
|
||||
typedef list<WinInfo>::iterator WinListIt;
|
||||
|
||||
class Tray : public Fl_Group {
|
||||
EDE_PANEL_APPLET_CLASS(Tray, Fl_Group) {
|
||||
private:
|
||||
Atom opcode, message_data;
|
||||
WinList win_list;
|
||||
|
@ -1,5 +1,3 @@
|
||||
#include "Applet.h"
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <edelib/Debug.h>
|
||||
|
@ -2,11 +2,12 @@
|
||||
#define __TASKBAR_H__
|
||||
|
||||
#include <FL/Fl_Group.H>
|
||||
#include "Applet.h"
|
||||
|
||||
class TaskButton;
|
||||
class Panel;
|
||||
|
||||
class Taskbar : public Fl_Group {
|
||||
EDE_PANEL_APPLET_CLASS(Taskbar, Fl_Group) {
|
||||
public:
|
||||
TaskButton *curr_active, *prev_active;
|
||||
Panel *panel;
|
||||
|
@ -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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user