76 #include "render/graphics.h" 101 "scrollbuttons_pressed.xml" 107 const std::string &skin) :
118 mUpButtonScrollAmount(10),
119 mDownButtonScrollAmount(10),
120 mLeftButtonScrollAmount(10),
121 mRightButtonScrollAmount(10),
122 mHorizontalMarkerDragOffset(0),
123 mVerticalMarkerDragOffset(0),
134 mUpButtonPressed(false),
135 mDownButtonPressed(false),
136 mLeftButtonPressed(false),
137 mRightButtonPressed(false),
138 mIsVerticalMarkerDragged(false),
139 mIsHorizontalMarkerDragged(false),
165 for (
int i = 0; i < 2; i ++)
192 for (
int f = 0; f < 9; f ++)
202 if (skinName.empty())
203 skinName =
"scroll_background.xml";
204 if (
theme !=
nullptr)
208 "scroll_background.xml",
217 "scroll_highlighted.xml",
222 "scroll_vbackground.xml",
227 "scroll_hbackground.xml",
233 for (
int i = 0; i < 2; i ++)
235 Skin *skin =
nullptr;
236 if (
theme !=
nullptr)
248 if (rect.
grid[f] !=
nullptr)
264 if (
theme !=
nullptr)
287 if (content !=
nullptr)
327 for (
int a = 0; a < 9; a++)
384 const bool redraw = graphics->
getRedraw();
527 logger->
log(
"ScrollArea::drawButton unknown dir: " 540 if (image !=
nullptr)
550 if (image !=
nullptr)
762 const unsigned int frameSize = 2 *
mFrameSize;
764 if (content !=
nullptr)
778 const int x =
event.getX();
779 const int y =
event.getY();
870 int dx =
mClickX -
event.getX();
871 int dy =
mClickY -
event.getY();
874 int dx =
event.getX() -
mClickX;
875 int dy =
event.getY() -
mClickY;
878 if ((dx < 20 && dx > 0) || (dx > -20 && dx < 0))
881 if ((dy < 20 && dy > 0) || (dy > -20 && dy < 0))
884 if (abs(dx) > abs(dy))
939 const int pos =
event.getY() - barDim.
y 943 if ((barDim.
height - length) > 0)
946 / (barDim.
height - length));
958 const int pos =
event.getX() - barDim.
x 962 if ((barDim.
width - length) > 0)
965 / (barDim.
width - length));
980 return Rect(0, 0, 0, 0);
1000 return Rect(0, 0, 0, 0);
1020 return Rect(0, 0, 0, 0);
1046 if (content !=
nullptr)
1059 if (length < mScrollbarWidth)
1062 if (length > height)
1066 pos = ((height - length) *
mVScroll) / maxV;
1072 mScrollbarWidth, length);
1078 return Rect(0, 0, 0, 0);
1104 if (content !=
nullptr)
1106 const int w3 = content->
getWidth();
1117 if (length < mScrollbarWidth)
1125 pos = ((width - length) *
mHScroll) / maxH;
1134 length, mScrollbarWidth);
1140 return Rect(0, 0, 0, 0);
1149 return Rect(0, 0, 0, 0);
1168 return Rect(0, 0, 0, 0);
1177 return Rect(0, 0, 0, 0);
1195 if (widget !=
nullptr)
1258 else if (hScroll < 0)
1273 if (content ==
nullptr)
1290 if (content ==
nullptr)
1313 if (widget != content || (content ==
nullptr))
1393 if (content ==
nullptr)
void showWidgetPart(Widget *const widget, const Rect &area)
void void calcTileCollection(ImageCollection *restrict const vertCol, const Image *restrict const image, int x, int y) restrict2 override final
void loadRect(ImageRect &image, const std::string &name, const std::string &name2, const int start, const int end)
virtual void drawTileCollection(const ImageCollection *const vertCol)=0
void unload(Skin *const skin)
ClipRect & getTopClip() const
virtual void drawImageRect(const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
MouseButtonT getButton() const
float getMinimumOpacity() const
#define BLOCK_START(name)
static std::string getThemePath()
Skin * load(const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath)
int getOption(const std::string &name) const
virtual void finalize(ImageCollection *const col)
virtual void setAlpha(const float alpha)
const ImageRect & getBorder() const
void add(Widget *const widget)
virtual void calcPattern(ImageVertexes *const vert, const Image *const image, const int x, const int y, const int w, const int h) const =0
std::string toString(T const &value)
converts any type to a string
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
void removeDragged(const Widget *const widget)
virtual void drawChildren(Graphics *const graphics)
int getWidth() const A_INLINE
virtual void drawPattern(const Image *const image, const int x, const int y, const int w, const int h)=0
void setRedraw(const bool n)
void log(const char *const log_text,...)
static void unloadRect(const ImageRect &rect, const int start, const int end)
virtual void safeDrawChildren(Graphics *const graphics)
virtual void calcWindow(ImageCollection *const vertCol, const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
int getHeight() const A_INLINE