2006-08-20 22:43:09 +04:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
2007-05-22 18:53:17 +04:00
|
|
|
* Eiconman, desktop and icon manager
|
2006-08-20 22:43:09 +04:00
|
|
|
* Part of Equinox Desktop Environment (EDE).
|
2007-05-22 18:53:17 +04:00
|
|
|
* Copyright (c) 2000-2007 EDE Authors.
|
2006-08-20 22:43:09 +04:00
|
|
|
*
|
2007-05-22 18:53:17 +04:00
|
|
|
* This program is licensed under terms of the
|
|
|
|
* GNU General Public License version 2 or newer.
|
2006-08-20 22:43:09 +04:00
|
|
|
* See COPYING for details.
|
|
|
|
*/
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
#ifndef __EICONMAN_H__
|
|
|
|
#define __EICONMAN_H__
|
2006-08-20 22:43:09 +04:00
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
#include <FL/Fl_Window.h>
|
|
|
|
#include <FL/Fl_Double_Window.h>
|
|
|
|
#include <FL/Fl_Image.h>
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
#include <edelib/String.h>
|
|
|
|
#include <edelib/Config.h>
|
|
|
|
#include <edelib/Vector.h>
|
2006-08-20 22:43:09 +04:00
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
#define EDAMAGE_LABEL 0x20
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
struct DesktopSettings {
|
2007-05-24 16:53:03 +04:00
|
|
|
int color; // background color
|
|
|
|
bool wp_use; // use wallpaper or not
|
2007-05-22 18:53:17 +04:00
|
|
|
};
|
2006-08-20 22:43:09 +04:00
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
struct GlobalIconSettings {
|
|
|
|
int label_background;
|
|
|
|
int label_foreground;
|
|
|
|
int label_fontsize;
|
|
|
|
int label_maxwidth;
|
|
|
|
bool label_transparent;
|
|
|
|
bool label_draw;
|
|
|
|
bool one_click_exec;
|
2007-06-18 18:18:35 +04:00
|
|
|
bool auto_arrange;
|
2007-05-22 18:53:17 +04:00
|
|
|
bool same_size;
|
2006-08-20 22:43:09 +04:00
|
|
|
};
|
|
|
|
|
2007-05-25 21:45:17 +04:00
|
|
|
#define ICON_NORMAL 1 // .desktop file
|
|
|
|
#define ICON_TRASH 2 // trash.desktop (specific since have two icons for empty/full)
|
|
|
|
#define ICON_FILE 3 // real file
|
|
|
|
#define ICON_SYMLINK 4 // symbolic link
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Settings representing related to icon on desktop. To complicate our lives
|
|
|
|
* (and to, at least, simplify code) it can be:
|
|
|
|
* - .desktop file content (normal or trash like)
|
|
|
|
* - real file copied/moved inside ~/Desktop directory
|
|
|
|
* - symlink in ~/Desktop directory pointing to the real file
|
|
|
|
*/
|
2007-05-22 18:53:17 +04:00
|
|
|
struct IconSettings {
|
2007-06-18 18:18:35 +04:00
|
|
|
int x, y;
|
|
|
|
int type; // ICON_NORMAL, ICON_TRASH,...
|
2007-05-25 21:45:17 +04:00
|
|
|
bool cmd_is_url; // interpret cmd as url, like system:/,trash:/,$HOME
|
2007-05-22 18:53:17 +04:00
|
|
|
|
|
|
|
edelib::String name;
|
|
|
|
edelib::String cmd;
|
|
|
|
edelib::String icon;
|
2007-05-25 21:45:17 +04:00
|
|
|
edelib::String icon2; // for stateable icons, like trash (empty/full)
|
|
|
|
edelib::String key_name; // name used as key when storing positions
|
2007-05-22 18:53:17 +04:00
|
|
|
};
|
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
class Wallpaper;
|
2007-05-22 18:53:17 +04:00
|
|
|
class DesktopIcon;
|
2007-06-18 20:46:27 +04:00
|
|
|
class NotifyBox;
|
2007-05-22 18:53:17 +04:00
|
|
|
|
2007-05-24 16:53:03 +04:00
|
|
|
typedef edelib::vector<DesktopIcon*> DesktopIconList;
|
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
class Desktop : public Fl_Window {
|
2007-05-22 18:53:17 +04:00
|
|
|
private:
|
2007-05-24 16:53:03 +04:00
|
|
|
static Desktop* pinstance;
|
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
int selection_x, selection_y;
|
2007-05-22 18:53:17 +04:00
|
|
|
bool moving;
|
|
|
|
|
|
|
|
GlobalIconSettings gisett;
|
2007-05-24 16:53:03 +04:00
|
|
|
DesktopSettings* dsett;
|
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
Wallpaper* wallpaper;
|
2007-06-18 20:46:27 +04:00
|
|
|
NotifyBox* notify;
|
2007-06-18 18:18:35 +04:00
|
|
|
|
2007-05-24 16:53:03 +04:00
|
|
|
DesktopIconList icons;
|
|
|
|
DesktopIconList selectionbuff;
|
2007-05-22 18:53:17 +04:00
|
|
|
|
|
|
|
void load_icons(const char* path, edelib::Config& conf);
|
2007-05-25 21:45:17 +04:00
|
|
|
bool read_desktop_file(const char* path, IconSettings& is);
|
2007-05-22 18:53:17 +04:00
|
|
|
|
|
|
|
void add_icon(DesktopIcon* ic);
|
2007-06-18 18:18:35 +04:00
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
void unfocus_all(void);
|
|
|
|
|
|
|
|
void select(DesktopIcon* ic);
|
|
|
|
void select_only(DesktopIcon* ic);
|
|
|
|
bool in_selection(const DesktopIcon* ic);
|
|
|
|
void move_selection(int x, int y, bool apply);
|
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
//DesktopIcon* below_mouse(int px, int py);
|
2007-05-23 16:43:50 +04:00
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
public:
|
2007-06-18 18:18:35 +04:00
|
|
|
Desktop();
|
|
|
|
~Desktop();
|
|
|
|
|
|
|
|
virtual void show(void);
|
|
|
|
virtual void hide(void);
|
|
|
|
virtual int handle(int event);
|
|
|
|
|
2007-05-24 16:53:03 +04:00
|
|
|
static void init(void);
|
|
|
|
static void shutdown(void);
|
|
|
|
static Desktop* instance(void);
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
void read_config(void);
|
|
|
|
void save_config(void);
|
2007-05-24 16:53:03 +04:00
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
void update_workarea(void);
|
|
|
|
void set_bg_color(int c, bool do_redraw = true);
|
2007-05-24 16:53:03 +04:00
|
|
|
|
2007-06-19 13:59:15 +04:00
|
|
|
void notify_box(const char* msg, bool copy = false);
|
|
|
|
void notify_box_color(Fl_Color col);
|
|
|
|
void notify_desktop_changed(void);
|
2007-06-18 20:46:27 +04:00
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
Fl_Window* desktop_window(void) { return this; }
|
2007-05-22 18:53:17 +04:00
|
|
|
};
|
2006-08-20 22:43:09 +04:00
|
|
|
|
|
|
|
#endif
|