mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Converted to fltk1
This commit is contained in:
@ -6,86 +6,52 @@
|
|||||||
#include <edelib/Debug.h>
|
#include <edelib/Debug.h>
|
||||||
#include <edelib/Nls.h>
|
#include <edelib/Nls.h>
|
||||||
|
|
||||||
#include <fltk/run.h>
|
#include <FL/Fl.h>
|
||||||
#include <fltk/SharedImage.h>
|
#include <FL/Fl_Shared_Image.h>
|
||||||
#include <fltk/Rectangle.h>
|
#include <FL/fl_draw.h>
|
||||||
#include <fltk/events.h>
|
|
||||||
#include <fltk/layout.h>
|
|
||||||
#include <fltk/damage.h>
|
|
||||||
#include <fltk/draw.h> // measure
|
|
||||||
|
|
||||||
using namespace edelib;
|
using namespace edelib;
|
||||||
using namespace fltk;
|
|
||||||
|
|
||||||
ControlButton::ControlButton(InvisibleBox* t, String tv, int x, int y, int w, int h, const char* l) :
|
ControlButton::ControlButton(Fl_Box* t, String tv, int x, int y, int w, int h, const char* l) :
|
||||||
Button(x, y, w, h, l) {
|
Fl_Button(x, y, w, h, l) {
|
||||||
tip = t;
|
tip = t;
|
||||||
tipval = tv;
|
tipval = tv;
|
||||||
//box(UP_BOX);
|
box(FL_FLAT_BOX);
|
||||||
box(FLAT_BOX);
|
align(FL_ALIGN_WRAP);
|
||||||
align(ALIGN_WRAP|ALIGN_CLIP|ALIGN_TOP);
|
color(FL_WHITE);
|
||||||
//align(ALIGN_WRAP);
|
|
||||||
color(WHITE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlButton::~ControlButton() {
|
ControlButton::~ControlButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlButton::draw(void) {
|
|
||||||
draw_box();
|
|
||||||
|
|
||||||
int iw = 0;
|
|
||||||
int ih = 0;
|
|
||||||
|
|
||||||
if(image()) {
|
|
||||||
((fltk::Image*)image())->measure(iw, ih);
|
|
||||||
int ix = (w()/2)-(iw/2);
|
|
||||||
int iy = 5;
|
|
||||||
((fltk::Image*)image())->draw(ix, iy);
|
|
||||||
|
|
||||||
Rectangle r(0, ih+10, w(),h());
|
|
||||||
box()->inset(r);
|
|
||||||
drawtext(label(), r, flags());
|
|
||||||
} else
|
|
||||||
draw_label();
|
|
||||||
}
|
|
||||||
|
|
||||||
int ControlButton::handle(int event) {
|
int ControlButton::handle(int event) {
|
||||||
switch(event) {
|
switch(event) {
|
||||||
case ENTER:
|
case FL_ENTER:
|
||||||
tip->label(tipval.c_str());
|
tip->label(tipval.c_str());
|
||||||
tip->redraw_label();
|
|
||||||
return 1;
|
return 1;
|
||||||
case LEAVE:
|
case FL_LEAVE:
|
||||||
tip->label("");
|
tip->label("");
|
||||||
tip->redraw_label();
|
|
||||||
return 1;
|
return 1;
|
||||||
case PUSH:
|
case FL_PUSH:
|
||||||
/*color(fltk::GRAY85);
|
|
||||||
box(fltk::DOWN_BOX);
|
|
||||||
redraw();*/
|
|
||||||
return 1;
|
return 1;
|
||||||
case RELEASE:
|
case FL_RELEASE:
|
||||||
/*color(fltk::WHITE);
|
|
||||||
box(fltk::FLAT_BOX);
|
|
||||||
redraw();*/
|
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return Button::handle(event);
|
return Fl_Button::handle(event);
|
||||||
}
|
}
|
||||||
return Button::handle(event);
|
return Fl_Button::handle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void close_cb(Widget*, void* w) {
|
void close_cb(Fl_Widget*, void* w) {
|
||||||
ControlWin* cw = (ControlWin*)w;
|
ControlWin* cw = (ControlWin*)w;
|
||||||
cw->do_close();
|
cw->do_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlWin::ControlWin(const char* title, int w, int h) : Window(w, h, title) {
|
ControlWin::ControlWin(const char* title, int w, int h) : Fl_Window(w, h, title) {
|
||||||
|
|
||||||
IconTheme::init("edeneu");
|
IconTheme::init("edeneu");
|
||||||
|
|
||||||
register_images();
|
fl_register_images();
|
||||||
load_icons();
|
load_icons();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@ -142,47 +108,45 @@ void ControlWin::load_icons(void) {
|
|||||||
|
|
||||||
void ControlWin::init(void) {
|
void ControlWin::init(void) {
|
||||||
begin();
|
begin();
|
||||||
titlegrp = new Group(0, 0, 455, 50);
|
titlegrp = new Fl_Group(0, 0, 455, 50);
|
||||||
titlegrp->box(FLAT_BOX);
|
titlegrp->box(FL_FLAT_BOX);
|
||||||
titlegrp->color((Color)0x5271a200);
|
titlegrp->color(138);
|
||||||
titlegrp->begin();
|
titlegrp->begin();
|
||||||
title = new InvisibleBox(10, 10, 435, 30, label());
|
title = new Fl_Box(10, 10, 435, 30, label());
|
||||||
title->color((Color)0x5271a200);
|
title->color(138);
|
||||||
title->align(ALIGN_LEFT|ALIGN_INSIDE);
|
title->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||||
title->labelcolor((Color)0xffffff00);
|
title->labelcolor(23);
|
||||||
title->labelfont(HELVETICA_BOLD);
|
title->labelfont(FL_HELVETICA_BOLD);
|
||||||
title->labelsize(16);
|
title->labelsize(16);
|
||||||
titlegrp->end();
|
titlegrp->end();
|
||||||
titlegrp->resizable(title);
|
titlegrp->resizable(title);
|
||||||
|
|
||||||
icons = new ExpandableGroup(10, 60, 435, 225);
|
icons = new ExpandableGroup(10, 60, 435, 225);
|
||||||
icons->box(DOWN_BOX);
|
icons->box(FL_DOWN_BOX);
|
||||||
icons->color((Color)0xffffff00);
|
icons->color(FL_BACKGROUND2_COLOR);
|
||||||
|
icons->end();
|
||||||
|
|
||||||
tipbox = new InvisibleBox(10, 295, 240, 25, _("Double click on desired item"));
|
tipbox = new Fl_Box(10, 295, 240, 25, _("Double click on desired item"));
|
||||||
tipbox->box(FLAT_BOX);
|
tipbox->box(FL_FLAT_BOX);
|
||||||
tipbox->align(ALIGN_LEFT|ALIGN_INSIDE|ALIGN_CLIP);
|
tipbox->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
|
||||||
|
|
||||||
for(unsigned int i = 0; i < iconlist.size(); i++) {
|
for(unsigned int i = 0; i < iconlist.size(); i++) {
|
||||||
ControlButton* b = new ControlButton(tipbox, iconlist[i].tip, 0, 0, 80, 100);
|
ControlButton* b = new ControlButton(tipbox, iconlist[i].tip, 0, 0, 80, 100);
|
||||||
//String iconpath = IconTheme::get(iconlist[i].icon.c_str(), ICON_SIZE_MEDIUM);
|
//String iconpath = IconTheme::get(iconlist[i].icon.c_str(), ICON_SIZE_MEDIUM);
|
||||||
String iconpath = IconTheme::get(iconlist[i].icon.c_str(), ICON_SIZE_LARGE);
|
String iconpath = IconTheme::get(iconlist[i].icon.c_str(), ICON_SIZE_LARGE);
|
||||||
|
|
||||||
//EDEBUG("%s\n", iconpath.c_str());
|
|
||||||
|
|
||||||
b->label(iconlist[i].name.c_str());
|
b->label(iconlist[i].name.c_str());
|
||||||
|
|
||||||
if(!iconpath.empty())
|
if(!iconpath.empty())
|
||||||
b->image(SharedImage::get(iconpath.c_str()));
|
b->image(Fl_Shared_Image::get(iconpath.c_str()));
|
||||||
icons->add(b);
|
icons->add(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
options = new Button(260, 295, 90, 25, _("&Options"));
|
//options = new Fl_Button(260, 295, 90, 25, _("&Options"));
|
||||||
close = new Button(355, 295, 90, 25, _("&Close"));
|
close = new Fl_Button(355, 295, 90, 25, _("&Close"));
|
||||||
close->callback(close_cb, this);
|
close->callback(close_cb, this);
|
||||||
|
|
||||||
// resizable invisible box
|
// resizable invisible box
|
||||||
rbox = new InvisibleBox(10, 220, 120, 65);
|
rbox = new Fl_Box(10, 220, 120, 65);
|
||||||
resizable(rbox);
|
resizable(rbox);
|
||||||
end();
|
end();
|
||||||
}
|
}
|
||||||
@ -194,5 +158,5 @@ void ControlWin::do_close(void) {
|
|||||||
int main() {
|
int main() {
|
||||||
ControlWin cw(_("EDE Control Panel"));
|
ControlWin cw(_("EDE Control Panel"));
|
||||||
cw.show();
|
cw.show();
|
||||||
return run();
|
return Fl::run();
|
||||||
}
|
}
|
||||||
|
@ -1,41 +1,38 @@
|
|||||||
# data file for the FLTK User Interface Designer (FLUID)
|
# data file for the Fltk User Interface Designer (fluid)
|
||||||
version 2.1000
|
version 1.0108
|
||||||
header_name {.h}
|
header_name {.h}
|
||||||
code_name {.cxx}
|
code_name {.cxx}
|
||||||
gridx 5
|
|
||||||
gridy 5
|
|
||||||
snap 1
|
|
||||||
Function {} {open
|
Function {} {open
|
||||||
} {
|
} {
|
||||||
{fltk::Window} {} {open
|
Fl_Window {} {open
|
||||||
xywh {526 246 455 330} resizable visible
|
xywh {392 251 455 330} type Double resizable visible
|
||||||
} {
|
} {
|
||||||
{fltk::Group} {} {open
|
Fl_Group {} {open
|
||||||
xywh {0 0 455 50} box FLAT_BOX color 0x5271a200
|
xywh {0 0 455 50} box FLAT_BOX color 138
|
||||||
} {
|
} {
|
||||||
{fltk::InvisibleBox} {} {
|
Fl_Box {} {
|
||||||
label {EDE Control Panel}
|
label {EDE Control Panel}
|
||||||
xywh {10 10 435 30} align 36 resizable box FLAT_BOX labelfont 1 color 0x5271a200 labelcolor 0xffffff00 labelsize 16
|
xywh {10 10 435 30} box FLAT_BOX color 138 labelfont 1 labelsize 16 labelcolor 23 align 20 resizable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{fltk::Button} {} {
|
Fl_Button {} {
|
||||||
label {&Close}
|
label {&Close}
|
||||||
xywh {355 295 90 25}
|
xywh {355 295 90 25}
|
||||||
}
|
}
|
||||||
{fltk::Button} {} {
|
Fl_Button {} {
|
||||||
label {&Options}
|
label {&Options}
|
||||||
xywh {260 295 90 25}
|
xywh {260 295 90 25}
|
||||||
}
|
}
|
||||||
{fltk::InvisibleBox} {} {
|
Fl_Box {} {
|
||||||
label {This is some label }
|
label {This is some label }
|
||||||
xywh {10 295 240 25} align 100 box FLAT_BOX
|
xywh {10 295 240 25} box FLAT_BOX align 84
|
||||||
}
|
}
|
||||||
{fltk::InvisibleBox} {} {
|
Fl_Box {} {
|
||||||
xywh {10 60 435 225} box DOWN_BOX color 0xffffff00
|
xywh {10 60 435 225} box DOWN_BOX color 7
|
||||||
}
|
}
|
||||||
{fltk::InvisibleBox} {} {selected
|
Fl_Box {} {selected
|
||||||
xywh {10 220 120 65} resizable
|
xywh {10 220 120 65} resizable
|
||||||
extra_code {/* invisible resizable box */}
|
code0 {/* invisible resizable box */}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef __ECONTROL_H__
|
#ifndef __ECONTROL_H__
|
||||||
#define __ECONTROL_H__
|
#define __ECONTROL_H__
|
||||||
|
|
||||||
#include <fltk/Window.h>
|
#include <FL/Fl_Window.h>
|
||||||
#include <fltk/Group.h>
|
#include <FL/Fl_Group.h>
|
||||||
#include <fltk/InvisibleBox.h>
|
#include <FL/Fl_Box.h>
|
||||||
#include <fltk/Button.h>
|
#include <FL/Fl_Button.h>
|
||||||
|
|
||||||
#include <edelib/IconTheme.h>
|
#include <edelib/IconTheme.h>
|
||||||
#include <edelib/ExpandableGroup.h>
|
#include <edelib/ExpandableGroup.h>
|
||||||
@ -18,26 +18,25 @@ struct ControlIcon {
|
|||||||
int pos;
|
int pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ControlButton : public fltk::Button {
|
class ControlButton : public Fl_Button {
|
||||||
private:
|
private:
|
||||||
fltk::InvisibleBox* tip;
|
Fl_Box* tip;
|
||||||
edelib::String tipval;
|
edelib::String tipval;
|
||||||
public:
|
public:
|
||||||
ControlButton(fltk::InvisibleBox* t, edelib::String tv, int x, int y, int w, int h, const char* l = 0);
|
ControlButton(Fl_Box* t, edelib::String tv, int x, int y, int w, int h, const char* l = 0);
|
||||||
~ControlButton();
|
~ControlButton();
|
||||||
void draw(void);
|
|
||||||
int handle(int event);
|
int handle(int event);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ControlWin : public fltk::Window {
|
class ControlWin : public Fl_Window {
|
||||||
private:
|
private:
|
||||||
fltk::Group* titlegrp;
|
Fl_Group* titlegrp;
|
||||||
fltk::InvisibleBox* title;
|
Fl_Box* title;
|
||||||
fltk::Button* close;
|
Fl_Button* close;
|
||||||
fltk::Button* options;
|
//Fl_Button* options;
|
||||||
edelib::ExpandableGroup* icons;
|
edelib::ExpandableGroup* icons;
|
||||||
fltk::InvisibleBox* rbox;
|
Fl_Box* rbox;
|
||||||
fltk::InvisibleBox* tipbox;
|
Fl_Box* tipbox;
|
||||||
|
|
||||||
edelib::vector<ControlIcon> iconlist;
|
edelib::vector<ControlIcon> iconlist;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user