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);
136 if (strlen(big) >= strlen(little) &&
138 *(big + strlen(big) - strlen(little)) =
'\0';
146 int k = Fl::set_fonts (
"-*-iso10646-1");
147 for (
int i = 0; i < k; i++) {
149 char *
name =
dStrdup (Fl::get_font_name ((Fl_Font) i, &t));
157 _MSG(
"Found font: %s%s%s\n",
name, t & FL_BOLD ?
" bold" :
"",
158 t & FL_ITALIC ?
" italic" :
"");
165 family->
set ((Fl_Font) i, t);
170 family =
new FontFamily ((Fl_Font) i, -1, -1, -1);
171 family->
set ((Fl_Font) i, t);
194 return family->
get (attrs);
284 _MSG(
"FltkTooltip::onEnter\n");
295 tt_window =
new Fl_Menu_Window(0,0,100,24);
298 Fl_Box *b =
new Fl_Box(0,0,100,24);
299 b->box(FL_BORDER_BOX);
300 b->color(fl_color_cube(FL_NUM_RED-1, FL_NUM_GREEN-1, FL_NUM_BLUE-2));
301 b->labelcolor(FL_BLACK);
302 b->labelfont(FL_HELVETICA);
304 b->align(FL_ALIGN_WRAP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
311 Fl_Box *box = (Fl_Box*)
tt_window->child(0);
313 Fl::get_mouse(x,y); y += 6;
317 box->measure_label(ww, hh);
318 ww += 6 + 2 * Fl::box_dx(box->box());
319 hh += 6 + 2 * Fl::box_dy(box->box());
355 Fl_Widget *widget = Fl::belowmouse();
356 if (widget && widget->window()) {
357 widget->window()->damage(FL_DAMAGE_EXPOSE,0,0,1,1);
403 selectionMode,
int rows)
418 const char *placeholder)
427 const char *placeholder)
456 idleQueue =
new container::typed::List <IdleFunc> (
true);
461 resources =
new container::typed::List <ui::FltkResource> (
false);
486 MSG_ERR(
"FltkPlatform::attachView: multiple views!\n");
489 for (container::typed::Iterator <ui::FltkResource> it =
490 resources->iterator (); it.hasNext (); ) {
499 if (this->view !=
view)
500 MSG_ERR(
"FltkPlatform::detachView: this->view: %p view: %p\n",
501 (
void *) this->view, (
void *)
view);
503 for (container::typed::Iterator <ui::FltkResource> it =
504 resources->iterator (); it.hasNext (); ) {
519 int curr = 0, next = 0, nb;
523 for (curr = 0; next < len; curr = next) {
525 c = fl_utf8decode(text + curr, text + next, &nb);
526 if ((cu = fl_toupper(c)) == c) {
529 if (fl_nonspacing(cu) == 0) {
531 width += (int)fl_width(text + curr, next - curr);
535 nb = fl_utf8encode(cu, chbuf);
536 fl_font(ff->
font, sc_fontsize);
537 if (fl_nonspacing(cu) == 0) {
539 width += (int)fl_width(chbuf, nb);
545 width = (int) fl_width (text, len);
548 int curr = 0, next = 0;
552 c = fl_utf8decode(text + curr, text + next, &nb);
553 if (fl_nonspacing(c) == 0)
570 newstr = (
char*) malloc(3 * len + 1);
571 newlen = fl_utf_toupper((
const unsigned char*)text, len, newstr);
572 assert(newlen <= 3 * len);
573 newstr[newlen] =
'\0';
585 newstr = (
char*) malloc(3 * len + 1);
586 newlen = fl_utf_tolower((
const unsigned char*)text, len, newstr);
587 assert(newlen <= 3 * len);
588 newstr[newlen] =
'\0';
595 return fl_utf8fwd (&text[idx + 1], text, &text[strlen (text)]) - text;
600 return fl_utf8back (&text[idx - 1], text, &text[strlen (text)]) - text;
605 float horizontal, vertical;
607 Fl::screen_dpi(horizontal, vertical);
613 float horizontal, vertical;
615 Fl::screen_dpi(horizontal, vertical);
661 idleFunc->
func = func;
670 container::typed::Iterator <IdleFunc> it;
675 if (idleFunc->
id == idleId) {
704 Fl::copy(text, strlen(text), 0);
708 int width,
int height,
double gamma)
710 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.