Class: Wx::SizerFlags
- Inherits:
-
Object
- Object
- Wx::SizerFlags
- Defined in:
- lib/wx/doc/gen/sizer.rb
Overview
This class is untracked and should not be derived from nor instances extended!
Container for sizer items flags providing readable names for them.
Normally, when you add an item to a sizer via Wx::Sizer#add, you have to specify a lot of flags and parameters which can be unwieldy. This is where SizerFlags comes in: it allows you to specify all parameters using the named methods instead. For example, instead of
sizer.add(ctrl, 0, Wx::EXPAND | Wx::ALL, 10)
you can now write
sizer.add(ctrl, Wx::SizerFlags.new..border(Wx::ALL, 10))
This is more readable and also allows you to create SizerFlags objects which can be reused for several sizer items.
flagsExpand = Wx::SizerFlags.new(1)
flagsExpand..border(Wx::ALL, 10)
sizer.add(ctrl1, flagsExpand)
sizer.add(ctrl2, flagsExpand)
Note that by specification, all methods of SizerFlags return the SizerFlags object itself to allowing chaining multiple methods calls like in the examples above.
Category: Window Layout
Class Method Summary collapse
-
.disable_consistency_checks ⇒ void
Globally disable checks for sizer flag consistency in debug builds.
-
.get_default_border ⇒ Integer
Returns the border used by default in #border method.
-
.get_default_border_fractional ⇒ Float
Returns the border used by default, with fractional precision.
Instance Method Summary collapse
-
#align(alignment) ⇒ Wx::SizerFlags
Sets the alignment of this SizerFlags to align.
- #border(*args) ⇒ Object
-
#bottom ⇒ Wx::SizerFlags
Aligns the object to the bottom, similar for
Align(wxALIGN_BOTTOM)
. -
#center ⇒ Wx::SizerFlags
Sets the object of the SizerFlags to center itself in the area it is given.
-
#center_horizontal ⇒ Wx::SizerFlags
Same as #centre_horizontal.
-
#center_vertical ⇒ Wx::SizerFlags
Same as #centre_vertical.
-
#centre ⇒ Wx::SizerFlags
#center for people with the other dialect of English.
-
#centre_horizontal ⇒ Wx::SizerFlags
Center an item only in horizontal direction.
-
#centre_vertical ⇒ Wx::SizerFlags
Center an item only in vertical direction.
-
#double_border(direction = Wx::Direction::ALL) ⇒ Wx::SizerFlags
Sets the border in the given direction having twice the default border size.
-
#double_horz_border ⇒ Wx::SizerFlags
Sets the border in left and right directions having twice the default border size.
-
#expand ⇒ Wx::SizerFlags
Sets the object of the SizerFlags to expand to fill as much area as it can.
-
#fixed_min_size ⇒ Wx::SizerFlags
Set the Wx::SizerFlagBits::FIXED_MINSIZE flag which indicates that the initial size of the window should be also set as its minimal size.
-
#horz_border ⇒ Wx::SizerFlags
Sets the border in left and right directions having the default border size.
-
#initialize(proportion = 0) ⇒ Wx::SizerFlags
constructor
Creates the Sizer with the proportion specified by proportion.
-
#left ⇒ Wx::SizerFlags
Aligns the object to the left, similar for
Align(wxALIGN_LEFT)
. -
#proportion(proportion) ⇒ Wx::SizerFlags
Sets the proportion of this SizerFlags to proportion.
-
#reserve_space_even_if_hidden ⇒ Wx::SizerFlags
Set the Wx::SizerFlagBits::RESERVE_SPACE_EVEN_IF_HIDDEN flag.
-
#right ⇒ Wx::SizerFlags
Aligns the object to the right, similar for
Align(wxALIGN_RIGHT)
. -
#shaped ⇒ Wx::SizerFlags
Set the SHAPED flag which indicates that the elements should always keep the fixed width to height ratio equal to its original value.
-
#top ⇒ Wx::SizerFlags
Aligns the object to the top, similar for
Align(wxALIGN_TOP)
. -
#triple_border(direction = Wx::Direction::ALL) ⇒ Wx::SizerFlags
Sets the border in the given direction having thrice the default border size.
Constructor Details
#initialize(proportion = 0) ⇒ Wx::SizerFlags
Creates the Wx::Sizer with the proportion specified by proportion.
785 |
# File 'lib/wx/doc/gen/sizer.rb', line 785 def initialize(proportion=0) end |
Class Method Details
.disable_consistency_checks ⇒ void
This method returns an undefined value.
Globally disable checks for sizer flag consistency in debug builds.
By default, sizer classes such as BoxSizer and FlexGridSizer assert when passed invalid flags, even though doing this usually doesn’t result in any catastrophic consequences and the invalid flags are simply ignored later. Due to this, and the fact that these checks were only added in wxWidgets 3.1, existing code may run into multiple asserts warning about incorrect sizer flags use. Using this function provides a temporary solution for avoiding such asserts when upgrading to wxWidgets 3.1 from a previous version and will prevent such checks from being done. Please do note that correcting the code by removing the invalid flags remains a much better solution as these asserts may be very helpful to understand why some code using sizer flags doesn’t work as expected, so using this function, especially permanently, rather than a temporary workaround, is not recommended. Notice that the same effect as calling this function can be achieved by setting the environment variable WXSUPPRESS_SIZER_FLAGS_CHECK to any value.
914 |
# File 'lib/wx/doc/gen/sizer.rb', line 914 def self.disable_consistency_checks; end |
.get_default_border ⇒ Integer
Returns the border used by default in #border method.
This value is scaled appropriately for the current DPI on the systems where physical pixel values are used for the control positions and sizes, i.e. not with WXGTK or WXOSX.
921 |
# File 'lib/wx/doc/gen/sizer.rb', line 921 def self.get_default_border; end |
.get_default_border_fractional ⇒ Float
Returns the border used by default, with fractional precision.
For example when the border is scaled to a non-integer DPI.
928 |
# File 'lib/wx/doc/gen/sizer.rb', line 928 def self.get_default_border_fractional; end |
Instance Method Details
#align(alignment) ⇒ Wx::SizerFlags
Sets the alignment of this Wx::SizerFlags to align.
This method replaces the previously set alignment with the specified one.
797 |
# File 'lib/wx/doc/gen/sizer.rb', line 797 def align(alignment) end |
#border(direction, borderinpixels) ⇒ Wx::SizerFlags #border(direction = Wx::Direction::ALL) ⇒ Wx::SizerFlags
810 |
# File 'lib/wx/doc/gen/sizer.rb', line 810 def border(*args) end |
#bottom ⇒ Wx::SizerFlags
Aligns the object to the bottom, similar for Align(wxALIGN_BOTTOM)
.
Unlike #align, this method doesn’t change the horizontal alignment of the item.
816 |
# File 'lib/wx/doc/gen/sizer.rb', line 816 def bottom; end |
#center ⇒ Wx::SizerFlags
Sets the object of the Wx::SizerFlags to center itself in the area it is given.
820 |
# File 'lib/wx/doc/gen/sizer.rb', line 820 def center; end |
#center_horizontal ⇒ Wx::SizerFlags
Same as #centre_horizontal.
828 |
# File 'lib/wx/doc/gen/sizer.rb', line 828 def center_horizontal; end |
#center_vertical ⇒ Wx::SizerFlags
Same as #centre_vertical.
832 |
# File 'lib/wx/doc/gen/sizer.rb', line 832 def center_vertical; end |
#centre ⇒ Wx::SizerFlags
#center for people with the other dialect of English.
824 |
# File 'lib/wx/doc/gen/sizer.rb', line 824 def centre; end |
#centre_horizontal ⇒ Wx::SizerFlags
Center an item only in horizontal direction.
This is mostly useful for 2D sizers as for the 1D ones it is shorter to just use #centre as the alignment is only used in one direction with them anyhow. For 2D sizers, centering an item in one direction is quite different from centering it in both directions however. Note that, unlike #align, this method doesn’t change the vertical alignment.
840 |
# File 'lib/wx/doc/gen/sizer.rb', line 840 def centre_horizontal; end |
#centre_vertical ⇒ Wx::SizerFlags
Center an item only in vertical direction.
The remarks in #centre_horizontal documentation also apply to this function. Note that, unlike #align, this method doesn’t change the horizontal alignment.
847 |
# File 'lib/wx/doc/gen/sizer.rb', line 847 def centre_vertical; end |
#double_border(direction = Wx::Direction::ALL) ⇒ Wx::SizerFlags
Sets the border in the given direction having twice the default border size.
852 |
# File 'lib/wx/doc/gen/sizer.rb', line 852 def double_border(direction=Wx::Direction::ALL) end |
#double_horz_border ⇒ Wx::SizerFlags
Sets the border in left and right directions having twice the default border size.
860 |
# File 'lib/wx/doc/gen/sizer.rb', line 860 def double_horz_border; end |
#expand ⇒ Wx::SizerFlags
Sets the object of the Wx::SizerFlags to expand to fill as much area as it can.
864 |
# File 'lib/wx/doc/gen/sizer.rb', line 864 def ; end |
#fixed_min_size ⇒ Wx::SizerFlags
Set the Wx::SizerFlagBits::FIXED_MINSIZE flag which indicates that the initial size of the window should be also set as its minimal size.
868 |
# File 'lib/wx/doc/gen/sizer.rb', line 868 def fixed_min_size; end |
#horz_border ⇒ Wx::SizerFlags
Sets the border in left and right directions having the default border size.
856 |
# File 'lib/wx/doc/gen/sizer.rb', line 856 def horz_border; end |
#left ⇒ Wx::SizerFlags
Aligns the object to the left, similar for Align(wxALIGN_LEFT)
.
Unlike #align, this method doesn’t change the vertical alignment of the item.
880 |
# File 'lib/wx/doc/gen/sizer.rb', line 880 def left; end |
#proportion(proportion) ⇒ Wx::SizerFlags
Sets the proportion of this Wx::SizerFlags to proportion.
885 |
# File 'lib/wx/doc/gen/sizer.rb', line 885 def proportion(proportion) end |
#reserve_space_even_if_hidden ⇒ Wx::SizerFlags
Set the Wx::SizerFlagBits::RESERVE_SPACE_EVEN_IF_HIDDEN flag.
Normally Wx::Sizers don’t allocate space for hidden windows or other items. This flag overrides this behaviour so that sufficient space is allocated for the window even if it isn’t visible. This makes it possible to dynamically show and hide controls without resizing parent dialog, for example.
874 |
# File 'lib/wx/doc/gen/sizer.rb', line 874 def reserve_space_even_if_hidden; end |
#right ⇒ Wx::SizerFlags
Aligns the object to the right, similar for Align(wxALIGN_RIGHT)
.
Unlike #align, this method doesn’t change the vertical alignment of the item.
891 |
# File 'lib/wx/doc/gen/sizer.rb', line 891 def right; end |
#shaped ⇒ Wx::SizerFlags
Set the Wx::SHAPED flag which indicates that the elements should always keep the fixed width to height ratio equal to its original value.
895 |
# File 'lib/wx/doc/gen/sizer.rb', line 895 def shaped; end |
#top ⇒ Wx::SizerFlags
Aligns the object to the top, similar for Align(wxALIGN_TOP)
.
Unlike #align, this method doesn’t change the horizontal alignment of the item.
901 |
# File 'lib/wx/doc/gen/sizer.rb', line 901 def top; end |
#triple_border(direction = Wx::Direction::ALL) ⇒ Wx::SizerFlags
Sets the border in the given direction having thrice the default border size.
906 |
# File 'lib/wx/doc/gen/sizer.rb', line 906 def triple_border(direction=Wx::Direction::ALL) end |