Added wxInfoBar::Dismiss().
Add a method to conveniently hide the info bar and update the parent layout. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -41,6 +41,8 @@ public:
|
|||||||
virtual void ShowMessage(const wxString& msg,
|
virtual void ShowMessage(const wxString& msg,
|
||||||
int flags = wxICON_INFORMATION);
|
int flags = wxICON_INFORMATION);
|
||||||
|
|
||||||
|
virtual void Dismiss();
|
||||||
|
|
||||||
virtual void AddButton(wxWindowID btnid, const wxString& label = wxString());
|
virtual void AddButton(wxWindowID btnid, const wxString& label = wxString());
|
||||||
|
|
||||||
virtual void RemoveButton(wxWindowID btnid);
|
virtual void RemoveButton(wxWindowID btnid);
|
||||||
|
@@ -41,6 +41,8 @@ public:
|
|||||||
virtual void ShowMessage(const wxString& msg,
|
virtual void ShowMessage(const wxString& msg,
|
||||||
int flags = wxICON_INFORMATION);
|
int flags = wxICON_INFORMATION);
|
||||||
|
|
||||||
|
virtual void Dismiss();
|
||||||
|
|
||||||
virtual void AddButton(wxWindowID btnid,
|
virtual void AddButton(wxWindowID btnid,
|
||||||
const wxString& label = wxString());
|
const wxString& label = wxString());
|
||||||
|
|
||||||
|
@@ -36,6 +36,9 @@ public:
|
|||||||
virtual void ShowMessage(const wxString& msg,
|
virtual void ShowMessage(const wxString& msg,
|
||||||
int flags = wxICON_INFORMATION) = 0;
|
int flags = wxICON_INFORMATION) = 0;
|
||||||
|
|
||||||
|
// hide the info bar
|
||||||
|
virtual void Dismiss() = 0;
|
||||||
|
|
||||||
// add an extra button to the bar, near the message (replacing the default
|
// add an extra button to the bar, near the message (replacing the default
|
||||||
// close button which is only shown if no extra buttons are used)
|
// close button which is only shown if no extra buttons are used)
|
||||||
virtual void AddButton(wxWindowID btnid,
|
virtual void AddButton(wxWindowID btnid,
|
||||||
|
@@ -123,9 +123,10 @@ public:
|
|||||||
itself closes the window whenever a button in it is clicked so if you
|
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
|
wish the info bar to be hidden when the button is clicked, simply call
|
||||||
@c event.Skip() in the button handler to let the base class handler do
|
@c event.Skip() in the button handler to let the base class handler do
|
||||||
it. On the other hand, if you don't skip the event, the info bar will
|
it (calling Dismiss() explicitly works too, of course). On the other
|
||||||
remain opened so make sure to do it for at least some buttons to allow
|
hand, if you don't skip the event, the info bar will remain opened so
|
||||||
the user to close it.
|
make sure to do it for at least some buttons to allow the user to close
|
||||||
|
it.
|
||||||
|
|
||||||
Notice that the generic wxInfoBar implementation handles the button
|
Notice that the generic wxInfoBar implementation handles the button
|
||||||
events itself and so they are not propagated to the info bar parent and
|
events itself and so they are not propagated to the info bar parent and
|
||||||
@@ -143,6 +144,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
void AddButton(wxWindowID btnid, const wxString& label = wxString());
|
void AddButton(wxWindowID btnid, const wxString& label = wxString());
|
||||||
|
|
||||||
|
/**
|
||||||
|
Hide the info bar window.
|
||||||
|
|
||||||
|
This method hides the window and lays out the parent window to account
|
||||||
|
for its disappearance (unlike a simple Hide()).
|
||||||
|
*/
|
||||||
|
void Dismiss();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove a button previously added by AddButton().
|
Remove a button previously added by AddButton().
|
||||||
|
|
||||||
|
@@ -240,6 +240,11 @@ void wxInfoBarGeneric::ShowMessage(const wxString& msg, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxInfoBarGeneric::Dismiss()
|
||||||
|
{
|
||||||
|
DoHide();
|
||||||
|
}
|
||||||
|
|
||||||
void wxInfoBarGeneric::AddButton(wxWindowID btnid, const wxString& label)
|
void wxInfoBarGeneric::AddButton(wxWindowID btnid, const wxString& label)
|
||||||
{
|
{
|
||||||
wxSizer * const sizer = GetSizer();
|
wxSizer * const sizer = GetSizer();
|
||||||
|
@@ -177,17 +177,26 @@ void wxInfoBar::ShowMessage(const wxString& msg, int flags)
|
|||||||
UpdateParent();
|
UpdateParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxInfoBar::Dismiss()
|
||||||
|
{
|
||||||
|
if ( !UseNative() )
|
||||||
|
{
|
||||||
|
wxInfoBarGeneric::Dismiss();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Hide();
|
||||||
|
|
||||||
|
UpdateParent();
|
||||||
|
}
|
||||||
|
|
||||||
void wxInfoBar::GTKResponse(int btnid)
|
void wxInfoBar::GTKResponse(int btnid)
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, btnid);
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, btnid);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
if ( !HandleWindowEvent(event) )
|
if ( !HandleWindowEvent(event) )
|
||||||
{
|
Dismiss();
|
||||||
Hide();
|
|
||||||
|
|
||||||
UpdateParent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *wxInfoBar::GTKAddButton(wxWindowID btnid, const wxString& label)
|
GtkWidget *wxInfoBar::GTKAddButton(wxWindowID btnid, const wxString& label)
|
||||||
|
Reference in New Issue
Block a user