mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Merging new panel in the trunk.
This commit is contained in:
13
ede-panel/applets/quick-launch/Jamfile
Normal file
13
ede-panel/applets/quick-launch/Jamfile
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Part of Equinox Desktop Environment (EDE).
|
||||
# Copyright (c) 2009 EDE Authors.
|
||||
#
|
||||
# This program is licensed under terms of the
|
||||
# GNU General Public License version 2 or newer.
|
||||
# See COPYING for details.
|
||||
|
||||
SubDir TOP ede-panel-new applets quick-launch ;
|
||||
|
||||
PanelApplet quick_launch : QuickLaunch.cpp ;
|
117
ede-panel/applets/quick-launch/QuickLaunch.cpp
Normal file
117
ede-panel/applets/quick-launch/QuickLaunch.cpp
Normal file
@ -0,0 +1,117 @@
|
||||
#include "Applet.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Input.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
|
||||
#include <edelib/Debug.h>
|
||||
#include <edelib/Nls.h>
|
||||
#include <edelib/Run.h>
|
||||
|
||||
#include "edit-clear-icon.h"
|
||||
|
||||
EDELIB_NS_USING(run_async)
|
||||
|
||||
class QuickLaunch : public Fl_Input {
|
||||
private:
|
||||
Fl_Image *img;
|
||||
int img_x, img_y;
|
||||
public:
|
||||
QuickLaunch();
|
||||
|
||||
void draw(void);
|
||||
int handle(int e);
|
||||
|
||||
/* a stupid way to avoid draw_box() to draw the image */
|
||||
void image2(Fl_Image *im) { img = im; }
|
||||
Fl_Image *image2(void) { return img; }
|
||||
};
|
||||
|
||||
static bool empty_string(const char *s) {
|
||||
for(const char *ptr = s; ptr && *ptr; ptr++) {
|
||||
if(!isspace(*ptr))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void enter_cb(Fl_Widget*, void *o) {
|
||||
QuickLaunch *ql = (QuickLaunch*)o;
|
||||
|
||||
if(ql->value() && !empty_string(ql->value()))
|
||||
run_async("ede-launch %s", ql->value());
|
||||
}
|
||||
|
||||
QuickLaunch::QuickLaunch() : Fl_Input(0, 0, 130, 25), img(NULL), img_x(0), img_y(0) {
|
||||
when(FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED);
|
||||
callback(enter_cb, this);
|
||||
tooltip(_("Enter a command to be executed"));
|
||||
|
||||
image2((Fl_RGB_Image*)&image_edit);
|
||||
}
|
||||
|
||||
void QuickLaunch::draw(void) {
|
||||
Fl_Boxtype b = box(), oldb;
|
||||
|
||||
int X = x() + Fl::box_dx(b);
|
||||
int Y = y() + Fl::box_dy(b);
|
||||
int W = w() - Fl::box_dw(b);
|
||||
int H = h() - Fl::box_dh(b);
|
||||
|
||||
if(img) {
|
||||
W -= img->w() + 6;
|
||||
img_x = X + W + 2;
|
||||
img_y = (Y + H / 2) - (img->h() / 2);
|
||||
}
|
||||
|
||||
if(damage() & FL_DAMAGE_ALL) {
|
||||
draw_box(b, color());
|
||||
if(img) img->draw(img_x, img_y);
|
||||
}
|
||||
|
||||
/* use flat box when text is drawn or there would be visible border line */
|
||||
oldb = box();
|
||||
box(FL_FLAT_BOX);
|
||||
|
||||
Fl_Input_::drawtext(X, Y, W, H);
|
||||
box(oldb);
|
||||
}
|
||||
|
||||
int QuickLaunch::handle(int e) {
|
||||
if(!img)
|
||||
goto done;
|
||||
|
||||
switch(e) {
|
||||
case FL_ENTER:
|
||||
case FL_MOVE:
|
||||
if(active_r() && window()) {
|
||||
if(Fl::event_inside(img_x, img_y, img->w(), img->h()))
|
||||
window()->cursor(FL_CURSOR_DEFAULT);
|
||||
else
|
||||
window()->cursor(FL_CURSOR_INSERT);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
case FL_RELEASE:
|
||||
if(active_r() && Fl::event_inside(img_x, img_y, img->w(), img->h()))
|
||||
value(0);
|
||||
/* fallthrough */
|
||||
}
|
||||
|
||||
done:
|
||||
return Fl_Input::handle(e);
|
||||
}
|
||||
|
||||
|
||||
EDE_PANEL_APPLET_EXPORT (
|
||||
QuickLaunch,
|
||||
EDE_PANEL_APPLET_OPTION_ALIGN_LEFT,
|
||||
"Quick Launch applet",
|
||||
"0.1",
|
||||
"empty",
|
||||
"Sanel Zukan"
|
||||
)
|
55
ede-panel/applets/quick-launch/edit-clear-icon.h
Normal file
55
ede-panel/applets/quick-launch/edit-clear-icon.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef __EDIT_CLEAR_ICON_H__
|
||||
#define __EDIT_CLEAR_ICON_H__
|
||||
|
||||
#include <FL/Fl_Image.H>
|
||||
static unsigned char idata_edit[] =
|
||||
{255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
|
||||
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
|
||||
255,255,255,0,120,72,0,71,123,74,0,227,124,75,0,218,120,72,0,59,255,255,255,0,
|
||||
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
|
||||
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,120,72,0,68,123,
|
||||
74,0,245,171,109,11,255,166,105,10,255,123,74,0,229,255,255,255,0,255,255,255,
|
||||
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,
|
||||
255,255,0,156,139,0,19,156,139,0,130,138,105,0,2,123,74,0,218,169,107,10,255,
|
||||
193,125,16,255,178,114,12,255,123,74,0,237,255,255,255,0,255,255,255,0,255,255,
|
||||
255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,156,
|
||||
139,0,41,156,139,0,255,154,133,0,206,132,82,1,242,193,125,16,255,188,122,15,255,
|
||||
134,82,3,244,121,73,0,111,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,
|
||||
0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,156,139,0,61,177,
|
||||
160,29,242,190,174,50,254,161,136,1,255,178,118,11,255,128,78,1,244,123,74,0,
|
||||
149,120,72,0,2,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
|
||||
255,0,156,139,0,21,157,140,0,119,160,143,1,210,160,54,0,228,176,105,23,247,235,
|
||||
222,119,255,205,189,65,255,156,136,0,254,135,100,0,129,255,255,255,0,255,255,
|
||||
255,0,255,255,255,0,255,255,255,0,255,255,255,0,156,139,0,27,159,142,1,159,162,
|
||||
144,9,246,204,189,67,247,234,220,114,255,215,177,98,255,171,27,13,255,200,109,
|
||||
51,255,236,220,104,255,216,200,79,255,158,141,1,246,156,139,0,90,255,255,255,0,
|
||||
156,139,0,2,156,139,0,64,159,142,0,163,159,143,5,247,205,190,69,250,248,234,136,
|
||||
255,253,238,125,255,253,235,108,255,253,234,99,255,246,216,97,255,184,56,29,255,
|
||||
187,74,40,255,187,165,41,246,158,141,0,235,156,139,0,95,255,255,255,0,157,140,0,
|
||||
234,174,158,27,243,207,193,73,254,235,221,119,255,243,227,101,255,251,229,68,
|
||||
255,253,233,82,255,253,236,109,255,253,239,132,255,253,236,107,255,251,234,132,
|
||||
255,173,66,19,252,161,36,0,215,156,139,0,7,255,255,255,0,255,255,255,0,159,141,
|
||||
1,233,226,212,103,255,228,210,73,255,220,198,16,255,231,208,24,255,243,219,42,
|
||||
255,253,230,60,255,253,233,82,255,253,235,97,255,253,234,95,255,253,239,138,255,
|
||||
192,176,47,245,156,127,0,95,255,255,255,0,255,255,255,0,255,255,255,0,159,142,0,
|
||||
168,198,182,51,251,230,214,86,255,218,194,3,255,219,195,4,255,229,205,20,255,
|
||||
238,215,35,255,246,222,47,255,251,228,55,255,252,229,60,255,251,237,139,255,165,
|
||||
148,17,247,156,139,0,26,255,255,255,0,255,255,255,0,255,255,255,0,156,139,0,28,
|
||||
159,142,4,244,220,205,88,255,228,211,76,255,218,194,3,255,218,194,3,255,220,196,
|
||||
7,255,227,203,17,255,231,208,24,255,237,218,70,255,221,207,94,255,160,142,1,
|
||||
212,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,156,
|
||||
139,0,63,160,143,5,241,214,200,86,254,231,215,91,255,220,198,21,255,218,194,3,
|
||||
255,218,194,3,255,220,197,16,255,232,218,108,255,171,155,26,246,156,139,0,67,
|
||||
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
|
||||
255,0,156,139,0,38,158,141,0,230,197,180,50,251,231,217,109,255,229,212,78,255,
|
||||
223,202,38,255,231,216,95,255,197,181,54,250,159,142,0,197,255,255,255,0,255,
|
||||
255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
|
||||
255,255,255,0,156,139,0,20,159,141,0,169,161,144,8,246,198,181,48,250,225,211,
|
||||
91,255,210,195,79,253,158,141,0,226,156,139,0,19,255,255,255,0,255,255,255,0,
|
||||
255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,
|
||||
255,0,255,255,255,0,255,255,255,0,156,139,0,33,158,141,0,158,158,141,0,236,157,
|
||||
140,0,237,156,139,0,31,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,
|
||||
255,255,255,0,255,255,255,0};
|
||||
static Fl_RGB_Image image_edit(idata_edit, 16, 16, 4, 0);
|
||||
|
||||
#endif
|
BIN
ede-panel/applets/quick-launch/icons/edit-clear.png
Normal file
BIN
ede-panel/applets/quick-launch/icons/edit-clear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 771 B |
Reference in New Issue
Block a user