eiconman based on fltk1. Most of the stuff is

revised from scratch.
This commit is contained in:
Sanel Zukan
2007-06-18 14:18:35 +00:00
parent 95a3034827
commit 202b4ffb29
13 changed files with 563 additions and 1136 deletions

View File

@@ -13,18 +13,19 @@
#ifndef __EICONMAN_H__
#define __EICONMAN_H__
#include <fltk/Window.h>
#include <fltk/PopupMenu.h>
#include <fltk/Image.h>
#include <FL/Fl_Window.h>
#include <FL/Fl_Double_Window.h>
#include <FL/Fl_Image.h>
#include <edelib/String.h>
#include <edelib/Config.h>
#include <edelib/Vector.h>
#define EDAMAGE_LABEL 0x20
struct DesktopSettings {
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
};
struct GlobalIconSettings {
@@ -32,11 +33,10 @@ struct GlobalIconSettings {
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 auto_arrange;
bool same_size;
};
@@ -53,8 +53,8 @@ struct GlobalIconSettings {
* - symlink in ~/Desktop directory pointing to the real file
*/
struct IconSettings {
int x, y;
int type;
int x, y;
int type; // ICON_NORMAL, ICON_TRASH,...
bool cmd_is_url; // interpret cmd as url, like system:/,trash:/,$HOME
edelib::String name;
@@ -64,79 +64,59 @@ struct IconSettings {
edelib::String key_name; // name used as key when storing positions
};
// selection overlay
struct SelectionOverlay {
int x, y, w, h;
bool show;
};
class Wallpaper;
class DesktopIcon;
typedef edelib::vector<DesktopIcon*> DesktopIconList;
class Desktop : public fltk::Window {
class Desktop : public Fl_Window {
private:
static Desktop* pinstance;
int desktops_num;
int curr_desktop;
int bg_color;
bool wp_use;
int selection_x, selection_y;
bool moving;
int selection_x;
int selection_y;
SelectionOverlay* selbox;
GlobalIconSettings gisett;
IconSettings isett;
DesktopSettings* dsett;
Wallpaper* wallpaper;
DesktopIconList icons;
DesktopIconList selectionbuff;
fltk::PopupMenu* pmenu;
void init_desktops(void);
void load_icons(const char* path, edelib::Config& conf);
bool read_desktop_file(const char* path, IconSettings& is);
void add_icon(DesktopIcon* ic);
void unfocus_all(void);
void select(DesktopIcon* ic);
void select_only(DesktopIcon* ic);
bool in_selection(const DesktopIcon* ic);
void select_in_area(void);
void select_noredraw(DesktopIcon* ic);
void move_selection(int x, int y, bool apply);
DesktopIcon* below_mouse(int x, int y);
void drop_source(const char* src, int x, int y);
//DesktopIcon* below_mouse(int px, int py);
public:
Desktop();
~Desktop();
virtual void show(void);
virtual void hide(void);
virtual int handle(int event);
static void init(void);
static void shutdown(void);
static Desktop* instance(void);
Desktop();
~Desktop();
void update_workarea(void);
void read_config(void);
void save_config(void);
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);
void update_workarea(void);
void set_bg_color(int c, bool do_redraw = true);
void create(void);
virtual void draw(void);
virtual int handle(int event);
Fl_Window* desktop_window(void) { return this; }
};
#endif