24#include "../lout/msg.h"
25#include "../lout/debug.hh"
28#include <FL/fl_draw.H>
30#include <FL/Fl_Tooltip.H>
31#include <FL/Fl_Menu_Window.H>
32#include <FL/Fl_Paged_Device.H>
54 FltkFont> (
false,
false);
63 FL_HELVETICA_BOLD_ITALIC);
66 Fl_Font fontItalic, Fl_Font fontBoldItalic)
71 font[3] = fontBoldItalic;
79 if (attrs & FL_ITALIC)
89 if (attrs & FL_ITALIC)
124 fl_text_extents(
"x", xx, xy, xw, xh);
138 if (strlen(big) >= strlen(little) &&
140 *(big + strlen(big) - strlen(little)) =
'\0';
148 int k = Fl::set_fonts (
"-*-iso10646-1");
149 for (
int i = 0; i < k; i++) {
151 char *
name =
dStrdup (Fl::get_font_name ((Fl_Font) i, &t));
159 _MSG(
"Found font: %s%s%s\n",
name, t & FL_BOLD ?
" bold" :
"",
160 t & FL_ITALIC ?
" italic" :
"");
167 family->
set ((Fl_Font) i, t);
172 family =
new FontFamily ((Fl_Font) i, -1, -1, -1);
173 family->
set ((Fl_Font) i, t);
196 return family->
get (attrs);
286 _MSG(
"FltkTooltip::onEnter\n");
297 tt_window =
new Fl_Menu_Window(0,0,100,24);
300 Fl_Box *b =
new Fl_Box(0,0,100,24);
301 b->box(FL_BORDER_BOX);
302 b->color(fl_color_cube(FL_NUM_RED-1, FL_NUM_GREEN-1, FL_NUM_BLUE-2));
303 b->labelcolor(FL_BLACK);
304 b->labelfont(FL_HELVETICA);
306 b->align(FL_ALIGN_WRAP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
313 Fl_Box *box = (Fl_Box*)
tt_window->child(0);
315 Fl::get_mouse(x,y); y += 6;
319 box->measure_label(ww, hh);
320 ww += 6 + 2 * Fl::box_dx(box->box());
321 hh += 6 + 2 * Fl::box_dy(box->box());
357 Fl_Widget *widget = Fl::belowmouse();
358 if (widget && widget->window()) {
359 widget->window()->damage(FL_DAMAGE_EXPOSE,0,0,1,1);
405 selectionMode,
int rows)
420 const char *placeholder)
429 const char *placeholder)
458 idleQueue =
new container::typed::List <IdleFunc> (
true);
463 resources =
new container::typed::List <ui::FltkResource> (
false);
488 MSG_ERR(
"FltkPlatform::attachView: multiple views!\n");
491 for (container::typed::Iterator <ui::FltkResource> it =
492 resources->iterator (); it.hasNext (); ) {
501 if (this->view !=
view)
502 MSG_ERR(
"FltkPlatform::detachView: this->view: %p view: %p\n",
503 (
void *) this->view, (
void *)
view);
505 for (container::typed::Iterator <ui::FltkResource> it =
506 resources->iterator (); it.hasNext (); ) {
521 int curr = 0, next = 0, nb;
525 for (curr = 0; next < len; curr = next) {
527 c = fl_utf8decode(text + curr, text + next, &nb);
528 if ((cu = fl_toupper(c)) == c) {
531 if (fl_nonspacing(cu) == 0) {
533 width += (int)fl_width(text + curr, next - curr);
537 nb = fl_utf8encode(cu, chbuf);
538 fl_font(ff->
font, sc_fontsize);
539 if (fl_nonspacing(cu) == 0) {
541 width += (int)fl_width(chbuf, nb);
547 width = (int) fl_width (text, len);
550 int curr = 0, next = 0;
554 c = fl_utf8decode(text + curr, text + next, &nb);
555 if (fl_nonspacing(c) == 0)
572 newstr = (
char*) malloc(3 * len + 1);
573 newlen = fl_utf_toupper((
const unsigned char*)text, len, newstr);
574 assert(newlen <= 3 * len);
575 newstr[newlen] =
'\0';
587 newstr = (
char*) malloc(3 * len + 1);
588 newlen = fl_utf_tolower((
const unsigned char*)text, len, newstr);
589 assert(newlen <= 3 * len);
590 newstr[newlen] =
'\0';
597 return fl_utf8fwd (&text[idx + 1], text, &text[strlen (text)]) - text;
602 return fl_utf8back (&text[idx - 1], text, &text[strlen (text)]) - text;
607 float horizontal, vertical;
609 Fl::screen_dpi(horizontal, vertical);
615 float horizontal, vertical;
617 Fl::screen_dpi(horizontal, vertical);
663 idleFunc->
func = func;
672 container::typed::Iterator <IdleFunc> it;
677 if (idleFunc->
id == idleId) {
706 Fl::copy(text, strlen(text), destination);
710 int width,
int height,
double gamma)
712 return new FltkImgbuf (type, width, height, gamma);
The platform independent interface for image buffers.
The central class for managing and drawing a widget tree.
dw::core::Shape implementation for simple rectangles.
An interface to encapsulate platform dependent drawing.
int shadeColor(int color, int d)
void copyAttrs(FontAttrs *attrs)
A factory for the common resource.
static FltkColor * create(int color)
static lout::container::typed::HashTable< dw::core::style::ColorAttrs, FltkColor > * colorsTable
FontFamily(Fl_Font fontNormal, Fl_Font fontBold, Fl_Font fontItalic, Fl_Font fontBoldItalic)
void set(Fl_Font, int attrs)
FltkFont(core::style::FontAttrs *attrs)
static FontFamily standardFontFamily
static bool fontExists(const char *name)
static FltkFont * create(core::style::FontAttrs *attrs)
static lout::container::typed::HashTable< lout::object::ConstString, FontFamily > * systemFonts
static Fl_Font get(const char *name, int attrs)
static void initSystemFonts()
static lout::container::typed::HashTable< dw::core::style::FontAttrs, FltkFont > * fontsTable
This interface adds some more methods for all flkt-based views.
virtual void drawFltkWidget(Fl_Widget *widget, core::Rectangle *area)
virtual void removeFltkWidget(Fl_Widget *widget)
virtual void addFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
virtual void allocateFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
virtual void detachView(FltkView *view)
virtual void attachView(FltkView *view)
Typed version of container::untyped::HashTable.
An object::Object wrapper for constant strings (char*).
An object::Object wrapper for strings (char*).
#define DBG_OBJ_CREATE(klass)
#define DBG_OBJ_ASSOC_CHILD(child)
char * dStrdup(const char *s)
static FltkPlatform * platform
@ FONT_VARIANT_SMALL_CAPS
static void strstrip(char *big, const char *little)
static void tooltip_tcb(void *data)
Dw is in this namespace, or sub namespaces of this one.
int AsciiStrcasecmp(const char *s1, const char *s2)
Represents the allocation, i.e.