16 #define GETTEXT_DOMAIN "wesnoth-lib"
33 #define ERR_DP LOG_STREAM(err, log_display)
34 #define WRN_DP LOG_STREAM(warn, log_display)
35 #define DBG_DP LOG_STREAM(debug, log_display)
36 #define ERR_G LOG_STREAM(err, lg::general)
72 pb_event.type = SDL_MOUSEMOTION;
73 pb_event.motion.state = 0;
74 pb_event.motion.x = mousex;
75 pb_event.motion.y = mousey;
76 pb_event.motion.xrel = 0;
77 pb_event.motion.yrel = 0;
78 SDL_PushEvent(&pb_event);
83 std::vector<button*>* buttons,
button* help_button) :
87 help_button_(help_button),
89 top_(
image::
get_texture(
"dialogs/" + dialog_style_.panel +
"-border-top.png")),
90 bot_(
image::
get_texture(
"dialogs/" + dialog_style_.panel +
"-border-bottom.png")),
91 left_(
image::
get_texture(
"dialogs/" + dialog_style_.panel +
"-border-left.png")),
92 right_(
image::
get_texture(
"dialogs/" + dialog_style_.panel +
"-border-right.png")),
93 top_left_(
image::
get_texture(
"dialogs/" + dialog_style_.panel +
"-border-topleft.png")),
94 bot_left_(
image::
get_texture(
"dialogs/" + dialog_style_.panel +
"-border-botleft.png")),
95 top_right_(
image::
get_texture(
"dialogs/" + dialog_style_.panel +
"-border-topright.png")),
96 bot_right_(
image::
get_texture(
"dialogs/" + dialog_style_.panel +
"-border-botright.png")),
97 bg_(
image::
get_texture(
"dialogs/" + dialog_style_.panel +
"-background.png")),
98 have_border_(top_ && bot_ && left_ && right_),
145 for(std::vector<button*>::const_iterator
b =
buttons_->begin();
b !=
buttons_->end(); ++
b) {
146 padding = std::max<int>((**b).height() +
ButtonVPadding, padding);
162 for(std::vector<button*>::const_iterator
b =
buttons_->begin();
b !=
buttons_->end(); ++
b) {
181 w = std::max(
w, std::max(
dim_.
title.w,
static_cast<int>(buttons_width)));
188 bounds.y +=
top_.
h();
190 bounds.h -=
top_.
h();
202 }
else if(x +
w > bounds.w) {
207 }
else if(y +
h > bounds.h) {
291 ERR_DP <<
"GUI1 dialog_frame blur has been removed";
302 SDL_Rect
src {0,0,0,0};
345 #ifdef OK_BUTTON_ON_RIGHT
348 for(std::vector<button*>::const_iterator
b =
buttons_->begin();
b !=
buttons_->end(); ++
b) {
349 (**b).set_location(buttons_area.x, buttons_area.y);
364 DBG_DP <<
"dialog_frame::expose " << region;
dimension_measurements dim_
std::vector< button * > * buttons_
dialog_frame(const std::string &title="", const style &dialog_style=default_style, std::vector< button * > *buttons=nullptr, button *help_button=nullptr)
static const style default_style
void set_dirty(bool dirty=true)
static const int title_border_h
virtual void layout() override
Called by draw_manager to validate layout.
virtual bool expose(const rect ®ion) override
Called by draw_manager when it believes a redraw is necessary.
virtual rect screen_location() override
The current draw location of the window, on the screen.
const style & dialog_style_
static const int title_border_w
int bottom_padding() const
rect draw_title(bool actually_draw)
int w() const
The draw-space width of the texture, in pixels.
int h() const
The draw-space height of the texture, in pixels.
Drawing functions, for drawing things on the screen.
Standard logging facilities (interface).
void invalidate_region(const rect ®ion)
Mark a region of the screen as requiring redraw.
void raise_drawable(top_level_drawable *tld)
Raise a TLD to the top of the drawing stack.
clip_setter reduce_clip(const SDL_Rect &clip)
Set the clipping area to the intersection of the current clipping area and the given rectangle.
void blit(const texture &tex, const SDL_Rect &dst)
Draws a texture, or part of a texture, at the given location.
int get_max_height(unsigned size, font::family_class fclass, pango_text::FONT_STYLE style)
Returns the maximum glyph height of a font, in pixels.
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, bool use_tooltips, pango_text::FONT_STYLE style)
Draws text on the screen.
bool is_in_dialog()
Is a dialog open?
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.
constexpr const SDL_Rect empty_rect
uint32_t get_mouse_state(int *x, int *y)
A wrapper for SDL_GetMouseState that gives coordinates in draw space.
rect game_canvas()
The game canvas area, in drawing coordinates.
Contains the SDL_Rect helper code.
Transitional API for porting SDL_ttf-based code to Pango.
static lg::log_domain log_display("display")
rect dst
Location on the final composed sheet.
rect src
Non-transparent portion of the surface to compose.
An abstract description of a rectangle with integer coordinates.