16 #define GETTEXT_DOMAIN "wesnoth-lib"
18 #include "widgets/button.hpp"
32 #include <boost/algorithm/string/predicate.hpp>
36 #define ERR_DP LOG_STREAM(err, log_display)
44 const bool auto_join, std::string overlay_image,
int font_size)
47 image_(nullptr), pressedImage_(nullptr), activeImage_(nullptr), pressedActiveImage_(nullptr),
48 disabledImage_(nullptr), pressedDisabledImage_(nullptr),
49 overlayImage_(nullptr), overlayPressedImage_(nullptr), overlayActiveImage_(nullptr),
50 state_(
NORMAL), pressed_(false),
51 spacing_(spacing), base_height_(0), base_width_(0),
52 button_image_name_(), button_overlay_image_name_(std::move(overlay_image)),
53 button_image_path_suffix_(),
55 horizontal_padding_(font_size_),
56 checkbox_horizontal_padding_(font_size_ / 2),
57 vertical_padding_(font_size_ / 2)
59 if (button_image_name.empty()) {
87 std::string size_postfix;
179 std::string err_msg =
"error initializing button images! file name: ";
251 if (
state_ != new_state) {
369 clipArea.x += offset;
370 clipArea.y += offset;
371 clipArea.w -= 2*offset;
372 clipArea.h -= 2*offset;
414 const std::vector<std::string>::const_iterator
i = std::find_if(items.begin(),items.end(),
is_valid_image);
415 if(
i != items.end()) {
426 if (
hit(event.x, event.y)) {
460 if (
hit(event.x, event.y) && event.button == SDL_BUTTON_LEFT) {
488 if (!(
hit(event.x, event.y) && event.button == SDL_BUTTON_LEFT))
549 case SDL_MOUSEBUTTONDOWN:
552 case SDL_MOUSEBUTTONUP:
555 case SDL_MOUSEMOTION:
563 if (start_state !=
state_) {
Wrapper class to encapsulate creation and management of an SDL_Texture.
int w() const
The draw-space width of the texture, in pixels.
void reset()
Releases ownership of the managed texture and resets the ptr to null.
int h() const
The draw-space height of the texture, in pixels.
Drawing functions, for drawing things on the screen.
Declarations for File-IO.
std::string label
What to show in the filter's drop-down list.
Standard logging facilities (interface).
void blit(const texture &tex, const ::rect &dst)
Draws a texture, or part of a texture, at the given location.
static bool file_exists(const bfs::path &fpath)
const color_t TITLE_COLOR
rect pango_draw_text(bool actually_draw, const rect &area, int size, const color_t &color, const std::string &text, int x, int y)
Draws text on the screen.
const std::string checkbox_release
const std::string button_press
const int default_font_size
static bool is_valid_image(const std::string &str)
Functions to load and save images from/to disk.
texture get_texture(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image texture suitable for hardware-accelerated rendering.
void play_UI_sound(const std::string &files)
std::vector< std::string > split(const config_attribute_value &val)
auto * find(Container &container, const Value &value)
Convenience wrapper for using find on a container without needing to comare to end()
Contains the SDL_Rect helper code.
Transitional API for porting SDL_ttf-based code to Pango.
The basic class for representing 8-bit RGB or RGBA colour values.
Base class for all the errors encountered by the engine.
An abstract description of a rectangle with integer coordinates.
bool contains(int x, int y) const
Whether the given point lies within the rectangle.
char const COLUMN_SEPARATOR