# :stopdoc:
# This file is automatically generated by the WXRuby3 documentation
# generator. Do not alter this file.
# :startdoc:
module Wx
# A static box is a rectangle drawn around other windows to denote a logical grouping of items.
# Note that while the previous versions required that windows appearing inside a static box be created as its siblings (i.e. use the same parent as the static box itself), since wxWidgets 2.9.1 it is possible to create them as children of {Wx::StaticBox} itself and doing this is strongly recommended and avoids several different repainting problems that could happen when creating the other windows as siblings of the box.
# So the recommended way to create static box and the controls inside it is:
#
# void MyFrame::CreateControls()
# {
# wxPanel *panel = new wxPanel(this);
# wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox");
#
# new wxStaticText(box, wxID_ANY, "This window is a child of the staticbox");
# ...
# }
#
# Creating the windows with the static box parent (i.e. panel in the example above) as parent still works but can result in refresh and repaint problems.
# Also note that there is a specialized {Wx::Sizer} class ({Wx::StaticBoxSizer}) which can be used as an easier way to pack items into a static box.
# ===
#
# Category: {Wx::Controls}
Appearance: {Wx::MSW} Appearance
# | {Wx::GTK} Appearance
# | {Wx::OSX} Appearance
# |
# @see Wx::StaticText
# @see Wx::StaticBoxSizer
#
#
class StaticBox < Control
# @overload initialize()
# Default constructor.
# @return [StaticBox]
# @overload initialize(parent, id, label, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, name=Wx::StaticBoxNameStr)
# Constructor, creating and showing a static box.
#
# @see Wx::StaticBox#create
# @param parent [Wx::Window] Parent window. Must not be NULL.
# @param id [Integer] Window identifier. The value {Wx::StandardID::ID_ANY} indicates a default value.
# @param label [String] Text to be displayed in the static box, the empty string for no label.
# @param pos [Array(Integer, Integer), Wx::Point] Window position. If {Wx::DEFAULT_POSITION} is specified then a default position is chosen.
# @param size [Array(Integer, Integer), Wx::Size] Checkbox size. If {Wx::DEFAULT_SIZE} is specified then a default size is chosen.
# @param style [Integer] Window style. There are no {Wx::StaticBox}-specific styles, but generic {Wx::Alignment::ALIGN_LEFT}, {Wx::Alignment::ALIGN_CENTRE_HORIZONTAL} and {Wx::Alignment::ALIGN_RIGHT} can be used here to change the position of the static box label when using {Wx::GTK} (these styles are ignored under the other platforms currently).
# @param name [String] Window name.
# @return [StaticBox]
# @overload initialize(parent, id, label, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, name=Wx::StaticBoxNameStr)
# Constructor for a static box using the given window as label.
# This constructor takes a pointer to an arbitrary window (although usually a {Wx::CheckBox} or a {Wx::RadioButton}) instead of just the usual text label and puts this window at the top of the box at the place where the label would be shown.
# The label window must be a non-null, fully created window and will become a child of this {Wx::StaticBox}, i.e. it will be owned by this control and will be deleted when the {Wx::StaticBox} itself is deleted.
# An example of creating a {Wx::StaticBox} with window as a label:
#
# void MyFrame::CreateControls()
# {
# wxPanel* panel = new wxPanel(this);
# wxCheckBox* checkbox = new wxCheckBox(panel, wxID_ANY, "Box checkbox");
# wxStaticBox* box = new wxStaticBox(panel, wxID_ANY, checkbox);
# ...
# }
#
# Currently this constructor is only available in {Wx::GTK} and {Wx::MSW}, use {Wx::HAS_WINDOW_LABEL_IN_STATIC_BOX} to check whether it can be used at compile-time.
# @param parent [Wx::Window]
# @param id [Integer]
# @param label [Wx::Window]
# @param pos [Array(Integer, Integer), Wx::Point]
# @param size [Array(Integer, Integer), Wx::Size]
# @param style [Integer]
# @param name [String]
# @return [StaticBox]
def initialize(*args) end
# @overload create(parent, id, label, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, name=Wx::StaticBoxNameStr)
# Creates the static box for two-step construction.
# See {Wx::StaticBox#static_box} for further details.
# @param parent [Wx::Window]
# @param id [Integer]
# @param label [String]
# @param pos [Array(Integer, Integer), Wx::Point]
# @param size [Array(Integer, Integer), Wx::Size]
# @param style [Integer]
# @param name [String]
# @return [true,false]
# @overload create(parent, id, label, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, name=Wx::StaticBoxNameStr)
# Creates the static box with the window as a label.
# This method can only be called for an object created using its default constructor.
# See the constructor documentation for more details.
# Currently this overload is only available in {Wx::GTK} and {Wx::MSW}, use {Wx::HAS_WINDOW_LABEL_IN_STATIC_BOX} to check whether it can be used at compile-time.
# @param parent [Wx::Window]
# @param id [Integer]
# @param label [Wx::Window]
# @param pos [Array(Integer, Integer), Wx::Point]
# @param size [Array(Integer, Integer), Wx::Size]
# @param style [Integer]
# @param name [String]
# @return [true,false]
def create(*args) end
# Enables or disables the box without affecting its label window, if any.
# {Wx::StaticBox} overrides {Wx::Window#enable} in order to avoid disabling the control used as a label, if this box is using one. This is done in order to allow using a {Wx::CheckBox}, for example, label and enable or disable the box according to the state of the checkbox: if disabling the box also disabled the checkbox in this situation, it would make it impossible for the user to re-enable the box after disabling it, so the checkbox stays enabled even if box->Enable(false)
is called.
# However with the actual behaviour, implemented in this overridden method, the following code (shown using C++11 only for convenience, this behaviour is not C++11-specific):
#
# auto check = new wxCheckBox(parent, wxID_ANY, "Use the box");
# auto box = new wxStaticBox(parent, wxID_ANY, check);
# check->Bind(wxEVT_CHECKBOX,
# [box](wxCommandEvent& event) {
# box->Enable(event.IsChecked());
# });
# does work as expected.
# Please note that overriding {Wx::StaticBox#enable} to not actually disable this window itself has two possibly unexpected consequences:
#
# - The box retains its enabled status, i.e. {Wx::StaticBox#is_enabled} still returns true, after calling Enable(false)
.- The box children are enabled or disabled when the box is, which can result in the loss of their original state. E.g. if a box child is initially disabled, then the box itself is disabled and, finally, the box is enabled again, this child will end up being enabled too (this wouldn't happen with any other parent window as its children would inherit the disabled state from the parent instead of being really disabled themselves when it is disabled). To avoid this problem, consider using {Wx::EVT_UPDATE_UI} to ensure that the child state is always correct or restoring it manually after re-enabling the box.
# @param enable [true,false]
# @return [true,false]
def enable(enable=true) end
end # StaticBox
end