# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # An info bar is a transient window shown at top or bottom of its parent window to display non-critical information to the user. # This class provides another way to show messages to the user, intermediate between message boxes and status bar messages. The message boxes are modal and thus interrupt the users work flow and should be used sparingly for this reason. However status bar messages are often too easy not to notice at all. An info bar provides a way to present the messages which has a much higher chance to be noticed by the user but without being annoying. # Info bar may show an icon (on the left), text message and, optionally, buttons allowing the user to react to the information presented. Unless a custom button was added to the info bar, it also has a close button at the right allowing the user to dismiss it so it isn't necessary to provide a button just to close it. # {Wx::InfoBar} calls its parent {Wx::Window#layout} method and assumes that it will change the parent layout appropriately depending on whether the info bar itself is shown or hidden. Usually this is achieved by simply using a sizer for the parent window layout and adding {Wx::InfoBar} to this sizer as one of the items. Considering the usual placement of the info bars, normally this sizer should be a vertical {Wx::BoxSizer} and the bar its first or last element so the simplest possible example of using this class would be: # ``` # class MyFrame : public wxFrame # { # ... # # wxInfoBar *m_infoBar; # }; # # MyFrame::MyFrame() # { # ... # m_infoBar = new wxInfoBar(this); # # wxSizer *sizer = new wxBoxSizer(wxVERTICAL); # sizer->Add(m_infoBar, wxSizerFlags().Expand()); # ... add other frame controls to the sizer ... # SetSizer(sizer); # } # # void MyFrame::SomeMethod() # { # m_infoBar->ShowMessage("Something happened", wxICON_INFORMATION); # } # ``` # # See the dialogs sample for more sophisticated examples. # Currently this class is implemented generically (i.e. in the same platform-independent way for all ports) and also natively in wxGTK but the native implementation requires GTK+ 2.18 version or later (this requirement should be satisfied by any desktop systems currently in use). # === # # Category: Miscellaneous Windows # @see Wx::StatusBar # @see Wx::MessageDialog # # class InfoBar < Control # Set the effects to use when showing and hiding the bar. # Either or both of the parameters can be set to {Wx::ShowEffect::SHOW_EFFECT_NONE} to disable using effects entirely. # By default, the info bar uses {Wx::ShowEffect::SHOW_EFFECT_SLIDE_TO_BOTTOM} effect for showing itself and {Wx::ShowEffect::SHOW_EFFECT_SLIDE_TO_TOP} for hiding if it is the first element of the containing sizer and reverse effects if it's the last one. If it is neither the first nor the last element, no effect is used to avoid the use of an inappropriate one and this function must be called if an effect is desired. # @param showEffect [Wx::ShowEffect] The effect to use when showing the bar. # @param hideEffect [Wx::ShowEffect] The effect to use when hiding the bar. # @return [void] def set_show_hide_effects(showEffect, hideEffect) end # Return the effect currently used for showing the bar. # @return [Wx::ShowEffect] def get_show_effect; end alias_method :show_effect, :get_show_effect # Return the effect currently used for hiding the bar. # @return [Wx::ShowEffect] def get_hide_effect; end alias_method :hide_effect, :get_hide_effect # Set the duration of the animation used when showing or hiding the bar. # By default, 500ms duration is used. # @param duration [Integer] Duration of the animation, in milliseconds. # @return [void] def set_effect_duration(duration) end alias_method :effect_duration=, :set_effect_duration # Return the effect animation duration currently used. # @return [Integer] def get_effect_duration; end alias_method :effect_duration, :get_effect_duration # @overload initialize() # Default constructor. # Use {Wx::InfoBar#create} for the objects created using this constructor. # @return [Wx::InfoBar] # @overload initialize(parent, winid=Wx::StandardID::ID_ANY) # Constructor creating the info bar window. # # @see Wx::InfoBar#create # @param parent [Wx::Window] # @param winid [Integer] # @return [Wx::InfoBar] def initialize(*args) end # Create the info bar window. # Notice that unlike most of the other {Wx::Window}-derived classes, {Wx::InfoBar} is created hidden and is only shown when {Wx::InfoBar#show_message} is called. This is more convenient as usually the info bar is created to be shown at some later time and not immediately and so creating it hidden avoids the need to call {Wx::InfoBar#hide} explicitly from the code using it. # This should be only called if the object was created using its default constructor. # @param parent [Wx::Window] A valid parent window pointer. # @param winid [Integer] The id of the info bar window, usually unused as currently no events are generated by this class. # @return [Boolean] def create(parent, winid=Wx::StandardID::ID_ANY) end # Add a button to be shown in the info bar. # The button added by this method will be shown to the right of the text (in LTR layout), with each successive button being added to the right of the previous one. If any buttons are added to the info bar using this method, the default "Close" button is not shown as it is assumed that the extra buttons already allow the user to close it. # Clicking the button will generate a normal EVT_COMMAND_BUTTON_CLICKED event which can be handled as usual. The default handler in {Wx::InfoBar} itself closes the window whenever a button in it is clicked so if you wish the info bar to be hidden when the button is clicked, simply call event.Skip() in the button handler to let the base class handler do it (calling {Wx::InfoBar#dismiss} explicitly works too, of course). On the other hand, if you don't skip the event, the info bar will remain opened so make sure to do it for at least some buttons to allow the user to close it. # Notice that the generic {Wx::InfoBar} implementation handles the button events itself and so they are not propagated to the info bar parent and you need to either inherit from {Wx::InfoBar} and handle them in your derived class or use {Wx::EvtHandler#bind}, as is done in the dialogs sample, to handle the button events in the parent frame. # @param btnid [Integer] Id of the button. It will be used in the button message clicking this button will generate. # @param label [String] The label of the button. It may only be empty if btnid is one of the stock ids in which case the corresponding stock label (see {get_stock_label}) will be used. # @return [void] def add_button(btnid, label=(())) end # Hide the info bar window. # This method hides the window and lays out the parent window to account for its disappearance (unlike a simple {Wx::InfoBar#hide}). # @return [void] def dismiss; end # Remove a button previously added by {Wx::InfoBar#add_button}. # @param btnid [Integer] Id of the button to remove. If more than one button with the same id is used in the info bar (which is in any case not recommended), the last, i.e. most recently added, button with this id is removed. # @return [void] def remove_button(btnid) end # Show a message in the bar. # If the bar is currently hidden, it will be shown. Otherwise its message will be updated in place. # @param msg [String] The text of the message. # @param flags [Integer] One of {Wx::ICON_NONE}, {Wx::ICON_INFORMATION} (default), {Wx::ICON_QUESTION}, {Wx::ICON_WARNING} or {Wx::ICON_ERROR} values. These flags have the same meaning as in {Wx::MessageDialog} for the generic version, i.e. show (or not, in case of {Wx::ICON_NONE}) the corresponding icon in the bar but can be interpreted by the native versions. For example, the GTK+ native implementation doesn't show icons at all but uses this parameter to select the appropriate background colour for the notification. # @return [void] def show_message(msg, flags=Wx::ICON_INFORMATION) end # Returns the number of currently shown buttons. # This is simply the number of calls to {Wx::InfoBar#add_button} minus the number of calls to {Wx::InfoBar#remove_button} so far. # The number of currently shown buttons, possibly 0. # @return [Integer] def get_button_count; end alias_method :button_count, :get_button_count # Returns the ID of the button at the given position. # The positions of the buttons are counted in order of their addition. # # The ID of the button at the given position or {Wx::StandardID::ID_NONE} if it is out of range (this also results in an assertion failure). # @param idx [Integer] The position of the button in 0 to {Wx::InfoBar#get_button_count} range. # @return [Integer] def get_button_id(idx) end alias_method :button_id, :get_button_id # Returns whether a button with the given ID is currently shown. # true if the button with this ID is currently shown. # @param btnid [Integer] ID of the button to check for. # @return [Boolean] def has_button_id(btnid) end alias_method :has_button_id?, :has_button_id end # InfoBar end