// the application icon (under Windows and OS/2 it is in resources and even
// though we could still include the XPM here it would be unused)
-#if !defined(__WXMSW__) && !defined(__WXPM__)
+#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../sample.xpm"
#endif
class SimpleTransientPopup: public wxPopupTransientWindow
{
public:
- SimpleTransientPopup( wxWindow *parent );
+ SimpleTransientPopup( wxWindow *parent, bool scrolled );
virtual ~SimpleTransientPopup();
// wxPopupTransientWindow virtual methods are all overridden to log them
virtual bool ProcessLeftDown(wxMouseEvent& event);
virtual bool Show( bool show = true );
- wxScrolledWindow* GetChild() { return m_panel; }
-
private:
wxScrolledWindow *m_panel;
wxButton *m_button;
EVT_SPINCTRL( Minimal_PopupSpinctrl, SimpleTransientPopup::OnSpinCtrl )
END_EVENT_TABLE()
-SimpleTransientPopup::SimpleTransientPopup( wxWindow *parent )
+SimpleTransientPopup::SimpleTransientPopup( wxWindow *parent, bool scrolled )
:wxPopupTransientWindow( parent )
{
m_panel = new wxScrolledWindow( this, wxID_ANY );
topSizer->Add( m_spinCtrl, 0, wxALL, 5 );
topSizer->Add( m_mouseText, 0, wxCENTRE|wxALL, 5 );
+ if ( scrolled )
+ {
+ // Add a big window to ensure that scrollbars are shown when we set the
+ // panel size to a lesser size below.
+ topSizer->Add(new wxPanel(m_panel, wxID_ANY, wxDefaultPosition,
+ wxSize(600, 900)));
+ }
+
m_panel->SetSizer( topSizer );
- topSizer->Fit(m_panel);
- topSizer->Fit(this);
+ if ( scrolled )
+ {
+ // Set the fixed size to ensure that the scrollbars are shown.
+ m_panel->SetSize(300, 300);
+
+ // And also actually enable them.
+ m_panel->SetScrollRate(10, 10);
+ }
+ else
+ {
+ // Use the fitting size for the panel if we don't need scrollbars.
+ topSizer->Fit(m_panel);
+ }
+
+ SetClientSize(m_panel->GetSize());
}
SimpleTransientPopup::~SimpleTransientPopup()
// the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu;
- helpMenu->Append(Minimal_About, wxT("&About...\tF1"), wxT("Show about dialog"));
+ helpMenu->Append(Minimal_About, wxT("&About\tF1"), wxT("Show about dialog"));
menuFile->Append(Minimal_TestDialog, wxT("&Test dialog\tAlt-T"), wxT("Test dialog"));
menuFile->Append(Minimal_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));
{
wxLogMessage( wxT("================================================") );
delete m_simplePopup;
- m_simplePopup = new SimpleTransientPopup( this );
+ m_simplePopup = new SimpleTransientPopup( this, false );
wxWindow *btn = (wxWindow*) event.GetEventObject();
wxPoint pos = btn->ClientToScreen( wxPoint(0,0) );
wxSize sz = btn->GetSize();
{
wxLogMessage( wxT("================================================") );
delete m_scrolledPopup;
- m_scrolledPopup = new SimpleTransientPopup( this );
- m_scrolledPopup->GetChild()->SetScrollbars(1, 1, 1000, 1000);
+ m_scrolledPopup = new SimpleTransientPopup( this, true );
wxWindow *btn = (wxWindow*) event.GetEventObject();
wxPoint pos = btn->ClientToScreen( wxPoint(0,0) );
wxSize sz = btn->GetSize();
{
wxLogMessage( wxT("================================================") );
delete m_simplePopup;
- m_simplePopup = new SimpleTransientPopup( this );
+ m_simplePopup = new SimpleTransientPopup( this, false );
wxWindow *btn = (wxWindow*) event.GetEventObject();
wxPoint pos = btn->ClientToScreen( wxPoint(0,0) );
wxSize sz = btn->GetSize();
{
wxLogMessage( wxT("================================================") );
delete m_scrolledPopup;
- m_scrolledPopup = new SimpleTransientPopup( this );
- m_scrolledPopup->GetChild()->SetScrollbars(1, 1, 1000, 1000);
+ m_scrolledPopup = new SimpleTransientPopup( this, true );
wxWindow *btn = (wxWindow*) event.GetEventObject();
wxPoint pos = btn->ClientToScreen( wxPoint(0,0) );
wxSize sz = btn->GetSize();