15 #define GETTEXT_DOMAIN "wesnoth-lib" 27 #define ERR_DP LOG_STREAM(err, log_display) 33 std::string button_image_name,
34 const bool auto_join) :
36 baseImage_(nullptr), touchedBaseImage_(nullptr), activeBaseImage_(nullptr),
38 pressedDownImage_(nullptr), pressedUpImage_(nullptr), pressedBothImage_(nullptr),
39 pressedBothActiveImage_(nullptr), pressedDownActiveImage_(nullptr), pressedUpActiveImage_(nullptr),
40 touchedDownImage_(nullptr), touchedUpImage_(nullptr), touchedBothImage_(nullptr),
42 state_(
NORMAL), pressed_(false),
43 base_height_(0), base_width_(0),
44 palette_(palette), item_id_()
47 if (button_image_name.empty()) {
48 button_image_name =
"buttons/button_selectable/button_selectable_38_";
96 switch (new_pressed_state) {
110 if (
state_ != new_state) {
223 SDL_Rect r {1, 1, 0, 0};
224 sdl_blit(scaled_item,
nullptr, nbase, &r);
227 sdl_blit(overlay,
nullptr, nbase,
nullptr);
243 if (
hit(event.x, event.y))
298 if (!
hit(event.x, event.y))
301 if (event.button == SDL_BUTTON_RIGHT) {
308 if (event.button == SDL_BUTTON_LEFT) {
324 if (!(
hit(event.x, event.y)))
328 if (event.button == SDL_BUTTON_LEFT) {
346 if (event.button == SDL_BUTTON_RIGHT) {
380 switch (event.type) {
381 case SDL_MOUSEBUTTONDOWN:
384 case SDL_MOUSEBUTTONUP:
387 case SDL_MOUSEMOTION:
395 if (start_state !=
state_)
surface get_image(const image::locator &i_locator, TYPE type)
Caches and returns an image.
virtual void select_bg_item(const std::string &item_id)=0
std::vector< color_t > palette(const color_range &cr)
Creates a reference color palette from a color range.
surface scale_surface(const surface &surf, int w, int h)
Scale a surface using alpha-weighted modified bilinear filtering Note: causes artifacts with alpha gr...
void blit_surface(int x, int y, surface surf, SDL_Rect *srcrect=nullptr, SDL_Rect *clip_rect=nullptr)
Draws a surface directly onto the screen framebuffer.
surface clone() const
Makes a copy of this surface.
virtual void select_fg_item(const std::string &item_id)=0
bool point_in_rect(int x, int y, const SDL_Rect &rect)
Tests whether a point is inside a rectangle.
Contains the SDL_Rect helper code.
Functions to load and save images from/to disk.
void play_UI_sound(const std::string &files)
Standard logging facilities (interface).
void sdl_blit(const surface &src, SDL_Rect *src_rect, surface &dst, SDL_Rect *dst_rect)
const std::string checkbox_release