23#include "../lout/msg.h"
24#include "../lout/debug.hh"
27#include <FL/fl_draw.H>
29#include <FL/Fl_Tooltip.H>
30#include <FL/Fl_Menu_Window.H>
31#include <FL/Fl_Paged_Device.H>
53 FltkFont> (
false,
false);
62 FL_HELVETICA_BOLD_ITALIC);
65 Fl_Font fontItalic, Fl_Font fontBoldItalic)
70 font[3] = fontBoldItalic;
78 if (attrs & FL_ITALIC)
88 if (attrs & FL_ITALIC)
123 fl_text_extents(
"x", xx, xy, xw, xh);
137 if (strlen(big) >= strlen(little) &&
139 *(big + strlen(big) - strlen(little)) =
'\0';
147 int k = Fl::set_fonts (
"-*-iso10646-1");
148 for (
int i = 0; i < k; i++) {
150 char *
name =
dStrdup (Fl::get_font_name ((Fl_Font) i, &t));
158 _MSG(
"Found font: %s%s%s\n",
name, t & FL_BOLD ?
" bold" :
"",
159 t & FL_ITALIC ?
" italic" :
"");
166 family->
set ((Fl_Font) i, t);
171 family =
new FontFamily ((Fl_Font) i, -1, -1, -1);
172 family->
set ((Fl_Font) i, t);
195 return family->
get (attrs);
285 _MSG(
"FltkTooltip::onEnter\n");
296 tt_window =
new Fl_Menu_Window(0,0,100,24);
299 Fl_Box *b =
new Fl_Box(0,0,100,24);
300 b->box(FL_BORDER_BOX);
301 b->color(fl_color_cube(FL_NUM_RED-1, FL_NUM_GREEN-1, FL_NUM_BLUE-2));
302 b->labelcolor(FL_BLACK);
303 b->labelfont(FL_HELVETICA);
305 b->align(FL_ALIGN_WRAP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
312 Fl_Box *box = (Fl_Box*)
tt_window->child(0);
314 Fl::get_mouse(x,y); y += 6;
318 box->measure_label(ww, hh);
319 ww += 6 + 2 * Fl::box_dx(box->box());
320 hh += 6 + 2 * Fl::box_dy(box->box());
356 Fl_Widget *widget = Fl::belowmouse();
357 if (widget && widget->window()) {
358 widget->window()->damage(FL_DAMAGE_EXPOSE,0,0,1,1);
404 selectionMode,
int rows)
419 const char *placeholder)
428 const char *placeholder)
457 idleQueue =
new container::typed::List <IdleFunc> (
true);
462 resources =
new container::typed::List <ui::FltkResource> (
false);
487 MSG_ERR(
"FltkPlatform::attachView: multiple views!\n");
490 for (container::typed::Iterator <ui::FltkResource> it =
491 resources->iterator (); it.hasNext (); ) {
500 if (this->view !=
view)
501 MSG_ERR(
"FltkPlatform::detachView: this->view: %p view: %p\n",
502 (
void *) this->view, (
void *)
view);
504 for (container::typed::Iterator <ui::FltkResource> it =
505 resources->iterator (); it.hasNext (); ) {
520 int curr = 0, next = 0, nb;
524 for (curr = 0; next < len; curr = next) {
526 c = fl_utf8decode(text + curr, text + next, &nb);
527 if ((cu = fl_toupper(c)) == c) {
530 if (fl_nonspacing(cu) == 0) {
532 width += (int)fl_width(text + curr, next - curr);
536 nb = fl_utf8encode(cu, chbuf);
537 fl_font(ff->
font, sc_fontsize);
538 if (fl_nonspacing(cu) == 0) {
540 width += (int)fl_width(chbuf, nb);
546 width = (int) fl_width (text, len);
549 int curr = 0, next = 0;
553 c = fl_utf8decode(text + curr, text + next, &nb);
554 if (fl_nonspacing(c) == 0)
571 newstr = (
char*) malloc(3 * len + 1);
572 newlen = fl_utf_toupper((
const unsigned char*)text, len, newstr);
573 assert(newlen <= 3 * len);
574 newstr[newlen] =
'\0';
586 newstr = (
char*) malloc(3 * len + 1);
587 newlen = fl_utf_tolower((
const unsigned char*)text, len, newstr);
588 assert(newlen <= 3 * len);
589 newstr[newlen] =
'\0';
596 return fl_utf8fwd (&text[idx + 1], text, &text[strlen (text)]) - text;
601 return fl_utf8back (&text[idx - 1], text, &text[strlen (text)]) - text;
606 float horizontal, vertical;
608 Fl::screen_dpi(horizontal, vertical);
614 float horizontal, vertical;
616 Fl::screen_dpi(horizontal, vertical);
662 idleFunc->
func = func;
671 container::typed::Iterator <IdleFunc> it;
676 if (idleFunc->
id == idleId) {
705 Fl::copy(text, strlen(text), 0);
709 int width,
int height,
double gamma)
711 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 implemtation 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.