Rename tpoint -> point
This commit is contained in:
parent
68774b4285
commit
90ba2affcf
76 changed files with 542 additions and 542 deletions
|
@ -118,11 +118,11 @@ int ttext::get_height() const
|
|||
return this->get_size().y;
|
||||
}
|
||||
|
||||
gui2::tpoint ttext::get_size() const
|
||||
gui2::point ttext::get_size() const
|
||||
{
|
||||
this->recalculate();
|
||||
|
||||
return gui2::tpoint(rect_.width, rect_.height);
|
||||
return gui2::point(rect_.width, rect_.height);
|
||||
}
|
||||
|
||||
bool ttext::is_truncated() const
|
||||
|
@ -163,7 +163,7 @@ unsigned ttext::insert_unicode(const unsigned offset, const ucs4::string& unicod
|
|||
return this->insert_text(offset, insert);
|
||||
}
|
||||
|
||||
gui2::tpoint ttext::get_cursor_position(
|
||||
gui2::point ttext::get_cursor_position(
|
||||
const unsigned column, const unsigned line) const
|
||||
{
|
||||
this->recalculate();
|
||||
|
@ -175,7 +175,7 @@ gui2::tpoint ttext::get_cursor_position(
|
|||
// Go the wanted line.
|
||||
if(line != 0) {
|
||||
if(pango_layout_get_line_count(layout_) >= static_cast<int>(line)) {
|
||||
return gui2::tpoint(0, 0);
|
||||
return gui2::point(0, 0);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < line; ++i) {
|
||||
|
@ -193,7 +193,7 @@ gui2::tpoint ttext::get_cursor_position(
|
|||
break;
|
||||
}
|
||||
// We are beyond data.
|
||||
return gui2::tpoint(0, 0);
|
||||
return gui2::point(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,10 +204,10 @@ gui2::tpoint ttext::get_cursor_position(
|
|||
PangoRectangle rect;
|
||||
pango_layout_get_cursor_pos(layout_, offset, &rect, nullptr);
|
||||
|
||||
return gui2::tpoint(PANGO_PIXELS(rect.x), PANGO_PIXELS(rect.y));
|
||||
return gui2::point(PANGO_PIXELS(rect.x), PANGO_PIXELS(rect.y));
|
||||
}
|
||||
|
||||
std::string ttext::get_token(const gui2::tpoint & position, const char * delim) const
|
||||
std::string ttext::get_token(const gui2::point & position, const char * delim) const
|
||||
{
|
||||
this->recalculate();
|
||||
|
||||
|
@ -239,7 +239,7 @@ std::string ttext::get_token(const gui2::tpoint & position, const char * delim)
|
|||
return txt.substr(l,r-l);
|
||||
}
|
||||
|
||||
std::string ttext::get_link(const gui2::tpoint & position) const
|
||||
std::string ttext::get_link(const gui2::point & position) const
|
||||
{
|
||||
if (!link_aware_) {
|
||||
return "";
|
||||
|
@ -254,7 +254,7 @@ std::string ttext::get_link(const gui2::tpoint & position) const
|
|||
}
|
||||
}
|
||||
|
||||
gui2::tpoint ttext::get_column_line(const gui2::tpoint& position) const
|
||||
gui2::point ttext::get_column_line(const gui2::point& position) const
|
||||
{
|
||||
this->recalculate();
|
||||
|
||||
|
@ -283,7 +283,7 @@ gui2::tpoint ttext::get_column_line(const gui2::tpoint& position) const
|
|||
const int pos = this->get_cursor_position(i, line).x;
|
||||
|
||||
if(pos == offset) {
|
||||
return gui2::tpoint(i, line);
|
||||
return gui2::point(i, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
struct language_def;
|
||||
|
||||
namespace gui2 {
|
||||
struct tpoint;
|
||||
struct point;
|
||||
} // namespace gui2;
|
||||
|
||||
namespace font {
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
int get_height() const;
|
||||
|
||||
/** Returns the pixel size needed for the text. */
|
||||
gui2::tpoint get_size() const;
|
||||
gui2::point get_size() const;
|
||||
|
||||
/** Has the text been truncated? This happens if it exceeds max width or height. */
|
||||
bool is_truncated() const;
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
* requested location is out of range 0,0 is
|
||||
* returned.
|
||||
*/
|
||||
gui2::tpoint get_cursor_position(
|
||||
gui2::point get_cursor_position(
|
||||
const unsigned column, const unsigned line = 0) const;
|
||||
|
||||
/**
|
||||
|
@ -170,7 +170,7 @@ public:
|
|||
* delimiter characters. If position is out of bounds,
|
||||
* it returns the empty string.
|
||||
*/
|
||||
std::string get_token(const gui2::tpoint & position, const char * delimiters = " \n\r\t") const;
|
||||
std::string get_token(const gui2::point & position, const char * delimiters = " \n\r\t") const;
|
||||
|
||||
/**
|
||||
* Checks if position points to a character in a link in the text, returns it
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
*
|
||||
* @returns The link if one is found, the empty string otherwise.
|
||||
*/
|
||||
std::string get_link(const gui2::tpoint & position) const;
|
||||
std::string get_link(const gui2::point & position) const;
|
||||
|
||||
/**
|
||||
* Gets the column of line of the character at the position.
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
* value the line of the character found (or last
|
||||
* character if not found.
|
||||
*/
|
||||
gui2::tpoint get_column_line(const gui2::tpoint& position) const;
|
||||
gui2::point get_column_line(const gui2::point& position) const;
|
||||
|
||||
/**
|
||||
* Gets the length of the text in bytes.
|
||||
|
|
|
@ -179,7 +179,7 @@ bool tdispatcher::fire(const tevent event, twidget& target)
|
|||
class ttrigger_mouse
|
||||
{
|
||||
public:
|
||||
ttrigger_mouse(const tpoint& coordinate) : coordinate_(coordinate)
|
||||
ttrigger_mouse(const point& coordinate) : coordinate_(coordinate)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -193,11 +193,11 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
tpoint coordinate_;
|
||||
point coordinate_;
|
||||
};
|
||||
|
||||
bool
|
||||
tdispatcher::fire(const tevent event, twidget& target, const tpoint& coordinate)
|
||||
tdispatcher::fire(const tevent event, twidget& target, const point& coordinate)
|
||||
{
|
||||
assert(find<tset_event_mouse>(event, tevent_in_set()));
|
||||
return fire_event<tsignal_mouse_function>(event,
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
namespace gui2
|
||||
{
|
||||
|
||||
struct tpoint;
|
||||
struct point;
|
||||
class twidget;
|
||||
|
||||
namespace event
|
||||
|
@ -62,7 +62,7 @@ typedef std::function<void(tdispatcher& dispatcher,
|
|||
const tevent event,
|
||||
bool& handled,
|
||||
bool& halt,
|
||||
const tpoint& coordinate)> tsignal_mouse_function;
|
||||
const point& coordinate)> tsignal_mouse_function;
|
||||
|
||||
/**
|
||||
* Callback function signature.
|
||||
|
@ -152,7 +152,7 @@ public:
|
|||
* @result True if inside an active widget, false
|
||||
* otherwise.
|
||||
*/
|
||||
virtual bool is_at(const tpoint& coordinate) const = 0;
|
||||
virtual bool is_at(const point& coordinate) const = 0;
|
||||
|
||||
enum tevent_type {
|
||||
pre = 1,
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
* @param target The widget that should receive the event.
|
||||
* @param coordinate The mouse position for the event.
|
||||
*/
|
||||
bool fire(const tevent event, twidget& target, const tpoint& coordinate);
|
||||
bool fire(const tevent event, twidget& target, const point& coordinate);
|
||||
|
||||
/**
|
||||
* Fires an event which takes keyboard parameters.
|
||||
|
|
|
@ -159,7 +159,7 @@ void tmouse_motion::capture_mouse(const bool capture)
|
|||
|
||||
void tmouse_motion::signal_handler_sdl_mouse_motion(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate)
|
||||
const point& coordinate)
|
||||
{
|
||||
if(signal_handler_sdl_mouse_motion_entered_) {
|
||||
return;
|
||||
|
@ -204,7 +204,7 @@ void tmouse_motion::signal_handler_sdl_mouse_motion(const event::tevent event,
|
|||
|
||||
void tmouse_motion::signal_handler_sdl_wheel(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate)
|
||||
const point& coordinate)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << event << ".\n";
|
||||
|
||||
|
@ -222,7 +222,7 @@ void tmouse_motion::signal_handler_sdl_wheel(const event::tevent event,
|
|||
|
||||
void tmouse_motion::signal_handler_show_helptip(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate)
|
||||
const point& coordinate)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << event << ".\n";
|
||||
|
||||
|
@ -257,7 +257,7 @@ void tmouse_motion::mouse_enter(twidget* mouse_over)
|
|||
start_hover_timer(mouse_over, get_mouse_position());
|
||||
}
|
||||
|
||||
void tmouse_motion::mouse_motion(twidget* mouse_over, const tpoint& coordinate)
|
||||
void tmouse_motion::mouse_motion(twidget* mouse_over, const point& coordinate)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << "Firing: " << event::MOUSE_MOTION << ".\n";
|
||||
|
||||
|
@ -297,7 +297,7 @@ void tmouse_motion::show_tooltip()
|
|||
|
||||
hover_timer_ = 0;
|
||||
hover_widget_ = nullptr;
|
||||
hover_position_ = tpoint();
|
||||
hover_position_ = point();
|
||||
}
|
||||
|
||||
void tmouse_motion::mouse_leave()
|
||||
|
@ -316,7 +316,7 @@ void tmouse_motion::mouse_leave()
|
|||
stop_hover_timer();
|
||||
}
|
||||
|
||||
void tmouse_motion::start_hover_timer(twidget* widget, const tpoint& coordinate)
|
||||
void tmouse_motion::start_hover_timer(twidget* widget, const point& coordinate)
|
||||
{
|
||||
assert(widget);
|
||||
stop_hover_timer();
|
||||
|
@ -354,7 +354,7 @@ void tmouse_motion::stop_hover_timer()
|
|||
|
||||
hover_timer_ = 0;
|
||||
hover_widget_ = nullptr;
|
||||
hover_position_ = tpoint();
|
||||
hover_position_ = point();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ void tmouse_button<sdl_button_down,
|
|||
button_double_click>::
|
||||
signal_handler_sdl_button_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate)
|
||||
const point& coordinate)
|
||||
{
|
||||
if(signal_handler_sdl_button_down_entered_) {
|
||||
return;
|
||||
|
@ -514,7 +514,7 @@ void tmouse_button<sdl_button_down,
|
|||
button_double_click>::
|
||||
signal_handler_sdl_button_up(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate)
|
||||
const point& coordinate)
|
||||
{
|
||||
if(signal_handler_sdl_button_up_entered_) {
|
||||
return;
|
||||
|
|
|
@ -91,7 +91,7 @@ protected:
|
|||
twidget* hover_widget_;
|
||||
|
||||
/** The anchor point of the hover event. */
|
||||
tpoint hover_position_;
|
||||
point hover_position_;
|
||||
|
||||
/**
|
||||
* Has the hover been shown for the widget?
|
||||
|
@ -108,7 +108,7 @@ protected:
|
|||
* @param widget The widget that wants the tooltip.
|
||||
* @param coordinate The anchor coordinate.
|
||||
*/
|
||||
void start_hover_timer(twidget* widget, const tpoint& coordinate);
|
||||
void start_hover_timer(twidget* widget, const point& coordinate);
|
||||
|
||||
/** Stops the current hover timer. */
|
||||
void stop_hover_timer();
|
||||
|
@ -130,7 +130,7 @@ private:
|
|||
* @param mouse_over The widget that should receive the event.
|
||||
* @param coordinate The current screen coordinate of the mouse.
|
||||
*/
|
||||
void mouse_motion(twidget* mouse_over, const tpoint& coordinate);
|
||||
void mouse_motion(twidget* mouse_over, const point& coordinate);
|
||||
|
||||
/** Called when the mouse wants the widget to show its tooltip. */
|
||||
void show_tooltip();
|
||||
|
@ -138,15 +138,15 @@ private:
|
|||
bool signal_handler_sdl_mouse_motion_entered_;
|
||||
void signal_handler_sdl_mouse_motion(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate);
|
||||
const point& coordinate);
|
||||
|
||||
void signal_handler_sdl_wheel(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate);
|
||||
const point& coordinate);
|
||||
|
||||
void signal_handler_show_helptip(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate);
|
||||
const point& coordinate);
|
||||
};
|
||||
|
||||
/***** ***** ***** ***** tmouse_button ***** ***** ***** ***** *****/
|
||||
|
@ -196,12 +196,12 @@ private:
|
|||
bool signal_handler_sdl_button_down_entered_;
|
||||
void signal_handler_sdl_button_down(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate);
|
||||
const point& coordinate);
|
||||
|
||||
bool signal_handler_sdl_button_up_entered_;
|
||||
void signal_handler_sdl_button_up(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate);
|
||||
const point& coordinate);
|
||||
|
||||
|
||||
void mouse_button_click(twidget* widget);
|
||||
|
|
|
@ -172,7 +172,7 @@ private:
|
|||
*
|
||||
* @param new_size The new size of the window.
|
||||
*/
|
||||
void video_resize(const tpoint& new_size);
|
||||
void video_resize(const point& new_size);
|
||||
|
||||
/**
|
||||
* Fires a generic mouse event.
|
||||
|
@ -180,7 +180,7 @@ private:
|
|||
* @param event The event to fire.
|
||||
* @param position The position of the mouse.
|
||||
*/
|
||||
void mouse(const tevent event, const tpoint& position);
|
||||
void mouse(const tevent event, const point& position);
|
||||
|
||||
/**
|
||||
* Fires a mouse button up event.
|
||||
|
@ -189,7 +189,7 @@ private:
|
|||
* @param button The SDL id of the button that caused the
|
||||
* event.
|
||||
*/
|
||||
void mouse_button_up(const tpoint& position, const Uint8 button);
|
||||
void mouse_button_up(const point& position, const Uint8 button);
|
||||
|
||||
/**
|
||||
* Fires a mouse button down event.
|
||||
|
@ -198,7 +198,7 @@ private:
|
|||
* @param button The SDL id of the button that caused the
|
||||
* event.
|
||||
*/
|
||||
void mouse_button_down(const tpoint& position, const Uint8 button);
|
||||
void mouse_button_down(const point& position, const Uint8 button);
|
||||
|
||||
/**
|
||||
* Fires a mouse wheel event.
|
||||
|
@ -207,7 +207,7 @@ private:
|
|||
* @param scrollx The amount of horizontal scrolling.
|
||||
* @param scrolly The amount of vertical scrolling.
|
||||
*/
|
||||
void mouse_wheel(const tpoint& position, int scrollx, int scrolly);
|
||||
void mouse_wheel(const point& position, int scrollx, int scrolly);
|
||||
|
||||
/**
|
||||
* Gets the dispatcher that wants to receive the keyboard input.
|
||||
|
@ -538,7 +538,7 @@ void thandler::draw(const bool force)
|
|||
}
|
||||
}
|
||||
|
||||
void thandler::video_resize(const tpoint& new_size)
|
||||
void thandler::video_resize(const point& new_size)
|
||||
{
|
||||
DBG_GUI_E << "Firing: " << SDL_VIDEO_RESIZE << ".\n";
|
||||
|
||||
|
@ -550,7 +550,7 @@ void thandler::video_resize(const tpoint& new_size)
|
|||
}
|
||||
}
|
||||
|
||||
void thandler::mouse(const tevent event, const tpoint& position)
|
||||
void thandler::mouse(const tevent event, const point& position)
|
||||
{
|
||||
DBG_GUI_E << "Firing: " << event << ".\n";
|
||||
|
||||
|
@ -581,7 +581,7 @@ void thandler::mouse(const tevent event, const tpoint& position)
|
|||
}
|
||||
}
|
||||
|
||||
void thandler::mouse_button_up(const tpoint& position, const Uint8 button)
|
||||
void thandler::mouse_button_up(const point& position, const Uint8 button)
|
||||
{
|
||||
switch(button) {
|
||||
case SDL_BUTTON_LEFT:
|
||||
|
@ -604,7 +604,7 @@ void thandler::mouse_button_up(const tpoint& position, const Uint8 button)
|
|||
}
|
||||
}
|
||||
|
||||
void thandler::mouse_button_down(const tpoint& position, const Uint8 button)
|
||||
void thandler::mouse_button_down(const point& position, const Uint8 button)
|
||||
{
|
||||
// The wheel buttons generate and up and down event we handle the
|
||||
// up event so ignore the mouse if it's a down event. Handle it
|
||||
|
@ -634,7 +634,7 @@ void thandler::mouse_button_down(const tpoint& position, const Uint8 button)
|
|||
}
|
||||
}
|
||||
|
||||
void thandler::mouse_wheel(const tpoint& position, int x, int y)
|
||||
void thandler::mouse_wheel(const point& position, int x, int y)
|
||||
{
|
||||
if(x > 0) {
|
||||
mouse(SDL_WHEEL_RIGHT, position);
|
||||
|
@ -792,7 +792,7 @@ void disconnect_dispatcher(tdispatcher* dispatcher)
|
|||
|
||||
void init_mouse_location()
|
||||
{
|
||||
tpoint mouse = get_mouse_position();
|
||||
point mouse = get_mouse_position();
|
||||
|
||||
SDL_Event event;
|
||||
event.type = SDL_MOUSEMOTION;
|
||||
|
|
|
@ -54,7 +54,7 @@ struct tmessage
|
|||
/** The message for MESSAGE_SHOW_TOOLTIP. */
|
||||
struct tmessage_show_tooltip : public tmessage
|
||||
{
|
||||
tmessage_show_tooltip(const std::string& message_, const tpoint& location_, const SDL_Rect& source_rect_)
|
||||
tmessage_show_tooltip(const std::string& message_, const point& location_, const SDL_Rect& source_rect_)
|
||||
: message(message_), location(location_), source_rect(source_rect_)
|
||||
{
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ struct tmessage_show_tooltip : public tmessage
|
|||
const std::string message;
|
||||
|
||||
/** The location where to show the tooltip. */
|
||||
const tpoint location;
|
||||
const point location;
|
||||
|
||||
/** The size of the entity requesting to show a tooltip. */
|
||||
const SDL_Rect source_rect;
|
||||
|
@ -72,7 +72,7 @@ struct tmessage_show_tooltip : public tmessage
|
|||
/** The message for MESSAGE_SHOW_HELPTIP. */
|
||||
struct tmessage_show_helptip : public tmessage
|
||||
{
|
||||
tmessage_show_helptip(const std::string& message_, const tpoint& location_, const SDL_Rect& source_rect_)
|
||||
tmessage_show_helptip(const std::string& message_, const point& location_, const SDL_Rect& source_rect_)
|
||||
: message(message_), location(location_), source_rect(source_rect_)
|
||||
{
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ struct tmessage_show_helptip : public tmessage
|
|||
const std::string message;
|
||||
|
||||
/** The location where to show the helptip. */
|
||||
const tpoint location;
|
||||
const point location;
|
||||
|
||||
/** The size of the entity requesting to show a helptip. */
|
||||
const SDL_Rect source_rect;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
namespace gui2
|
||||
{
|
||||
|
||||
struct tpoint;
|
||||
struct point;
|
||||
|
||||
/**
|
||||
* Base class for the placement helper.
|
||||
|
@ -99,14 +99,14 @@ public:
|
|||
*
|
||||
* @param size The required size for the item.
|
||||
*/
|
||||
virtual void add_item(const tpoint& size) = 0;
|
||||
virtual void add_item(const point& size) = 0;
|
||||
|
||||
/**
|
||||
* Gets the required size of all items.
|
||||
*
|
||||
* @returns The required size.
|
||||
*/
|
||||
virtual tpoint get_size() const = 0;
|
||||
virtual point get_size() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the origin for an item.
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
*
|
||||
* @returns The origin where to place the widget.
|
||||
*/
|
||||
virtual tpoint get_origin(const unsigned index) const = 0;
|
||||
virtual point get_origin(const unsigned index) const = 0;
|
||||
};
|
||||
|
||||
} // namespace gui2
|
||||
|
|
|
@ -46,7 +46,7 @@ void tplacer_horizontal_list::initialise()
|
|||
column_ = 0;
|
||||
}
|
||||
|
||||
void tplacer_horizontal_list::add_item(const tpoint& size)
|
||||
void tplacer_horizontal_list::add_item(const point& size)
|
||||
{
|
||||
if(size.x > columns_[column_].second) {
|
||||
columns_[column_].second = size.x;
|
||||
|
@ -66,14 +66,14 @@ void tplacer_horizontal_list::add_item(const tpoint& size)
|
|||
}
|
||||
}
|
||||
|
||||
tpoint tplacer_horizontal_list::get_size() const
|
||||
point tplacer_horizontal_list::get_size() const
|
||||
{
|
||||
const int width = columns_.back().first + columns_.back().second;
|
||||
const int height = std::accumulate(rows_.begin(), rows_.end(), 0);
|
||||
return tpoint(width, height);
|
||||
return point(width, height);
|
||||
}
|
||||
|
||||
tpoint tplacer_horizontal_list::get_origin(const unsigned index) const
|
||||
point tplacer_horizontal_list::get_origin(const unsigned index) const
|
||||
{
|
||||
const unsigned row = index % maximum_rows_;
|
||||
const unsigned column = index / maximum_rows_;
|
||||
|
@ -82,7 +82,7 @@ tpoint tplacer_horizontal_list::get_origin(const unsigned index) const
|
|||
= row == 0 ? 0
|
||||
: std::accumulate(rows_.begin(), rows_.begin() + row, 0);
|
||||
|
||||
return tpoint(columns_[column].first, height);
|
||||
return point(columns_[column].first, height);
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
|
|
@ -48,11 +48,11 @@ public:
|
|||
|
||||
virtual void initialise();
|
||||
|
||||
virtual void add_item(const tpoint& size);
|
||||
virtual void add_item(const point& size);
|
||||
|
||||
virtual tpoint get_size() const;
|
||||
virtual point get_size() const;
|
||||
|
||||
virtual tpoint get_origin(const unsigned index) const;
|
||||
virtual point get_origin(const unsigned index) const;
|
||||
|
||||
|
||||
/***** ***** Members. ***** *****/
|
||||
|
|
|
@ -46,7 +46,7 @@ void tplacer_vertical_list::initialise()
|
|||
column_ = 0;
|
||||
}
|
||||
|
||||
void tplacer_vertical_list::add_item(const tpoint& size)
|
||||
void tplacer_vertical_list::add_item(const point& size)
|
||||
{
|
||||
if(size.x > columns_[column_]) {
|
||||
columns_[column_] = size.x;
|
||||
|
@ -66,14 +66,14 @@ void tplacer_vertical_list::add_item(const tpoint& size)
|
|||
}
|
||||
}
|
||||
|
||||
tpoint tplacer_vertical_list::get_size() const
|
||||
point tplacer_vertical_list::get_size() const
|
||||
{
|
||||
const int width = std::accumulate(columns_.begin(), columns_.end(), 0);
|
||||
const int height = rows_.back().first + rows_.back().second;
|
||||
return tpoint(width, height);
|
||||
return point(width, height);
|
||||
}
|
||||
|
||||
tpoint tplacer_vertical_list::get_origin(const unsigned index) const
|
||||
point tplacer_vertical_list::get_origin(const unsigned index) const
|
||||
{
|
||||
const unsigned row = index / maximum_columns_;
|
||||
const unsigned column = index % maximum_columns_;
|
||||
|
@ -83,7 +83,7 @@ tpoint tplacer_vertical_list::get_origin(const unsigned index) const
|
|||
columns_.begin() + column,
|
||||
0);
|
||||
|
||||
return tpoint(width, rows_[row].first);
|
||||
return point(width, rows_[row].first);
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
|
|
@ -47,11 +47,11 @@ public:
|
|||
|
||||
virtual void initialise();
|
||||
|
||||
virtual void add_item(const tpoint& size);
|
||||
virtual void add_item(const point& size);
|
||||
|
||||
virtual tpoint get_size() const;
|
||||
virtual point get_size() const;
|
||||
|
||||
virtual tpoint get_origin(const unsigned index) const;
|
||||
virtual point get_origin(const unsigned index) const;
|
||||
|
||||
|
||||
/***** ***** Members. ***** *****/
|
||||
|
|
|
@ -21,21 +21,21 @@
|
|||
namespace gui2
|
||||
{
|
||||
|
||||
tpoint& tpoint::operator+=(const tpoint& point)
|
||||
point& point::operator+=(const point& point)
|
||||
{
|
||||
x += point.x;
|
||||
y += point.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
tpoint& tpoint::operator-=(const tpoint& point)
|
||||
point& point::operator-=(const point& point)
|
||||
{
|
||||
x -= point.x;
|
||||
y -= point.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const tpoint& point)
|
||||
std::ostream& operator<<(std::ostream& stream, const point& point)
|
||||
{
|
||||
stream << point.x << ',' << point.y;
|
||||
return stream;
|
||||
|
|
|
@ -21,13 +21,13 @@ namespace gui2
|
|||
{
|
||||
|
||||
/** Holds a 2D point. */
|
||||
struct tpoint
|
||||
struct point
|
||||
{
|
||||
tpoint() : x(0), y(0)
|
||||
point() : x(0), y(0)
|
||||
{
|
||||
}
|
||||
|
||||
tpoint(const int x_, const int y_) : x(x_), y(y_)
|
||||
point(const int x_, const int y_) : x(x_), y(y_)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -37,40 +37,40 @@ struct tpoint
|
|||
/** y coordinate. */
|
||||
int y;
|
||||
|
||||
bool operator==(const tpoint& point) const
|
||||
bool operator==(const point& point) const
|
||||
{
|
||||
return x == point.x && y == point.y;
|
||||
}
|
||||
bool operator!=(const tpoint& point) const
|
||||
bool operator!=(const point& point) const
|
||||
{
|
||||
return x != point.x || y != point.y;
|
||||
}
|
||||
bool operator<(const tpoint& point) const
|
||||
bool operator<(const point& point) const
|
||||
{
|
||||
return x < point.x || (x == point.x && y < point.y);
|
||||
}
|
||||
|
||||
bool operator<=(const tpoint& point) const
|
||||
bool operator<=(const point& point) const
|
||||
{
|
||||
return x < point.x || (x == point.x && y <= point.y);
|
||||
}
|
||||
|
||||
tpoint operator+(const tpoint& point) const
|
||||
point operator+(const point& point) const
|
||||
{
|
||||
return {x + point.x, y + point.y};
|
||||
}
|
||||
|
||||
tpoint& operator+=(const tpoint& point);
|
||||
point& operator+=(const point& point);
|
||||
|
||||
tpoint operator-(const tpoint& point) const
|
||||
point operator-(const point& point) const
|
||||
{
|
||||
return {x - point.x, y - point.y};
|
||||
}
|
||||
|
||||
tpoint& operator-=(const tpoint& point);
|
||||
point& operator-=(const point& point);
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const tpoint& point);
|
||||
std::ostream& operator<<(std::ostream& stream, const point& point);
|
||||
|
||||
|
||||
} // namespace gui2
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace gui2
|
|||
REGISTER_DIALOG(drop_down_list)
|
||||
|
||||
namespace {
|
||||
void click_callback(twindow& window, bool&, bool&, tpoint coordinate)
|
||||
void click_callback(twindow& window, bool&, bool&, point coordinate)
|
||||
{
|
||||
/* FIXME: This dialog uses a listbox with 'has_minimum = false'. This allows a listbox to have 0 or more selections,
|
||||
* and selecting the same entry toggles that entry's state (ie, if it was selected, it will be deselected). Because
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
message_ = message;
|
||||
}
|
||||
|
||||
void set_mouse(const tpoint& mouse)
|
||||
void set_mouse(const point& mouse)
|
||||
{
|
||||
mouse_ = mouse;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ private:
|
|||
t_string message_;
|
||||
|
||||
/** The position of the mouse. */
|
||||
tpoint mouse_;
|
||||
point mouse_;
|
||||
|
||||
/** The size of the requestor. */
|
||||
SDL_Rect source_rect_;
|
||||
|
@ -146,7 +146,7 @@ static ttip& tip()
|
|||
void show(CVideo& video,
|
||||
const std::string& window_id,
|
||||
const t_string& message,
|
||||
const tpoint& mouse,
|
||||
const point& mouse,
|
||||
const SDL_Rect& source_rect)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -24,7 +24,7 @@ class t_string;
|
|||
namespace gui2
|
||||
{
|
||||
|
||||
struct tpoint;
|
||||
struct point;
|
||||
|
||||
namespace tip
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ namespace tip
|
|||
void show(CVideo& video,
|
||||
const std::string& window_id,
|
||||
const t_string& message,
|
||||
const tpoint& mouse,
|
||||
const point& mouse,
|
||||
const SDL_Rect& source_rect);
|
||||
|
||||
/**
|
||||
|
|
|
@ -187,7 +187,7 @@ static bool launch_lua_console(twindow& window)
|
|||
* - 150 to test with a borderline to insanely huge tooltip placement.
|
||||
* - 180 to test with an insanely huge tooltip placement.
|
||||
*/
|
||||
static void debug_tooltip(twindow& window, bool& handled, const tpoint& coordinate)
|
||||
static void debug_tooltip(twindow& window, bool& handled, const point& coordinate)
|
||||
{
|
||||
std::string message = "Hello world.";
|
||||
|
||||
|
|
|
@ -73,13 +73,13 @@ bool tcontainer_::can_wrap() const
|
|||
return grid_.can_wrap() || twidget::can_wrap();
|
||||
}
|
||||
|
||||
void tcontainer_::place(const tpoint& origin, const tpoint& size)
|
||||
void tcontainer_::place(const point& origin, const point& size)
|
||||
{
|
||||
tcontrol::place(origin, size);
|
||||
|
||||
const SDL_Rect rect = get_client_rect();
|
||||
const tpoint client_size(rect.w, rect.h);
|
||||
const tpoint client_position(rect.x, rect.y);
|
||||
const point client_size(rect.w, rect.h);
|
||||
const point client_position(rect.x, rect.y);
|
||||
grid_.place(client_position, client_size);
|
||||
}
|
||||
|
||||
|
@ -88,13 +88,13 @@ bool tcontainer_::has_widget(const twidget& widget) const
|
|||
return twidget::has_widget(widget) || grid_.has_widget(widget);
|
||||
}
|
||||
|
||||
tpoint tcontainer_::calculate_best_size() const
|
||||
point tcontainer_::calculate_best_size() const
|
||||
{
|
||||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
|
||||
tpoint result(grid_.get_best_size());
|
||||
const tpoint border_size = border_space();
|
||||
const tpoint minimum_size = get_config_minimum_size();
|
||||
point result(grid_.get_best_size());
|
||||
const point border_size = border_space();
|
||||
const point minimum_size = get_config_minimum_size();
|
||||
|
||||
// If the best size has a value of 0 it's means no limit so don't
|
||||
// add the border_size might set a very small best size.
|
||||
|
@ -119,13 +119,13 @@ tpoint tcontainer_::calculate_best_size() const
|
|||
return result;
|
||||
}
|
||||
|
||||
void tcontainer_::set_origin(const tpoint& origin)
|
||||
void tcontainer_::set_origin(const point& origin)
|
||||
{
|
||||
// Inherited.
|
||||
twidget::set_origin(origin);
|
||||
|
||||
const SDL_Rect rect = get_client_rect();
|
||||
const tpoint client_position(rect.x, rect.y);
|
||||
const point client_position(rect.x, rect.y);
|
||||
grid_.set_origin(client_position);
|
||||
}
|
||||
|
||||
|
@ -160,13 +160,13 @@ tcontainer_::child_populate_dirty_list(twindow& caller,
|
|||
grid_.populate_dirty_list(caller, child_call_stack);
|
||||
}
|
||||
|
||||
twidget* tcontainer_::find_at(const tpoint& coordinate,
|
||||
twidget* tcontainer_::find_at(const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
return grid_.find_at(coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* tcontainer_::find_at(const tpoint& coordinate,
|
||||
const twidget* tcontainer_::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
return grid_.find_at(coordinate, must_be_active);
|
||||
|
@ -215,9 +215,9 @@ tcontainer_::init_grid(const std::shared_ptr<tbuilder_grid>& grid_builder)
|
|||
grid_builder->build(&initial_grid());
|
||||
}
|
||||
|
||||
tpoint tcontainer_::border_space() const
|
||||
point tcontainer_::border_space() const
|
||||
{
|
||||
return tpoint();
|
||||
return point();
|
||||
}
|
||||
|
||||
} // namespace gui2
|
||||
|
|
|
@ -87,14 +87,14 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/** See @ref twidget::can_wrap. */
|
||||
virtual bool can_wrap() const override;
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
virtual bool has_widget(const twidget& widget) const override;
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& origin) override;
|
||||
virtual void set_origin(const point& origin) override;
|
||||
|
||||
/** See @ref twidget::set_visible_rectangle. */
|
||||
virtual void set_visible_rectangle(const SDL_Rect& rectangle) override;
|
||||
|
@ -123,11 +123,11 @@ protected:
|
|||
|
||||
public:
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** See @ref twidget::find. */
|
||||
|
@ -250,7 +250,7 @@ private:
|
|||
}
|
||||
|
||||
/** Returns the space used by the border. */
|
||||
virtual tpoint border_space() const;
|
||||
virtual point border_space() const;
|
||||
|
||||
/**
|
||||
* Helper for set_active.
|
||||
|
|
|
@ -145,31 +145,31 @@ iterator::twalker_* tcontrol::create_walker()
|
|||
return new iterator::walker::twidget(*this);
|
||||
}
|
||||
|
||||
tpoint tcontrol::get_config_minimum_size() const
|
||||
point tcontrol::get_config_minimum_size() const
|
||||
{
|
||||
assert(config_);
|
||||
|
||||
tpoint result(config_->min_width, config_->min_height);
|
||||
point result(config_->min_width, config_->min_height);
|
||||
|
||||
DBG_GUI_L << LOG_HEADER << " result " << result << ".\n";
|
||||
return result;
|
||||
}
|
||||
|
||||
tpoint tcontrol::get_config_default_size() const
|
||||
point tcontrol::get_config_default_size() const
|
||||
{
|
||||
assert(config_);
|
||||
|
||||
tpoint result(config_->default_width, config_->default_height);
|
||||
point result(config_->default_width, config_->default_height);
|
||||
|
||||
DBG_GUI_L << LOG_HEADER << " result " << result << ".\n";
|
||||
return result;
|
||||
}
|
||||
|
||||
tpoint tcontrol::get_config_maximum_size() const
|
||||
point tcontrol::get_config_maximum_size() const
|
||||
{
|
||||
assert(config_);
|
||||
|
||||
tpoint result(config_->max_width, config_->max_height);
|
||||
point result(config_->max_width, config_->max_height);
|
||||
|
||||
DBG_GUI_L << LOG_HEADER << " result " << result << ".\n";
|
||||
return result;
|
||||
|
@ -206,8 +206,8 @@ void tcontrol::request_reduce_width(const unsigned maximum_width)
|
|||
|
||||
if(!label_.empty() && can_wrap()) {
|
||||
|
||||
tpoint size = get_best_text_size(
|
||||
tpoint(), tpoint(maximum_width - config_->text_extra_width, 0));
|
||||
point size = get_best_text_size(
|
||||
point(), point(maximum_width - config_->text_extra_width, 0));
|
||||
|
||||
size.x += config_->text_extra_width;
|
||||
size.y += config_->text_extra_height;
|
||||
|
@ -224,7 +224,7 @@ void tcontrol::request_reduce_width(const unsigned maximum_width)
|
|||
}
|
||||
}
|
||||
|
||||
tpoint tcontrol::calculate_best_size() const
|
||||
point tcontrol::calculate_best_size() const
|
||||
{
|
||||
assert(config_);
|
||||
if(label_.empty()) {
|
||||
|
@ -232,20 +232,20 @@ tpoint tcontrol::calculate_best_size() const
|
|||
return get_config_default_size();
|
||||
}
|
||||
|
||||
const tpoint minimum = get_config_default_size();
|
||||
const tpoint maximum = get_config_maximum_size();
|
||||
const point minimum = get_config_default_size();
|
||||
const point maximum = get_config_maximum_size();
|
||||
|
||||
/**
|
||||
* @todo The value send should subtract the border size
|
||||
* and read it after calculation to get the proper result.
|
||||
*/
|
||||
tpoint result = get_best_text_size(minimum, maximum);
|
||||
point result = get_best_text_size(minimum, maximum);
|
||||
DBG_GUI_L << LOG_HEADER << " label '" << debug_truncate(label_)
|
||||
<< "' result " << result << ".\n";
|
||||
return result;
|
||||
}
|
||||
|
||||
void tcontrol::place(const tpoint& origin, const tpoint& size)
|
||||
void tcontrol::place(const point& origin, const point& size)
|
||||
{
|
||||
// resize canvasses
|
||||
for(auto & canvas : canvas_)
|
||||
|
@ -279,7 +279,7 @@ void tcontrol::load_config()
|
|||
}
|
||||
}
|
||||
|
||||
twidget* tcontrol::find_at(const tpoint& coordinate, const bool must_be_active)
|
||||
twidget* tcontrol::find_at(const point& coordinate, const bool must_be_active)
|
||||
{
|
||||
return (twidget::find_at(coordinate, must_be_active)
|
||||
&& (!must_be_active || get_active()))
|
||||
|
@ -287,7 +287,7 @@ twidget* tcontrol::find_at(const tpoint& coordinate, const bool must_be_active)
|
|||
: nullptr;
|
||||
}
|
||||
|
||||
const twidget* tcontrol::find_at(const tpoint& coordinate,
|
||||
const twidget* tcontrol::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
return (twidget::find_at(coordinate, must_be_active)
|
||||
|
@ -332,7 +332,7 @@ void tcontrol::set_label(const t_string& label)
|
|||
}
|
||||
|
||||
label_ = label;
|
||||
set_layout_size(tpoint());
|
||||
set_layout_size(point());
|
||||
update_canvas();
|
||||
set_is_dirty(true);
|
||||
}
|
||||
|
@ -437,15 +437,15 @@ void tcontrol::definition_load_configuration(const std::string& control_type)
|
|||
update_canvas();
|
||||
}
|
||||
|
||||
tpoint tcontrol::get_best_text_size(tpoint minimum_size,
|
||||
tpoint maximum_size) const
|
||||
point tcontrol::get_best_text_size(point minimum_size,
|
||||
point maximum_size) const
|
||||
{
|
||||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
|
||||
assert(!label_.empty());
|
||||
|
||||
const tpoint border(config_->text_extra_width, config_->text_extra_height);
|
||||
tpoint size = minimum_size - border;
|
||||
const point border(config_->text_extra_width, config_->text_extra_height);
|
||||
point size = minimum_size - border;
|
||||
|
||||
renderer_.set_link_aware(get_link_aware())
|
||||
.set_link_color(get_link_color());
|
||||
|
@ -487,7 +487,7 @@ tpoint tcontrol::get_best_text_size(tpoint minimum_size,
|
|||
if(renderer_.is_truncated() && !can_wrap()) {
|
||||
// FIXME if maximum size is defined we should look at that
|
||||
// but also we don't adjust for the extra text space yet!!!
|
||||
maximum_size = tpoint(config_->max_width, config_->max_height);
|
||||
maximum_size = point(config_->max_width, config_->max_height);
|
||||
renderer_.set_maximum_width(maximum_size.x ? maximum_size.x - border.x
|
||||
: -1);
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ tpoint tcontrol::get_best_text_size(tpoint minimum_size,
|
|||
|
||||
void tcontrol::signal_handler_show_tooltip(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& location)
|
||||
const point& location)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";
|
||||
|
||||
|
@ -532,7 +532,7 @@ void tcontrol::signal_handler_show_tooltip(const event::tevent event,
|
|||
|
||||
void tcontrol::signal_handler_show_helptip(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& location)
|
||||
const point& location)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";
|
||||
|
||||
|
@ -557,12 +557,12 @@ void tcontrol::signal_handler_notify_remove_tooltip(const event::tevent event,
|
|||
handled = true;
|
||||
}
|
||||
|
||||
std::string tcontrol::get_label_token(const gui2::tpoint & position, const char * delim) const
|
||||
std::string tcontrol::get_label_token(const gui2::point & position, const char * delim) const
|
||||
{
|
||||
return renderer_.get_token(position, delim);
|
||||
}
|
||||
|
||||
std::string tcontrol::get_label_link(const gui2::tpoint & position) const
|
||||
std::string tcontrol::get_label_link(const gui2::point & position) const
|
||||
{
|
||||
return renderer_.get_link(position);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public:
|
|||
*
|
||||
* @returns The size.
|
||||
*/
|
||||
tpoint get_config_minimum_size() const;
|
||||
point get_config_minimum_size() const;
|
||||
|
||||
/**
|
||||
* Gets the default size as defined in the config.
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
*
|
||||
* @returns The size.
|
||||
*/
|
||||
tpoint get_config_default_size() const;
|
||||
point get_config_default_size() const;
|
||||
|
||||
/**
|
||||
* Gets the best size as defined in the config.
|
||||
|
@ -129,7 +129,7 @@ public:
|
|||
*
|
||||
* @returns The size.
|
||||
*/
|
||||
tpoint get_config_maximum_size() const;
|
||||
point get_config_maximum_size() const;
|
||||
|
||||
/**
|
||||
* Returns the number of characters per line.
|
||||
|
@ -178,11 +178,11 @@ public:
|
|||
|
||||
protected:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
||||
|
@ -210,11 +210,11 @@ private:
|
|||
|
||||
public:
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** See @ref twidget::find. */
|
||||
|
@ -440,9 +440,9 @@ protected:
|
|||
int y_offset) override;
|
||||
|
||||
/** Exposes font::ttext::get_token, for the text label of this control */
|
||||
std::string get_label_token(const gui2::tpoint & position, const char * delimiters = " \n\r\t") const;
|
||||
std::string get_label_token(const gui2::point & position, const char * delimiters = " \n\r\t") const;
|
||||
|
||||
std::string get_label_link(const gui2::tpoint & position) const;
|
||||
std::string get_label_link(const gui2::point & position) const;
|
||||
|
||||
private:
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
|
@ -468,8 +468,8 @@ private:
|
|||
*
|
||||
* @returns The best size.
|
||||
*/
|
||||
tpoint get_best_text_size(tpoint minimum_size,
|
||||
tpoint maximum_size = {0, 0}) const;
|
||||
point get_best_text_size(point minimum_size,
|
||||
point maximum_size = {0, 0}) const;
|
||||
|
||||
/**
|
||||
* Contains a helper cache for the rendering.
|
||||
|
@ -497,11 +497,11 @@ private:
|
|||
|
||||
void signal_handler_show_tooltip(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& location);
|
||||
const point& location);
|
||||
|
||||
void signal_handler_show_helptip(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& location);
|
||||
const point& location);
|
||||
|
||||
void signal_handler_notify_remove_tooltip(const event::tevent event,
|
||||
bool& handled);
|
||||
|
|
|
@ -31,9 +31,9 @@ namespace gui2
|
|||
|
||||
REGISTER_WIDGET(drawing)
|
||||
|
||||
tpoint tdrawing::calculate_best_size() const
|
||||
point tdrawing::calculate_best_size() const
|
||||
{
|
||||
return best_size_ != tpoint() ? best_size_
|
||||
return best_size_ != point() ? best_size_
|
||||
: tcontrol::calculate_best_size();
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ twidget* tbuilder_drawing::build() const
|
|||
const unsigned h = height(size);
|
||||
|
||||
if(w || h) {
|
||||
widget->set_best_size(tpoint(w, h));
|
||||
widget->set_best_size(point(w, h));
|
||||
}
|
||||
|
||||
widget->canvas().front().set_cfg(draw);
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
/***** ***** ***** setters / getters for members ***** ****** *****/
|
||||
|
||||
void set_best_size(const tpoint& best_size)
|
||||
void set_best_size(const point& best_size)
|
||||
{
|
||||
best_size_ = best_size;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ private:
|
|||
};
|
||||
|
||||
/** When we're used as a fixed size item, this holds the best size. */
|
||||
tpoint best_size_;
|
||||
point best_size_;
|
||||
|
||||
/** See @ref tcontrol::get_control_type. */
|
||||
virtual const std::string& get_control_type() const override;
|
||||
|
|
|
@ -119,10 +119,10 @@ void thorizontal_list::create_item(const unsigned /*index*/)
|
|||
assert(false);
|
||||
}
|
||||
|
||||
tpoint thorizontal_list::calculate_best_size() const
|
||||
point thorizontal_list::calculate_best_size() const
|
||||
{
|
||||
// The best size is the sum of the widths and the greatest height.
|
||||
tpoint result(0, 0);
|
||||
point result(0, 0);
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
if(!get_item_shown(i)) {
|
||||
|
@ -130,7 +130,7 @@ tpoint thorizontal_list::calculate_best_size() const
|
|||
continue;
|
||||
}
|
||||
|
||||
const tpoint best_size = item(i).get_best_size();
|
||||
const point best_size = item(i).get_best_size();
|
||||
|
||||
result.x += best_size.x;
|
||||
|
||||
|
@ -142,7 +142,7 @@ tpoint thorizontal_list::calculate_best_size() const
|
|||
return result;
|
||||
}
|
||||
|
||||
void thorizontal_list::place(const tpoint& origin, const tpoint& size)
|
||||
void thorizontal_list::place(const point& origin, const point& size)
|
||||
{
|
||||
/*
|
||||
* - Set every item to its best size.
|
||||
|
@ -152,7 +152,7 @@ void thorizontal_list::place(const tpoint& origin, const tpoint& size)
|
|||
* width.
|
||||
*/
|
||||
|
||||
tpoint current_origin = origin;
|
||||
point current_origin = origin;
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
if(!get_item_shown(get_item_at_ordered(i))) {
|
||||
|
@ -161,7 +161,7 @@ void thorizontal_list::place(const tpoint& origin, const tpoint& size)
|
|||
}
|
||||
|
||||
tgrid& grid = item_ordered(i);
|
||||
tpoint best_size = grid.get_best_size();
|
||||
point best_size = grid.get_best_size();
|
||||
assert(best_size.y <= size.y);
|
||||
// FIXME should we look at grow factors???
|
||||
best_size.y = size.y;
|
||||
|
@ -178,9 +178,9 @@ void thorizontal_list::place(const tpoint& origin, const tpoint& size)
|
|||
}
|
||||
}
|
||||
|
||||
void thorizontal_list::set_origin(const tpoint& origin)
|
||||
void thorizontal_list::set_origin(const point& origin)
|
||||
{
|
||||
tpoint current_origin = origin;
|
||||
point current_origin = origin;
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
if(!get_item_shown(get_item_at_ordered(i))) {
|
||||
|
@ -209,7 +209,7 @@ void thorizontal_list::set_visible_rectangle(const SDL_Rect& rectangle)
|
|||
}
|
||||
}
|
||||
|
||||
twidget* thorizontal_list::find_at(const tpoint& coordinate,
|
||||
twidget* thorizontal_list::find_at(const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
assert(get_window());
|
||||
|
@ -230,7 +230,7 @@ twidget* thorizontal_list::find_at(const tpoint& coordinate,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const twidget* thorizontal_list::find_at(const tpoint& coordinate,
|
||||
const twidget* thorizontal_list::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
assert(get_window());
|
||||
|
@ -342,10 +342,10 @@ void tvertical_list::create_item(const unsigned /*index*/)
|
|||
assert(false);
|
||||
}
|
||||
|
||||
tpoint tvertical_list::calculate_best_size() const
|
||||
point tvertical_list::calculate_best_size() const
|
||||
{
|
||||
// The best size is the sum of the heights and the greatest width.
|
||||
tpoint result(0, 0);
|
||||
point result(0, 0);
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
if(!get_item_shown(i)) {
|
||||
|
@ -353,7 +353,7 @@ tpoint tvertical_list::calculate_best_size() const
|
|||
continue;
|
||||
}
|
||||
|
||||
const tpoint best_size = item(i).get_best_size();
|
||||
const point best_size = item(i).get_best_size();
|
||||
|
||||
if(best_size.x > result.x) {
|
||||
result.x = best_size.x;
|
||||
|
@ -365,7 +365,7 @@ tpoint tvertical_list::calculate_best_size() const
|
|||
return result;
|
||||
}
|
||||
|
||||
void tvertical_list::place(const tpoint& origin, const tpoint& size)
|
||||
void tvertical_list::place(const point& origin, const point& size)
|
||||
{
|
||||
/*
|
||||
* - Set every item to its best size.
|
||||
|
@ -375,7 +375,7 @@ void tvertical_list::place(const tpoint& origin, const tpoint& size)
|
|||
* height.
|
||||
*/
|
||||
|
||||
tpoint current_origin = origin;
|
||||
point current_origin = origin;
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
if(!get_item_shown(get_item_at_ordered(i))) {
|
||||
|
@ -384,7 +384,7 @@ void tvertical_list::place(const tpoint& origin, const tpoint& size)
|
|||
}
|
||||
|
||||
tgrid& grid = item_ordered(i);
|
||||
tpoint best_size = grid.get_best_size();
|
||||
point best_size = grid.get_best_size();
|
||||
assert(best_size.x <= size.x);
|
||||
// FIXME should we look at grow factors???
|
||||
best_size.x = size.x;
|
||||
|
@ -401,9 +401,9 @@ void tvertical_list::place(const tpoint& origin, const tpoint& size)
|
|||
}
|
||||
}
|
||||
|
||||
void tvertical_list::set_origin(const tpoint& origin)
|
||||
void tvertical_list::set_origin(const point& origin)
|
||||
{
|
||||
tpoint current_origin = origin;
|
||||
point current_origin = origin;
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
if(!get_item_shown(get_item_at_ordered(i))) {
|
||||
|
@ -432,7 +432,7 @@ void tvertical_list::set_visible_rectangle(const SDL_Rect& rectangle)
|
|||
}
|
||||
}
|
||||
|
||||
twidget* tvertical_list::find_at(const tpoint& coordinate,
|
||||
twidget* tvertical_list::find_at(const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
assert(get_window());
|
||||
|
@ -454,7 +454,7 @@ twidget* tvertical_list::find_at(const tpoint& coordinate,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const twidget* tvertical_list::find_at(const tpoint& coordinate,
|
||||
const twidget* tvertical_list::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
assert(get_window());
|
||||
|
@ -565,7 +565,7 @@ void tmatrix::create_item(const unsigned /*index*/)
|
|||
assert(false);
|
||||
}
|
||||
|
||||
tpoint tmatrix::calculate_best_size() const
|
||||
point tmatrix::calculate_best_size() const
|
||||
{
|
||||
// The best size is the one that minimizes aspect ratio of the enclosing rect
|
||||
// We first calculate the best size of each item,
|
||||
|
@ -573,29 +573,29 @@ tpoint tmatrix::calculate_best_size() const
|
|||
// We try a number of columns from 1 up to sqrt(visible_items) + 2
|
||||
size_t n_items = get_item_count();
|
||||
size_t max_cols = sqrt(n_items) + 2;
|
||||
std::vector<tpoint> item_sizes;
|
||||
std::vector<point> item_sizes;
|
||||
for(size_t i = 0; i < n_items; i++) {
|
||||
if(get_item_shown(i)) {
|
||||
item_sizes.push_back(item(i).get_best_size());
|
||||
}
|
||||
}
|
||||
if(item_sizes.empty()) {
|
||||
return tpoint();
|
||||
return point();
|
||||
}
|
||||
std::vector<tpoint> best_sizes(1);
|
||||
best_sizes[0] = std::accumulate(item_sizes.begin(), item_sizes.end(), tpoint(), [](tpoint a, tpoint b) {
|
||||
return tpoint(std::max(a.x, b.x), a.y + b.y);
|
||||
std::vector<point> best_sizes(1);
|
||||
best_sizes[0] = std::accumulate(item_sizes.begin(), item_sizes.end(), point(), [](point a, point b) {
|
||||
return point(std::max(a.x, b.x), a.y + b.y);
|
||||
});
|
||||
int max_xtra = std::min_element(item_sizes.begin(), item_sizes.end(), [](tpoint a, tpoint b) {
|
||||
int max_xtra = std::min_element(item_sizes.begin(), item_sizes.end(), [](point a, point b) {
|
||||
return a.x < b.x;
|
||||
})->x / 2;
|
||||
for(size_t cells_in_1st_row = 2; cells_in_1st_row <= max_cols; cells_in_1st_row++) {
|
||||
int row_min_width = std::accumulate(item_sizes.begin(), item_sizes.begin() + cells_in_1st_row, 0, [](int a, tpoint b) {
|
||||
int row_min_width = std::accumulate(item_sizes.begin(), item_sizes.begin() + cells_in_1st_row, 0, [](int a, point b) {
|
||||
return a + b.x;
|
||||
});
|
||||
int row_max_width = row_min_width + max_xtra;
|
||||
int row = 0;
|
||||
tpoint row_size, total_size;
|
||||
point row_size, total_size;
|
||||
for(size_t n = 0; n < item_sizes.size(); n++) {
|
||||
if(row_size.x + item_sizes[n].x > row_max_width) {
|
||||
// Start new row
|
||||
|
@ -604,7 +604,7 @@ tpoint tmatrix::calculate_best_size() const
|
|||
if(total_size.x < row_size.x) {
|
||||
total_size.x = row_size.x;
|
||||
}
|
||||
row_size = tpoint();
|
||||
row_size = point();
|
||||
}
|
||||
row_size.x += item_sizes[n].x;
|
||||
if(row_size.y < item_sizes[n].y) {
|
||||
|
@ -618,12 +618,12 @@ tpoint tmatrix::calculate_best_size() const
|
|||
best_sizes.push_back(total_size);
|
||||
}
|
||||
|
||||
return *std::min_element(best_sizes.begin(), best_sizes.end(), [](tpoint p1, tpoint p2) {
|
||||
return *std::min_element(best_sizes.begin(), best_sizes.end(), [](point p1, point p2) {
|
||||
return std::max<double>(p1.x, p1.y) / std::min<double>(p1.x, p1.y) < std::max<double>(p2.x, p2.y) / std::min<double>(p2.x, p2.y);
|
||||
});
|
||||
}
|
||||
|
||||
void tmatrix::place(const tpoint& origin, const tpoint& size)
|
||||
void tmatrix::place(const point& origin, const point& size)
|
||||
{
|
||||
/*
|
||||
* - Set every item to its best size.
|
||||
|
@ -634,7 +634,7 @@ void tmatrix::place(const tpoint& origin, const tpoint& size)
|
|||
*/
|
||||
|
||||
// TODO: Make sure all cells in a row are the same height
|
||||
tpoint current_origin = origin;
|
||||
point current_origin = origin;
|
||||
int row_height = 0;
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
|
@ -644,7 +644,7 @@ void tmatrix::place(const tpoint& origin, const tpoint& size)
|
|||
}
|
||||
|
||||
tgrid& grid = item_ordered(i);
|
||||
tpoint best_size = grid.get_best_size();
|
||||
point best_size = grid.get_best_size();
|
||||
// FIXME should we look at grow factors???
|
||||
|
||||
if(current_origin.x + best_size.x > origin.x + size.x) {
|
||||
|
@ -665,15 +665,15 @@ void tmatrix::place(const tpoint& origin, const tpoint& size)
|
|||
// This block is supposed to correct for that, but doesn't work properly.
|
||||
// To be more specific, it requires invalidating the layout to take effect.
|
||||
if(current_origin.y + row_height != origin.y + size.y) {
|
||||
tpoint better_size = size;
|
||||
point better_size = size;
|
||||
better_size.y -= current_origin.y + row_height - origin.y;
|
||||
set_layout_size(better_size);
|
||||
}
|
||||
}
|
||||
|
||||
void tmatrix::set_origin(const tpoint& origin)
|
||||
void tmatrix::set_origin(const point& origin)
|
||||
{
|
||||
tpoint current_origin = origin;
|
||||
point current_origin = origin;
|
||||
size_t row_height = 0;
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
|
@ -713,7 +713,7 @@ void tmatrix::set_visible_rectangle(const SDL_Rect& rectangle)
|
|||
}
|
||||
}
|
||||
|
||||
twidget* tmatrix::find_at(const tpoint& coordinate,
|
||||
twidget* tmatrix::find_at(const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
assert(get_window());
|
||||
|
@ -734,7 +734,7 @@ twidget* tmatrix::find_at(const tpoint& coordinate,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const twidget* tmatrix::find_at(const tpoint& coordinate,
|
||||
const twidget* tmatrix::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
assert(get_window());
|
||||
|
@ -926,18 +926,18 @@ void tindependent::request_reduce_height(const unsigned maximum_height)
|
|||
}
|
||||
}
|
||||
|
||||
tpoint tindependent::calculate_best_size() const
|
||||
point tindependent::calculate_best_size() const
|
||||
{
|
||||
/*
|
||||
* The best size is the combination of the greatest width and greatest
|
||||
* height.
|
||||
*/
|
||||
tpoint result(0, 0);
|
||||
point result(0, 0);
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
const tgrid& grid = item(i);
|
||||
|
||||
const tpoint best_size = grid.get_best_size();
|
||||
const point best_size = grid.get_best_size();
|
||||
|
||||
if(best_size.x > result.x) {
|
||||
result.x = best_size.x;
|
||||
|
@ -951,7 +951,7 @@ tpoint tindependent::calculate_best_size() const
|
|||
return result;
|
||||
}
|
||||
|
||||
void tindependent::place(const tpoint& origin, const tpoint& size)
|
||||
void tindependent::place(const point& origin, const point& size)
|
||||
{
|
||||
for(size_t i = 0; i < get_item_count(); ++i) {
|
||||
|
||||
|
@ -960,7 +960,7 @@ void tindependent::place(const tpoint& origin, const tpoint& size)
|
|||
}
|
||||
}
|
||||
|
||||
void tindependent::set_origin(const tpoint& origin)
|
||||
void tindependent::set_origin(const point& origin)
|
||||
{
|
||||
/*
|
||||
* Set the origin for every item.
|
||||
|
@ -975,7 +975,7 @@ void tindependent::set_origin(const tpoint& origin)
|
|||
}
|
||||
}
|
||||
|
||||
twidget* tindependent::find_at(const tpoint& coordinate,
|
||||
twidget* tindependent::find_at(const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
assert(get_window());
|
||||
|
@ -989,7 +989,7 @@ twidget* tindependent::find_at(const tpoint& coordinate,
|
|||
return grid.find_at(coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* tindependent::find_at(const tpoint& coordinate,
|
||||
const twidget* tindependent::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
assert(get_window());
|
||||
|
|
|
@ -271,13 +271,13 @@ public:
|
|||
= 0;
|
||||
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override = 0;
|
||||
virtual point calculate_best_size() const override = 0;
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override = 0;
|
||||
virtual void place(const point& origin, const point& size) override = 0;
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& origin) override = 0;
|
||||
virtual void set_origin(const point& origin) override = 0;
|
||||
|
||||
/** See @ref twidget::set_visible_rectangle. */
|
||||
virtual void set_visible_rectangle(const SDL_Rect& rectangle) override = 0;
|
||||
|
@ -296,11 +296,11 @@ protected:
|
|||
|
||||
public:
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override = 0;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override
|
||||
= 0;
|
||||
|
||||
|
|
|
@ -208,13 +208,13 @@ struct thorizontal_list : public virtual tgenerator_
|
|||
}
|
||||
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& origin) override;
|
||||
virtual void set_origin(const point& origin) override;
|
||||
|
||||
/**
|
||||
* Sets the visible rectangle of the generator.
|
||||
|
@ -224,11 +224,11 @@ struct thorizontal_list : public virtual tgenerator_
|
|||
void set_visible_rectangle(const SDL_Rect& rectangle) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
|
@ -286,23 +286,23 @@ struct tvertical_list : public virtual tgenerator_
|
|||
}
|
||||
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& origin) override;
|
||||
virtual void set_origin(const point& origin) override;
|
||||
|
||||
/** See @ref thorizontal_list::set_visible_rectangle(). */
|
||||
void set_visible_rectangle(const SDL_Rect& rectangle) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
|
@ -370,24 +370,24 @@ struct tmatrix : public virtual tgenerator_
|
|||
}
|
||||
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& /*origin*/
|
||||
, const tpoint& /*size*/) override;
|
||||
virtual void place(const point& /*origin*/
|
||||
, const point& /*size*/) override;
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& /*origin*/) override;
|
||||
virtual void set_origin(const point& /*origin*/) override;
|
||||
|
||||
/** See @ref thorizontal_list::set_visible_rectangle(). */
|
||||
void set_visible_rectangle(const SDL_Rect& /*rectangle*/) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& /*coordinate*/
|
||||
virtual twidget* find_at(const point& /*coordinate*/
|
||||
, const bool /*must_be_active*/) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& /*coordinate*/
|
||||
virtual const twidget* find_at(const point& /*coordinate*/
|
||||
, const bool /*must_be_active*/) const override;
|
||||
|
||||
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
|
||||
|
@ -439,23 +439,23 @@ struct tindependent : public virtual tgenerator_
|
|||
virtual void request_reduce_height(const unsigned maximum_height) override;
|
||||
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& origin) override;
|
||||
virtual void set_origin(const point& origin) override;
|
||||
|
||||
/** See @ref thorizontal_list::set_visible_rectangle(). */
|
||||
void set_visible_rectangle(const SDL_Rect& rectangle) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** See @ref twidget::find. */
|
||||
|
@ -817,13 +817,13 @@ public:
|
|||
}
|
||||
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override
|
||||
virtual point calculate_best_size() const override
|
||||
{
|
||||
return placement::calculate_best_size();
|
||||
}
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override
|
||||
virtual void place(const point& origin, const point& size) override
|
||||
{
|
||||
// Inherited, so we get useful debug info.
|
||||
twidget::place(origin, size);
|
||||
|
@ -832,7 +832,7 @@ public:
|
|||
}
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& origin) override
|
||||
virtual void set_origin(const point& origin) override
|
||||
{
|
||||
// Inherited.
|
||||
twidget::set_origin(origin);
|
||||
|
@ -877,14 +877,14 @@ public:
|
|||
}
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override
|
||||
{
|
||||
return placement::find_at(coordinate, must_be_active);
|
||||
}
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override
|
||||
{
|
||||
return placement::find_at(coordinate, must_be_active);
|
||||
|
|
|
@ -207,7 +207,7 @@ void tgrid::reduce_width(const unsigned maximum_width)
|
|||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
DBG_GUI_L << LOG_HEADER << " maximum width " << maximum_width << ".\n";
|
||||
|
||||
tpoint size = get_best_size();
|
||||
point size = get_best_size();
|
||||
if(size.x <= static_cast<int>(maximum_width)) {
|
||||
DBG_GUI_L << LOG_HEADER << " Already fits.\n";
|
||||
return;
|
||||
|
@ -236,7 +236,7 @@ void tgrid::reduce_width(const unsigned maximum_width)
|
|||
|
||||
void tgrid::request_reduce_width(const unsigned maximum_width)
|
||||
{
|
||||
tpoint size = get_best_size();
|
||||
point size = get_best_size();
|
||||
if(size.x <= static_cast<int>(maximum_width)) {
|
||||
/** @todo this point shouldn't be reached, find out why it does. */
|
||||
return;
|
||||
|
@ -285,7 +285,7 @@ void tgrid::reduce_height(const unsigned maximum_height)
|
|||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
DBG_GUI_L << LOG_HEADER << " maximum height " << maximum_height << ".\n";
|
||||
|
||||
tpoint size = get_best_size();
|
||||
point size = get_best_size();
|
||||
if(size.y <= static_cast<int>(maximum_height)) {
|
||||
DBG_GUI_L << LOG_HEADER << " Already fits.\n";
|
||||
return;
|
||||
|
@ -314,7 +314,7 @@ void tgrid::reduce_height(const unsigned maximum_height)
|
|||
|
||||
void tgrid::request_reduce_height(const unsigned maximum_height)
|
||||
{
|
||||
tpoint size = get_best_size();
|
||||
point size = get_best_size();
|
||||
if(size.y <= static_cast<int>(maximum_height)) {
|
||||
/** @todo this point shouldn't be reached, find out why it does. */
|
||||
return;
|
||||
|
@ -377,14 +377,14 @@ void tgrid::demand_reduce_height(const unsigned /*maximum_height*/)
|
|||
/** @todo Implement. */
|
||||
}
|
||||
|
||||
tpoint tgrid::recalculate_best_size()
|
||||
point tgrid::recalculate_best_size()
|
||||
{
|
||||
tpoint best_size = calculate_best_size();
|
||||
point best_size = calculate_best_size();
|
||||
set_layout_size(best_size);
|
||||
return best_size;
|
||||
}
|
||||
|
||||
tpoint tgrid::calculate_best_size() const
|
||||
point tgrid::calculate_best_size() const
|
||||
{
|
||||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
|
||||
|
@ -398,7 +398,7 @@ tpoint tgrid::calculate_best_size() const
|
|||
for(unsigned row = 0; row < rows_; ++row) {
|
||||
for(unsigned col = 0; col < cols_; ++col) {
|
||||
|
||||
const tpoint size = child(row, col).get_best_size();
|
||||
const point size = child(row, col).get_best_size();
|
||||
|
||||
if(size.x > static_cast<int>(col_width_[col])) {
|
||||
col_width_[col] = size.x;
|
||||
|
@ -420,7 +420,7 @@ tpoint tgrid::calculate_best_size() const
|
|||
<< " will be " << col_width_[col] << ".\n";
|
||||
}
|
||||
|
||||
const tpoint result(
|
||||
const point result(
|
||||
std::accumulate(col_width_.begin(), col_width_.end(), 0),
|
||||
std::accumulate(row_height_.begin(), row_height_.end(), 0));
|
||||
|
||||
|
@ -441,7 +441,7 @@ bool tgrid::can_wrap() const
|
|||
return twidget::can_wrap();
|
||||
}
|
||||
|
||||
void tgrid::place(const tpoint& origin, const tpoint& size)
|
||||
void tgrid::place(const point& origin, const point& size)
|
||||
{
|
||||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
|
||||
|
@ -454,7 +454,7 @@ void tgrid::place(const tpoint& origin, const tpoint& size)
|
|||
}
|
||||
|
||||
// call the calculate so the size cache gets updated.
|
||||
const tpoint best_size = calculate_best_size();
|
||||
const point best_size = calculate_best_size();
|
||||
|
||||
assert(row_height_.size() == rows_);
|
||||
assert(col_width_.size() == cols_);
|
||||
|
@ -548,9 +548,9 @@ void tgrid::place(const tpoint& origin, const tpoint& size)
|
|||
return;
|
||||
}
|
||||
|
||||
void tgrid::set_origin(const tpoint& origin)
|
||||
void tgrid::set_origin(const point& origin)
|
||||
{
|
||||
const tpoint movement = {origin.x - get_x(), origin.y - get_y()};
|
||||
const point movement = {origin.x - get_x(), origin.y - get_y()};
|
||||
|
||||
// Inherited.
|
||||
twidget::set_origin(origin);
|
||||
|
@ -561,7 +561,7 @@ void tgrid::set_origin(const tpoint& origin)
|
|||
twidget* widget = child.widget();
|
||||
assert(widget);
|
||||
|
||||
widget->set_origin(tpoint(widget->get_x() + movement.x, widget->get_y() + movement.y));
|
||||
widget->set_origin(point(widget->get_x() + movement.x, widget->get_y() + movement.y));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -604,13 +604,13 @@ void tgrid::child_populate_dirty_list(twindow& caller,
|
|||
}
|
||||
}
|
||||
|
||||
twidget* tgrid::find_at(const tpoint& coordinate, const bool must_be_active)
|
||||
twidget* tgrid::find_at(const point& coordinate, const bool must_be_active)
|
||||
{
|
||||
return tgrid_implementation::find_at<twidget>(
|
||||
*this, coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* tgrid::find_at(const tpoint& coordinate,
|
||||
const twidget* tgrid::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
return tgrid_implementation::find_at<const twidget>(
|
||||
|
@ -702,7 +702,7 @@ void tgrid::set_rows_cols(const unsigned rows, const unsigned cols)
|
|||
children_.resize(rows_ * cols_);
|
||||
}
|
||||
|
||||
tpoint tgrid::tchild::get_best_size() const
|
||||
point tgrid::tchild::get_best_size() const
|
||||
{
|
||||
log_scope2(log_gui_layout, LOG_CHILD_SCOPE_HEADER)
|
||||
|
||||
|
@ -716,10 +716,10 @@ tpoint tgrid::tchild::get_best_size() const
|
|||
DBG_GUI_L << LOG_CHILD_HEADER << " has widget " << true
|
||||
<< " widget visible " << false << " returning 0,0"
|
||||
<< ".\n";
|
||||
return tpoint();
|
||||
return point();
|
||||
}
|
||||
|
||||
const tpoint best_size = widget_->get_best_size() + border_space();
|
||||
const point best_size = widget_->get_best_size() + border_space();
|
||||
|
||||
DBG_GUI_L << LOG_CHILD_HEADER << " has widget " << true
|
||||
<< " widget visible " << true << " returning " << best_size
|
||||
|
@ -727,7 +727,7 @@ tpoint tgrid::tchild::get_best_size() const
|
|||
return best_size;
|
||||
}
|
||||
|
||||
void tgrid::tchild::place(tpoint origin, tpoint size)
|
||||
void tgrid::tchild::place(point origin, point size)
|
||||
{
|
||||
assert(widget());
|
||||
if(widget()->get_visible() == twidget::tvisible::invisible) {
|
||||
|
@ -754,7 +754,7 @@ void tgrid::tchild::place(tpoint origin, tpoint size)
|
|||
|
||||
// If size smaller or equal to best size set that size.
|
||||
// No need to check > min size since this is what we got.
|
||||
const tpoint best_size = widget()->get_best_size();
|
||||
const point best_size = widget()->get_best_size();
|
||||
if(size <= best_size) {
|
||||
DBG_GUI_L << LOG_CHILD_HEADER
|
||||
<< " in best size range setting widget to " << origin << " x "
|
||||
|
@ -765,13 +765,13 @@ void tgrid::tchild::place(tpoint origin, tpoint size)
|
|||
}
|
||||
|
||||
const tcontrol* control = dynamic_cast<const tcontrol*>(widget());
|
||||
const tpoint maximum_size = control ? control->get_config_maximum_size()
|
||||
: tpoint();
|
||||
const point maximum_size = control ? control->get_config_maximum_size()
|
||||
: point();
|
||||
|
||||
if((flags_ & (HORIZONTAL_MASK | VERTICAL_MASK))
|
||||
== (HORIZONTAL_GROW_SEND_TO_CLIENT | VERTICAL_GROW_SEND_TO_CLIENT)) {
|
||||
|
||||
if(maximum_size == tpoint() || size <= maximum_size) {
|
||||
if(maximum_size == point() || size <= maximum_size) {
|
||||
|
||||
DBG_GUI_L << LOG_CHILD_HEADER
|
||||
<< " in maximum size range setting widget to " << origin
|
||||
|
@ -782,8 +782,8 @@ void tgrid::tchild::place(tpoint origin, tpoint size)
|
|||
}
|
||||
}
|
||||
|
||||
tpoint widget_size = tpoint(std::min(size.x, best_size.x), std::min(size.y, best_size.y));
|
||||
tpoint widget_orig = origin;
|
||||
point widget_size = point(std::min(size.x, best_size.x), std::min(size.y, best_size.y));
|
||||
point widget_orig = origin;
|
||||
|
||||
const unsigned v_flag = flags_ & VERTICAL_MASK;
|
||||
|
||||
|
@ -870,9 +870,9 @@ const std::string& tgrid::tchild::id() const
|
|||
return widget_->id();
|
||||
}
|
||||
|
||||
tpoint tgrid::tchild::border_space() const
|
||||
point tgrid::tchild::border_space() const
|
||||
{
|
||||
tpoint result(0, 0);
|
||||
point result(0, 0);
|
||||
|
||||
if(border_size_) {
|
||||
|
||||
|
@ -890,13 +890,13 @@ tpoint tgrid::tchild::border_space() const
|
|||
return result;
|
||||
}
|
||||
|
||||
void tgrid::layout(const tpoint& origin)
|
||||
void tgrid::layout(const point& origin)
|
||||
{
|
||||
tpoint orig = origin;
|
||||
point orig = origin;
|
||||
for(unsigned row = 0; row < rows_; ++row) {
|
||||
for(unsigned col = 0; col < cols_; ++col) {
|
||||
|
||||
const tpoint size(col_width_[col], row_height_[row]);
|
||||
const point size(col_width_[col], row_height_[row]);
|
||||
DBG_GUI_L << LOG_HEADER << " set widget at " << row << ',' << col
|
||||
<< " at origin " << orig << " with size " << size
|
||||
<< ".\n";
|
||||
|
@ -958,7 +958,7 @@ unsigned tgrid_implementation::row_request_reduce_height(
|
|||
tgrid::tchild& cell = grid.child(row, x);
|
||||
cell_request_reduce_height(cell, maximum_height);
|
||||
|
||||
const tpoint size(cell.get_best_size());
|
||||
const point size(cell.get_best_size());
|
||||
|
||||
if(required_height == 0 || static_cast<size_t>(size.y)
|
||||
> required_height) {
|
||||
|
@ -983,7 +983,7 @@ unsigned tgrid_implementation::column_request_reduce_width(
|
|||
tgrid::tchild& cell = grid.child(y, column);
|
||||
cell_request_reduce_width(cell, maximum_width);
|
||||
|
||||
const tpoint size(cell.get_best_size());
|
||||
const point size(cell.get_best_size());
|
||||
|
||||
if(required_width == 0 || static_cast<size_t>(size.x)
|
||||
> required_width) {
|
||||
|
|
|
@ -228,11 +228,11 @@ public:
|
|||
*
|
||||
* @returns The newly calculated size.
|
||||
*/
|
||||
tpoint recalculate_best_size();
|
||||
point recalculate_best_size();
|
||||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/** See @ref twidget::can_wrap. */
|
||||
|
@ -240,12 +240,12 @@ public:
|
|||
|
||||
public:
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& origin) override;
|
||||
virtual void set_origin(const point& origin) override;
|
||||
|
||||
/** See @ref twidget::set_visible_rectangle. */
|
||||
virtual void set_visible_rectangle(const SDL_Rect& rectangle) override;
|
||||
|
@ -259,11 +259,11 @@ public:
|
|||
const std::vector<twidget*>& call_stack) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** See @ref twidget::find. */
|
||||
|
@ -319,7 +319,7 @@ private:
|
|||
}
|
||||
|
||||
/** Returns the best size for the cell. */
|
||||
tpoint get_best_size() const;
|
||||
point get_best_size() const;
|
||||
|
||||
/**
|
||||
* Places the widget in the cell.
|
||||
|
@ -327,7 +327,7 @@ private:
|
|||
* @param origin The origin (x, y) for the widget.
|
||||
* @param size The size for the widget.
|
||||
*/
|
||||
void place(tpoint origin, tpoint size);
|
||||
void place(point origin, point size);
|
||||
|
||||
/** Forwards @ref tgrid::layout_initialise to the cell. */
|
||||
void layout_initialise(const bool full_initialisation);
|
||||
|
@ -392,7 +392,7 @@ private:
|
|||
twidget* widget_;
|
||||
|
||||
/** Returns the space needed for the border. */
|
||||
tpoint border_space() const;
|
||||
point border_space() const;
|
||||
|
||||
}; // class tchild
|
||||
|
||||
|
@ -484,7 +484,7 @@ private:
|
|||
}
|
||||
|
||||
/** Layouts the children in the grid. */
|
||||
void layout(const tpoint& origin);
|
||||
void layout(const point& origin);
|
||||
|
||||
/** See @ref twidget::impl_draw_children. */
|
||||
virtual void impl_draw_children(surface& frame_buffer,
|
||||
|
|
|
@ -47,13 +47,13 @@ struct tgrid_implementation
|
|||
{
|
||||
/**
|
||||
* Implementation for the wrappers for
|
||||
* [const] twidget* tgrid::find_at(const tpoint&, const bool) [const].
|
||||
* [const] twidget* tgrid::find_at(const point&, const bool) [const].
|
||||
*
|
||||
* @tparam W twidget or const twidget.
|
||||
*/
|
||||
template <class W>
|
||||
static W* find_at(typename utils::tconst_clone<tgrid, W>::reference grid,
|
||||
const tpoint& coordinate,
|
||||
const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
typedef typename utils::tconst_clone<tgrid::tchild, W>::type hack;
|
||||
|
|
|
@ -45,7 +45,7 @@ bool init()
|
|||
return initialized_;
|
||||
}
|
||||
|
||||
SDL_Rect create_rect(const tpoint& origin, const tpoint& size)
|
||||
SDL_Rect create_rect(const point& origin, const point& size)
|
||||
{
|
||||
return sdl::create_rect(origin.x, origin.y, size.x, size.y);
|
||||
}
|
||||
|
@ -144,12 +144,12 @@ game_logic::map_formula_callable get_screen_size_variables()
|
|||
return result;
|
||||
}
|
||||
|
||||
tpoint get_mouse_position()
|
||||
point get_mouse_position()
|
||||
{
|
||||
int x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
|
||||
return tpoint(x, y);
|
||||
return point(x, y);
|
||||
}
|
||||
|
||||
std::string debug_truncate(const std::string& text)
|
||||
|
|
|
@ -36,7 +36,7 @@ class map_formula_callable;
|
|||
namespace gui2
|
||||
{
|
||||
|
||||
struct tpoint;
|
||||
struct point;
|
||||
|
||||
/**
|
||||
* Initializes the gui subsystems.
|
||||
|
@ -54,7 +54,7 @@ bool init();
|
|||
*
|
||||
* @returns SDL_Rect with the proper rectangle.
|
||||
*/
|
||||
SDL_Rect create_rect(const tpoint& origin, const tpoint& size);
|
||||
SDL_Rect create_rect(const point& origin, const point& size);
|
||||
|
||||
/**
|
||||
* Converts a color string to a color.
|
||||
|
@ -130,7 +130,7 @@ void get_screen_size_variables(game_logic::map_formula_callable& variable);
|
|||
game_logic::map_formula_callable get_screen_size_variables();
|
||||
|
||||
/** Returns the current mouse position. */
|
||||
tpoint get_mouse_position();
|
||||
point get_mouse_position();
|
||||
|
||||
/**
|
||||
* Returns a truncated version of the text.
|
||||
|
|
|
@ -73,7 +73,7 @@ unsigned thorizontal_scrollbar::offset_after() const
|
|||
return conf->right_offset;
|
||||
}
|
||||
|
||||
bool thorizontal_scrollbar::on_positioner(const tpoint& coordinate) const
|
||||
bool thorizontal_scrollbar::on_positioner(const point& coordinate) const
|
||||
{
|
||||
// Note we assume the positioner is over the entire height of the widget.
|
||||
return coordinate.x >= static_cast<int>(get_positioner_offset())
|
||||
|
@ -82,7 +82,7 @@ bool thorizontal_scrollbar::on_positioner(const tpoint& coordinate) const
|
|||
&& coordinate.y > 0 && coordinate.y < static_cast<int>(get_height());
|
||||
}
|
||||
|
||||
int thorizontal_scrollbar::on_bar(const tpoint& coordinate) const
|
||||
int thorizontal_scrollbar::on_bar(const point& coordinate) const
|
||||
{
|
||||
// Not on the widget, leave.
|
||||
if(static_cast<size_t>(coordinate.x) > get_width()
|
||||
|
@ -102,7 +102,7 @@ int thorizontal_scrollbar::on_bar(const tpoint& coordinate) const
|
|||
}
|
||||
}
|
||||
|
||||
bool thorizontal_scrollbar::in_orthogonal_range(const tpoint& coordinate) const
|
||||
bool thorizontal_scrollbar::in_orthogonal_range(const point& coordinate) const
|
||||
{
|
||||
return static_cast<size_t>(coordinate.x) < get_width();
|
||||
}
|
||||
|
|
|
@ -53,16 +53,16 @@ private:
|
|||
unsigned offset_after() const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
bool on_positioner(const tpoint& coordinate) const override;
|
||||
bool on_positioner(const point& coordinate) const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
int on_bar(const tpoint& coordinate) const override;
|
||||
int on_bar(const point& coordinate) const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
bool in_orthogonal_range(const tpoint& coordinate) const override;
|
||||
bool in_orthogonal_range(const point& coordinate) const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
int get_length_difference(const tpoint& original, const tpoint& current) const override
|
||||
int get_length_difference(const point& original, const point& current) const override
|
||||
{
|
||||
return current.x - original.x;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace gui2
|
|||
|
||||
REGISTER_WIDGET(image)
|
||||
|
||||
tpoint timage::calculate_best_size() const
|
||||
point timage::calculate_best_size() const
|
||||
{
|
||||
surface image(image::get_image(image::locator(label())));
|
||||
|
||||
|
@ -45,10 +45,10 @@ tpoint timage::calculate_best_size() const
|
|||
return get_config_default_size();
|
||||
}
|
||||
|
||||
const tpoint minimum = get_config_default_size();
|
||||
const tpoint maximum = get_config_maximum_size();
|
||||
const point minimum = get_config_default_size();
|
||||
const point maximum = get_config_maximum_size();
|
||||
|
||||
tpoint result = {image->w, image->h};
|
||||
point result = {image->w, image->h};
|
||||
|
||||
if(minimum.x > 0 && result.x < minimum.x) {
|
||||
DBG_GUI_L << LOG_HEADER << " increase width to minimum.\n";
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
|
|
@ -164,7 +164,7 @@ void tlabel::signal_handler_left_button_click(const event::tevent /* event */, b
|
|||
}
|
||||
|
||||
|
||||
tpoint mouse = get_mouse_position();
|
||||
point mouse = get_mouse_position();
|
||||
|
||||
mouse.x -= get_x();
|
||||
mouse.y -= get_y();
|
||||
|
@ -193,7 +193,7 @@ void tlabel::signal_handler_right_button_click(const event::tevent /* event */,
|
|||
return ; // without marking event as "handled".
|
||||
}
|
||||
|
||||
tpoint mouse = get_mouse_position();
|
||||
point mouse = get_mouse_position();
|
||||
|
||||
mouse.x -= get_x();
|
||||
mouse.y -= get_y();
|
||||
|
|
|
@ -264,7 +264,7 @@ int tlist::get_selected_row() const
|
|||
return generator_->get_selected_item();
|
||||
}
|
||||
|
||||
void tlist::place(const tpoint& origin, const tpoint& size)
|
||||
void tlist::place(const point& origin, const point& size)
|
||||
{
|
||||
// Inherited.
|
||||
tcontainer_::place(origin, size);
|
||||
|
@ -303,7 +303,7 @@ void tlist::resize_content(
|
|||
if(content_resize_request(width_modification, height_modification)) {
|
||||
|
||||
// Calculate new size.
|
||||
tpoint size = content_grid()->get_size();
|
||||
point size = content_grid()->get_size();
|
||||
size.x += width_modification;
|
||||
size.y += height_modification;
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ public:
|
|||
virtual unsigned get_state() const override;
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -268,7 +268,7 @@ private:
|
|||
void layout_children(const bool force);
|
||||
#if 0
|
||||
/** Inherited from tscrollbar_container. */
|
||||
virtual void set_content_size(const tpoint& origin, const tpoint& size);
|
||||
virtual void set_content_size(const point& origin, const point& size);
|
||||
#endif
|
||||
/** See @ref tcontainer_::set_self_active. */
|
||||
virtual void set_self_active(const bool active) override;
|
||||
|
|
|
@ -165,7 +165,7 @@ void tlistbox::set_row_shown(const unsigned row, const bool shown)
|
|||
twindow::tinvalidate_layout_blocker invalidate_layout_blocker(*window);
|
||||
|
||||
generator_->set_item_shown(row, shown);
|
||||
tpoint best_size = generator_->calculate_best_size();
|
||||
point best_size = generator_->calculate_best_size();
|
||||
generator_->place(generator_->get_origin(), { std::max(best_size.x, content_visible_area().w), best_size.y });
|
||||
resize_needed = !content_resize_request();
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ void tlistbox::set_row_shown(const boost::dynamic_bitset<>& shown)
|
|||
for(size_t i = 0; i < shown.size(); ++i) {
|
||||
generator_->set_item_shown(i, shown[i]);
|
||||
}
|
||||
tpoint best_size = generator_->calculate_best_size();
|
||||
point best_size = generator_->calculate_best_size();
|
||||
generator_->place(generator_->get_origin(), { std::max(best_size.x, content_visible_area().w), best_size.y });
|
||||
resize_needed = !content_resize_request();
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ bool tlistbox::update_content_size()
|
|||
return true;
|
||||
}
|
||||
|
||||
if(get_size() == tpoint()) {
|
||||
if(get_size() == point()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -321,11 +321,11 @@ bool tlistbox::update_content_size()
|
|||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif
|
||||
|
||||
void tlistbox::place(const tpoint& origin, const tpoint& size)
|
||||
void tlistbox::place(const point& origin, const point& size)
|
||||
{
|
||||
boost::optional<unsigned> vertical_scrollbar_position, horizontal_scrollbar_position;
|
||||
// Check if this is the first time placing the list box
|
||||
if (get_origin() != tpoint{-1, -1})
|
||||
if (get_origin() != point{-1, -1})
|
||||
{
|
||||
vertical_scrollbar_position = get_vertical_scrollbar_item_position();
|
||||
horizontal_scrollbar_position = get_horizontal_scrollbar_item_position();
|
||||
|
@ -370,7 +370,7 @@ void tlistbox::resize_content(const int width_modification,
|
|||
if(content_resize_request(width_modification, height_modification, width_modification_pos, height_modification_pos)) {
|
||||
|
||||
// Calculate new size.
|
||||
tpoint size = content_grid()->get_size();
|
||||
point size = content_grid()->get_size();
|
||||
size.x += width_modification;
|
||||
size.y += height_modification;
|
||||
|
||||
|
@ -398,8 +398,8 @@ void tlistbox::resize_content(const twidget& row)
|
|||
DBG_GUI_L << LOG_HEADER << " current size " << content_grid()->get_size()
|
||||
<< " row size " << row.get_best_size() << ".\n";
|
||||
|
||||
const tpoint content = content_grid()->get_size();
|
||||
tpoint size = row.get_best_size();
|
||||
const point content = content_grid()->get_size();
|
||||
point size = row.get_best_size();
|
||||
if(size.x < content.x) {
|
||||
size.x = 0;
|
||||
} else {
|
||||
|
@ -674,13 +674,13 @@ const tlistbox::order_pair tlistbox::get_active_sorting_option()
|
|||
return {-1, SORT_NONE};
|
||||
}
|
||||
|
||||
void tlistbox::set_content_size(const tpoint& origin, const tpoint& size)
|
||||
void tlistbox::set_content_size(const point& origin, const point& size)
|
||||
{
|
||||
/** @todo This function needs more testing. */
|
||||
assert(content_grid());
|
||||
|
||||
const int best_height = content_grid()->get_best_size().y;
|
||||
const tpoint s(size.x, size.y < best_height ? size.y : best_height);
|
||||
const point s(size.x, size.y < best_height ? size.y : best_height);
|
||||
|
||||
content_grid()->place(origin, s);
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ public:
|
|||
/***** ***** ***** ***** inherited ***** ***** ****** *****/
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/** See @ref twidget::layout_children. */
|
||||
virtual void layout_children() override;
|
||||
|
@ -389,7 +389,7 @@ private:
|
|||
void layout_children(const bool force);
|
||||
|
||||
/** Inherited from tscrollbar_container. */
|
||||
virtual void set_content_size(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void set_content_size(const point& origin, const point& size) override;
|
||||
|
||||
/** See @ref tcontrol::get_control_type. */
|
||||
virtual const std::string& get_control_type() const override;
|
||||
|
|
|
@ -101,7 +101,7 @@ tmatrix::create_item(const std::map<std::string, string_map>& item_data,
|
|||
return pane_->create_item(item_data, tags);
|
||||
}
|
||||
|
||||
void tmatrix::place(const tpoint& origin, const tpoint& size)
|
||||
void tmatrix::place(const point& origin, const point& size)
|
||||
{
|
||||
twidget::place(origin, size);
|
||||
|
||||
|
@ -135,12 +135,12 @@ void tmatrix::request_reduce_width(const unsigned /*maximum_width*/)
|
|||
{
|
||||
}
|
||||
|
||||
twidget* tmatrix::find_at(const tpoint& coordinate, const bool must_be_active)
|
||||
twidget* tmatrix::find_at(const point& coordinate, const bool must_be_active)
|
||||
{
|
||||
return content_.find_at(coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* tmatrix::find_at(const tpoint& coordinate,
|
||||
const twidget* tmatrix::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
return content_.find_at(coordinate, must_be_active);
|
||||
|
@ -165,9 +165,9 @@ const twidget* tmatrix::find(const std::string& id, const bool must_be_active)
|
|||
}
|
||||
}
|
||||
|
||||
tpoint tmatrix::calculate_best_size() const
|
||||
point tmatrix::calculate_best_size() const
|
||||
{
|
||||
tpoint size = content_.get_best_size();
|
||||
point size = content_.get_best_size();
|
||||
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ public:
|
|||
/***** ***** ***** ***** Inherited operations. ***** ***** ****** *****/
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/** See @ref twidget::layout_initialise. */
|
||||
virtual void layout_initialise(const bool full_initialisation) override;
|
||||
|
@ -139,11 +139,11 @@ public:
|
|||
virtual void request_reduce_width(const unsigned maximum_width) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** See @ref twidget::find. */
|
||||
|
@ -182,7 +182,7 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/** See @ref twidget::disable_click_dismiss. */
|
||||
|
|
|
@ -45,13 +45,13 @@ struct tpane_implementation
|
|||
{
|
||||
/**
|
||||
* Implementation for the wrappers for
|
||||
* [const] twidget* tpane::find_at(const tpoint&, const bool) [const].
|
||||
* [const] twidget* tpane::find_at(const point&, const bool) [const].
|
||||
*
|
||||
* @tparam W A pointer to the pane.
|
||||
*/
|
||||
template <class W>
|
||||
static typename utils::tconst_clone<twidget, W>::pointer
|
||||
find_at(W pane, tpoint coordinate, const bool must_be_active)
|
||||
find_at(W pane, point coordinate, const bool must_be_active)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -164,7 +164,7 @@ unsigned tpane::create_item(const std::map<std::string, string_map>& item_data,
|
|||
return item.id;
|
||||
}
|
||||
|
||||
void tpane::place(const tpoint& origin, const tpoint& size)
|
||||
void tpane::place(const point& origin, const point& size)
|
||||
{
|
||||
DBG_GUI_L << LOG_HEADER << '\n';
|
||||
twidget::place(origin, size);
|
||||
|
@ -235,18 +235,18 @@ void tpane::request_reduce_width(const unsigned /*maximum_width*/)
|
|||
{
|
||||
}
|
||||
|
||||
twidget* tpane::find_at(const tpoint& coordinate, const bool must_be_active)
|
||||
twidget* tpane::find_at(const point& coordinate, const bool must_be_active)
|
||||
{
|
||||
return tpane_implementation::find_at(this, coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* tpane::find_at(const tpoint& coordinate,
|
||||
const twidget* tpane::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
return tpane_implementation::find_at(this, coordinate, must_be_active);
|
||||
}
|
||||
|
||||
tpoint tpane::calculate_best_size() const
|
||||
point tpane::calculate_best_size() const
|
||||
{
|
||||
prepare_placement();
|
||||
return placer_->get_size();
|
||||
|
@ -285,7 +285,7 @@ void tpane::place_children()
|
|||
continue;
|
||||
}
|
||||
|
||||
const tpoint origin = placer_->get_origin(index);
|
||||
const point origin = placer_->get_origin(index);
|
||||
item.grid->place(origin, item.grid->get_best_size());
|
||||
++index;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ void tpane::set_origin_children()
|
|||
continue;
|
||||
}
|
||||
|
||||
const tpoint origin = placer_->get_origin(index);
|
||||
const point origin = placer_->get_origin(index);
|
||||
item.grid->set_origin(origin);
|
||||
++index;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ void tpane::place_or_set_origin_children()
|
|||
continue;
|
||||
}
|
||||
|
||||
const tpoint origin = placer_->get_origin(index);
|
||||
const point origin = placer_->get_origin(index);
|
||||
if(item.grid->get_size() != item.grid->get_best_size()) {
|
||||
item.grid->place(origin, item.grid->get_best_size());
|
||||
} else {
|
||||
|
@ -369,7 +369,7 @@ void tpane::signal_handler_request_placement(tdispatcher& dispatcher,
|
|||
* what seems to work properly when showing and hiding
|
||||
* items. Might fail with new items (haven't tested yet).
|
||||
*/
|
||||
item.grid->place(tpoint(), item.grid->get_best_size());
|
||||
item.grid->place(point(), item.grid->get_best_size());
|
||||
}
|
||||
place_or_set_origin_children();
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << " handled.\n";
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
const std::map<std::string, std::string>& tags);
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/** See @ref twidget::layout_initialise. */
|
||||
virtual void layout_initialise(const bool full_initialisation) override;
|
||||
|
@ -90,11 +90,11 @@ public:
|
|||
virtual void request_reduce_width(const unsigned maximum_width) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/** See @ref twidget::disable_click_dismiss. */
|
||||
|
|
|
@ -74,14 +74,14 @@ void tpanel::impl_draw_foreground(surface& frame_buffer, int x_offset, int y_off
|
|||
calculate_blitting_rectangle(x_offset, y_offset));
|
||||
}
|
||||
|
||||
tpoint tpanel::border_space() const
|
||||
point tpanel::border_space() const
|
||||
{
|
||||
std::shared_ptr<const tpanel_definition::tresolution> conf
|
||||
= std::static_pointer_cast<const tpanel_definition::tresolution>(
|
||||
config());
|
||||
assert(conf);
|
||||
|
||||
return tpoint(conf->left_border + conf->right_border, conf->top_border + conf->bottom_border);
|
||||
return point(conf->left_border + conf->right_border, conf->top_border + conf->bottom_border);
|
||||
}
|
||||
|
||||
const std::string& tpanel::get_control_type() const
|
||||
|
|
|
@ -68,7 +68,7 @@ private:
|
|||
virtual const std::string& get_control_type() const override;
|
||||
|
||||
/** See @ref tcontainer_::border_space. */
|
||||
virtual tpoint border_space() const override;
|
||||
virtual point border_space() const override;
|
||||
|
||||
/** See @ref tcontainer_::set_self_active. */
|
||||
virtual void set_self_active(const bool active) override;
|
||||
|
|
|
@ -99,7 +99,7 @@ void tscrollbar_::scroll(const tscroll scroll)
|
|||
fire(event::NOTIFY_MODIFIED, *this, nullptr);
|
||||
}
|
||||
|
||||
void tscrollbar_::place(const tpoint& origin, const tpoint& size)
|
||||
void tscrollbar_::place(const point& origin, const point& size)
|
||||
{
|
||||
// Inherited.
|
||||
tcontrol::place(origin, size);
|
||||
|
@ -326,11 +326,11 @@ void tscrollbar_::signal_handler_mouse_enter(const event::tevent event,
|
|||
void tscrollbar_::signal_handler_mouse_motion(const event::tevent event,
|
||||
bool& handled,
|
||||
bool& halt,
|
||||
const tpoint& coordinate)
|
||||
const point& coordinate)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << " at " << coordinate << ".\n";
|
||||
|
||||
tpoint mouse = coordinate;
|
||||
point mouse = coordinate;
|
||||
mouse.x -= get_x();
|
||||
mouse.y -= get_y();
|
||||
|
||||
|
@ -386,7 +386,7 @@ void tscrollbar_::signal_handler_left_button_down(const event::tevent event,
|
|||
{
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";
|
||||
|
||||
tpoint mouse = get_mouse_position();
|
||||
point mouse = get_mouse_position();
|
||||
mouse.x -= get_x();
|
||||
mouse.y -= get_y();
|
||||
|
||||
|
@ -419,7 +419,7 @@ void tscrollbar_::signal_handler_left_button_up(const event::tevent event,
|
|||
{
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";
|
||||
|
||||
tpoint mouse = get_mouse_position();
|
||||
point mouse = get_mouse_position();
|
||||
mouse.x -= get_x();
|
||||
mouse.y -= get_y();
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
/***** ***** ***** ***** layout functions ***** ***** ***** *****/
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
||||
|
@ -182,7 +182,7 @@ protected:
|
|||
return positioner_length_;
|
||||
}
|
||||
|
||||
tpoint get_mouse_position_last_move() const
|
||||
point get_mouse_position_last_move() const
|
||||
{
|
||||
return mouse_;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ private:
|
|||
*
|
||||
* This is used during dragging the positioner.
|
||||
*/
|
||||
tpoint mouse_;
|
||||
point mouse_;
|
||||
|
||||
/**
|
||||
* The start offset of the positioner.
|
||||
|
@ -298,7 +298,7 @@ private:
|
|||
*
|
||||
* @returns Whether the location on the positioner is.
|
||||
*/
|
||||
virtual bool on_positioner(const tpoint& coordinate) const = 0;
|
||||
virtual bool on_positioner(const point& coordinate) const = 0;
|
||||
|
||||
/**
|
||||
* Is the coordinate on the bar?
|
||||
|
@ -311,7 +311,7 @@ private:
|
|||
* @retval 0 Coordinate is not on the bar.
|
||||
* @retval 1 Coordinate is on the bar after the positioner.
|
||||
*/
|
||||
virtual int on_bar(const tpoint& coordinate) const = 0;
|
||||
virtual int on_bar(const point& coordinate) const = 0;
|
||||
|
||||
/**
|
||||
* Is the coordinate in the bar's orthogonal range?
|
||||
|
@ -321,7 +321,7 @@ private:
|
|||
* @returns Whether the location is in the bar's.
|
||||
* orthogonal range.
|
||||
*/
|
||||
virtual bool in_orthogonal_range(const tpoint& coordinate) const = 0;
|
||||
virtual bool in_orthogonal_range(const point& coordinate) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the relevant difference in between the two positions.
|
||||
|
@ -329,8 +329,8 @@ private:
|
|||
* This function is used to determine how much the positioner needs to be
|
||||
* moved.
|
||||
*/
|
||||
virtual int get_length_difference(const tpoint& original,
|
||||
const tpoint& current) const = 0;
|
||||
virtual int get_length_difference(const point& original,
|
||||
const point& current) const = 0;
|
||||
|
||||
/***** ***** ***** ***** Private functions ***** ***** ***** *****/
|
||||
|
||||
|
@ -370,7 +370,7 @@ private:
|
|||
void signal_handler_mouse_motion(const event::tevent event,
|
||||
bool& handled,
|
||||
bool& halt,
|
||||
const tpoint& coordinate);
|
||||
const point& coordinate);
|
||||
|
||||
void signal_handler_mouse_leave(const event::tevent event, bool& handled);
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ void tscrollbar_container::request_reduce_height(const unsigned maximum_height)
|
|||
content_grid_->request_reduce_height(maximum_height - offset);
|
||||
|
||||
// Did we manage to achieve the wanted size?
|
||||
tpoint size = get_best_size();
|
||||
point size = get_best_size();
|
||||
if(static_cast<unsigned>(size.y) <= maximum_height) {
|
||||
DBG_GUI_L << LOG_HEADER << " child honored request, height " << size.y
|
||||
<< ".\n";
|
||||
|
@ -200,7 +200,7 @@ void tscrollbar_container::request_reduce_height(const unsigned maximum_height)
|
|||
// Always set the bar visible, is a nop is already visible.
|
||||
vertical_scrollbar_grid_->set_visible(twidget::tvisible::visible);
|
||||
|
||||
const tpoint scrollbar_size = vertical_scrollbar_grid_->get_best_size();
|
||||
const point scrollbar_size = vertical_scrollbar_grid_->get_best_size();
|
||||
|
||||
// If showing the scrollbar increased the height, hide and abort.
|
||||
if(resized && scrollbar_size.y > size.y) {
|
||||
|
@ -246,7 +246,7 @@ void tscrollbar_container::request_reduce_width(const unsigned maximum_width)
|
|||
content_grid_->request_reduce_width(maximum_width - offset);
|
||||
|
||||
// Did we manage to achieve the wanted size?
|
||||
tpoint size = get_best_size();
|
||||
point size = get_best_size();
|
||||
if(static_cast<unsigned>(size.x) <= maximum_width) {
|
||||
DBG_GUI_L << LOG_HEADER << " child honored request, width " << size.x
|
||||
<< ".\n";
|
||||
|
@ -263,7 +263,7 @@ void tscrollbar_container::request_reduce_width(const unsigned maximum_width)
|
|||
horizontal_scrollbar_grid_->set_visible(twidget::tvisible::visible);
|
||||
size = get_best_size();
|
||||
|
||||
tpoint scrollbar_size = horizontal_scrollbar_grid_->get_best_size();
|
||||
point scrollbar_size = horizontal_scrollbar_grid_->get_best_size();
|
||||
|
||||
/*
|
||||
* If the vertical bar is not invisible it's size needs to be added to the
|
||||
|
@ -302,29 +302,29 @@ bool tscrollbar_container::can_wrap() const
|
|||
return content_grid_ ? content_grid_->can_wrap() : false;
|
||||
}
|
||||
|
||||
tpoint tscrollbar_container::calculate_best_size() const
|
||||
point tscrollbar_container::calculate_best_size() const
|
||||
{
|
||||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
|
||||
/***** get vertical scrollbar size *****/
|
||||
const tpoint vertical_scrollbar
|
||||
const point vertical_scrollbar
|
||||
= vertical_scrollbar_grid_->get_visible()
|
||||
== twidget::tvisible::invisible
|
||||
? tpoint()
|
||||
? point()
|
||||
: vertical_scrollbar_grid_->get_best_size();
|
||||
|
||||
/***** get horizontal scrollbar size *****/
|
||||
const tpoint horizontal_scrollbar
|
||||
const point horizontal_scrollbar
|
||||
= horizontal_scrollbar_grid_->get_visible()
|
||||
== twidget::tvisible::invisible
|
||||
? tpoint()
|
||||
? point()
|
||||
: horizontal_scrollbar_grid_->get_best_size();
|
||||
|
||||
/***** get content size *****/
|
||||
assert(content_grid_);
|
||||
const tpoint content = content_grid_->get_best_size();
|
||||
const point content = content_grid_->get_best_size();
|
||||
|
||||
tpoint result(
|
||||
point result(
|
||||
vertical_scrollbar.x + std::max(horizontal_scrollbar.x, content.x),
|
||||
horizontal_scrollbar.y + std::max(vertical_scrollbar.y, content.y));
|
||||
|
||||
|
@ -424,7 +424,7 @@ adjust_scrollbar_mode(tgrid* scrollbar_grid,
|
|||
}
|
||||
}
|
||||
|
||||
void tscrollbar_container::place(const tpoint& origin, const tpoint& size)
|
||||
void tscrollbar_container::place(const point& origin, const point& size)
|
||||
{
|
||||
// Inherited.
|
||||
tcontainer_::place(origin, size);
|
||||
|
@ -432,12 +432,12 @@ void tscrollbar_container::place(const tpoint& origin, const tpoint& size)
|
|||
// Set content size
|
||||
assert(content_ && content_grid_);
|
||||
|
||||
const tpoint content_origin = content_->get_origin();
|
||||
const point content_origin = content_->get_origin();
|
||||
|
||||
const tpoint best_size = content_grid_->get_best_size();
|
||||
const tpoint content_size(content_->get_width(), content_->get_height());
|
||||
const point best_size = content_grid_->get_best_size();
|
||||
const point content_size(content_->get_width(), content_->get_height());
|
||||
|
||||
const tpoint content_grid_size(std::max(best_size.x, content_size.x),
|
||||
const point content_grid_size(std::max(best_size.x, content_size.x),
|
||||
std::max(best_size.y, content_size.y));
|
||||
|
||||
set_content_size(content_origin, content_grid_size);
|
||||
|
@ -464,7 +464,7 @@ void tscrollbar_container::place(const tpoint& origin, const tpoint& size)
|
|||
content_grid_->set_visible_rectangle(content_visible_area_);
|
||||
}
|
||||
|
||||
void tscrollbar_container::set_origin(const tpoint& origin)
|
||||
void tscrollbar_container::set_origin(const point& origin)
|
||||
{
|
||||
// Inherited.
|
||||
tcontainer_::set_origin(origin);
|
||||
|
@ -472,7 +472,7 @@ void tscrollbar_container::set_origin(const tpoint& origin)
|
|||
// Set content size
|
||||
assert(content_ && content_grid_);
|
||||
|
||||
const tpoint content_origin = content_->get_origin();
|
||||
const point content_origin = content_->get_origin();
|
||||
|
||||
content_grid_->set_origin(content_origin);
|
||||
|
||||
|
@ -502,14 +502,14 @@ unsigned tscrollbar_container::get_state() const
|
|||
return state_;
|
||||
}
|
||||
|
||||
twidget* tscrollbar_container::find_at(const tpoint& coordinate,
|
||||
twidget* tscrollbar_container::find_at(const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
return tscrollbar_container_implementation::find_at<twidget>(
|
||||
*this, coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* tscrollbar_container::find_at(const tpoint& coordinate,
|
||||
const twidget* tscrollbar_container::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
return tscrollbar_container_implementation::find_at<const twidget>(
|
||||
|
@ -549,19 +549,19 @@ bool tscrollbar_container::content_resize_request(const bool force_sizing)
|
|||
|
||||
assert(content_ && content_grid_);
|
||||
|
||||
tpoint best_size = content_grid_->recalculate_best_size();
|
||||
tpoint size = content_->get_size();
|
||||
point best_size = content_grid_->recalculate_best_size();
|
||||
point size = content_->get_size();
|
||||
|
||||
DBG_GUI_L << LOG_HEADER << " wanted size " << best_size
|
||||
<< " available size " << size << ".\n";
|
||||
|
||||
if(size == tpoint()) {
|
||||
if(size == point()) {
|
||||
DBG_GUI_L << LOG_HEADER << " initial setup not done, bailing out.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(best_size.x <= size.x && best_size.y <= size.y) {
|
||||
const tpoint content_size = content_grid_->get_size();
|
||||
const point content_size = content_grid_->get_size();
|
||||
if(content_size.x > size.x || content_size.y > size.y) {
|
||||
DBG_GUI_L << LOG_HEADER << " will fit, only needs a resize.\n";
|
||||
goto resize;
|
||||
|
@ -621,7 +621,7 @@ bool tscrollbar_container::content_resize_request(const int width_modification,
|
|||
<< width_modification << " wanted height modification "
|
||||
<< height_modification << ".\n";
|
||||
|
||||
if(get_size() == tpoint()) {
|
||||
if(get_size() == point()) {
|
||||
DBG_GUI_L << LOG_HEADER << " initial setup not done, bailing out.\n";
|
||||
return false;
|
||||
}
|
||||
|
@ -870,8 +870,8 @@ void tscrollbar_container::child_populate_dirty_list(
|
|||
content_grid_->populate_dirty_list(caller, child_call_stack);
|
||||
}
|
||||
|
||||
void tscrollbar_container::set_content_size(const tpoint& origin,
|
||||
const tpoint& size)
|
||||
void tscrollbar_container::set_content_size(const point& origin,
|
||||
const point& size)
|
||||
{
|
||||
content_grid_->place(origin, size);
|
||||
}
|
||||
|
@ -1147,7 +1147,7 @@ void tscrollbar_container::scrollbar_moved()
|
|||
: vertical_scrollbar_->get_item_position()
|
||||
* vertical_scrollbar_->get_step_size();
|
||||
|
||||
const tpoint content_origin = {content_->get_x() - x_offset, content_->get_y() - y_offset};
|
||||
const point content_origin = {content_->get_x() - x_offset, content_->get_y() - y_offset};
|
||||
|
||||
content_grid_->set_origin(content_origin);
|
||||
content_grid_->set_visible_rectangle(content_visible_area_);
|
||||
|
|
|
@ -106,14 +106,14 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& origin) override;
|
||||
virtual void set_origin(const point& origin) override;
|
||||
|
||||
/** See @ref twidget::set_visible_rectangle. */
|
||||
virtual void set_visible_rectangle(const SDL_Rect& rectangle) override;
|
||||
|
@ -127,11 +127,11 @@ public:
|
|||
virtual unsigned get_state() const override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** See @ref twidget::find. */
|
||||
|
@ -528,7 +528,7 @@ private:
|
|||
* @param origin The origin for the content.
|
||||
* @param size The size of the content.
|
||||
*/
|
||||
virtual void set_content_size(const tpoint& origin, const tpoint& size);
|
||||
virtual void set_content_size(const point& origin, const point& size);
|
||||
|
||||
/** Helper function which needs to be called after the scollbar moved. */
|
||||
void scrollbar_moved();
|
||||
|
|
|
@ -48,7 +48,7 @@ struct tscrollbar_container_implementation
|
|||
/**
|
||||
* Implementation for the wrappers for
|
||||
* [const] twidget* tscrollbar_container::find_at(
|
||||
* const tpoint&, const bool) [const].
|
||||
* const point&, const bool) [const].
|
||||
*
|
||||
* @tparam W twidget or const twidget.
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ struct tscrollbar_container_implementation
|
|||
static W*
|
||||
find_at(typename utils::tconst_clone<tscrollbar_container, W>::reference
|
||||
scrollbar_container,
|
||||
const tpoint& coordinate,
|
||||
const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
|
||||
|
|
|
@ -54,12 +54,12 @@ tslider::tslider()
|
|||
std::bind(&tslider::signal_handler_left_button_up, this, _2, _3));
|
||||
}
|
||||
|
||||
tpoint tslider::calculate_best_size() const
|
||||
point tslider::calculate_best_size() const
|
||||
{
|
||||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
|
||||
// Inherited.
|
||||
tpoint result = tcontrol::calculate_best_size();
|
||||
point result = tcontrol::calculate_best_size();
|
||||
if(best_slider_length_ != 0) {
|
||||
|
||||
// Override length.
|
||||
|
@ -190,7 +190,7 @@ unsigned tslider::offset_after() const
|
|||
return conf->right_offset;
|
||||
}
|
||||
|
||||
bool tslider::on_positioner(const tpoint& coordinate) const
|
||||
bool tslider::on_positioner(const point& coordinate) const
|
||||
{
|
||||
// Note we assume the positioner is over the entire height of the widget.
|
||||
return coordinate.x >= static_cast<int>(get_positioner_offset())
|
||||
|
@ -199,7 +199,7 @@ bool tslider::on_positioner(const tpoint& coordinate) const
|
|||
&& coordinate.y > 0 && coordinate.y < static_cast<int>(get_height());
|
||||
}
|
||||
|
||||
int tslider::on_bar(const tpoint& coordinate) const
|
||||
int tslider::on_bar(const point& coordinate) const
|
||||
{
|
||||
const unsigned x = static_cast<size_t>(coordinate.x);
|
||||
const unsigned y = static_cast<size_t>(coordinate.y);
|
||||
|
@ -219,14 +219,14 @@ int tslider::on_bar(const tpoint& coordinate) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool tslider::in_orthogonal_range(const tpoint& coordinate) const
|
||||
bool tslider::in_orthogonal_range(const point& coordinate) const
|
||||
{
|
||||
return static_cast<size_t>(coordinate.x) < (get_width() - offset_after());
|
||||
}
|
||||
|
||||
/*void tslider::update_current_item_mouse_position()
|
||||
{
|
||||
tpoint mouse = get_mouse_position();
|
||||
point mouse = get_mouse_position();
|
||||
mouse.x -= get_x();
|
||||
mouse.y -= get_y();
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
@ -138,16 +138,16 @@ private:
|
|||
unsigned offset_after() const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
bool on_positioner(const tpoint& coordinate) const override;
|
||||
bool on_positioner(const point& coordinate) const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
int on_bar(const tpoint& coordinate) const override;
|
||||
int on_bar(const point& coordinate) const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
bool in_orthogonal_range(const tpoint& coordinate) const override;
|
||||
bool in_orthogonal_range(const point& coordinate) const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
int get_length_difference(const tpoint& original, const tpoint& current) const override
|
||||
int get_length_difference(const point& original, const point& current) const override
|
||||
{
|
||||
return current.x - original.x;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ private:
|
|||
* this value is upda with the mouse position at the time. This allows the widget to track
|
||||
* how far the mouse has moved since setting the last value.
|
||||
*/
|
||||
tpoint current_item_mouse_position_;
|
||||
point current_item_mouse_position_;
|
||||
|
||||
//void update_current_item_mouse_position();
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ namespace gui2
|
|||
|
||||
REGISTER_WIDGET(spacer)
|
||||
|
||||
tpoint tspacer::calculate_best_size() const
|
||||
point tspacer::calculate_best_size() const
|
||||
{
|
||||
return best_size_ != tpoint() ? best_size_
|
||||
return best_size_ != point() ? best_size_
|
||||
: tcontrol::calculate_best_size();
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ twidget* tbuilder_spacer::build() const
|
|||
const unsigned height = height_(size);
|
||||
|
||||
if(width || height) {
|
||||
widget->set_best_size(tpoint(width, height));
|
||||
widget->set_best_size(point(width, height));
|
||||
}
|
||||
|
||||
DBG_GUI_G << "Window builder: placed spacer '" << id
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
@ -65,14 +65,14 @@ public:
|
|||
|
||||
/***** ***** ***** setters / getters for members ***** ****** *****/
|
||||
|
||||
void set_best_size(const tpoint& best_size)
|
||||
void set_best_size(const point& best_size)
|
||||
{
|
||||
best_size_ = best_size;
|
||||
}
|
||||
|
||||
private:
|
||||
/** When we're used as a fixed size item, this holds the best size. */
|
||||
tpoint best_size_;
|
||||
point best_size_;
|
||||
|
||||
/** See @ref twidget::impl_draw_background. */
|
||||
virtual void impl_draw_background(surface& frame_buffer,
|
||||
|
|
|
@ -201,13 +201,13 @@ protected:
|
|||
|
||||
/***** ***** ***** ***** expose some functions ***** ***** ***** *****/
|
||||
|
||||
gui2::tpoint get_cursor_position(const unsigned column,
|
||||
gui2::point get_cursor_position(const unsigned column,
|
||||
const unsigned line = 0) const
|
||||
{
|
||||
return text_.get_cursor_position(column, line);
|
||||
}
|
||||
|
||||
tpoint get_column_line(const tpoint& position) const
|
||||
point get_column_line(const point& position) const
|
||||
{
|
||||
return text_.get_column_line(position);
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ ttext_box::ttext_box()
|
|||
&ttext_box::signal_handler_left_button_double_click, this, _2, _3));
|
||||
}
|
||||
|
||||
void ttext_box::place(const tpoint& origin, const tpoint& size)
|
||||
void ttext_box::place(const point& origin, const point& size)
|
||||
{
|
||||
// Inherited.
|
||||
tcontrol::place(origin, size);
|
||||
|
@ -216,7 +216,7 @@ void ttext_box::delete_selection()
|
|||
set_cursor(start, false);
|
||||
}
|
||||
|
||||
void ttext_box::handle_mouse_selection(tpoint mouse, const bool start_selection)
|
||||
void ttext_box::handle_mouse_selection(point mouse, const bool start_selection)
|
||||
{
|
||||
mouse.x -= get_x();
|
||||
mouse.y -= get_y();
|
||||
|
@ -227,7 +227,7 @@ void ttext_box::handle_mouse_selection(tpoint mouse, const bool start_selection)
|
|||
return;
|
||||
}
|
||||
|
||||
int offset = get_column_line(tpoint(mouse.x - text_x_offset_, mouse.y - text_y_offset_)).x;
|
||||
int offset = get_column_line(point(mouse.x - text_x_offset_, mouse.y - text_y_offset_)).x;
|
||||
|
||||
if(offset < 0) {
|
||||
return;
|
||||
|
@ -348,7 +348,7 @@ const std::string& ttext_box::get_control_type() const
|
|||
|
||||
void ttext_box::signal_handler_mouse_motion(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate)
|
||||
const point& coordinate)
|
||||
{
|
||||
DBG_GUI_E << get_control_type() << "[" << id() << "]: " << event << ".\n";
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ protected:
|
|||
/***** ***** ***** ***** layout functions ***** ***** ***** *****/
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
||||
|
@ -172,7 +172,7 @@ protected:
|
|||
/** Inherited from ttext_. */
|
||||
void delete_selection() override;
|
||||
|
||||
void handle_mouse_selection(tpoint mouse, const bool start_selection);
|
||||
void handle_mouse_selection(point mouse, const bool start_selection);
|
||||
|
||||
private:
|
||||
/** The history text for this widget. */
|
||||
|
@ -266,7 +266,7 @@ private:
|
|||
|
||||
void signal_handler_mouse_motion(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& coordinate);
|
||||
const point& coordinate);
|
||||
|
||||
void signal_handler_left_button_down(const event::tevent event,
|
||||
bool& handled);
|
||||
|
|
|
@ -98,7 +98,7 @@ void ttoggle_panel::set_child_members(
|
|||
}
|
||||
}
|
||||
}
|
||||
twidget* ttoggle_panel::find_at(const tpoint& coordinate,
|
||||
twidget* ttoggle_panel::find_at(const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
/**
|
||||
|
@ -113,7 +113,7 @@ twidget* ttoggle_panel::find_at(const tpoint& coordinate,
|
|||
return result ? result : tcontrol::find_at(coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* ttoggle_panel::find_at(const tpoint& coordinate,
|
||||
const twidget* ttoggle_panel::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
const twidget* result = tcontainer_::find_at(coordinate, must_be_active);
|
||||
|
@ -155,14 +155,14 @@ SDL_Rect ttoggle_panel::get_client_rect() const
|
|||
return result;
|
||||
}
|
||||
|
||||
tpoint ttoggle_panel::border_space() const
|
||||
point ttoggle_panel::border_space() const
|
||||
{
|
||||
std::shared_ptr<const ttoggle_panel_definition::tresolution> conf
|
||||
= std::static_pointer_cast<const ttoggle_panel_definition::
|
||||
tresolution>(config());
|
||||
assert(conf);
|
||||
|
||||
return tpoint(conf->left_border + conf->right_border, conf->top_border + conf->bottom_border);
|
||||
return point(conf->left_border + conf->right_border, conf->top_border + conf->bottom_border);
|
||||
}
|
||||
|
||||
void ttoggle_panel::set_value(const unsigned selected)
|
||||
|
|
|
@ -51,11 +51,11 @@ public:
|
|||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** See @ref tcontrol::set_active. */
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
* tpanel_definition we need to override this function and do about the
|
||||
* same, look at a way to 'fix' that.
|
||||
*/
|
||||
virtual tpoint border_space() const override;
|
||||
virtual point border_space() const override;
|
||||
|
||||
/** Inherited from tselectable_ */
|
||||
unsigned get_value() const override
|
||||
|
|
|
@ -79,7 +79,7 @@ int ttree_view::remove_node(ttree_view_node* node)
|
|||
|
||||
siblings.erase(itor);
|
||||
|
||||
if(get_size() != tpoint()) {
|
||||
if(get_size() != point()) {
|
||||
// Don't shrink the width, need to think about a good algorithm to do so.
|
||||
resize_content(0, -node->get_size().y);
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ void ttree_view::resize_content(const int width_modification,
|
|||
if(content_resize_request(width_modification, height_modification, width__modification_pos, height_modification_pos)) {
|
||||
|
||||
// Calculate new size.
|
||||
tpoint size = content_grid()->get_size();
|
||||
point size = content_grid()->get_size();
|
||||
size.x += width_modification;
|
||||
size.y += height_modification;
|
||||
|
||||
|
|
|
@ -147,16 +147,16 @@ ttree_view_node& ttree_view_node::add_child(
|
|||
return *itor;
|
||||
}
|
||||
|
||||
if(tree_view().get_size() == tpoint()) {
|
||||
if(tree_view().get_size() == point()) {
|
||||
return *itor;
|
||||
}
|
||||
|
||||
assert(tree_view().content_grid());
|
||||
const tpoint current_size = tree_view().content_grid()->get_size();
|
||||
const point current_size = tree_view().content_grid()->get_size();
|
||||
|
||||
// Calculate width modification.
|
||||
// This increases tree width if the width of the new node is greater than the current width.
|
||||
tpoint best_size = itor->get_best_size();
|
||||
point best_size = itor->get_best_size();
|
||||
best_size.x += get_indentation_level() * tree_view().indentation_step_size_;
|
||||
const int width_modification = best_size.x > current_size.x ? best_size.x - current_size.x : 0;
|
||||
|
||||
|
@ -164,7 +164,7 @@ ttree_view_node& ttree_view_node::add_child(
|
|||
// For this, we only increase height if the best size of the tree (that is, the size with the new node)
|
||||
// is larger than its current size. This prevents the scrollbar being reserved even when there's obviously
|
||||
// enough visual space.
|
||||
const tpoint tree_best_size = tree_view().get_best_size();
|
||||
const point tree_best_size = tree_view().get_best_size();
|
||||
const int height_modification = tree_best_size.y > current_size.y ? tree_best_size.y - current_size.y : 0;
|
||||
assert(height_modification >= 0);
|
||||
|
||||
|
@ -238,8 +238,8 @@ void ttree_view_node::unfold(const bool recursive)
|
|||
|
||||
void ttree_view_node::fold_internal()
|
||||
{
|
||||
const tpoint current_size(get_current_size().x, get_unfolded_size().y);
|
||||
const tpoint new_size = get_folded_size();
|
||||
const point current_size(get_current_size().x, get_unfolded_size().y);
|
||||
const point new_size = get_folded_size();
|
||||
|
||||
const int width_modification = std::max(0, new_size.x - current_size.x);
|
||||
const int height_modification = new_size.y - current_size.y;
|
||||
|
@ -255,8 +255,8 @@ void ttree_view_node::fold_internal()
|
|||
|
||||
void ttree_view_node::unfold_internal()
|
||||
{
|
||||
const tpoint current_size(get_current_size().x, get_folded_size().y);
|
||||
const tpoint new_size = get_unfolded_size();
|
||||
const point current_size(get_current_size().x, get_folded_size().y);
|
||||
const point new_size = get_unfolded_size();
|
||||
|
||||
const int width_modification = std::max(0, new_size.x - current_size.x);
|
||||
const int height_modification = new_size.y - current_size.y;
|
||||
|
@ -297,7 +297,7 @@ private:
|
|||
template <class W, class It>
|
||||
static W* find_at_aux(It begin,
|
||||
It end,
|
||||
const tpoint& coordinate,
|
||||
const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
for(It it = begin; it != end; ++it) {
|
||||
|
@ -311,7 +311,7 @@ private:
|
|||
public:
|
||||
template <class W>
|
||||
static W* find_at(typename utils::tconst_clone<ttree_view_node, W>::reference tree_view_node,
|
||||
const tpoint& coordinate,
|
||||
const point& coordinate,
|
||||
const bool must_be_active)
|
||||
{
|
||||
if(W* widget = tree_view_node.grid_.find_at(coordinate, must_be_active)) {
|
||||
|
@ -329,12 +329,12 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
twidget* ttree_view_node::find_at(const tpoint& coordinate, const bool must_be_active)
|
||||
twidget* ttree_view_node::find_at(const point& coordinate, const bool must_be_active)
|
||||
{
|
||||
return ttree_view_node_implementation::find_at<twidget>(*this, coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* ttree_view_node::find_at(const tpoint& coordinate, const bool must_be_active) const
|
||||
const twidget* ttree_view_node::find_at(const point& coordinate, const bool must_be_active) const
|
||||
{
|
||||
return ttree_view_node_implementation::find_at<const twidget>(*this, coordinate, must_be_active);
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ void ttree_view_node::impl_populate_dirty_list(twindow& caller, const std::vecto
|
|||
}
|
||||
}
|
||||
|
||||
tpoint ttree_view_node::calculate_best_size() const
|
||||
point ttree_view_node::calculate_best_size() const
|
||||
{
|
||||
return calculate_best_size(-1, tree_view().indentation_step_size_);
|
||||
}
|
||||
|
@ -376,13 +376,13 @@ bool ttree_view_node::disable_click_dismiss() const
|
|||
return true;
|
||||
}
|
||||
|
||||
tpoint ttree_view_node::get_current_size(bool assume_visible) const
|
||||
point ttree_view_node::get_current_size(bool assume_visible) const
|
||||
{
|
||||
if(!assume_visible && parent_node_ && parent_node_->is_folded()) {
|
||||
return tpoint();
|
||||
return point();
|
||||
}
|
||||
|
||||
tpoint size = get_folded_size();
|
||||
point size = get_folded_size();
|
||||
if(is_folded()) {
|
||||
return size;
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ tpoint ttree_view_node::get_current_size(bool assume_visible) const
|
|||
continue;
|
||||
}
|
||||
|
||||
tpoint node_size = node.get_current_size();
|
||||
point node_size = node.get_current_size();
|
||||
|
||||
size.y += node_size.y;
|
||||
size.x = std::max(size.x, node_size.x);
|
||||
|
@ -401,18 +401,18 @@ tpoint ttree_view_node::get_current_size(bool assume_visible) const
|
|||
return size;
|
||||
}
|
||||
|
||||
tpoint ttree_view_node::get_folded_size() const
|
||||
point ttree_view_node::get_folded_size() const
|
||||
{
|
||||
tpoint size = grid_.get_best_size();
|
||||
point size = grid_.get_best_size();
|
||||
if(get_indentation_level() > 1) {
|
||||
size.x += (get_indentation_level() - 1) * tree_view().indentation_step_size_;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
tpoint ttree_view_node::get_unfolded_size() const
|
||||
point ttree_view_node::get_unfolded_size() const
|
||||
{
|
||||
tpoint size = grid_.get_best_size();
|
||||
point size = grid_.get_best_size();
|
||||
if(get_indentation_level() > 1) {
|
||||
size.x += (get_indentation_level() - 1) * tree_view().indentation_step_size_;
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ tpoint ttree_view_node::get_unfolded_size() const
|
|||
continue;
|
||||
}
|
||||
|
||||
tpoint node_size = node.get_current_size(true);
|
||||
point node_size = node.get_current_size(true);
|
||||
|
||||
size.y += node_size.y;
|
||||
size.x = std::max(size.x, node_size.x);
|
||||
|
@ -431,12 +431,12 @@ tpoint ttree_view_node::get_unfolded_size() const
|
|||
return size;
|
||||
}
|
||||
|
||||
tpoint ttree_view_node::calculate_best_size(const int indentation_level,
|
||||
point ttree_view_node::calculate_best_size(const int indentation_level,
|
||||
const unsigned indentation_step_size) const
|
||||
{
|
||||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
|
||||
tpoint best_size = grid_.get_best_size();
|
||||
point best_size = grid_.get_best_size();
|
||||
if(indentation_level > 0) {
|
||||
best_size.x += indentation_level * indentation_step_size;
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ tpoint ttree_view_node::calculate_best_size(const int indentation_level,
|
|||
continue;
|
||||
}
|
||||
|
||||
const tpoint node_size = node.calculate_best_size(indentation_level + 1, indentation_step_size);
|
||||
const point node_size = node.calculate_best_size(indentation_level + 1, indentation_step_size);
|
||||
|
||||
if(!is_folded()) {
|
||||
best_size.y += node_size.y;
|
||||
|
@ -461,7 +461,7 @@ tpoint ttree_view_node::calculate_best_size(const int indentation_level,
|
|||
return best_size;
|
||||
}
|
||||
|
||||
void ttree_view_node::set_origin(const tpoint& origin)
|
||||
void ttree_view_node::set_origin(const point& origin)
|
||||
{
|
||||
// Inherited.
|
||||
twidget::set_origin(origin);
|
||||
|
@ -470,7 +470,7 @@ void ttree_view_node::set_origin(const tpoint& origin)
|
|||
place(tree_view().indentation_step_size_, origin, get_size().x);
|
||||
}
|
||||
|
||||
void ttree_view_node::place(const tpoint& origin, const tpoint& size)
|
||||
void ttree_view_node::place(const point& origin, const point& size)
|
||||
{
|
||||
// Inherited.
|
||||
twidget::place(origin, size);
|
||||
|
@ -479,14 +479,14 @@ void ttree_view_node::place(const tpoint& origin, const tpoint& size)
|
|||
}
|
||||
|
||||
unsigned ttree_view_node::place(const unsigned indentation_step_size,
|
||||
tpoint origin,
|
||||
point origin,
|
||||
unsigned width)
|
||||
{
|
||||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
DBG_GUI_L << LOG_HEADER << " origin " << origin << ".\n";
|
||||
|
||||
const unsigned offset = origin.y;
|
||||
tpoint best_size = grid_.get_best_size();
|
||||
point best_size = grid_.get_best_size();
|
||||
best_size.x = width;
|
||||
|
||||
grid_.place(origin, best_size);
|
||||
|
@ -510,7 +510,7 @@ unsigned ttree_view_node::place(const unsigned indentation_step_size,
|
|||
}
|
||||
|
||||
// Inherited.
|
||||
twidget::set_size(tpoint(width, origin.y - offset));
|
||||
twidget::set_size(point(width, origin.y - offset));
|
||||
|
||||
DBG_GUI_L << LOG_HEADER << " result " << (origin.y - offset) << ".\n";
|
||||
return origin.y - offset;
|
||||
|
|
|
@ -154,11 +154,11 @@ public:
|
|||
}
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** See @ref twidget::find. */
|
||||
|
@ -304,26 +304,26 @@ private:
|
|||
const std::vector<twidget*>& call_stack);
|
||||
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
/** See @ref twidget::disable_click_dismiss. */
|
||||
bool disable_click_dismiss() const override;
|
||||
|
||||
tpoint calculate_best_size(const int indentation_level,
|
||||
point calculate_best_size(const int indentation_level,
|
||||
const unsigned indentation_step_size) const;
|
||||
/** @param assume_visible: if false (default) it will return 0 if the parent node is folded*/
|
||||
tpoint get_current_size(bool assume_visible = false) const;
|
||||
tpoint get_folded_size() const;
|
||||
tpoint get_unfolded_size() const;
|
||||
point get_current_size(bool assume_visible = false) const;
|
||||
point get_folded_size() const;
|
||||
point get_unfolded_size() const;
|
||||
|
||||
/** See @ref twidget::set_origin. */
|
||||
virtual void set_origin(const tpoint& origin) override;
|
||||
virtual void set_origin(const point& origin) override;
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
unsigned
|
||||
place(const unsigned indentation_step_size, tpoint origin, unsigned width);
|
||||
place(const unsigned indentation_step_size, point origin, unsigned width);
|
||||
|
||||
/** See @ref twidget::set_visible_rectangle. */
|
||||
virtual void set_visible_rectangle(const SDL_Rect& rectangle) override;
|
||||
|
|
|
@ -64,7 +64,7 @@ unsigned tvertical_scrollbar::offset_after() const
|
|||
return conf->bottom_offset;
|
||||
}
|
||||
|
||||
bool tvertical_scrollbar::on_positioner(const tpoint& coordinate) const
|
||||
bool tvertical_scrollbar::on_positioner(const point& coordinate) const
|
||||
{
|
||||
// Note we assume the positioner is over the entire width of the widget.
|
||||
return coordinate.y >= static_cast<int>(get_positioner_offset())
|
||||
|
@ -73,7 +73,7 @@ bool tvertical_scrollbar::on_positioner(const tpoint& coordinate) const
|
|||
&& coordinate.x > 0 && coordinate.x < static_cast<int>(get_width());
|
||||
}
|
||||
|
||||
int tvertical_scrollbar::on_bar(const tpoint& coordinate) const
|
||||
int tvertical_scrollbar::on_bar(const point& coordinate) const
|
||||
{
|
||||
// Not on the widget, leave.
|
||||
if(static_cast<size_t>(coordinate.x) > get_width()
|
||||
|
@ -92,7 +92,7 @@ int tvertical_scrollbar::on_bar(const tpoint& coordinate) const
|
|||
}
|
||||
}
|
||||
|
||||
bool tvertical_scrollbar::in_orthogonal_range(const tpoint& coordinate) const
|
||||
bool tvertical_scrollbar::in_orthogonal_range(const point& coordinate) const
|
||||
{
|
||||
return static_cast<size_t>(coordinate.y) < get_height();
|
||||
}
|
||||
|
|
|
@ -50,16 +50,16 @@ private:
|
|||
unsigned offset_after() const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
bool on_positioner(const tpoint& coordinate) const override;
|
||||
bool on_positioner(const point& coordinate) const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
int on_bar(const tpoint& coordinate) const override;
|
||||
int on_bar(const point& coordinate) const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
bool in_orthogonal_range(const tpoint& coordinate) const override;
|
||||
bool in_orthogonal_range(const point& coordinate) const override;
|
||||
|
||||
/** Inherited from tscrollbar. */
|
||||
int get_length_difference(const tpoint& original, const tpoint& current) const override
|
||||
int get_length_difference(const point& original, const point& current) const override
|
||||
{
|
||||
return current.y - original.y;
|
||||
}
|
||||
|
|
|
@ -39,13 +39,13 @@ struct tviewport_implementation
|
|||
{
|
||||
/**
|
||||
* Implementation for the wrappers for
|
||||
* [const] twidget* tpane::find_at(const tpoint&, const bool) [const].
|
||||
* [const] twidget* tpane::find_at(const point&, const bool) [const].
|
||||
*
|
||||
* @tparam W A pointer to the pane.
|
||||
*/
|
||||
template <class W>
|
||||
static typename utils::tconst_clone<twidget, W>::pointer
|
||||
find_at(W viewport, tpoint coordinate, const bool must_be_active)
|
||||
find_at(W viewport, point coordinate, const bool must_be_active)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -104,11 +104,11 @@ tviewport* tviewport::build(const implementation::tbuilder_viewport& builder,
|
|||
return new tviewport(builder, replacements);
|
||||
}
|
||||
|
||||
void tviewport::place(const tpoint& origin, const tpoint& size)
|
||||
void tviewport::place(const point& origin, const point& size)
|
||||
{
|
||||
twidget::place(origin, size);
|
||||
|
||||
widget_.place(tpoint(), widget_.get_best_size());
|
||||
widget_.place(point(), widget_.get_best_size());
|
||||
}
|
||||
|
||||
void tviewport::layout_initialise(const bool full_initialisation)
|
||||
|
@ -146,12 +146,12 @@ void tviewport::request_reduce_width(const unsigned /*maximum_width*/)
|
|||
{
|
||||
}
|
||||
|
||||
twidget* tviewport::find_at(const tpoint& coordinate, const bool must_be_active)
|
||||
twidget* tviewport::find_at(const point& coordinate, const bool must_be_active)
|
||||
{
|
||||
return tviewport_implementation::find_at(this, coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* tviewport::find_at(const tpoint& coordinate,
|
||||
const twidget* tviewport::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
return tviewport_implementation::find_at(this, coordinate, must_be_active);
|
||||
|
@ -168,7 +168,7 @@ const twidget* tviewport::find(const std::string& id, const bool must_be_active)
|
|||
return tviewport_implementation::find(this, id, must_be_active);
|
||||
}
|
||||
|
||||
tpoint tviewport::calculate_best_size() const
|
||||
point tviewport::calculate_best_size() const
|
||||
{
|
||||
return widget_.get_best_size();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
~tviewport();
|
||||
|
||||
/** See @ref twidget::place. */
|
||||
virtual void place(const tpoint& origin, const tpoint& size) override;
|
||||
virtual void place(const point& origin, const point& size) override;
|
||||
|
||||
/** See @ref twidget::layout_initialise. */
|
||||
virtual void layout_initialise(const bool full_initialisation) override;
|
||||
|
@ -68,11 +68,11 @@ public:
|
|||
virtual void request_reduce_width(const unsigned maximum_width) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** See @ref twidget::find. */
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref twidget::calculate_best_size. */
|
||||
virtual tpoint calculate_best_size() const override;
|
||||
virtual point calculate_best_size() const override;
|
||||
|
||||
public:
|
||||
/** See @ref twidget::disable_click_dismiss. */
|
||||
|
|
|
@ -164,7 +164,7 @@ void twidget::layout_initialise(const bool /*full_initialisation*/)
|
|||
assert(visible_ != tvisible::invisible);
|
||||
assert(get_window());
|
||||
|
||||
layout_size_ = tpoint();
|
||||
layout_size_ = point();
|
||||
if(!linked_group_.empty()) {
|
||||
get_window()->add_linked_widget(linked_group_, this);
|
||||
}
|
||||
|
@ -185,17 +185,17 @@ void twidget::demand_reduce_height(const unsigned /*maximum_height*/)
|
|||
/* DO NOTHING */
|
||||
}
|
||||
|
||||
tpoint twidget::get_best_size() const
|
||||
point twidget::get_best_size() const
|
||||
{
|
||||
assert(visible_ != tvisible::invisible);
|
||||
|
||||
tpoint result = layout_size_;
|
||||
if(result == tpoint()) {
|
||||
point result = layout_size_;
|
||||
if(result == point()) {
|
||||
result = calculate_best_size();
|
||||
//Adjust to linked widget size if linked widget size was already calculated.
|
||||
if(!get_window()->get_need_layout() && !linked_group_.empty())
|
||||
{
|
||||
tpoint linked_size = get_window()->get_linked_size(linked_group_);
|
||||
point linked_size = get_window()->get_linked_size(linked_group_);
|
||||
result.x = std::max(result.x, linked_size.x);
|
||||
result.y = std::max(result.y, linked_size.y);
|
||||
}
|
||||
|
@ -213,13 +213,13 @@ bool twidget::can_wrap() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void twidget::set_origin(const tpoint& origin)
|
||||
void twidget::set_origin(const point& origin)
|
||||
{
|
||||
x_ = origin.x;
|
||||
y_ = origin.y;
|
||||
}
|
||||
|
||||
void twidget::set_size(const tpoint& size)
|
||||
void twidget::set_size(const point& size)
|
||||
{
|
||||
assert(size.x >= 0);
|
||||
assert(size.y >= 0);
|
||||
|
@ -230,7 +230,7 @@ void twidget::set_size(const tpoint& size)
|
|||
set_is_dirty(true);
|
||||
}
|
||||
|
||||
void twidget::place(const tpoint& origin, const tpoint& size)
|
||||
void twidget::place(const point& origin, const point& size)
|
||||
{
|
||||
assert(size.x >= 0);
|
||||
assert(size.y >= 0);
|
||||
|
@ -266,14 +266,14 @@ void twidget::layout_children()
|
|||
/* DO NOTHING */
|
||||
}
|
||||
|
||||
tpoint twidget::get_origin() const
|
||||
point twidget::get_origin() const
|
||||
{
|
||||
return tpoint(x_, y_);
|
||||
return point(x_, y_);
|
||||
}
|
||||
|
||||
tpoint twidget::get_size() const
|
||||
point twidget::get_size() const
|
||||
{
|
||||
return tpoint(width_, height_);
|
||||
return point(width_, height_);
|
||||
}
|
||||
|
||||
SDL_Rect twidget::get_rectangle() const
|
||||
|
@ -301,12 +301,12 @@ unsigned twidget::get_height() const
|
|||
return height_;
|
||||
}
|
||||
|
||||
void twidget::set_layout_size(const tpoint& size)
|
||||
void twidget::set_layout_size(const point& size)
|
||||
{
|
||||
layout_size_ = size;
|
||||
}
|
||||
|
||||
const tpoint& twidget::layout_size() const
|
||||
const point& twidget::layout_size() const
|
||||
{
|
||||
return layout_size_;
|
||||
}
|
||||
|
@ -544,12 +544,12 @@ twidget::draw_debug_border(surface& frame_buffer, int x_offset, int y_offset)
|
|||
|
||||
/***** ***** ***** ***** Query functions ***** ***** ***** *****/
|
||||
|
||||
twidget* twidget::find_at(const tpoint& coordinate, const bool must_be_active)
|
||||
twidget* twidget::find_at(const point& coordinate, const bool must_be_active)
|
||||
{
|
||||
return is_at(coordinate, must_be_active) ? this : nullptr;
|
||||
}
|
||||
|
||||
const twidget* twidget::find_at(const tpoint& coordinate,
|
||||
const twidget* twidget::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
return is_at(coordinate, must_be_active) ? this : nullptr;
|
||||
|
@ -571,7 +571,7 @@ bool twidget::has_widget(const twidget& widget) const
|
|||
return &widget == this;
|
||||
}
|
||||
|
||||
bool twidget::is_at(const tpoint& coordinate) const
|
||||
bool twidget::is_at(const point& coordinate) const
|
||||
{
|
||||
return is_at(coordinate, true);
|
||||
}
|
||||
|
@ -590,7 +590,7 @@ bool twidget::recursive_is_visible(const twidget* widget, const bool must_be_act
|
|||
return true;
|
||||
}
|
||||
|
||||
bool twidget::is_at(const tpoint& coordinate, const bool must_be_active) const
|
||||
bool twidget::is_at(const point& coordinate, const bool must_be_active) const
|
||||
{
|
||||
if(!recursive_is_visible(this, must_be_active)) {
|
||||
return false;
|
||||
|
|
|
@ -313,7 +313,7 @@ public:
|
|||
* @returns The best size for the widget.
|
||||
* @retval 0,0 The best size is 0,0.
|
||||
*/
|
||||
tpoint get_best_size() const;
|
||||
point get_best_size() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -326,7 +326,7 @@ private:
|
|||
* @returns The best size for the widget.
|
||||
* @retval 0,0 The best size is 0,0.
|
||||
*/
|
||||
virtual tpoint calculate_best_size() const = 0;
|
||||
virtual point calculate_best_size() const = 0;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -354,7 +354,7 @@ public:
|
|||
*
|
||||
* @param origin The new origin.
|
||||
*/
|
||||
virtual void set_origin(const tpoint& origin);
|
||||
virtual void set_origin(const point& origin);
|
||||
|
||||
/**
|
||||
* Sets the size of the widget.
|
||||
|
@ -365,7 +365,7 @@ public:
|
|||
*
|
||||
* @param size The size of the widget.
|
||||
*/
|
||||
virtual void set_size(const tpoint& size);
|
||||
virtual void set_size(const point& size);
|
||||
|
||||
/**
|
||||
* Places the widget.
|
||||
|
@ -376,7 +376,7 @@ public:
|
|||
* @param origin The position of top left of the widget.
|
||||
* @param size The size of the widget.
|
||||
*/
|
||||
virtual void place(const tpoint& origin, const tpoint& size);
|
||||
virtual void place(const point& origin, const point& size);
|
||||
|
||||
/**
|
||||
* Moves a widget.
|
||||
|
@ -407,14 +407,14 @@ public:
|
|||
*
|
||||
* @returns The origin of the widget.
|
||||
*/
|
||||
tpoint get_origin() const;
|
||||
point get_origin() const;
|
||||
|
||||
/**
|
||||
* Returns the size of the widget.
|
||||
*
|
||||
* @returns The size of the widget.
|
||||
*/
|
||||
tpoint get_size() const;
|
||||
point get_size() const;
|
||||
|
||||
/**
|
||||
* Gets the bounding rectangle of the widget on the screen.
|
||||
|
@ -434,8 +434,8 @@ public:
|
|||
unsigned get_height() const;
|
||||
|
||||
protected:
|
||||
void set_layout_size(const tpoint& size);
|
||||
const tpoint& layout_size() const;
|
||||
void set_layout_size(const point& size);
|
||||
const point& layout_size() const;
|
||||
|
||||
public:
|
||||
void set_linked_group(const std::string& linked_group);
|
||||
|
@ -462,7 +462,7 @@ private:
|
|||
* wrapping or a scrollbar might change the best size for that widget.
|
||||
* This variable holds that best value.
|
||||
*/
|
||||
tpoint layout_size_;
|
||||
point layout_size_;
|
||||
|
||||
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
|
||||
|
||||
|
@ -472,7 +472,7 @@ private:
|
|||
* We're mutable so calls can stay const and this is disabled in
|
||||
* production code.
|
||||
*/
|
||||
mutable tpoint last_best_size_;
|
||||
mutable point last_best_size_;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -744,11 +744,11 @@ public:
|
|||
* @retval nullptr No widget at the wanted coordinate found (or
|
||||
* not active if must_be_active was set).
|
||||
*/
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active);
|
||||
|
||||
/** The constant version of @ref find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const;
|
||||
|
||||
/**
|
||||
|
@ -787,7 +787,7 @@ public:
|
|||
|
||||
private:
|
||||
/** See @ref event::tdispatcher::is_at. */
|
||||
virtual bool is_at(const tpoint& coordinate) const override;
|
||||
virtual bool is_at(const point& coordinate) const override;
|
||||
|
||||
/**
|
||||
* Is the coordinate inside our area.
|
||||
|
@ -802,7 +802,7 @@ private:
|
|||
*
|
||||
* @returns Status.
|
||||
*/
|
||||
bool is_at(const tpoint& coordinate, const bool must_be_active) const;
|
||||
bool is_at(const point& coordinate, const bool must_be_active) const;
|
||||
|
||||
/**
|
||||
* Is the widget and every single one of its parents visible?
|
||||
|
|
|
@ -898,12 +898,12 @@ void twindow::invalidate_layout()
|
|||
need_layout_ = true;
|
||||
}
|
||||
}
|
||||
twidget* twindow::find_at(const tpoint& coordinate, const bool must_be_active)
|
||||
twidget* twindow::find_at(const point& coordinate, const bool must_be_active)
|
||||
{
|
||||
return tpanel::find_at(coordinate, must_be_active);
|
||||
}
|
||||
|
||||
const twidget* twindow::find_at(const tpoint& coordinate,
|
||||
const twidget* twindow::find_at(const point& coordinate,
|
||||
const bool must_be_active) const
|
||||
{
|
||||
return tpanel::find_at(coordinate, must_be_active);
|
||||
|
@ -980,7 +980,7 @@ void twindow::layout()
|
|||
|
||||
log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
|
||||
|
||||
const tpoint mouse = get_mouse_position();
|
||||
const point mouse = get_mouse_position();
|
||||
variables_.add("mouse_x", variant(mouse.x));
|
||||
variables_.add("mouse_y", variant(mouse.y));
|
||||
variables_.add("window_width", variant(0));
|
||||
|
@ -1081,11 +1081,11 @@ void twindow::layout()
|
|||
}
|
||||
|
||||
/***** Get the best location for the window *****/
|
||||
tpoint size = get_best_size();
|
||||
point size = get_best_size();
|
||||
|
||||
assert(size.x <= maximum_width && size.y <= maximum_height);
|
||||
|
||||
tpoint origin(0, 0);
|
||||
point origin(0, 0);
|
||||
|
||||
if(automatic_placement_) {
|
||||
|
||||
|
@ -1159,13 +1159,13 @@ void twindow::layout_linked_widgets()
|
|||
for(auto & linked_size : linked_size_)
|
||||
{
|
||||
|
||||
tpoint max_size(0, 0);
|
||||
point max_size(0, 0);
|
||||
|
||||
// Determine the maximum size.
|
||||
for(auto widget : linked_size.second.widgets)
|
||||
{
|
||||
|
||||
const tpoint size = widget->get_best_size();
|
||||
const point size = widget->get_best_size();
|
||||
|
||||
if(size.x > max_size.x) {
|
||||
max_size.x = size.x;
|
||||
|
@ -1185,7 +1185,7 @@ void twindow::layout_linked_widgets()
|
|||
for(auto widget : linked_size.second.widgets)
|
||||
{
|
||||
|
||||
tpoint size = widget->get_best_size();
|
||||
point size = widget->get_best_size();
|
||||
|
||||
if(linked_size.second.width != -1) {
|
||||
size.x = max_size.x;
|
||||
|
@ -1288,7 +1288,7 @@ void twindow_implementation::layout(twindow& window,
|
|||
|
||||
try
|
||||
{
|
||||
tpoint size = window.get_best_size();
|
||||
point size = window.get_best_size();
|
||||
|
||||
DBG_GUI_L << LOG_IMPL_HEADER << " best size : " << size
|
||||
<< " maximum size : " << maximum_width << ','
|
||||
|
@ -1373,7 +1373,7 @@ void twindow::remove_from_keyboard_chain(twidget* widget)
|
|||
|
||||
void twindow::signal_handler_sdl_video_resize(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& new_size)
|
||||
const point& new_size)
|
||||
{
|
||||
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class CVideo;
|
|||
|
||||
namespace gui2 { class twidget; }
|
||||
namespace gui2 { namespace event { struct tmessage; } }
|
||||
namespace gui2 { struct tpoint; }
|
||||
namespace gui2 { struct point; }
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
@ -278,11 +278,11 @@ public:
|
|||
}
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual twidget* find_at(const tpoint& coordinate,
|
||||
virtual twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) override;
|
||||
|
||||
/** See @ref twidget::find_at. */
|
||||
virtual const twidget* find_at(const tpoint& coordinate,
|
||||
virtual const twidget* find_at(const point& coordinate,
|
||||
const bool must_be_active) const override;
|
||||
|
||||
/** Inherited from twidget. */
|
||||
|
@ -455,14 +455,14 @@ public:
|
|||
variables_.add(key, value);
|
||||
set_is_dirty(true);
|
||||
}
|
||||
tpoint get_linked_size(const std::string& linked_group_id) const
|
||||
point get_linked_size(const std::string& linked_group_id) const
|
||||
{
|
||||
std::map<std::string, tlinked_size>::const_iterator it = linked_size_.find(linked_group_id);
|
||||
if(it != linked_size_.end()) {
|
||||
return tpoint(it->second.width, it->second.height);
|
||||
return point(it->second.width, it->second.height);
|
||||
}
|
||||
else {
|
||||
return tpoint(-1, -1);
|
||||
return point(-1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -759,7 +759,7 @@ private:
|
|||
|
||||
void signal_handler_sdl_video_resize(const event::tevent event,
|
||||
bool& handled,
|
||||
const tpoint& new_size);
|
||||
const point& new_size);
|
||||
|
||||
/**
|
||||
* The handler for the click dismiss mouse 'event'.
|
||||
|
|
|
@ -34,7 +34,7 @@ bool point_in_rect(int x, int y, const SDL_Rect& rect)
|
|||
return x >= rect.x && y >= rect.y && x < rect.x + rect.w && y < rect.y + rect.h;
|
||||
}
|
||||
|
||||
bool point_in_rect(const gui2::tpoint& point, const SDL_Rect& rect)
|
||||
bool point_in_rect(const gui2::point& point, const SDL_Rect& rect)
|
||||
{
|
||||
return point.x >= rect.x && point.y >= rect.y && point.x < rect.x + rect.w && point.y < rect.y + rect.h;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <SDL_rect.h>
|
||||
|
||||
namespace gui2 {
|
||||
struct tpoint;
|
||||
struct point;
|
||||
}
|
||||
|
||||
namespace sdl
|
||||
|
@ -54,7 +54,7 @@ SDL_Rect create_rect(const int x, const int y, const int w, const int h);
|
|||
*/
|
||||
bool point_in_rect(int x, int y, const SDL_Rect& rect);
|
||||
|
||||
bool point_in_rect(const gui2::tpoint& point, const SDL_Rect& rect);
|
||||
bool point_in_rect(const gui2::point& point, const SDL_Rect& rect);
|
||||
|
||||
/**
|
||||
* Tests whether two rectangles overlap.
|
||||
|
|
|
@ -279,7 +279,7 @@ namespace {
|
|||
gui2::tip::show(video
|
||||
, id
|
||||
, "Test messsage for a tooltip."
|
||||
, gui2::tpoint(0, 0)
|
||||
, gui2::point(0, 0)
|
||||
, {0,0,0,0});
|
||||
} catch(gui2::tlayout_exception_width_modified&) {
|
||||
exception = "gui2::tlayout_exception_width_modified";
|
||||
|
|
Loading…
Add table
Reference in a new issue