15 #define GETTEXT_DOMAIN "wesnoth-lib"
33 #define ERR_DP LOG_STREAM(err, log_display)
43 const bool auto_join) :
45 baseImage_(nullptr), touchedBaseImage_(nullptr), activeBaseImage_(nullptr),
47 pressedDownImage_(nullptr), pressedUpImage_(nullptr), pressedBothImage_(nullptr),
48 pressedBothActiveImage_(nullptr), pressedDownActiveImage_(nullptr), pressedUpActiveImage_(nullptr),
49 touchedDownImage_(nullptr), touchedUpImage_(nullptr), touchedBothImage_(nullptr),
51 state_(
NORMAL), pressed_(false),
52 base_height_(0), base_width_(0),
53 palette_(palette), item_id_()
56 if (button_image_name.empty()) {
57 button_image_name =
"buttons/button_selectable/button_selectable_38_";
105 switch (new_pressed_state) {
119 if (
state_ != new_state) {
226 const int image_w = image->w;
228 SDL_Rect clipArea = loc;
233 textx = loc.x + image_w + checkbox_horizontal_padding / 2;
249 if (!overlay.
null()) {
281 if (
hit(event.x, event.y))
336 if (!
hit(event.x, event.y))
339 if (event.button == SDL_BUTTON_RIGHT) {
346 if (event.button == SDL_BUTTON_LEFT) {
362 if (!(
hit(event.x, event.y)))
366 if (event.button == SDL_BUTTON_LEFT) {
384 if (event.button == SDL_BUTTON_RIGHT) {
418 switch (event.type) {
419 case SDL_MOUSEBUTTONDOWN:
422 case SDL_MOUSEBUTTONUP:
425 case SDL_MOUSEMOTION:
433 if (start_state !=
state_)
const SDL_Color BUTTON_COLOR
surface get_image(const image::locator &i_locator, TYPE type)
function to get the surface corresponding to an image.
virtual void select_bg_item(const std::string &item_id)=0
GLenum GLsizei GLenum GLenum const GLvoid * image
GLint GLint GLint GLint GLint GLint y
surface scale_surface(const surface &surf, int w, int h)
void blit_surface(int x, int y, surface surf, SDL_Rect *srcrect=nullptr, SDL_Rect *clip_rect=nullptr)
virtual void select_fg_item(const std::string &item_id)=0
void blit_surface(const surface &surf, const SDL_Rect *srcrect, surface &dst, const SDL_Rect *dstrect)
Replacement for sdl_blit.
bool point_in_rect(int x, int y, const SDL_Rect &rect)
Tests whether a point is inside a rectangle.
SDL_Rect draw_text(surface &dst, const SDL_Rect &area, int size, const SDL_Color &color, const std::string &txt, int x, int y, bool use_tooltips, int style)
Function to draw text on a surface.
GLint GLint GLint GLint GLint x
GLdouble GLdouble GLdouble r
SDL_Rect create_rect(const int x, const int y, const int w, const int h)
Creates an empty SDL_Rect.
surface make_neutral_surface(const surface &surf)
void play_UI_sound(const std::string &files)
Standard logging facilities (interface).
void assign(const surface &o)
Compatibility layer for using SDL 1.2 and 2.0.
void update_rect(const SDL_Rect &)
std::vector< Uint32 > palette(color_range cr)
Creates a reference color palette from a color range.
GLsizei const GLcharARB ** string
const int checkbox_horizontal_padding
const std::string checkbox_release