25#include <FL/fl_draw.H>
28#include "../lout/msg.h"
46 fl_delete_offscreen (offscreen);
51 if (!created || w > this->w || h > this->h) {
55 fl_delete_offscreen (offscreen);
56 offscreen = fl_create_offscreen (w, h);
65 Fl_Group (x, y, w, h, label)
99 if ((d & FL_DAMAGE_USER1) && !(d & FL_DAMAGE_EXPOSE)) {
100 lout::container::typed::Iterator <core::Rectangle> it;
107 d &= ~FL_DAMAGE_USER1;
110 if (d & FL_DAMAGE_CHILD) {
112 d &= ~FL_DAMAGE_CHILD;
122 if (d == FL_DAMAGE_SCROLL) {
140 if (X > x () + w () || Y > y () + h ())
143 W = X + rect->
width > x () + w () ? x () + w () - X : rect->
width;
144 H = Y + rect->
height > y () + h () ? y () + h () - Y : rect->
height;
146 fl_clip_box(X, Y, W,
H, X, Y, W,
H);
162 fl_rectf (X, Y, W,
H);
171 fl_push_clip (X, Y, W,
H);
173 fl_rectf (X, Y, W,
H);
178 fl_rectf (X, Y, W,
H);
189 for (
int i = children () - 1; i >= 0; i--) {
190 Fl_Widget& w = *child(i);
193 if (w.damage() & DAMAGE_CHILD_LABEL) {
194 draw_outside_label(w);
195 w.set_damage(w.damage() & ~DAMAGE_CHILD_LABEL);
204 int s1 = Fl::event_state ();
226 Fl_Widget *old_child = NULL;
228 if (
this == Fl::focus()) {
231 if (!(Fl::event_state() & FL_SHIFT)) {
232 for (i = 0; i < children(); i++) {
233 if (child(i)->take_focus()) {
239 for (i = children() - 1; i >= 0; i--) {
240 if (child(i)->take_focus()) {
248 old_child = Fl::focus();
250 if (!(ret = Fl_Group::handle (FL_KEYBOARD))) {
256 i = find(Fl::focus());
260 if (i >= 0 && i < children()) {
261 Fl_Widget *c = child(i);
266 canvasX, canvasY, c->w(), c->h());
278 r.
width = old_child->w();
279 r.
height = old_child->h();
306 _MSG(
"PUSH => %s\n", processed ?
"true" :
"false");
309 if (Fl::event_button() != FL_RIGHT_MOUSE)
320 _MSG(
"RELEASE => %s\n", processed ?
"true" :
"false");
332 _MSG(
"MOVE => %s\n", processed ?
"true" :
"false");
342 _MSG(
"DRAG => %s\n", processed ?
"true" :
"false");
366 if (find(Fl::focus()) < children())
368 else if (Fl::focus() ==
this)
372 if (Fl::event_key() == FL_Tab)
378 return Fl_Group::handle (event);
398 static Fl_Cursor mapDwToFltk[] = {
416 fl_cursor (mapDwToFltk[cursor]);
437 damage (FL_DAMAGE_USER1);
442 damage (FL_DAMAGE_EXPOSE);
457 int x1,
int y1,
int x2,
int y2)
459 fl_color(((
FltkColor*)color)->colors[shading]);
474 int x1,
int y1,
int x2,
int y2)
476 char dashes[3], w, ng, d, gap, len;
479 w = (width == 1) ? 0 : width;
482 len = (x2 == x1) ? y2 - y1 + 1 : (y2 == y1) ? x2 - x1 + 1 : 0;
485 gap = ng ? d/ng + (w > 3 ? 2 : 0) : 0;
486 dashes[0] = 1; dashes[1] = f*width-gap; dashes[2] = 0;
487 fl_line_style(FL_DASH + FL_CAP_ROUND, w, dashes);
494 fl_line_style(FL_DASH + FL_CAP_ROUND, w);
497 fl_color(((
FltkColor*)color)->colors[shading]);
498 drawLine (color, shading, x1, y1, x2, y2);
501 fl_line_style(FL_SOLID);
507 int X,
int Y,
int width,
int height)
509 fl_color(((
FltkColor*)color)->colors[shading]);
536 fl_rectf (x1, y1, x2 - x1, y2 - y1);
538 fl_rect (x1, y1, x2 - x1, y2 - y1);
543 int centerX,
int centerY,
int width,
int height,
544 int angle1,
int angle2)
546 fl_color(((
FltkColor*)color)->colors[shading]);
550 fl_arc(x, y, width, height, angle1, angle2);
554 fl_pie(x, y, width, height, angle1, angle2);
564 fl_color(((
FltkColor*)color)->colors[shading]);
570 fl_begin_complex_polygon();
574 for (
int i = 0; i < npoints; i++) {
582 fl_end_complex_polygon();
615 int X,
int Y,
const char *text,
int len)
624 fl_color(((
FltkColor*)color)->colors[shading]);
633 int curr = 0, next = 0, nb;
639 for (curr = 0; next < len; curr = next) {
641 c = fl_utf8decode(text + curr, text + next, &nb);
642 if ((cu = fl_toupper(c)) == c) {
645 width = (int)fl_width(text + curr, next - curr);
648 fl_draw(text + curr, next - curr, viewX, viewY);
652 nb = fl_utf8encode(cu, chbuf);
653 fl_font(ff->
font, sc_fontsize);
654 width = (int)fl_width(chbuf, nb);
657 fl_draw(chbuf, nb, viewX, viewY);
664 width = (int)fl_width(text + curr, next - curr);
667 fl_draw(text + curr, next - curr, viewX, viewY);
682 int X,
int Y,
int W,
int H,
687 fl_color(((
FltkColor*)color)->colors[shading]);
690 W,
H, FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_WRAP, NULL, 0);
694 int X,
int Y,
int width,
int height)
699 X, Y, width, height);
731 draw_child (*widget);
732 draw_outside_label(*widget);
The platform independent interface for image buffers.
The central class for managing and drawing a widget tree.
void enterNotify(View *view, int x, int y, ButtonState state)
This function is called by a view, to delegate a enter notify event.
bool motionNotify(View *view, int x, int y, ButtonState state)
This function is called by a view, to delegate a motion notify event.
void leaveNotify(View *view, ButtonState state)
This function is called by a view, to delegate a leave notify event.
void expose(View *view, Rectangle *area)
int nextGlyph(const char *text, int idx)
void viewportSizeChanged(View *view, int width, int height)
bool buttonRelease(View *view, int numPressed, int x, int y, ButtonState state, int button)
This function is called by a view, to delegate a button press event.
void scrollTo(HPosition hpos, VPosition vpos, int x, int y, int width, int height)
Scrolls all viewports, so that the region [x, y, width, height] is seen, according to hpos and vpos.
bool buttonPress(View *view, int numPressed, int x, int y, ButtonState state, int button)
This function is called by a view, to delegate a button press event.
dw::core::Shape implemtation for simple rectangles.
void addRectangle(Rectangle *r)
Add a rectangle to the region and combine it with existing rectangles if possible.
lout::container::typed::Iterator< Rectangle > rectangles()
An interface to encapsulate platform dependent drawing.
virtual bool usesViewport()=0
Return, whether this view uses a viewport.
void setSize(int w, int h)
void setBgColor(core::style::Color *color)
Set the background of the view.
virtual int translateCanvasXToViewX(int x)=0
void clipPoint(int *x, int *y, int border)
FltkViewBase(int x, int y, int w, int h, const char *label=0)
void drawTypedLine(core::style::Color *color, core::style::Color::Shading shading, core::style::LineType type, int width, int x1, int y1, int x2, int y2)
void queueDraw(core::Rectangle *area)
Queue a region, which is given in canvas coordinates, for drawing.
void drawRectangle(core::style::Color *color, core::style::Color::Shading shading, bool filled, int x, int y, int width, int height)
static bool backBufferInUse
void drawLine(core::style::Color *color, core::style::Color::Shading shading, int x1, int y1, int x2, int y2)
void startDrawing(core::Rectangle *area)
Called before drawing.
void cancelQueueDraw()
Cancel a draw queue request.
void drawArc(core::style::Color *color, core::style::Color::Shading shading, bool filled, int centerX, int centerY, int width, int height, int angle1, int angle2)
Fl_Widget * focused_child
void drawPoint(core::style::Color *color, core::style::Color::Shading shading, int x, int y)
void setCanvasSize(int width, int ascent, int descent)
Set the canvas size.
static BackBuffer * backBuffer
void finishDrawing(core::Rectangle *area)
Called after drawing.
void drawPolygon(core::style::Color *color, core::style::Color::Shading shading, bool filled, bool convex, core::Point *points, int npoints)
void setLayout(core::Layout *layout)
This methods notifies the view, that it has been attached to a layout.
void setBufferedDrawing(bool b)
void mergeClippingView(core::View *clippingView)
core::View * getClippingView(int x, int y, int width, int height)
virtual int translateViewXToCanvasX(int x)=0
virtual int translateCanvasYToViewY(int y)=0
void queueDrawTotal()
Queue the total viewport for drawing.
void setCursor(core::style::Cursor cursor)
Set the cursor appearance.
virtual int translateViewYToCanvasY(int y)=0
core::Rectangle * exposeArea
static core::Imgbuf * imgbuf
@ FONT_VARIANT_SMALL_CAPS
ButtonState
Platform independent representation.
core::ButtonState getDwButtonState()
Dw is in this namespace, or sub namespaces of this one.
This namespace provides thin wrappers, implemented as C++ templates, to gain type-safety.
Here, some common classes (or interfaces) are defined, to standardize the access to other classes.
Represents the allocation, i.e.