File diff r18781:e1de9a06f7cd → r18782:6453522c2154
src/widget_type.h
Show inline comments
 
@@ -140,22 +140,22 @@ public:
 
	 * Set additional space (padding) around the widget.
 
	 * @param top    Amount of additional space above the widget.
 
	 * @param right  Amount of additional space right of the widget.
 
	 * @param bottom Amount of additional space below the widget.
 
	 * @param left   Amount of additional space left of the widget.
 
	 */
 
	FORCEINLINE void SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
 
	inline void SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
 
	{
 
		this->padding_top = top;
 
		this->padding_right = right;
 
		this->padding_bottom = bottom;
 
		this->padding_left = left;
 
	}
 

	
 
	FORCEINLINE uint GetHorizontalStepSize(SizingType sizing) const;
 
	FORCEINLINE uint GetVerticalStepSize(SizingType sizing) const;
 
	inline uint GetHorizontalStepSize(SizingType sizing) const;
 
	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.
 
	uint fill_x;          ///< Horizontal fill stepsize (from initial size, \c 0 means not resizable).
 
@@ -180,42 +180,42 @@ public:
 
	uint8 padding_top;    ///< Paddings added to the top of the widget. Managed by parent container widget.
 
	uint8 padding_right;  ///< Paddings added to the right of the widget. Managed by parent container widget.
 
	uint8 padding_bottom; ///< Paddings added to the bottom of the widget. Managed by parent container widget.
 
	uint8 padding_left;   ///< Paddings added to the left of the widget. Managed by parent container widget.
 

	
 
protected:
 
	FORCEINLINE void StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height);
 
	inline void StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height);
 
};
 

	
 
/**
 
 * Get the horizontal sizing step.
 
 * @param sizing Type of resize being performed.
 
 */
 
FORCEINLINE uint NWidgetBase::GetHorizontalStepSize(SizingType sizing) const
 
inline uint NWidgetBase::GetHorizontalStepSize(SizingType sizing) const
 
{
 
	return (sizing == ST_RESIZE) ? this->resize_x : this->fill_x;
 
}
 

	
 
/**
 
 * Get the vertical sizing step.
 
 * @param sizing Type of resize being performed.
 
 */
 
FORCEINLINE uint NWidgetBase::GetVerticalStepSize(SizingType sizing) const
 
inline uint NWidgetBase::GetVerticalStepSize(SizingType sizing) const
 
{
 
	return (sizing == ST_RESIZE) ? this->resize_y : this->fill_y;
 
}
 

	
 
/**
 
 * Store size and position.
 
 * @param sizing       Type of resizing to perform.
 
 * @param x            Horizontal offset of the widget relative to the left edge of the window.
 
 * @param y            Vertical offset of the widget relative to the top edge of the window.
 
 * @param given_width  Width allocated to the widget.
 
 * @param given_height Height allocated to the widget.
 
 */
 
FORCEINLINE void NWidgetBase::StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height)
 
inline void NWidgetBase::StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height)
 
{
 
	this->pos_x = x;
 
	this->pos_y = y;
 
	if (sizing == ST_SMALLEST) {
 
		this->smallest_x = given_width;
 
		this->smallest_y = given_height;
 
@@ -604,50 +604,50 @@ public:
 
	}
 

	
 
	/**
 
	 * Gets the number of elements in the list
 
	 * @return the number of elements
 
	 */
 
	FORCEINLINE uint16 GetCount() const
 
	inline uint16 GetCount() const
 
	{
 
		return this->count;
 
	}
 

	
 
	/**
 
	 * Gets the number of visible elements of the scrollbar
 
	 * @return the number of visible elements
 
	 */
 
	FORCEINLINE uint16 GetCapacity() const
 
	inline uint16 GetCapacity() const
 
	{
 
		return this->cap;
 
	}
 

	
 
	/**
 
	 * Gets the position of the first visible element in the list
 
	 * @return the position of the element
 
	 */
 
	FORCEINLINE uint16 GetPosition() const
 
	inline uint16 GetPosition() const
 
	{
 
		return this->pos;
 
	}
 

	
 
	/**
 
	 * Checks whether given current item is visible in the list
 
	 * @param item to check
 
	 * @return true iff the item is visible
 
	 */
 
	FORCEINLINE bool IsVisible(uint16 item) const
 
	inline bool IsVisible(uint16 item) const
 
	{
 
		return IsInsideBS(item, this->GetPosition(), this->GetCapacity());
 
	}
 

	
 
	/**
 
	 * Is the scrollbar vertical or not?
 
	 * @return True iff the scrollbar is vertical.
 
	 */
 
	FORCEINLINE bool IsVertical() const
 
	inline bool IsVertical() const
 
	{
 
		return this->is_vertical;
 
	}
 

	
 
	/**
 
	 * Set the distance to scroll when using the buttons or the wheel.
 
@@ -786,13 +786,13 @@ private:
 
 * Return the biggest possible size of a nested widget.
 
 * @param base      Base size of the widget.
 
 * @param max_space Available space for the widget.
 
 * @param step      Stepsize of the widget.
 
 * @return Biggest possible size of the widget, assuming that \a base may only be incremented by \a step size steps.
 
 */
 
static FORCEINLINE uint ComputeMaxSize(uint base, uint max_space, uint step)
 
static inline uint ComputeMaxSize(uint base, uint max_space, uint step)
 
{
 
	if (base >= max_space || step == 0) return base;
 
	if (step == 1) return max_space;
 
	uint increment = max_space - base;
 
	increment -= increment % step;
 
	return base + increment;