26#include "../lout/msg.h"
27#include "../lout/debug.hh"
28#include "../lout/misc.hh"
46 getRefArea (x, y, width, height);
55 - (
layout->canvasHeightGreater ?
56 layout->vScrollbarThickness : 0),
59 -
layout->hScrollbarThickness,
76 return layout->bgAttachment;
81 return layout->bgPositionX;
86 return layout->bgPositionY;
91 layout->queueDraw (x, y, width, height);
107 int signalNo,
int argc,
113 case CANVAS_SIZE_CHANGED:
115 ((
Integer*)argv[1])->getValue (),
116 ((
Integer*)argv[2])->getValue ());
133 Object *argv[1] = { &ec };
134 emitVoid (RESIZE_QUEUED, 1, argv);
138 int ascent,
int descent)
140 Integer w (width), a (ascent), d (descent);
141 Object *argv[3] = { &w, &a, &d };
142 emitVoid (CANVAS_SIZE_CHANGED, 3, argv);
174 int signalNo,
int argc,
182 ((
Integer*)argv[1])->getValue (),
183 ((
Integer*)argv[2])->getValue (),
184 ((
Integer*)argv[3])->getValue (),
185 ((
Integer*)argv[4])->getValue ());
189 ((
Integer*)argv[1])->getValue (),
190 ((
Integer*)argv[2])->getValue (),
191 ((
Integer*)argv[3])->getValue (),
192 ((
Integer*)argv[4])->getValue (),
197 ((
Integer*)argv[1])->getValue (),
198 ((
Integer*)argv[2])->getValue (),
199 ((
Integer*)argv[3])->getValue (),
200 ((
Integer*)argv[4])->getValue (),
205 ((
Integer*)argv[1])->getValue (),
206 ((
Integer*)argv[2])->getValue (),
207 ((
Integer*)argv[3])->getValue (),
208 ((
Integer*)argv[4])->getValue (),
220 Integer ilink (link), iimg (img), ix (x), iy (y);
221 Object *argv[5] = { widget, &ilink, &iimg, &ix, &iy };
222 return emitBool (ENTER, 5, argv);
228 Integer ilink (link), iimg (img), ix (x), iy (y);
229 Object *argv[6] = { widget, &ilink, &iimg, &ix, &iy,
event };
230 return emitBool (PRESS, 6, argv);
236 Integer ilink (link), iimg (img), ix (x), iy (y);
237 Object *argv[6] = { widget, &ilink, &iimg, &ix, &iy,
event };
238 return emitBool (RELEASE, 6, argv);
244 Integer ilink (link), iimg (img), ix (x), iy (y);
245 Object *argv[6] = { widget, &ilink, &iimg, &ix, &iy,
event };
246 return emitBool (CLICK, 6, argv);
291 new container::typed::HashTable <object::String, Anchor> (
true,
true);
461 MSG_ERR(
"attachView: Multiple views for layout!\n");
512 if (this->view !=
view) {
513 MSG_ERR(
"detachView: this->view: %p view %p\n",
514 (
void *) this->view, (
void *)
view);
539 int x,
int y,
int width,
int height)
541 scrollTo0 (hpos, vpos, x, y, width, height,
true);
545 int x,
int y,
int width,
int height,
546 bool scrollingInterrupted)
549 _MSG(
"scrollTo (%d, %d, %s)\n",
550 x, y, scrollingInterrupted ?
"true" :
"false");
571 bool xChanged =
true;
595 bool yChanged =
true;
619 if (xChanged || yChanged) {
645 int *value,
int viewportSize)
647 if (requestedSize > viewportSize) {
652 if (*value >= requestedValue &&
653 *value + viewportSize < requestedValue + requestedSize)
656 requestedSize = viewportSize;
659 if (requestedValue < *value) {
660 *value = requestedValue;
662 }
else if (requestedValue + requestedSize > *value + viewportSize) {
663 *value = requestedValue - viewportSize + requestedSize;
674 Rectangle widgetArea, intersection, widgetDrawArea;
739 _MSG(
"setAnchor (%s)\n", anchor);
778 assert (anchor->
widget == widget);
798 if (anchor == NULL) {
811 if (
cursor != this->cursor) {
850 this->bgImage->
unref ();
887 MSG_ERR(
"Please file a bug report with the complete console output\n");
902 Widget *widget = it.getNext ();
933 DBG_OBJ_MSGF (
"resize", 1,
"toplevel size: %d * (%d + %d)",
945 allocation.
x = allocation.
y = 0;
975 currHThickness, currVThickness);
1004 int ex,
int ey,
int ewidth,
int eheight) {
1006 if (x == ex && y == ey && width == ewidth && height == eheight)
1017 int ix2 =
misc::min (x + width, ex + ewidth);
1018 int iy2 =
misc::min (y + height, ey + eheight);
1021 queueDraw (x, iy2, width, y + height - iy2);
1023 queueDraw (ix2, iy1, x + width - ix2, iy2 - iy1);
1029 extremesChanged ?
"true" :
"false");
1056 event.state = state;
1057 event.button = button;
1058 event.numPressed = numPressed;
1077 event.state = state;
1096 event.state = state;
1097 event.lastWidget = lastWidget;
1118 event.state = state;
1119 event.lastWidget = lastWidget;
1133 DBG_OBJ_ENTER (
"events", 0,
"getWidgetAtPoint",
"%d, %d", x, y);
1155 newWidgetAtPoint, state);
1159 int trackLen, i, i_a;
1169 else if (newWidgetAtPoint)
1181 if (newWidgetAtPoint)
1183 for (w = newWidgetAtPoint; w != ancestor; w = w->
getParent ())
1186 track =
new Widget* [trackLen];
1193 track[i++] = ancestor;
1194 if (newWidgetAtPoint) {
1197 for (w = newWidgetAtPoint; w != ancestor; w = w->
getParent ())
1202 for (i = 0; i < trackLen; i++)
1203 MSG(
"%s%p ", i == i_a ?
">" :
"", track[i]);
1204 MSG(
"] %s\n", newWidgetAtPoint ?
"" :
"nil");
1208 for (i = 0; i < trackLen; i++) {
1209 crossingEvent.
state = state;
1214 }
else if (i == i_a) {
1218 if (i_a == trackLen-1 && !newWidgetAtPoint)
1221 (i_a == trackLen-1 && newWidgetAtPoint))
1259 event->xCanvas = maxX;
1268 event->yCanvas = maxY;
1273 for (; widget; widget = widget->
getParent ()) {
1323 DBG_OBJ_ENTER (
"resize", 0,
"viewportSizeChanged",
"%p, %d, %d",
1324 view, width, height);
Set at the top when drawing.
Represents a enter or leave notify event.
Represents a mouse motion event.
void setWidget(Widget *widget)
Set at the top when getting the widget at the point.
Iterators are used to iterate through the contents of a widget.
virtual void unref()
Delete the iterator.
virtual bool next()=0
Move iterator forward and store content it.
bool emitToReceiver(lout::signal::Receiver *receiver, int signalNo, int argc, lout::object::Object **argv)
A sub class must implement this for a call to a single receiver.
void emitResizeQueued(bool extremesChanged)
void emitCanvasSizeChanged(int width, int ascent, int descent)
void draw(int x, int y, int width, int height)
Draw (or queue for drawing) an area, which is given in canvas coordinates.
void getBgArea(int *x, int *y, int *width, int *height)
Return the area covered by the background image.
style::BackgroundRepeat getBackgroundRepeat()
style::BackgroundAttachment getBackgroundAttachment()
void getRefArea(int *xRef, int *yRef, int *widthRef, int *heightRef)
Return the "reference area".
style::Length getBackgroundPositionX()
style::Length getBackgroundPositionY()
style::StyleImage * getBackgroundImage()
bool readyToDraw()
If this method returns false, nothing is done at all.
bool emitEnter(Widget *widget, int link, int img, int x, int y)
bool emitToReceiver(lout::signal::Receiver *receiver, int signalNo, int argc, lout::object::Object **argv)
A sub class must implement this for a call to a single receiver.
bool emitPress(Widget *widget, int link, int img, int x, int y, EventButton *event)
bool emitRelease(Widget *widget, int link, int img, int x, int y, EventButton *event)
bool emitClick(Widget *widget, int link, int img, int x, int y, EventButton *event)
virtual bool click(Widget *widget, int link, int img, int x, int y, EventButton *event)
Called, when the user has clicked on a link.
virtual bool press(Widget *widget, int link, int img, int x, int y, EventButton *event)
Called, when the user has pressed the mouse button on a link (but not yet released).
virtual bool release(Widget *widget, int link, int img, int x, int y, EventButton *event)
Called, when the user has released the mouse button on a link.
virtual bool enter(Widget *widget, int link, int img, int x, int y)
Called, when a link is entered, left, or the position has changed.
Receiver interface different signals.
virtual void resizeQueued(bool extremesChanged)
virtual void canvasSizeChanged(int width, int ascent, int descent)
void attachView(View *view)
Attach a view to the layout.
lout::misc::ZoneAllocator * textZone
void changeAnchor(Widget *widget, char *name, int y)
void detachWidget(Widget *widget)
int currHScrollbarThickness()
bool emitLinkRelease(Widget *w, int link, int img, int x, int y, EventButton *event)
void setCursor(style::Cursor cursor)
void enterNotify(View *view, int x, int y, ButtonState state)
This function is called by a view, to delegate a enter notify event.
void queueDraw(int x, int y, int width, int height)
bool scrollIdleNotInterrupted
Widget * getWidgetAtPoint(int x, int y)
void containerSizeChanged()
bool motionNotify(View *view, int x, int y, ButtonState state)
This function is called by a view, to delegate a motion notify event.
void setWidget(Widget *widget)
bool processMouseEvent(MousePositionEvent *event, ButtonEventType type)
Common processing of press, release and motion events.
style::StyleImage * bgImage
void setBgColor(style::Color *color)
void detachView(View *view)
void moveToWidgetAtPoint(int x, int y, ButtonState state)
Emit the necessary crossing events, when the mouse pointer has moved to position (x,...
char * addAnchor(Widget *widget, const char *name)
Used, when the widget is not allocated yet.
void leaveNotify(View *view, ButtonState state)
This function is called by a view, to delegate a leave notify event.
lout::container::typed::HashTable< lout::object::String, Anchor > * anchorsTable
void queueDrawExcept(int x, int y, int width, int height, int ex, int ey, int ewidth, int eheight)
VPosition scrollTargetVpos
void viewportSizeChanged(View *view, int width, int height)
HPosition scrollTargetHpos
lout::container::typed::Vector< Widget > * queueResizeList
void addWidget(Widget *widget)
bool buttonEvent(ButtonEventType type, View *view, int numPressed, int x, int y, ButtonState state, int button)
SelectionState selectionState
void draw(View *view, Rectangle *area)
void moveToWidget(Widget *newWidgetAtPoint, ButtonState state)
void setBgImage(style::StyleImage *bgImage, style::BackgroundRepeat bgRepeat, style::BackgroundAttachment bgAttachment, style::Length bgPositionX, style::Length bgPositionY)
void moveOutOfView(ButtonState state)
Emit the necessary crossing events, when the mouse pointer has moved out of the view.
bool emitLinkPress(Widget *w, int link, int img, int x, int y, EventButton *event)
FindtextState findtextState
style::BackgroundRepeat bgRepeat
void scrollTo0(HPosition hpos, VPosition vpos, int x, int y, int width, int height, bool scrollingInterrupted)
void removeAnchor(Widget *widget, char *name)
style::BackgroundAttachment bgAttachment
static bool calcScrollInto(int targetValue, int requestedSize, int *value, int viewportSize)
void scrollPosChanged(View *view, int x, int y)
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.
void scroll(ScrollCommand)
style::Length bgPositionX
style::Length bgPositionY
int currVScrollbarThickness()
Layout(Platform *platform)
void setAnchor(const char *anchor)
Sets the anchor to scroll to.
void queueResize(bool extremesChanged)
LayoutImgRenderer * layoutImgRenderer
Base class for all mouse events related to a specific position.
dw::core::Shape implemtation for simple rectangles.
bool intersectsWith(Rectangle *otherRect, Rectangle *dest)
Return whether this rectangle and otherRect intersect.
void setLayout(Layout *layout)
See Handling stacking contexts.
An interface to encapsulate platform dependent drawing.
virtual void setViewportSize(int width, int height, int hScrollbarThickness, int vScrollbarThickness)=0
Set the viewport size.
virtual void queueDraw(Rectangle *area)=0
Queue a region, which is given in canvas coordinates, for drawing.
virtual void startDrawing(Rectangle *area)=0
Called before drawing.
virtual int getScrollbarOnLeft()=0
virtual void scroll(ScrollCommand)
Scroll the viewport as commanded.
virtual int getHScrollbarThickness()=0
Get the thickness of the horizontal scrollbar, when it is visible.
virtual void setCanvasSize(int width, int ascent, int descent)=0
Set the canvas size.
virtual void finishDrawing(Rectangle *area)=0
Called after drawing.
virtual void queueDrawTotal()=0
Queue the total viewport for drawing.
virtual void setCursor(style::Cursor cursor)=0
Set the cursor appearance.
virtual bool usesViewport()=0
Return, whether this view uses a viewport.
virtual int getVScrollbarThickness()=0
Get the thickness of the vertical scrollbar, when it is visible.
virtual void setBgColor(style::Color *color)=0
Set the background of the view.
virtual void cancelQueueDraw()=0
Cancel a draw queue request.
virtual void scrollTo(int x, int y)=0
Scroll the vieport to the given position.
virtual void setLayout(Layout *layout)=0
This methods notifies the view, that it has been attached to a layout.
void putExternalImgRenderer(ImgRenderer *ir)
Add an additional ImgRenderer, especially used for drawing.
void removeExternalImgRenderer(ImgRenderer *ir)
Remove a previously added additional ImgRenderer.
Typed version of container::untyped::Vector.
A simple allocator optimized to handle many small chunks of memory.
An object::Object wrapper for bool's.
An object::Object wrapper for int's.
This is the base class for many other classes, which defines very common virtual methods.
An object::Object wrapper for strings (char*).
The base class for signal receiver base classes.
#define DBG_OBJ_ENTER0(aspect, prio, funname)
#define DBG_OBJ_CREATE(klass)
#define DBG_OBJ_SET_SYM(var, val)
#define DBG_OBJ_MSGF(aspect, prio, fmt,...)
#define DBG_OBJ_SET_NUM(var, val)
#define DBG_OBJ_ENTER(aspect, prio, funname, fmt,...)
#define DBG_OBJ_ASSOC(parent, child)
#define DBG_OBJ_ASSOC_CHILD(child)
#define DBG_OBJ_SET_PTR_O(obj, var, val)
char * dStrdup(const char *s)
void drawBackgroundImage(View *view, StyleImage *backgroundImage, BackgroundRepeat backgroundRepeat, BackgroundAttachment backgroundAttachment, Length backgroundPositionX, Length backgroundPositionY, int x, int y, int width, int height, int xRef, int yRef, int widthRef, int heightRef)
int Length
Type for representing all lengths within dw::core::style.
ButtonState
Platform independent representation.
Dw is in this namespace, or sub namespaces of this one.
This namespace contains a framework for container classes, which members are instances of object::Obj...
Here, some common classes (or interfaces) are defined, to standardize the access to other classes.
Represents the allocation, i.e.
@ WIDGET_IN_FLOW
widget in normal flow, so that this widget (containing this content) is both container (parent) and g...
@ WIDGET_OOF_CONT
widget out of flow (OOF); this widget (containing this content) is only the container (parent),...