10 #ifndef PRIORITYGRIDLAYOUT_HPP 11 #define PRIORITYGRIDLAYOUT_HPP 135 typedef std::pair<unsigned int, PanelStatus*>
KeyPanel;
152 bool heightExpand =
false;
162 bool minCols(
int mc) noexcept;
165 KeyPanel &operator [] (
int c);
192 static bool minRows(RowVec &rv,
int ms);
358 void remove(
unsigned int pri);
460 #endif // #ifndef PRIORITYGRIDLAYOUT_HPP Stores a location within an image.
std::vector< KeyPanel > panels
The panels in column order, left to right.
Internal data structure used to store a Panel, its configuration, and current layout status...
std::map< unsigned int, PanelStatus > GridConfig
The type that maps panel priorities to panel data.
void render(BppImage &dest)
Renders all visible panels to the provided image.
GridLayoutConfig & panelConfig(unsigned int pri)
Returns the layout configuration for the specified panel.
ImageLocation loc
The location on the target image as determined by layout().
void maxRowHeight(int row, std::int16_t height)
Sets the maximum height of a row.
A single size-step used by a PriorityGridLayout to place a Panel.
GridLayoutConfig::Flags flags() const
Returns the configuration flags to use for rendering.
bool hidden
True to indicate that the panel will not be rendered.
PanelSptr panel
The Panel object.
const ImageLocation & renderOffset() const
Returns the upper left corner of the destination image that will receive the panel images rendered th...
void renderOffset(const ImageLocation &off)
Change the upper left corner of the destination image that will receive the panel images rendered thr...
int sizeStep
The index of the size-step to use for rendering the panel as selected by layout().
A way to place Panel objects dynamically with a priority mechanism to allow panels to be resized and ...
The location of a panel in a PriorityGridLayout.
static unsigned int panelAt(RowVec &rv, const GridLocation &gl) noexcept
Returns the priority key for the panel at the given location, or zero if there is no panel...
Flags flags
The configuration flags used for the panel for all of its size-steps.
Stores the dimensions of an image.
ImageLocation layoutLocation(unsigned int pri) const
Returns the location assigned to the panel at priority pri by layout(), or { 0, 0 }...
ImageLocation offset
The upper right location of the destination image where the topmost row and leftmost column will be p...
std::vector< RowData > RowVec
Type used inside layout() to store data on all the rows.
std::shared_ptr< BppImage > BppImageSptr
std::pair< unsigned int, PanelStatus * > KeyPanel
Stores a panel priority key and a pointer to the associated PanelStatus object inside configs...
bool add(const PanelSptr &panel, const GridLayoutConfig &config, unsigned int pri)
Adds a panel in an unused priority spot, or fail to add if the spot is already used.
void render(const BppImageSptr &dest)
Renders all visible panels to the provided image.
GridLayoutConfig config
The panel's layout configuration.
GridSizeSteps sizes
The size-steps for the panel.
const ImageDimensions & renderFill() const
Returns the area filled by the layout.
GridConfig configs
The mapping of Panel objects by priority key.
static bool minRows(RowVec &rv, int ms)
Ensures a minimum number of rows in rv, and returns true if at least that many rows already existed...
bool layoutPosition(ImageDimensions &dim, ImageLocation &loc, unsigned int pri) const
Provides the dimensions and location assigned to the panel at priority pri by layout() ...
void render(BppImage *dest)
Renders all visible panels to the provided image.
void renderFill(const ImageDimensions &dim)
Changes the area filled by the layout.
ImageDimensions layoutDimensions(unsigned int pri) const
Returns the dimensions assigned to the panel at priority pri by layout(), or { 0, 0 }...
General graphics related code.
ImageDimensions dim
The maximum dimensions allocated to the panel by layout().
Informs a PriorityGridLayout object where to place and how large to make Panel objects.
int layout()
Places all panels into general positions.
std::vector< std::int16_t > rowMaxHeight
Maximum heights for rows.
std::shared_ptr< Panel > PanelSptr
A shared pointer to a Panel.
void addOrReplace(const PanelSptr &panel, const GridLayoutConfig &config, unsigned int pri)
Adds a panel or replaces an existing panel at the given priority spot.
Internal data structure used by layout() to store information on each row that is only needed to plac...
const GridSizeStep & currentStep() const
Returns the size-step selected by layout().
An image that uses a single bit to represent the state of each pixel; a black or white picture...
ImageDimensions fill
The area to fill in the destination image.