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-05-22 18:53:17 +04:00
|
|
|
#include <fltk/Window.h>
|
|
|
|
#include <fltk/PopupMenu.h>
|
2007-05-24 16:53:03 +04:00
|
|
|
#include <fltk/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-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
|
|
|
|
fltk::Image* wp_image; // wallpaper image (can be NULL)
|
|
|
|
edelib::String wp_path; // wallpaper path
|
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;
|
|
|
|
int gridspacing;
|
|
|
|
bool label_transparent;
|
|
|
|
bool label_draw;
|
|
|
|
bool one_click_exec;
|
|
|
|
bool auto_arr;
|
|
|
|
bool same_size;
|
2006-08-20 22:43:09 +04:00
|
|
|
};
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
// settings related to .desktop files
|
|
|
|
struct IconSettings {
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
bool cmd_is_url; // interpret cmd as url, like system:/,trash:/,$HOME
|
|
|
|
|
|
|
|
edelib::String name;
|
|
|
|
edelib::String cmd;
|
|
|
|
edelib::String icon;
|
|
|
|
edelib::String icon2; // for stateable icons, like trash (empty/full)
|
|
|
|
edelib::String desktop_name; // name used as key when storing positions
|
|
|
|
};
|
|
|
|
|
2007-05-22 20:27:33 +04:00
|
|
|
// selection overlay
|
|
|
|
struct SelectionOverlay {
|
|
|
|
int x, y, w, h;
|
|
|
|
bool show;
|
|
|
|
};
|
2007-05-22 18:53:17 +04:00
|
|
|
|
|
|
|
class DesktopIcon;
|
|
|
|
|
2007-05-24 16:53:03 +04:00
|
|
|
typedef edelib::vector<DesktopIcon*> DesktopIconList;
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
class Desktop : public fltk::Window {
|
|
|
|
private:
|
2007-05-24 16:53:03 +04:00
|
|
|
static Desktop* pinstance;
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
int desktops_num;
|
2007-05-24 16:53:03 +04:00
|
|
|
int curr_desktop;
|
2007-05-22 18:53:17 +04:00
|
|
|
int bg_color;
|
|
|
|
bool wp_use;
|
|
|
|
|
|
|
|
bool moving;
|
|
|
|
int selection_x;
|
|
|
|
int selection_y;
|
|
|
|
|
2007-05-22 20:27:33 +04:00
|
|
|
SelectionOverlay* selbox;
|
2007-05-22 18:53:17 +04:00
|
|
|
|
|
|
|
GlobalIconSettings gisett;
|
|
|
|
IconSettings isett;
|
|
|
|
|
2007-05-24 16:53:03 +04:00
|
|
|
DesktopSettings* dsett;
|
|
|
|
|
|
|
|
DesktopIconList icons;
|
|
|
|
DesktopIconList selectionbuff;
|
2007-05-22 18:53:17 +04:00
|
|
|
|
|
|
|
fltk::PopupMenu* pmenu;
|
|
|
|
|
2007-05-24 16:53:03 +04:00
|
|
|
void init_desktops(void);
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
void load_icons(const char* path, edelib::Config& conf);
|
|
|
|
bool read_desktop_file(const char* path, IconSettings& is, int& icon_type);
|
|
|
|
|
|
|
|
void add_icon(DesktopIcon* ic);
|
|
|
|
void unfocus_all(void);
|
|
|
|
|
|
|
|
void select(DesktopIcon* ic);
|
|
|
|
void select_only(DesktopIcon* ic);
|
|
|
|
bool in_selection(const DesktopIcon* ic);
|
|
|
|
|
2007-05-23 16:43:50 +04:00
|
|
|
void select_in_area(void);
|
|
|
|
void select_noredraw(DesktopIcon* ic);
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
void move_selection(int x, int y, bool apply);
|
|
|
|
|
2007-05-23 16:43:50 +04:00
|
|
|
DesktopIcon* below_mouse(int x, int y);
|
2007-05-24 16:53:03 +04:00
|
|
|
void drop_source(const char* src, int x, int y);
|
2007-05-23 16:43:50 +04:00
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
public:
|
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
|
|
|
Desktop();
|
|
|
|
~Desktop();
|
|
|
|
void update_workarea(void);
|
|
|
|
void read_config(void);
|
|
|
|
void save_config(void);
|
2007-05-24 16:53:03 +04:00
|
|
|
|
|
|
|
void set_wallpaper(const char* path, bool do_redraw = true);
|
|
|
|
void set_wallpaper(fltk::Image* im, bool do_redraw = true);
|
|
|
|
void set_bg_color(unsigned int c, bool do_redraw = true);
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
void create(void);
|
|
|
|
virtual void draw(void);
|
|
|
|
virtual int handle(int event);
|
|
|
|
};
|
2006-08-20 22:43:09 +04:00
|
|
|
|
|
|
|
#endif
|