Dillo v3.2.0-143-gabad1053
Loading...
Searching...
No Matches
image.hh
Go to the documentation of this file.
1/*
2 * Dillo Widget
3 *
4 * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
5 * Copyright 2024-2025 Rodrigo Arias Mallo <rodarima@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __DW_IMAGE_HH__
22#define __DW_IMAGE_HH__
23
24#include "core.hh"
25
26namespace dw {
27
44{
45private:
47 private:
49 public:
51 int link;
52
53 ~ShapeAndLink () { if (shape) delete shape; };
54 };
55
56 lout::container::typed::List <ShapeAndLink> *shapesAndLinks;
58 public:
59 ImageMap ();
60 ~ImageMap ();
61
62 void draw (core::View *view, core::style::Style *style, int x, int y);
63 void add (core::Shape *shape, int link);
65 int link (int x, int y);
66 };
67
68 lout::container::typed::HashTable <lout::object::Object, ImageMap>
71
72public:
75
77 void addShapeToCurrentMap (core::Shape *shape, int link);
80 core::style::Style *style, int x, int y);
81 int link (lout::object::Object *key, int x, int y);
82};
83
140{
141private:
142 char *altText;
150 bool isMap;
151
156
157protected:
162
163 void draw (core::View *view, core::Rectangle *area,
164 core::DrawingContext *context);
165
173
174 //core::Iterator *iterator (Content::Type mask, bool atEnd);
175
176public:
177 static int CLASS_ID;
178
179 Image(const char *altText, bool markEmpty = false);
180 ~Image();
181
182 // For images, the minimal width is not well defined, and
183 // correction of the size makes not much sense.
184 virtual bool getAdjustMinWidth () { return false; }
185
186 core::Iterator *iterator (core::Content::Type mask, bool atEnd);
187
188 inline core::Imgbuf *getBuffer () { return buffer; }
189 void setBuffer (core::Imgbuf *buffer, bool resize = false);
190
191 void drawRow (int row);
192
193 void finish ();
194 void fatal ();
195
196 void setIsMap ();
197 void setUseMap (ImageMapsList *list, Object *key);
198
199 /* This is a hack for the perhaps frivolous feature of drawing image map
200 * shapes when there is no image to display. If the map is defined after
201 * an image using an image map, and the actual image data has not been
202 * loaded, tell the image to redraw.
203 */
204 void forceMapRedraw () { if (mapKey && ! buffer) queueDraw (); };
205};
206
207} // namespace dw
208
209#endif // __DW_IMAGE_HH__
void setDefaultLink(int link)
Definition image.hh:64
void add(core::Shape *shape, int link)
Definition image.cc:57
int link(int x, int y)
Definition image.cc:64
void draw(core::View *view, core::style::Style *style, int x, int y)
Definition image.cc:45
lout::container::typed::List< ShapeAndLink > * shapesAndLinks
Definition image.hh:56
Represents a list of client-side image maps.
Definition image.hh:44
void drawMap(lout::object::Object *key, core::View *view, core::style::Style *style, int x, int y)
Definition image.cc:124
ImageMap * currentMap
Definition image.hh:70
void addShapeToCurrentMap(core::Shape *shape, int link)
Add a shape to the current map-.
Definition image.cc:111
void startNewMap(lout::object::Object *key)
Start a new map and make it the current one.
Definition image.cc:99
lout::container::typed::HashTable< lout::object::Object, ImageMap > * imageMaps
Definition image.hh:69
void setCurrentMapDefaultLink(int link)
Set default link for current map-.
Definition image.cc:119
int link(lout::object::Object *key, int x, int y)
Definition image.cc:133
Displays an instance of dw::core::Imgbuf.
Definition image.hh:140
void setIsMap()
Sets image as server side image map.
Definition image.cc:571
void setUseMap(ImageMapsList *list, Object *key)
Sets image as client side image map.
Definition image.cc:584
core::Iterator * iterator(core::Content::Type mask, bool atEnd)
Return an iterator for this widget.
Definition image.cc:507
int contentY(core::MousePositionEvent *event)
Definition image.cc:376
void finish()
Called, when all image data has been retrieved.
Definition image.cc:557
core::Imgbuf * buffer
Definition image.hh:143
void drawRow(int row)
Called, when data from a row is available and has been copied into the image buffer.
Definition image.cc:545
ImageMapsList * mapList
Definition image.hh:148
core::Imgbuf * getBuffer()
Definition image.hh:188
void sizeAllocateImpl(core::Allocation *allocation)
See Sizes of Dillo Widgets.
Definition image.cc:289
bool useAltStyle
Definition image.hh:153
core::style::Style * altStyle
Definition image.hh:154
bool buttonReleaseImpl(core::EventButton *event)
Definition image.cc:426
void sizeRequestSimpl(core::Requisition *requisition)
Simple variant, to be implemented by widgets with sizes not depending on positions.
Definition image.cc:186
static int CLASS_ID
Definition image.hh:177
void containerSizeChangedForChildren()
Definition image.cc:334
bool isMap
Definition image.hh:150
bool markEmpty
Definition image.hh:152
void forceMapRedraw()
Definition image.hh:204
bool buttonPressImpl(core::EventButton *event)
Definition image.cc:409
void fatal()
Called, when there are problems with the retrieval of image data.
Definition image.cc:562
core::style::Style * savedStyle
Definition image.hh:155
int contentX(core::MousePositionEvent *event)
Definition image.cc:368
void getExtremesSimpl(core::Extremes *extremes)
Simple variant, to be implemented by widgets with extremes not depending on positions.
Definition image.cc:256
void setBuffer(core::Imgbuf *buffer, bool resize=false)
Called, when an image buffer is attached.
Definition image.cc:514
Object * mapKey
Definition image.hh:149
bool clicking
Definition image.hh:146
void enterNotifyImpl(core::EventCrossing *event)
Definition image.cc:341
int altTextWidth
Definition image.hh:145
int bufWidth
Definition image.hh:144
virtual bool getAdjustMinWidth()
Definition image.hh:184
void leaveNotifyImpl(core::EventCrossing *event)
Definition image.cc:352
bool motionNotifyImpl(core::EventMotion *event)
Definition image.cc:384
char * altText
Definition image.hh:142
int bufHeight
Definition image.hh:144
void draw(core::View *view, core::Rectangle *area, core::DrawingContext *context)
Area is given in widget coordinates.
Definition image.cc:440
int currLink
Definition image.hh:147
Set at the top when drawing.
Definition types.hh:295
Represents a button press or release event.
Definition events.hh:58
Represents a enter or leave notify event.
Definition events.hh:75
Represents a mouse motion event.
Definition events.hh:68
The platform independent interface for image buffers.
Definition imgbuf.hh:162
Iterators are used to iterate through the contents of a widget.
Definition iterator.hh:20
Base class for all mouse events related to a specific position.
Definition events.hh:49
dw::core::Shape implementation for simple rectangles.
Definition types.hh:70
Abstract interface for different shapes.
Definition types.hh:59
An interface to encapsulate platform dependent drawing.
Definition view.hh:17
The base class of all dillo widgets.
Definition widget.hh:44
Extremes extremes
Analogue to dw::core::Widget::requisition.
Definition widget.hh:166
Allocation allocation
The current allocation: size and position, always relative to the canvas.
Definition widget.hh:204
Requisition requisition
Size_request() stores the result of the last call of size_request_impl().
Definition widget.hh:160
void queueDraw()
Definition widget.hh:304
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:45
Dw is in this namespace, or sub namespaces of this one.
Represents the allocation, i.e.
Definition types.hh:164