A GContainer is a logical grouping for interactors. More...
#include "gcontainer.h"
Public Types | |
enum | Layout { LAYOUT_NONE, LAYOUT_FLOW_HORIZONTAL, LAYOUT_FLOW_VERTICAL, LAYOUT_BORDER, LAYOUT_GRID } |
The various layout management styles that containers can use. More... | |
enum | Region { REGION_CENTER, REGION_EAST, REGION_NORTH, REGION_SOUTH, REGION_WEST } |
The five regions of border layouts. More... | |
enum | TextPosition { TEXT_BESIDE_ICON, TEXT_UNDER_ICON, TEXT_ONLY } |
The places where an interactor can place its text relative to its icon. More... | |
Public Member Functions | |
GContainer(Layout layout=LAYOUT_FLOW_HORIZONTAL, QWidget* parent=nullptr) | |
Creates a new container with the given layout. More... | |
GContainer(Layout layout, int rows, int cols, QWidget* parent=nullptr) | |
Creates a new container with the given number of rows and columns. More... | |
~GContainer() override | |
Frees memory allocated internally by the container. More... | |
void | add(GInteractor *interactor) |
Adds the given interactor to the end of the list of interactors in this container. More... | |
void | add(GInteractor &interactor) |
Adds the given interactor to the end of the list of interactors in this container. More... | |
void | addActionListener() (deprecated) |
Adds an event listener to be notified when this interactor is clicked or generally interacted with. More... | |
void | addToGrid(GInteractor *interactor, int row, int col, int rowspan=1, int colspan=1) |
Adds the given interactor to the given row and column in this container, which is assumed to use a grid layout. More... | |
void | addToGrid(GInteractor &interactor, int row, int col, int rowspan=1, int colspan=1) |
Adds the given interactor to the given row and column in this container, which is assumed to use a grid layout. More... | |
void | addToRegion(GInteractor *interactor, Region region) |
Adds the given interactor to the given region in this container, which is assumed to use a border layout. More... | |
void | addToRegion(GInteractor *interactor, string region="Center") |
Adds the given interactor to the given region in this container, which is assumed to use a border layout. More... | |
void | addToRegion(GInteractor &interactor, Region region) |
Adds the given interactor to the given region in this container, which is assumed to use a border layout. More... | |
void | addToRegion(GInteractor &interactor, string region="Center") |
Adds the given interactor to the given region in this container, which is assumed to use a border layout. More... | |
void | clear() |
Removes all interactors from this container. More... | |
void | clearRegion(Region region) |
Removes all interactors from the given region of this container, which is assumed to use a border layout. More... | |
void | clearRegion(string region) |
Removes all interactors from the given region of this container, which is assumed to use a border layout. More... | |
bool | contains(GInteractor *interactor) const |
Returns true if the given interactor is found in this container. More... | |
bool | contains(GInteractor &interactor) const |
Returns true if the given interactor is found in this container. More... | |
bool | eventsEnabled() const override |
Returns true if this interactor is currently accepting events. More... | |
string | getAccelerator() const |
Returns a string representing a hotkey for this interactor, or an empty string if no accelerator has been set. More... | |
string | getActionCommand() const |
Returns an action command for this interactor, which is a semi-unique string you can use to identify it when events occur. More... | |
string | getBackground() const |
Returns the background color of the interactor as a string. More... | |
int | getBackgroundInt() const |
Returns the background color of the interactor as an RGB integer. More... | |
GRectangle | getBounds() const |
Returns a rectangle representing the x/y position and size of this interactor. More... | |
string | getColor() const |
Returns the foreground/text color of the interactor as a string. More... | |
int | getColorInt() const |
Returns the foreground/text color of the interactor as an RGB integer. More... | |
GContainer * | getContainer() const |
Returns a pointer to the onscreen container holding this interactor. More... | |
std::vector< GInteractor * > | getDescendents(string type="") const |
Returns all interactors that are children or descendents inside this container. More... | |
string | getFont() const |
Returns the font of this interactor's text as a font string such as "Helvetica-12-Bold". More... | |
string | getForeground() const |
Returns the foreground/text color of the interactor as a string. More... | |
int | getForegroundInt() const |
Returns the foreground/text color of the interactor as an RGB integer. More... | |
double | getHeight() const |
Returns the current onscreen height of this interactor in pixels. More... | |
string | getIcon() const |
Returns the file name of the icon associated with this interactor, or an empty string if no icon has been set. More... | |
int | getID() const |
Returns a globally unique identifier for this interactor, which is set when the interactor is constructed. More... | |
GInteractor * | getInteractor(int i) const |
Returns the child interactor at the given 0-based index in this container. More... | |
GInteractor * | getInteractorByRegion(int i, Region region) const |
Returns the child interactor at the given 0-based index within the given region in this container, which is assumed to use a border layout. More... | |
GInteractor * | getInteractorByRegion(int i, string region="Center") const |
Returns the child interactor at the given 0-based index within the given region in this container, which is assumed to use a border layout. More... | |
int | getInteractorCount() const |
Returns the number of children interactors in this container. More... | |
int | getInteractorCountByRegion(Region region) const |
Returns the number of children interactors within the given region in this container, which is assumed to use a border layout. More... | |
int | getInteractorCountByRegion(string region="Center") const |
Returns the number of children interactors within the given region in this container, which is assumed to use a border layout. More... | |
const std::vector< GInteractor * > & | getInteractors() const |
Returns a vector of all children interactors in this container. More... | |
_Internal_QWidget* | getInternalWidget() const override |
Returns a direct pointer to the internal Qt widget being wrapped by this interactor. More... | |
Layout | getLayout() const |
Returns the type of layout used by this container. More... | |
GPoint | getLocation() const |
Returns an (x, y) point representing the onscreen location of the top-left corner of this interactor within its containing window. More... | |
double | getMargin() const |
Returns the margin around each widget in this container in pixels. More... | |
double | getMinimumHeight() const |
Returns the minimum height in pixels that this interactor will permit itself to be resized to. More... | |
GDimension | getMinimumSize() const |
Returns a GDimension structure representing the minimum size in pixels that this interactor will permit itself to be resized to. More... | |
double | getMinimumWidth() const |
Returns the minimum width in pixels that this interactor will permit itself to be resized to. More... | |
string | getName() const |
Returns a string representing a unique name for this interactor. More... | |
double | getPadding() const |
Returns the padding inside this container in pixels. More... | |
double | getPaddingBottom() const |
Returns the padding on the bottom side of this container in pixels. More... | |
double | getPaddingLeft() const |
Returns the padding on the left side of this container in pixels. More... | |
double | getPaddingRight() const |
Returns the padding on the right side of this container in pixels. More... | |
double | getPaddingTop() const |
Returns the padding on the top side of this container in pixels. More... | |
double | getPreferredHeight() const |
Returns the height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars. More... | |
GDimension | getPreferredSize() const override |
Returns a GDimension structure storing the width and height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars. More... | |
double | getPreferredWidth() const |
Returns the height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars. More... | |
double | getRegionHeight(Region region) const |
Returns the height in pixels of the given region of this container, which is assumed to use a border layout. More... | |
double | getRegionHeight(string region) const |
Returns the height in pixels of the given region of this container, which is assumed to use a border layout. More... | |
GDimension | getRegionSize(Region region) const |
Returns the width and height in pixels of the given region of this container, which is assumed to use a border layout. More... | |
GDimension | getRegionSize(string region) const |
Returns the width and height in pixels of the given region of this container, which is assumed to use a border layout. More... | |
double | getRegionWidth(Region region) const |
Returns the width in pixels of the given region of this container, which is assumed to use a border layout. More... | |
double | getRegionWidth(string region) const |
Returns the width in pixels of the given region of this container, which is assumed to use a border layout. More... | |
GDimension | getSize() const |
Returns a GDimension structure storing the current onscreen width and height of this interactor in pixels. More... | |
double | getSpacing() const |
Returns the spacing between widgets in this container in pixels. More... | |
string | getType() const override |
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox". More... | |
QWidget* | getWidget() const override |
Returns a direct pointer to the internal Qt widget being wrapped by this interactor. More... | |
double | getWidth() const |
Returns the current onscreen width of this interactor in pixels. More... | |
double | getX() const |
Returns the x-coordinate of the top-left pixel of this interactor within its onscreen window. More... | |
double | getY() const |
Returns the y-coordinate of the top-left pixel of this interactor within its onscreen window. More... | |
bool | inBounds(double x, double y) const |
Returns true if the given x/y pixel is within the bounds of this interactor. More... | |
bool | inBounds(int x, int y) const |
Returns true if the given x/y pixel is within the bounds of this interactor. More... | |
void | insert(int index, GInteractor *interactor) |
Adds the given interactor to this container just before the given index. More... | |
void | insert(int index, GInteractor &interactor) |
Adds the given interactor to this container just before the given index. More... | |
void | insertToRegion(int index, GInteractor *interactor, Region region) |
Adds the given interactor to the given layout region within this container just before the given index. More... | |
void | insertToRegion(int index, GInteractor *interactor, string region="Center") |
Adds the given interactor to the given layout region within this container just before the given index. More... | |
void | insertToRegion(int index, GInteractor &interactor, Region region) |
Adds the given interactor to the given layout region within this container just before the given index. More... | |
void | insertToRegion(int index, GInteractor &interactor, string region="Center") |
Adds the given interactor to the given layout region within this container just before the given index. More... | |
bool | isEmpty() const |
Returns true if the container does not contain any interactors. More... | |
bool | isEnabled() const |
Returns true if this interactor is currently enabled. More... | |
bool | isVisible() const |
Returns true if the interactor is visible on the screen. More... | |
bool | regionContains(GInteractor *interactor, Region region) const |
Returns true if the given interactor is found in the given region of this container, which is assumed to use a border layout. More... | |
bool | regionContains(GInteractor *interactor, string region) const |
Returns true if the given interactor is found in the given region of this container, which is assumed to use a border layout. More... | |
bool | regionContains(GInteractor &interactor, Region region) const |
Returns true if the given interactor is found in the given region of this container, which is assumed to use a border layout. More... | |
bool | regionContains(GInteractor &interactor, string region) const |
Returns true if the given interactor is found in the given region of this container, which is assumed to use a border layout. More... | |
void | remove(GInteractor *interactor) |
Removes the given interactor from this container. More... | |
void | remove(GInteractor &interactor) |
Removes the given interactor from this container. More... | |
void | remove(int index) |
Removes the child interactor at the given 0-based index from this container. More... | |
void | removeActionListener() |
Removes the action listener from this interactor so that it will no longer call it when events occur. More... | |
void | removeClickListener() |
Removes the click listener from this interactor so that it will no longer call it when events occur. More... | |
void | removeDoubleClickListener() |
Removes the double-click listener from this interactor so that it will no longer call it when events occur. More... | |
void | removeFromRegion(GInteractor *interactor, Region region) |
Removes the given interactor from the given region within this container, which is assumed to use a border layout. More... | |
void | removeFromRegion(GInteractor *interactor, string region) |
Removes the given interactor from the given region within this container, which is assumed to use a border layout. More... | |
void | removeFromRegion(GInteractor &interactor, Region region) |
Removes the given interactor from the given region within this container, which is assumed to use a border layout. More... | |
void | removeFromRegion(GInteractor &interactor, string region) |
Removes the given interactor from the given region within this container, which is assumed to use a border layout. More... | |
void | removeFromRegion(int index, Region region) |
Removes the child interactor at the given 0-based index from the given region of this container, which is assumed to use a border layout. More... | |
void | removeFromRegion(int index, string region) |
Removes the child interactor at the given 0-based index from the given region of this container, which is assumed to use a border layout. More... | |
void | removeKeyListener() |
Removes the key listener from this interactor so that it will no longer call it when key events occur. More... | |
void | removeMouseListener() |
Removes the mouse listener from this interactor so that it will no longer call it when events occur. More... | |
void | requestFocus() |
Transfers keyboard focus to this interactor. More... | |
void | setAccelerator(string accelerator) |
Sets an accelerator hotkey for this interactor, such as "Ctrl-S". More... | |
void | setActionCommand(string actionCommand) |
Sets the action command for this interactor. More... | |
void | setActionListener(GEventListener func) |
Sets an action listener on this interactor so that it will be called when it is interacted with in its primary way. More... | |
void | setActionListener(GEventListenerVoid func) |
Sets an action listener on this interactor so that it will be called when it is interacted with in its primary way. More... | |
void | setAlignment(HorizontalAlignment halign, VerticalAlignment valign) |
Sets the horizontal and vertical alignment of interactors in this container. More... | |
void | setBackground(int rgb) |
Sets the background color of the interactor to the color represented by the given RGB integer. More... | |
void | setBackground(string color) |
Sets the background color of the interactor to the color represented by the given string. More... | |
void | setBounds(double x, double y, double width, double height) |
Sets the size and location of the widget. More... | |
void | setBounds(const GRectangle &size) |
Sets the size and location of the widget. More... | |
void | setClickListener(GEventListener func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is clicked on it. More... | |
void | setClickListener(GEventListenerVoid func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is clicked on it. More... | |
void | setColor(int rgb) |
Sets the foreground/text color of the interactor to the color represented by the given RGB integer. More... | |
void | setColor(string color) |
Sets the foreground/text color of the interactor to the color represented by the given string. More... | |
void | setDoubleClickListener(GEventListener func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is double-clicked on it. More... | |
void | setDoubleClickListener(GEventListenerVoid func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is double-clicked on it. More... | |
void | setEnabled(bool value) |
Sets whether this interactor is currently enabled. More... | |
void | setEventsEnabled(bool eventsEnabled) |
Sets whether the object is currently allowing itself to fire events. More... | |
void | setFont(const QFont &font) |
Sets the font used by this widget to the given Qt font. More... | |
void | setFont(string font) |
Sets the font used by this widget to the font represented by the given font string, such as "Helvetica-16-Bold". More... | |
void | setForeground(int rgb) |
Sets the foreground/text color of the interactor to the color represented by the given RGB integer. More... | |
void | setForeground(string color) |
Sets the foreground/text color of the interactor to the color represented by the given string. More... | |
void | setHeight(double height) |
Sets the onscreen height of the interactor in pixels. More... | |
void | setHorizontalAlignment(HorizontalAlignment halign) |
Sets the horizontal alignment of interactors in this container. More... | |
void | setIcon(const QIcon &icon) |
Sets the icon associated with this interactor. More... | |
void | setIcon(const QPixmap &icon) |
Sets the icon associated with this interactor. More... | |
void | setIcon(string filename, bool retainIconSize=true) |
Sets the file name of the icon associated with this interactor, or an empty string if no icon has been set. More... | |
void | setKeyListener(GEventListener func) |
Sets a key listener on this interactor so that it will be called when the user presses any key. More... | |
void | setKeyListener(GEventListenerVoid func) |
Sets a key listener on this interactor so that it will be called when the user presses any key. More... | |
void | setLocation(double x, double y) |
Sets the onscreen x/y-coordinate of the top-left corner of the interactor relative to its window. More... | |
void | setMargin(double px) |
Sets the margin in pixels around interactors in this container. More... | |
void | setMinimumSize(double width, double height) |
Sets the minimum size in pixels that this interactor will permit itself to be resized to. More... | |
void | setMinimumSize(const GDimension &size) |
Sets the minimum size in pixels that this interactor will permit itself to be resized to. More... | |
void | setMouseListener(GEventListener func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is moved or clicked on it. More... | |
void | setMouseListener(GEventListenerVoid func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is moved or clicked on it. More... | |
void | setName(string name) |
Sets a string representing a unique name for this interactor. More... | |
void | setPadding(double px) |
Sets the padding on all 4 sides around widgets in this container. More... | |
void | setPadding(double topBottom, double leftRight) |
Sets the padding on all 4 sides around widgets in this container, using different padding on the vertical vs horizontal sides. More... | |
void | setPadding(double top, double right, double bottom, double left) |
Sets the padding on all 4 sides around widgets in this container, using different padding on each of the 4 sides. More... | |
void | setPreferredHeight(double height) |
Sets the height in pixels that this interactor would prefer to be. More... | |
void | setPreferredSize(double width, double height) |
Sets the width and height in pixels that this interactor would prefer to be. More... | |
void | setPreferredSize(const GDimension &size) |
Sets the size in pixels that this interactor would prefer to be. More... | |
void | setPreferredWidth(double width) |
Sets the width in pixels that this interactor would prefer to be. More... | |
void | setRegionAlignment(Region region, HorizontalAlignment halign) |
Sets the horizontal alignment of interactors in the given region of this container, which is assumed to use a border layout. More... | |
void | setRegionAlignment(Region region, VerticalAlignment valign) |
Sets the vertical alignment of interactors in the given region of this container, which is assumed to use a border layout. More... | |
void | setRegionAlignment(Region region, HorizontalAlignment halign, VerticalAlignment valign) |
Sets the horizontal and vertical alignment of interactors in the given region of this container, which is assumed to use a border layout. More... | |
void | setRegionAlignment(string region, string align) |
Sets the horizontal and/or vertical alignment of interactors in the given region of this container, which is assumed to use a border layout. More... | |
void | setRegionAlignment(string region, string halign, string valign) |
Sets the horizontal and vertical alignment of interactors in the given region of this container, which is assumed to use a border layout. More... | |
void | setRegionHorizontalAlignment(Region region, HorizontalAlignment halign) |
Sets the horizontal alignment of interactors in the given region of this container, which is assumed to use a border layout. More... | |
void | setRegionHorizontalAlignment(string region, string halign) |
Sets the horizontal alignment of interactors in the given region of this container, which is assumed to use a border layout. More... | |
void | setRegionVerticalAlignment(string region, string valign) |
Sets the vertical alignment of interactors in the given region of this container, which is assumed to use a border layout. More... | |
void | setRegionVerticalAlignment(Region region, VerticalAlignment valign) |
Sets the vertical alignment of interactors in the given region of this container, which is assumed to use a border layout. More... | |
void | setSize(double width, double height) |
Sets the onscreen width and height of the interactor in pixels. More... | |
void | setSize(const GDimension &size) |
Sets the onscreen width and height of the interactor in pixels. More... | |
void | setSpacing(double px) |
Sets the spacing between interactors in this container. More... | |
void | setTooltip(string tooltipText) |
Sets a "tooltip" that will appear if the user hovers their mouse over the interactor. More... | |
void | setVerticalAlignment(VerticalAlignment valign) |
Sets the vertical alignment of interactors in this container. More... | |
void | setVisible(bool visible) |
Returns true if the interactor is visible on the screen. More... | |
void | setWidth(double width) |
Sets the onscreen width of the interactor in pixels. More... | |
void | setX(double x) |
Sets the onscreen x-coordinate of the top-left corner of the interactor relative to its window. More... | |
void | setY(double y) |
Sets the onscreen y-coordinate of the top-left corner of the interactor relative to its window. More... | |
string | toString() const |
Returns a string representation of this observable object's state. More... | |
Static Public Attributes | |
static const int | MARGIN_DEFAULT = 5 |
Default margin around each interactor. More... | |
static const int | SPACING_DEFAULT = 8 |
Default spacing between neighboring interactors. More... | |
Protected Member Functions | |
void | clearEventListeners() |
Removes all event listeners from this object. More... | |
void | ensureThreadSafety(string memberName="") |
Ensures that we are currently in the Qt GUI thread. More... | |
void | fireEvent(GEvent &event) |
Sends out the given event to any attached listeners. More... | |
void | fireGEvent(QEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QCloseEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QKeyEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QMouseEvent *event, EventType eventType, string eventName, string actionCommand="") |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QResizeEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QTimerEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QWheelEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QWindowStateChangeEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
bool | hasEventListener(string eventName) const |
Returns true if the observable object has a listener for the given type of event. More... | |
bool | isAcceptingEvent(int eventMask) const |
Returns true if the observable object has a listener for the given type of event. More... | |
bool | isAcceptingEvent(const GEvent &event) const |
Returns true if the observable object has a listener for the given type of event. More... | |
bool | isAcceptingEvent(string eventType) const |
Returns true if the observable object has a listener for the given type of event. More... | |
void | removeEventListener(string eventName) |
Removes any event listener from this observable object that would respond to the given type of event, such as "click" or "keydown". More... | |
void | removeEventListeners(std::initializer_list< string > eventNames) |
Removes any event listener from this observable object that would respond to the given types of events, such as "click" or "keydown". More... | |
void | setEventListener(string eventName, GEventListener func) |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown". More... | |
void | setEventListener(string eventName, GEventListenerVoid func) |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown". More... | |
void | setEventListeners(std::initializer_list< string > eventNames, GEventListener func) |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown". More... | |
void | setEventListeners(std::initializer_list< string > eventNames, GEventListenerVoid func) |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown". More... | |
A GContainer is a logical grouping for interactors.
The container manages the position and size of the interactors inside it. This class is very similar to the Java concept of a container, represented in Swing by the JPanel class.
A container has a layout that guides how it positions its interactors. Supported layouts include border (put interactors in the N/S/W/E/Center), grid (rows and columns of interactors), and flow (interactors go in a single horizontal or vertical line).
Containers also use a "box model" similar to the CSS box model with margins and padding around each interactor, and spacing between neighboring widgets:
container +----------------—+ | margin | | +—border-—+ | | | padding | | | | content | | | | padding | | | +----------—+ |
margin |
---|
spacing |
margin |
+—border-—+ |
enum Layout |
enum Region |
|
inherited |
GContainer | ( | Layout | layout = LAYOUT_FLOW_HORIZONTAL , |
QWidget* | parent = nullptr |
||
) |
Creates a new container with the given layout.
GContainer | ( | Layout | layout, |
int | rows, | ||
int | cols, | ||
QWidget* | parent = nullptr |
||
) |
Creates a new container with the given number of rows and columns.
Meant to be used for grid layouts.
|
override |
Frees memory allocated internally by the container.
|
virtual |
Adds the given interactor to the end of the list of interactors in this container.
If the container uses a grid layout, adds the interactor to the next available row/column. If it uses a border layout, adds to the center region.
ErrorException | if the interactor is null |
|
virtual |
Adds the given interactor to the end of the list of interactors in this container.
If the container uses a grid layout, adds the interactor to the next available row/column. If it uses a border layout, adds to the center region.
|
virtualinherited |
Adds an event listener to be notified when this interactor is clicked or generally interacted with.
|
virtual |
Adds the given interactor to the given row and column in this container, which is assumed to use a grid layout.
If the rowspan and/or colspan arguments are passed, the item will occupy multiple rows or columns' worth of space. If the container does not use a grid layout, equivalent to add().
ErrorException | if the interactor is null |
|
virtual |
Adds the given interactor to the given row and column in this container, which is assumed to use a grid layout.
If the rowspan and/or colspan arguments are passed, the item will occupy multiple rows or columns' worth of space. If the container does not use a grid layout, equivalent to add().
|
virtual |
Adds the given interactor to the given region in this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to add().
ErrorException | if the interactor is null |
|
virtual |
Adds the given interactor to the given region in this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to add().
ErrorException | if the interactor is null |
|
virtual |
Adds the given interactor to the given region in this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to add().
|
virtual |
Adds the given interactor to the given region in this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to add().
|
virtual |
Removes all interactors from this container.
|
protectedvirtualinherited |
Removes all event listeners from this object.
|
virtual |
Removes all interactors from the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, has no effect.
|
virtual |
Removes all interactors from the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, has no effect.
|
virtual |
Returns true if the given interactor is found in this container.
Returns false if the interactor is null
|
virtual |
Returns true if the given interactor is found in this container.
|
protectedvirtualinherited |
Ensures that we are currently in the Qt GUI thread.
|
overridevirtualinherited |
Returns true if this interactor is currently accepting events.
Initially true. An interactor must be visible and added to an onscreen window to receive events.
Reimplemented from GObservable.
|
protectedvirtualinherited |
Sends out the given event to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
virtualinherited |
Returns a string representing a hotkey for this interactor, or an empty string if no accelerator has been set.
Reimplemented in GButton.
|
virtualinherited |
Returns an action command for this interactor, which is a semi-unique string you can use to identify it when events occur.
For example, for buttons, the default action command is the button's text.
Reimplemented in GChooser, GRadioButton, GButton, and GCheckBox.
|
virtualinherited |
Returns the background color of the interactor as a string.
Reimplemented in GCanvas.
|
virtualinherited |
Returns the background color of the interactor as an RGB integer.
Reimplemented in GCanvas.
|
virtualinherited |
Returns a rectangle representing the x/y position and size of this interactor.
|
virtualinherited |
Returns the foreground/text color of the interactor as a string.
Equivalent to getForeground.
|
virtualinherited |
Returns the foreground/text color of the interactor as an RGB integer.
Equivalent to getForegroundInt.
|
virtualinherited |
Returns a pointer to the onscreen container holding this interactor.
When an interactor is created, its container is initially null. This will become non-null automatically if you add the interactor to a window or other layout container. Interactors must be added to a container or window to receive events or to become visible on the screen.
|
virtual |
Returns all interactors that are children or descendents inside this container.
This differs from getInteractors in that it returns not only direct children but also grandchildren, etc. in any sub-containers. If the type argument is passed, will return only interactors of that type (e.g. "GCheckBox"). Otherwise all interactors will be returned.
|
virtualinherited |
Returns the font of this interactor's text as a font string such as "Helvetica-12-Bold".
Reimplemented in GCanvas.
|
virtualinherited |
Returns the foreground/text color of the interactor as a string.
Equivalent to getColor.
|
virtualinherited |
Returns the foreground/text color of the interactor as an RGB integer.
Equivalent to getColorInt.
|
virtualinherited |
Returns the current onscreen height of this interactor in pixels.
|
virtualinherited |
Returns the file name of the icon associated with this interactor, or an empty string if no icon has been set.
Not all types of interactors support icons.
|
virtualinherited |
Returns a globally unique identifier for this interactor, which is set when the interactor is constructed.
These IDs can be useful for debugging to help identify interactors uniquely.
|
virtual |
Returns the child interactor at the given 0-based index in this container.
ErrorException | if the index is out of bounds |
|
virtual |
Returns the child interactor at the given 0-based index within the given region in this container, which is assumed to use a border layout.
If the container does not use a border layout, returns nullptr.
ErrorException | if the index is out of bounds |
|
virtual |
Returns the child interactor at the given 0-based index within the given region in this container, which is assumed to use a border layout.
If the container does not use a border layout, returns nullptr.
ErrorException | if the index is out of bounds |
|
virtual |
Returns the number of children interactors in this container.
|
virtual |
Returns the number of children interactors within the given region in this container, which is assumed to use a border layout.
If the container does not use a border layout, returns 0.
|
virtual |
Returns the number of children interactors within the given region in this container, which is assumed to use a border layout.
If the container does not use a border layout, returns 0.
|
virtual |
Returns a vector of all children interactors in this container.
|
overridevirtual |
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
This must be overridden by all interactor subclasses. Students/clients generally should not need to call this.
Implements GInteractor.
|
virtual |
Returns the type of layout used by this container.
|
virtualinherited |
Returns an (x, y) point representing the onscreen location of the top-left corner of this interactor within its containing window.
|
virtual |
Returns the margin around each widget in this container in pixels.
|
virtualinherited |
Returns the minimum height in pixels that this interactor will permit itself to be resized to.
|
virtualinherited |
Returns a GDimension structure representing the minimum size in pixels that this interactor will permit itself to be resized to.
|
virtualinherited |
Returns the minimum width in pixels that this interactor will permit itself to be resized to.
|
virtualinherited |
Returns a string representing a unique name for this interactor.
The default name string uses the interactor's type and its ID to make a string like "GButton_14", but you can override this by calling setName.
|
virtual |
Returns the padding inside this container in pixels.
|
virtual |
Returns the padding on the bottom side of this container in pixels.
|
virtual |
Returns the padding on the left side of this container in pixels.
|
virtual |
Returns the padding on the right side of this container in pixels.
|
virtual |
Returns the padding on the top side of this container in pixels.
|
virtualinherited |
Returns the height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars.
|
overridevirtual |
Returns a GDimension structure storing the width and height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars.
Reimplemented from GInteractor.
|
virtualinherited |
Returns the height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars.
|
virtual |
Returns the height in pixels of the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, returns 0.
|
virtual |
Returns the height in pixels of the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, returns 0.
|
virtual |
Returns the width and height in pixels of the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, returns 0.
|
virtual |
Returns the width and height in pixels of the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, returns 0.
|
virtual |
Returns the width in pixels of the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, returns 0.
|
virtual |
Returns the width in pixels of the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, returns 0.
|
virtualinherited |
Returns a GDimension structure storing the current onscreen width and height of this interactor in pixels.
|
virtual |
Returns the spacing between widgets in this container in pixels.
|
overridevirtual |
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox".
All subclasses of GInteractor must implement this method.
Implements GInteractor.
|
overridevirtual |
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
This must be overridden by all interactor subclasses. Students/clients generally should not need to call this.
Implements GInteractor.
|
virtualinherited |
Returns the current onscreen width of this interactor in pixels.
|
virtualinherited |
Returns the x-coordinate of the top-left pixel of this interactor within its onscreen window.
|
virtualinherited |
Returns the y-coordinate of the top-left pixel of this interactor within its onscreen window.
|
protectedvirtualinherited |
Returns true if the observable object has a listener for the given type of event.
|
virtualinherited |
Returns true if the given x/y pixel is within the bounds of this interactor.
|
virtualinherited |
Returns true if the given x/y pixel is within the bounds of this interactor.
|
virtual |
Adds the given interactor to this container just before the given index.
ErrorException | if the index is out of bounds or interactor is null |
|
virtual |
Adds the given interactor to this container just before the given index.
ErrorException | if the index is out of bounds |
|
virtual |
Adds the given interactor to the given layout region within this container just before the given index.
The container is assumed to use a border layout; if it does not, equivalent to insert().
ErrorException | if the index is out of bounds or interactor is null |
|
virtual |
Adds the given interactor to the given layout region within this container just before the given index.
The container is assumed to use a border layout; if it does not, equivalent to insert().
ErrorException | if the index is out of bounds or interactor is null |
|
virtual |
Adds the given interactor to the given layout region within this container just before the given index.
The container is assumed to use a border layout; if it does not, equivalent to insert().
ErrorException | if the index is out of bounds |
|
virtual |
Adds the given interactor to the given layout region within this container just before the given index.
The container is assumed to use a border layout; if it does not, equivalent to insert().
ErrorException | if the index is out of bounds |
|
protectedvirtualinherited |
Returns true if the observable object has a listener for the given type of event.
See gevent.h for event types and masks.
|
protectedvirtualinherited |
Returns true if the observable object has a listener for the given type of event.
|
protectedvirtualinherited |
Returns true if the observable object has a listener for the given type of event.
|
virtual |
Returns true if the container does not contain any interactors.
|
virtualinherited |
Returns true if this interactor is currently enabled.
Most interactors begin as enabled but can be disabled to stop them from being able to be clicked on or otherwise emit events.
|
virtualinherited |
Returns true if the interactor is visible on the screen.
Interactors will not be visible until they are added to an onscreen window or container.
|
virtual |
Returns true if the given interactor is found in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to contains().
ErrorException | if the interactor is null |
|
virtual |
Returns true if the given interactor is found in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to contains().
ErrorException | if the interactor is null |
|
virtual |
Returns true if the given interactor is found in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to contains().
|
virtual |
Returns true if the given interactor is found in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to contains().
|
virtual |
Removes the given interactor from this container.
Works for any layout. If the given interactor is not found in this container, has no effect.
ErrorException | if the interactor is null |
|
virtual |
Removes the given interactor from this container.
Works for any layout. If the given interactor is not found in this container, has no effect.
|
virtual |
Removes the child interactor at the given 0-based index from this container.
Works for any layout.
ErrorException | if the index is out of bounds |
|
virtualinherited |
Removes the action listener from this interactor so that it will no longer call it when events occur.
|
virtualinherited |
Removes the click listener from this interactor so that it will no longer call it when events occur.
|
virtualinherited |
Removes the double-click listener from this interactor so that it will no longer call it when events occur.
|
protectedvirtualinherited |
Removes any event listener from this observable object that would respond to the given type of event, such as "click" or "keydown".
|
protectedvirtualinherited |
Removes any event listener from this observable object that would respond to the given types of events, such as "click" or "keydown".
|
virtual |
Removes the given interactor from the given region within this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to remove(). If the given interactor is not found in the given region, has no effect.
ErrorException | if the interactor is null |
|
virtual |
Removes the given interactor from the given region within this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to remove(). If the given interactor is not found in the given region, has no effect.
ErrorException | if the interactor is null |
|
virtual |
Removes the given interactor from the given region within this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to remove(). If the given interactor is not found in the given region, has no effect.
|
virtual |
Removes the given interactor from the given region within this container, which is assumed to use a border layout.
If the container does not use a border layout, equivalent to remove(). If the given interactor is not found in the given region, has no effect.
|
virtual |
Removes the child interactor at the given 0-based index from the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, has no effect. If the given interactor is not found in the given region, has no effect.
ErrorException | if the index is out of bounds |
|
virtual |
Removes the child interactor at the given 0-based index from the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, has no effect. If the given interactor is not found in the given region, has no effect.
ErrorException | if the index is out of bounds |
|
virtualinherited |
Removes the key listener from this interactor so that it will no longer call it when key events occur.
|
virtualinherited |
Removes the mouse listener from this interactor so that it will no longer call it when events occur.
|
virtualinherited |
Transfers keyboard focus to this interactor.
Reimplemented in GTable.
|
virtualinherited |
Sets an accelerator hotkey for this interactor, such as "Ctrl-S".
Not all interactor types support accelerators.
accelerator | a hotkey such as "Ctrl-S" |
Reimplemented in GButton.
|
virtualinherited |
Sets the action command for this interactor.
The action command is meant to be a semi-unique string you can use to identify the interactor when events occur. For example, for buttons, the default action command is the button's text, but you can change it to a different string if you prefer. The main usage of this feature is if you want to use the same function as an event listener for many interactors, you can use the action command to help distinguish which interactor generates each event.
|
virtualinherited |
Sets an action listener on this interactor so that it will be called when it is interacted with in its primary way.
For example, if this interactor is a button, this will fire when it is clicked. Any existing action listener will be replaced.
|
virtualinherited |
Sets an action listener on this interactor so that it will be called when it is interacted with in its primary way.
For example, if this interactor is a button, this will fire when it is clicked. Any existing action listener will be replaced.
|
virtual |
Sets the horizontal and vertical alignment of interactors in this container.
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
Sets the size and location of the widget.
In general you should avoid explicitly sizing and positioning widgets in this way; instead, use containers and regions to help you lay out widgets at the proper sizes.
Reimplemented in GLabel.
|
virtualinherited |
Sets the size and location of the widget.
In general you should avoid explicitly sizing and positioning widgets in this way; instead, use containers and regions to help you lay out widgets at the proper sizes.
Reimplemented in GLabel.
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is clicked on it.
Any existing click listener will be replaced.
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is clicked on it.
Any existing click listener will be replaced.
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is double-clicked on it.
Any existing double-click listener will be replaced.
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is double-clicked on it.
Any existing double-click listener will be replaced.
|
virtualinherited |
Sets whether this interactor is currently enabled.
Most interactors begin as enabled but can be disabled to stop them from being able to be clicked on or otherwise emit events.
|
protectedvirtualinherited |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown".
Any prior listener for that type of event is replaced.
|
protectedvirtualinherited |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown".
Any prior listener for that type of event is replaced.
|
protectedvirtualinherited |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown".
Any prior listener for those types of event are replaced.
|
protectedvirtualinherited |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown".
Any prior listener for those types of event are replaced.
|
virtualinherited |
Sets whether the object is currently allowing itself to fire events.
Initially this is true.
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
Sets the onscreen height of the interactor in pixels.
ErrorException | if height is negative |
Reimplemented in GLabel.
|
virtual |
Sets the horizontal alignment of interactors in this container.
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
Sets the file name of the icon associated with this interactor, or an empty string if no icon has been set.
Not all types of interactors support icons.
filename | icon file path to use |
retainIconSize | true if icon should stay at its existing pixel size (default), or false if it should be resized to fit the interactor |
|
virtualinherited |
Sets a key listener on this interactor so that it will be called when the user presses any key.
Any existing key listener will be replaced.
Reimplemented in GCanvas.
|
virtualinherited |
Sets a key listener on this interactor so that it will be called when the user presses any key.
Any existing key listener will be replaced.
Reimplemented in GCanvas.
|
virtualinherited |
Sets the onscreen x/y-coordinate of the top-left corner of the interactor relative to its window.
Generally clients should not call this and should instead use containers and layout regions to position interactors.
Reimplemented in GLabel.
|
virtual |
Sets the margin in pixels around interactors in this container.
|
virtualinherited |
Sets the minimum size in pixels that this interactor will permit itself to be resized to.
ErrorException | if width or height is negative |
|
virtualinherited |
Sets the minimum size in pixels that this interactor will permit itself to be resized to.
ErrorException | if width or height is negative |
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is moved or clicked on it.
Any existing mouse listener will be replaced.
Reimplemented in GBrowserPane, and GTextArea.
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is moved or clicked on it.
Any existing mouse listener will be replaced.
Reimplemented in GBrowserPane, and GTextArea.
|
virtualinherited |
Sets a string representing a unique name for this interactor.
The default name string uses the interactor's type and its ID to make a string like "GButton_14", but you can override this by calling setName.
name | a string such as "GButton_14" |
|
virtual |
Sets the padding on all 4 sides around widgets in this container.
|
virtual |
Sets the padding on all 4 sides around widgets in this container, using different padding on the vertical vs horizontal sides.
|
virtual |
Sets the padding on all 4 sides around widgets in this container, using different padding on each of the 4 sides.
|
virtualinherited |
Sets the height in pixels that this interactor would prefer to be.
Normally clients do not need to call this method; the interactor can figure out its own preferred size. But calling it can help you to hint to the container/layout system if you want a given interactor to "prefer" to make itself larger or smaller for the purposes of your particular program.
|
virtualinherited |
Sets the width and height in pixels that this interactor would prefer to be.
Normally clients do not need to call this method; the interactor can figure out its own preferred size. But calling it can help you to hint to the container/layout system if you want a given interactor to "prefer" to make itself larger or smaller for the purposes of your particular program.
|
virtualinherited |
Sets the size in pixels that this interactor would prefer to be.
Normally clients do not need to call this method; the interactor can figure out its own preferred size.
|
virtualinherited |
Sets the width in pixels that this interactor would prefer to be.
Normally clients do not need to call this method; the interactor can figure out its own preferred size.
|
virtual |
Sets the horizontal alignment of interactors in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, sets the alignment of the entire container instead.
|
virtual |
Sets the vertical alignment of interactors in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, sets the alignment of the entire container instead.
|
virtual |
Sets the horizontal and vertical alignment of interactors in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, sets the alignment of the entire container instead.
|
virtual |
Sets the horizontal and/or vertical alignment of interactors in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, sets the alignment of the entire container instead.
|
virtual |
Sets the horizontal and vertical alignment of interactors in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, sets the alignment of the entire container instead.
|
virtual |
Sets the horizontal alignment of interactors in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, sets the alignment of the entire container instead.
|
virtual |
Sets the horizontal alignment of interactors in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, sets the alignment of the entire container instead.
|
virtual |
Sets the vertical alignment of interactors in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, sets the alignment of the entire container instead.
|
virtual |
Sets the vertical alignment of interactors in the given region of this container, which is assumed to use a border layout.
If the container does not use a border layout, sets the alignment of the entire container instead.
|
virtualinherited |
Sets the onscreen width and height of the interactor in pixels.
ErrorException | if width or height is negative |
Reimplemented in GLabel.
|
virtualinherited |
Sets the onscreen width and height of the interactor in pixels.
ErrorException | if width or height is negative |
Reimplemented in GLabel.
|
virtual |
Sets the spacing between interactors in this container.
|
virtualinherited |
Sets a "tooltip" that will appear if the user hovers their mouse over the interactor.
Set an empty string to clear the tooltip.
|
virtual |
Sets the vertical alignment of interactors in this container.
|
virtualinherited |
Returns true if the interactor is visible on the screen.
Interactors will not be visible until they are added to an onscreen window or container. If you call setVisible on an interactor that is not in any onscreen container, it will have no effect.
Reimplemented in GLabel.
|
virtualinherited |
Sets the onscreen width of the interactor in pixels.
ErrorException | if width is negative |
Reimplemented in GLabel.
|
virtualinherited |
Sets the onscreen x-coordinate of the top-left corner of the interactor relative to its window.
Generally clients should not call this and should instead use containers and layout regions to position interactors.
Reimplemented in GLabel.
|
virtualinherited |
Sets the onscreen y-coordinate of the top-left corner of the interactor relative to its window.
Generally clients should not call this and should instead use containers and layout regions to position interactors.
Reimplemented in GLabel.
|
virtualinherited |
Returns a string representation of this observable object's state.
Primarily used for debugging purposes.
|
friend |
|
static |
Default margin around each interactor.
|
static |
Default spacing between neighboring interactors.