Add XRC handler for wxInfoBar
Update the schema and the sample to show it in action. Closes https://github.com/wxWidgets/wxWidgets/pull/1564
This commit is contained in:
committed by
Vadim Zeitlin
parent
68b36aed6d
commit
7f91481294
@@ -52,6 +52,7 @@
|
||||
#include "objrefdlg.h"
|
||||
// For functions to manipulate the corresponding controls.
|
||||
#include "wx/animate.h"
|
||||
#include "wx/infobar.h"
|
||||
#include "wx/treectrl.h"
|
||||
#include "wx/listctrl.h"
|
||||
|
||||
@@ -265,6 +266,12 @@ void MyFrame::OnControlsToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
XRCID("controls_animation_button_play"));
|
||||
#endif
|
||||
|
||||
#if wxUSE_INFOBAR
|
||||
// Show the message on button click
|
||||
dlg.Bind(wxEVT_BUTTON, &MyFrame::OnInfoBarShowMessage, this,
|
||||
XRCID("controls_infobar_button_message"));
|
||||
#endif
|
||||
|
||||
// All done. Show the dialog.
|
||||
dlg.ShowModal();
|
||||
}
|
||||
@@ -405,3 +412,18 @@ void MyFrame::OnAboutToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
wxMessageBox(msg, _("About XML resources demo"), wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
void MyFrame::OnInfoBarShowMessage(wxCommandEvent& event)
|
||||
{
|
||||
#if wxUSE_INFOBAR
|
||||
// get the pointers we need
|
||||
wxButton *btn = wxDynamicCast(event.GetEventObject(), wxButton);
|
||||
if ( !btn || !btn->GetParent() )
|
||||
return;
|
||||
|
||||
wxWindow *win = btn->GetParent();
|
||||
wxInfoBar *ctrl = XRCCTRL(*win, "controls_infobar", wxInfoBar);
|
||||
ctrl->ShowMessage("Message", wxICON_QUESTION);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@@ -52,6 +52,7 @@ private:
|
||||
void OnVariants(wxCommandEvent& event);
|
||||
void OnRecursiveLoad(wxCommandEvent& event);
|
||||
void OnAnimationCtrlPlay(wxCommandEvent& event);
|
||||
void OnInfoBarShowMessage(wxCommandEvent& event);
|
||||
|
||||
// Any class wishing to process wxWidgets events must use this macro
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
@@ -547,6 +547,39 @@ lay them out using wxSizers, absolute positioning, everything you like!
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="choicebookpage">
|
||||
<label>wxInfoBar</label>
|
||||
<object class="wxPanel" name="infobarctrl">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
|
||||
<object class="sizeritem">
|
||||
<flag>wxALIGN_CENTRE|wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxButton" name="controls_infobar_button_message">
|
||||
<label>Show Message</label>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object class="spacer">
|
||||
<option>1</option>
|
||||
</object>
|
||||
|
||||
<object class="sizeritem">
|
||||
<flag>wxEXPAND</flag>
|
||||
<object class="wxInfoBar" name="controls_infobar">
|
||||
<effectduration>1000</effectduration>
|
||||
<showeffect>wxSHOW_EFFECT_EXPAND</showeffect>
|
||||
<hideeffect>wxSHOW_EFFECT_SLIDE_TO_RIGHT</hideeffect>
|
||||
<object class="button" name="wxID_UNDO"/>
|
||||
<object class="button" name="wxID_REDO">
|
||||
<label>Redo Custom Label</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="choicebookpage">
|
||||
<label>wxListBox</label>
|
||||
<object class="wxPanel" name="listbox">
|
||||
|
Reference in New Issue
Block a user