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:
@ -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__
|
#ifndef __APPLET_H__
|
||||||
#define __APPLET_H__
|
#define __APPLET_H__
|
||||||
|
|
||||||
#define EDE_PANEL_APPLET_INTERFACE_VERSION 0x01
|
|
||||||
|
|
||||||
class Fl_Widget;
|
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 {
|
enum {
|
||||||
EDE_PANEL_APPLET_OPTION_RESIZABLE_H = (1 << 1),
|
EDE_PANEL_APPLET_OPTION_RESIZABLE_H = (1 << 1),
|
||||||
EDE_PANEL_APPLET_OPTION_RESIZABLE_V = (1 << 2),
|
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);
|
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) \
|
#define EDE_PANEL_APPLET_EXPORT(klass, aoptions, aname, aversion, aicon, aauthor) \
|
||||||
extern "C" Fl_Widget *ede_panel_applet_create(void) { \
|
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; \
|
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
|
#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 <dlfcn.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <edelib/Debug.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__
|
#ifndef __APPLETMANAGER_H__
|
||||||
#define __APPLETMANAGER_H__
|
#define __APPLETMANAGER_H__
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
#define DEFAULT_PANEL_H 35
|
#define DEFAULT_PANEL_H 35
|
||||||
|
|
||||||
#undef MIN
|
#undef MIN
|
||||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
|
||||||
#undef MAX
|
#undef MAX
|
||||||
|
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||||
#define MAX(x,y) ((x) > (y) ? (x) : (y))
|
#define MAX(x,y) ((x) > (y) ? (x) : (y))
|
||||||
|
|
||||||
EDELIB_NS_USING_LIST(10, (list,
|
EDELIB_NS_USING_LIST(10, (list,
|
||||||
|
@ -11,7 +11,7 @@ EDELIB_NS_USING(run_async)
|
|||||||
|
|
||||||
static void clock_refresh(void *o);
|
static void clock_refresh(void *o);
|
||||||
|
|
||||||
class Clock : public Fl_Box {
|
EDE_PANEL_APPLET_CLASS(Clock, Fl_Box) {
|
||||||
private:
|
private:
|
||||||
int hour;
|
int hour;
|
||||||
char buf[64], tbuf[128];
|
char buf[64], tbuf[128];
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Applet.h"
|
|
||||||
#include "CpuMonitor.h"
|
#include "CpuMonitor.h"
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define __CPUMONITOR_H__
|
#define __CPUMONITOR_H__
|
||||||
|
|
||||||
#include <FL/Fl_Box.H>
|
#include <FL/Fl_Box.H>
|
||||||
|
#include "Applet.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef HAVE_KSTAT_H
|
#ifdef HAVE_KSTAT_H
|
||||||
@ -18,7 +19,7 @@ enum {
|
|||||||
IWM_STATES
|
IWM_STATES
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPUMonitor : public Fl_Box {
|
EDE_PANEL_APPLET_CLASS(CPUMonitor, Fl_Box) {
|
||||||
private:
|
private:
|
||||||
bool m_draw_label;
|
bool m_draw_label;
|
||||||
int m_old_samples;
|
int m_old_samples;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
class MyButton : public Fl_Button {
|
EDE_PANEL_APPLET_CLASS(MyButton, Fl_Button) {
|
||||||
public:
|
public:
|
||||||
MyButton() : Fl_Button(0, 0, 90, 25, "xxx") {
|
MyButton() : Fl_Button(0, 0, 90, 25, "xxx") {
|
||||||
color(FL_RED);
|
color(FL_RED);
|
||||||
|
@ -41,7 +41,7 @@ EDELIB_NS_USING(RES_SYS_ONLY)
|
|||||||
|
|
||||||
static Atom _XA_XKB_RF_NAMES_PROP_ATOM = 0;
|
static Atom _XA_XKB_RF_NAMES_PROP_ATOM = 0;
|
||||||
|
|
||||||
class KeyLayout : public Fl_Button {
|
EDE_PANEL_APPLET_CLASS(KeyLayout, Fl_Button) {
|
||||||
private:
|
private:
|
||||||
bool should_show_flag;
|
bool should_show_flag;
|
||||||
String path, curr_layout;
|
String path, curr_layout;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
#include <edelib/Color.h>
|
#include <edelib/Color.h>
|
||||||
#include <edelib/Missing.h>
|
#include <edelib/Missing.h>
|
||||||
#include "Applet.h"
|
|
||||||
#include "MemMonitor.h"
|
#include "MemMonitor.h"
|
||||||
|
|
||||||
EDELIB_NS_USING(color_rgb_to_fltk)
|
EDELIB_NS_USING(color_rgb_to_fltk)
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
#define __MEMMONITOR_H__
|
#define __MEMMONITOR_H__
|
||||||
|
|
||||||
#include <FL/Fl_Box.H>
|
#include <FL/Fl_Box.H>
|
||||||
|
#include "Applet.h"
|
||||||
|
|
||||||
class MemMonitor : public Fl_Box {
|
EDE_PANEL_APPLET_CLASS(MemMonitor, Fl_Box) {
|
||||||
private:
|
private:
|
||||||
int mem_usedp, swap_usedp;
|
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_callback_remove)
|
||||||
EDELIB_NS_USING(NETWM_CHANGED_CURRENT_WORKSPACE)
|
EDELIB_NS_USING(NETWM_CHANGED_CURRENT_WORKSPACE)
|
||||||
|
|
||||||
class Pager : public Fl_Group {
|
EDE_PANEL_APPLET_CLASS(Pager, Fl_Group) {
|
||||||
public:
|
public:
|
||||||
Pager();
|
Pager();
|
||||||
~Pager();
|
~Pager();
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
EDELIB_NS_USING(run_async)
|
EDELIB_NS_USING(run_async)
|
||||||
|
|
||||||
class QuickLaunch : public Fl_Input {
|
EDE_PANEL_APPLET_CLASS(QuickLaunch, Fl_Input) {
|
||||||
private:
|
private:
|
||||||
Fl_Image *img;
|
Fl_Image *img;
|
||||||
int img_x, img_y;
|
int img_x, img_y;
|
||||||
|
@ -13,7 +13,7 @@ EDELIB_NS_USING(MenuBase)
|
|||||||
|
|
||||||
/* some of this code was ripped from Fl_Menu_Button.cxx */
|
/* some of this code was ripped from Fl_Menu_Button.cxx */
|
||||||
|
|
||||||
class StartMenu : public MenuBase {
|
EDE_PANEL_APPLET_CLASS(StartMenu, MenuBase) {
|
||||||
private:
|
private:
|
||||||
MenuItem *mcontent;
|
MenuItem *mcontent;
|
||||||
public:
|
public:
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <FL/Fl_Window.H>
|
#include <FL/Fl_Window.H>
|
||||||
#include <edelib/Debug.h>
|
#include <edelib/Debug.h>
|
||||||
|
|
||||||
#include "Applet.h"
|
|
||||||
#include "Panel.h"
|
#include "Panel.h"
|
||||||
#include "Tray.h"
|
#include "Tray.h"
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <FL/Fl_Group.H>
|
#include <FL/Fl_Group.H>
|
||||||
#include <FL/x.H>
|
#include <FL/x.H>
|
||||||
#include <edelib/List.h>
|
#include <edelib/List.h>
|
||||||
|
#include "Applet.h"
|
||||||
|
|
||||||
EDELIB_NS_USING(list)
|
EDELIB_NS_USING(list)
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ struct WinInfo {
|
|||||||
typedef list<WinInfo> WinList;
|
typedef list<WinInfo> WinList;
|
||||||
typedef list<WinInfo>::iterator WinListIt;
|
typedef list<WinInfo>::iterator WinListIt;
|
||||||
|
|
||||||
class Tray : public Fl_Group {
|
EDE_PANEL_APPLET_CLASS(Tray, Fl_Group) {
|
||||||
private:
|
private:
|
||||||
Atom opcode, message_data;
|
Atom opcode, message_data;
|
||||||
WinList win_list;
|
WinList win_list;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#include "Applet.h"
|
|
||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/Fl_Button.H>
|
#include <FL/Fl_Button.H>
|
||||||
#include <edelib/Debug.h>
|
#include <edelib/Debug.h>
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
#define __TASKBAR_H__
|
#define __TASKBAR_H__
|
||||||
|
|
||||||
#include <FL/Fl_Group.H>
|
#include <FL/Fl_Group.H>
|
||||||
|
#include "Applet.h"
|
||||||
|
|
||||||
class TaskButton;
|
class TaskButton;
|
||||||
class Panel;
|
class Panel;
|
||||||
|
|
||||||
class Taskbar : public Fl_Group {
|
EDE_PANEL_APPLET_CLASS(Taskbar, Fl_Group) {
|
||||||
public:
|
public:
|
||||||
TaskButton *curr_active, *prev_active;
|
TaskButton *curr_active, *prev_active;
|
||||||
Panel *panel;
|
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
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user