2007-05-22 18:53:17 +04:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-10-02 13:42:19 +04:00
|
|
|
* ede-desktop, desktop and icon manager
|
2007-05-22 18:53:17 +04:00
|
|
|
* Part of Equinox Desktop Environment (EDE).
|
2008-10-02 13:42:19 +04:00
|
|
|
* Copyright (c) 2006-2008 EDE Authors.
|
2007-05-22 18:53:17 +04:00
|
|
|
*
|
|
|
|
* This program is licensed under terms of the
|
|
|
|
* GNU General Public License version 2 or newer.
|
|
|
|
* See COPYING for details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DESKTOPICON_H__
|
|
|
|
#define __DESKTOPICON_H__
|
|
|
|
|
2008-10-02 13:42:19 +04:00
|
|
|
#include <X11/Xlib.h> // Pixmap
|
|
|
|
|
2008-09-15 15:00:23 +04:00
|
|
|
#include <FL/Fl_Widget.H>
|
|
|
|
#include <FL/Fl_Window.H>
|
|
|
|
#include <FL/Fl_Box.H>
|
|
|
|
#include <FL/Fl_Button.H>
|
|
|
|
#include <FL/Fl_Image.H>
|
2007-05-22 18:53:17 +04:00
|
|
|
|
2008-08-07 18:22:05 +04:00
|
|
|
#include <edelib/String.h>
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
class GlobalIconSettings;
|
|
|
|
class IconSettings;
|
|
|
|
class MovableIcon;
|
|
|
|
|
2007-07-02 14:28:18 +04:00
|
|
|
class Fl_Menu_Button;
|
|
|
|
|
2007-06-20 14:58:07 +04:00
|
|
|
class DesktopIcon : public Fl_Widget {
|
2007-05-22 18:53:17 +04:00
|
|
|
private:
|
|
|
|
IconSettings* settings;
|
|
|
|
const GlobalIconSettings* globals;
|
|
|
|
|
|
|
|
int lwidth;
|
|
|
|
int lheight;
|
|
|
|
bool focus;
|
|
|
|
|
|
|
|
MovableIcon* micon;
|
|
|
|
|
2008-10-03 15:29:56 +04:00
|
|
|
Fl_Image* darker_img;
|
2007-07-02 14:28:18 +04:00
|
|
|
Fl_Menu_Button* imenu;
|
|
|
|
|
2007-11-28 15:42:52 +03:00
|
|
|
void load_icon(int face);
|
2007-05-22 18:53:17 +04:00
|
|
|
void update_label_size(void);
|
2007-07-02 14:28:18 +04:00
|
|
|
void fix_position(int X, int Y);
|
2007-05-22 18:53:17 +04:00
|
|
|
|
|
|
|
public:
|
2007-06-18 18:18:35 +04:00
|
|
|
DesktopIcon(GlobalIconSettings* gisett, IconSettings* isett, int bg);
|
2007-05-22 18:53:17 +04:00
|
|
|
~DesktopIcon();
|
2007-06-18 18:18:35 +04:00
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
virtual void draw(void);
|
|
|
|
virtual int handle(int event);
|
2007-06-18 18:18:35 +04:00
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
void drag(int x, int y, bool apply);
|
|
|
|
int drag_icon_x(void);
|
|
|
|
int drag_icon_y(void);
|
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
/*
|
|
|
|
* This is 'enhanced' (in some sense) redraw(). Redrawing
|
|
|
|
* icon will not fully redraw label nor focus box, which laid outside
|
|
|
|
* icon box. It will use damage() on given region, but called from
|
|
|
|
* parent, so parent can redraw that region on itself (since label does
|
|
|
|
* not laid on any box)
|
|
|
|
*
|
|
|
|
* Alternative way would be to redraw whole parent, but it is pretty unneeded
|
|
|
|
* and slow.
|
|
|
|
*/
|
|
|
|
void fast_redraw(void);
|
|
|
|
|
2007-05-22 18:53:17 +04:00
|
|
|
/*
|
|
|
|
* Here is implemented localy focus schema avoiding
|
|
|
|
* messy fltk one. Focus/unfocus is handled from Desktop.
|
|
|
|
*/
|
|
|
|
void do_focus(void) { focus = true; }
|
|
|
|
void do_unfocus(void) { focus = false; }
|
|
|
|
bool is_focused(void) { return focus; }
|
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
Fl_Image* icon_image(void) { return image(); }
|
2007-05-25 21:45:17 +04:00
|
|
|
|
2007-07-02 14:28:18 +04:00
|
|
|
void rename(const char* str);
|
2007-09-03 16:26:58 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* make sure this returns String since operator== is
|
|
|
|
* further used, especially in Desktop
|
|
|
|
*/
|
|
|
|
const edelib::String& path(void);
|
2007-11-28 15:42:52 +03:00
|
|
|
|
2008-10-03 15:29:56 +04:00
|
|
|
int icon_type(void);
|
|
|
|
void use_icon1(void);
|
|
|
|
void use_icon2(void);
|
2007-05-22 18:53:17 +04:00
|
|
|
};
|
|
|
|
|
2007-06-18 18:18:35 +04:00
|
|
|
class MovableIcon : public Fl_Window {
|
2007-05-22 18:53:17 +04:00
|
|
|
private:
|
|
|
|
DesktopIcon* icon;
|
2007-06-18 18:18:35 +04:00
|
|
|
Fl_Box* icon_box;
|
2007-06-22 13:43:15 +04:00
|
|
|
Pixmap mask;
|
2007-05-22 18:53:17 +04:00
|
|
|
|
|
|
|
public:
|
|
|
|
MovableIcon(DesktopIcon* i);
|
|
|
|
~MovableIcon();
|
2007-06-18 18:18:35 +04:00
|
|
|
virtual void show(void);
|
2007-05-22 18:53:17 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|