|
@@ -147,14 +147,14 @@ public:
|
|
|
inline uint GetVerticalStepSize(SizingType sizing) const;
|
|
|
|
|
|
virtual void Draw(const Window *w) = 0;
|
|
|
virtual void SetDirty(const Window *w) const;
|
|
|
|
|
|
WidgetType type; ///< Type of the widget / nested widget.
|
|
|
bool fill_x; ///< Allow horizontal filling from initial size.
|
|
|
bool fill_y; ///< Allow vertical filling from initial size.
|
|
|
uint fill_x; ///< Horizontal fill stepsize (from initial size, \c 0 means not resizable).
|
|
|
uint fill_y; ///< Vertical fill stepsize (from initial size, \c 0 means not resizable).
|
|
|
uint resize_x; ///< Horizontal resize step (\c 0 means not resizable).
|
|
|
uint resize_y; ///< Vertical resize step (\c 0 means not resizable).
|
|
|
/* Size of the widget in the smallest window possible.
|
|
|
* Computed by #SetupSmallestSize() followed by #AssignSizePosition().
|
|
|
*/
|
|
|
uint smallest_x; ///< Smallest horizontal size of the widget in a filled window.
|
|
@@ -181,35 +181,33 @@ protected:
|
|
|
/**
|
|
|
* Get the horizontal sizing step.
|
|
|
* @param sizing Type of resize being performed.
|
|
|
*/
|
|
|
inline uint NWidgetBase::GetHorizontalStepSize(SizingType sizing) const
|
|
|
{
|
|
|
if (sizing == ST_RESIZE) return this->resize_x;
|
|
|
return this->fill_x ? 1 : 0;
|
|
|
return (sizing == ST_RESIZE) ? this->resize_x : this->fill_x;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the vertical sizing step.
|
|
|
* @param sizing Type of resize being performed.
|
|
|
*/
|
|
|
inline uint NWidgetBase::GetVerticalStepSize(SizingType sizing) const
|
|
|
{
|
|
|
if (sizing == ST_RESIZE) return this->resize_y;
|
|
|
return this->fill_y ? 1 : 0;
|
|
|
return (sizing == ST_RESIZE) ? this->resize_y : this->fill_y;
|
|
|
}
|
|
|
|
|
|
/** Base class for a resizable nested widget.
|
|
|
* @ingroup NestedWidgets */
|
|
|
class NWidgetResizeBase : public NWidgetBase {
|
|
|
public:
|
|
|
NWidgetResizeBase(WidgetType tp, bool fill_x, bool fill_y);
|
|
|
NWidgetResizeBase(WidgetType tp, uint fill_x, uint fill_y);
|
|
|
|
|
|
void SetMinimalSize(uint min_x, uint min_y);
|
|
|
void SetMinimalTextLines(uint8 min_lines, uint8 spacing, FontSize size);
|
|
|
void SetFill(bool fill_x, bool fill_y);
|
|
|
void SetFill(uint fill_x, uint fill_y);
|
|
|
void SetResize(uint resize_x, uint resize_y);
|
|
|
|
|
|
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl);
|
|
|
|
|
|
uint min_x; ///< Minimal horizontal size of only this widget.
|
|
|
uint min_y; ///< Minimal vertical size of only this widget.
|
|
@@ -237,13 +235,13 @@ enum NWidgetDisplay {
|
|
|
DECLARE_ENUM_AS_BIT_SET(NWidgetDisplay);
|
|
|
|
|
|
/** Base class for a 'real' widget.
|
|
|
* @ingroup NestedWidgets */
|
|
|
class NWidgetCore : public NWidgetResizeBase {
|
|
|
public:
|
|
|
NWidgetCore(WidgetType tp, Colours colour, bool def_fill_x, bool def_fill_y, uint16 widget_data, StringID tool_tip);
|
|
|
NWidgetCore(WidgetType tp, Colours colour, uint fill_x, uint fill_y, uint16 widget_data, StringID tool_tip);
|
|
|
|
|
|
void SetIndex(int index);
|
|
|
void SetDataTip(uint16 widget_data, StringID tool_tip);
|
|
|
|
|
|
inline void SetLowered(bool lowered);
|
|
|
inline bool IsLowered() const;
|
|
@@ -635,19 +633,19 @@ static inline NWidgetPart SetMinimalText
|
|
|
/**
|
|
|
* Widget part function for setting filling.
|
|
|
* @param x_fill Allow horizontal filling from minimal size.
|
|
|
* @param y_fill Allow vertical filling from minimal size.
|
|
|
* @ingroup NestedWidgetParts
|
|
|
*/
|
|
|
static inline NWidgetPart SetFill(bool x_fill, bool y_fill)
|
|
|
static inline NWidgetPart SetFill(uint fill_x, uint fill_y)
|
|
|
{
|
|
|
NWidgetPart part;
|
|
|
|
|
|
part.type = WPT_FILL;
|
|
|
part.u.xy.x = x_fill;
|
|
|
part.u.xy.y = y_fill;
|
|
|
part.u.xy.x = fill_x;
|
|
|
part.u.xy.y = fill_y;
|
|
|
|
|
|
return part;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Widget part function for denoting the end of a container
|