Added sample to reproduce resize display bug.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
6
samples/wxtest/.cvsignore
Normal file
6
samples/wxtest/.cvsignore
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
scrollM5.mcp
|
||||||
|
scrollM*Data
|
||||||
|
*Classic?Debug*
|
||||||
|
*Classic?Release*
|
||||||
|
*Carbon?Debug*
|
||||||
|
*Carbon?Release*
|
16
samples/wxtest/makefile.g95
Normal file
16
samples/wxtest/makefile.g95
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.g95
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1999
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) Julian Smart, 1999
|
||||||
|
#
|
||||||
|
# Makefile for wxWindows sample (Cygwin/Mingw32).
|
||||||
|
|
||||||
|
WXDIR = ../..
|
||||||
|
|
||||||
|
TARGET=test
|
||||||
|
OBJECTS = $(TARGET).o test_wdr.o
|
||||||
|
|
||||||
|
include $(WXDIR)/src/makeprog.g95
|
||||||
|
|
18
samples/wxtest/makefile.vc
Normal file
18
samples/wxtest/makefile.vc
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.vc
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1999
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) Julian Smart
|
||||||
|
#
|
||||||
|
# Makefile : Builds sample (VC++, WIN32)
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debug info.
|
||||||
|
|
||||||
|
# Set WXDIR for your system
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
PROGRAM=test
|
||||||
|
OBJECTS = $(PROGRAM).obj test_wdr.o
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.vc
|
||||||
|
|
BIN
samples/wxtest/mondrian.ico
Normal file
BIN
samples/wxtest/mondrian.ico
Normal file
Binary file not shown.
143
samples/wxtest/test.cpp
Normal file
143
samples/wxtest/test.cpp
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: test.cpp
|
||||||
|
// Author: XX
|
||||||
|
// Created: XX/XX/XX
|
||||||
|
// Copyright:
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "test.cpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Include private headers
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
// WDR: class implementations
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// MyDialog
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// WDR: event table for MyDialog
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyDialog,wxDialog)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
MyDialog::MyDialog( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
|
const wxPoint &position, const wxSize& size, long style ) :
|
||||||
|
wxDialog( parent, id, title, position, size, style|wxRESIZE_BORDER )
|
||||||
|
{
|
||||||
|
MyDialogFunc( this, TRUE );
|
||||||
|
|
||||||
|
CentreOnParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MyDialog::Validate()
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MyDialog::TransferDataToWindow()
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MyDialog::TransferDataFromWindow()
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WDR: handler implementations for MyDialog
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// MyFrame
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// WDR: event table for MyFrame
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
||||||
|
EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
|
||||||
|
EVT_MENU(ID_QUIT, MyFrame::OnQuit)
|
||||||
|
EVT_CLOSE(MyFrame::OnCloseWindow)
|
||||||
|
EVT_MENU( ID_TEST, MyFrame::OnTest )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
|
const wxPoint &position, const wxSize& size, long style ) :
|
||||||
|
wxFrame( parent, id, title, position, size, style )
|
||||||
|
{
|
||||||
|
CreateMyMenuBar();
|
||||||
|
|
||||||
|
CreateStatusBar(1);
|
||||||
|
SetStatusText( "Welcome!" );
|
||||||
|
|
||||||
|
// insert main window here
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::CreateMyMenuBar()
|
||||||
|
{
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
wxApp::s_macAboutMenuItemId = ID_ABOUT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SetMenuBar( MyMenuBarFunc() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// WDR: handler implementations for MyFrame
|
||||||
|
|
||||||
|
void MyFrame::OnTest( wxCommandEvent &event )
|
||||||
|
{
|
||||||
|
MyDialog dialog( this, -1, "Test" );
|
||||||
|
dialog.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnAbout( wxCommandEvent &event )
|
||||||
|
{
|
||||||
|
wxMessageDialog dialog( this, "Welcome to SuperApp 1.0\n(C)opyright Joe Hacker",
|
||||||
|
"About SuperApp", wxOK|wxICON_INFORMATION );
|
||||||
|
dialog.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnQuit( wxCommandEvent &event )
|
||||||
|
{
|
||||||
|
Close( TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnCloseWindow( wxCloseEvent &event )
|
||||||
|
{
|
||||||
|
// if ! saved changes -> return
|
||||||
|
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// MyApp
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
|
MyApp::MyApp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MyApp::OnInit()
|
||||||
|
{
|
||||||
|
MyFrame *frame = new MyFrame( NULL, -1, "SuperApp", wxPoint(20,20), wxSize(500,340) );
|
||||||
|
frame->Show( TRUE );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MyApp::OnExit()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
97
samples/wxtest/test.h
Normal file
97
samples/wxtest/test.h
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: test.h
|
||||||
|
// Author: XX
|
||||||
|
// Created: XX/XX/XX
|
||||||
|
// Copyright:
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __test_H__
|
||||||
|
#define __test_H__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "test.cpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Include wxWindows' headers
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "test_wdr.h"
|
||||||
|
|
||||||
|
// WDR: class declarations
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// MyDialog
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class MyDialog: public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructors and destructors
|
||||||
|
MyDialog( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_DIALOG_STYLE );
|
||||||
|
|
||||||
|
// WDR: method declarations for MyDialog
|
||||||
|
virtual bool Validate();
|
||||||
|
virtual bool TransferDataToWindow();
|
||||||
|
virtual bool TransferDataFromWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// WDR: member variable declarations for MyDialog
|
||||||
|
|
||||||
|
private:
|
||||||
|
// WDR: handler declarations for MyDialog
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// MyFrame
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class MyFrame: public wxFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructors and destructors
|
||||||
|
MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE );
|
||||||
|
|
||||||
|
private:
|
||||||
|
// WDR: method declarations for MyFrame
|
||||||
|
void CreateMyMenuBar();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// WDR: member variable declarations for MyFrame
|
||||||
|
|
||||||
|
private:
|
||||||
|
// WDR: handler declarations for MyFrame
|
||||||
|
void OnTest( wxCommandEvent &event );
|
||||||
|
void OnAbout( wxCommandEvent &event );
|
||||||
|
void OnQuit( wxCommandEvent &event );
|
||||||
|
void OnCloseWindow( wxCloseEvent &event );
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// MyApp
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class MyApp: public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyApp();
|
||||||
|
|
||||||
|
virtual bool OnInit();
|
||||||
|
virtual int OnExit();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
2
samples/wxtest/test.rc
Normal file
2
samples/wxtest/test.rc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#include "wx/msw/wx.rc"
|
||||||
|
|
73
samples/wxtest/test_wdr.cpp
Normal file
73
samples/wxtest/test_wdr.cpp
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Source code generated by wxDesigner from file: test.wdr
|
||||||
|
// Do not modify this file, all changes will be lost!
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "test_wdr.cpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Include private header
|
||||||
|
#include "test_wdr.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Implement window functions
|
||||||
|
|
||||||
|
wxSizer *MyDialogFunc( wxWindow *parent, bool call_fit, bool set_sizer )
|
||||||
|
{
|
||||||
|
wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
wxStaticBox *item2 = new wxStaticBox( parent, -1, "Text" );
|
||||||
|
wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
|
||||||
|
|
||||||
|
wxBoxSizer *item3 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
wxTextCtrl *item4 = new wxTextCtrl( parent, ID_TEXTCTRL, "", wxDefaultPosition, wxSize(80,-1), 0 );
|
||||||
|
item3->Add( item4, 0, wxALIGN_CENTRE|wxALL, 5 );
|
||||||
|
|
||||||
|
item1->Add( item3, 0, wxALIGN_CENTRE|wxALL, 5 );
|
||||||
|
|
||||||
|
item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
|
||||||
|
|
||||||
|
if (set_sizer)
|
||||||
|
{
|
||||||
|
parent->SetAutoLayout( TRUE );
|
||||||
|
parent->SetSizer( item0 );
|
||||||
|
if (call_fit)
|
||||||
|
{
|
||||||
|
item0->Fit( parent );
|
||||||
|
item0->SetSizeHints( parent );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return item0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implement menubar functions
|
||||||
|
|
||||||
|
wxMenuBar *MyMenuBarFunc()
|
||||||
|
{
|
||||||
|
wxMenuBar *item0 = new wxMenuBar;
|
||||||
|
|
||||||
|
wxMenu* item1 = new wxMenu;
|
||||||
|
item1->Append( ID_ABOUT, "About...\tF1", "" );
|
||||||
|
item1->Append( ID_TEST, "Test...\tF2", "" );
|
||||||
|
item1->Append( ID_QUIT, "Quit\tCtrl-Q", "" );
|
||||||
|
item0->Append( item1, "File" );
|
||||||
|
|
||||||
|
return item0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implement toolbar functions
|
||||||
|
|
||||||
|
// Implement bitmap functions
|
||||||
|
|
||||||
|
|
||||||
|
// End of generated file
|
48
samples/wxtest/test_wdr.h
Normal file
48
samples/wxtest/test_wdr.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Header generated by wxDesigner from file: test.wdr
|
||||||
|
// Do not modify this file, all changes will be lost!
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef __WDR_test_H__
|
||||||
|
#define __WDR_test_H__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "test_wdr.cpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Include wxWindows' headers
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <wx/image.h>
|
||||||
|
#include <wx/statline.h>
|
||||||
|
#include <wx/spinbutt.h>
|
||||||
|
#include <wx/spinctrl.h>
|
||||||
|
#include <wx/splitter.h>
|
||||||
|
#include <wx/listctrl.h>
|
||||||
|
#include <wx/treectrl.h>
|
||||||
|
#include <wx/notebook.h>
|
||||||
|
#include <wx/grid.h>
|
||||||
|
|
||||||
|
// Declare window functions
|
||||||
|
|
||||||
|
#define ID_TEXTCTRL 10000
|
||||||
|
wxSizer *MyDialogFunc( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
|
||||||
|
|
||||||
|
// Declare menubar functions
|
||||||
|
|
||||||
|
#define ID_MENU 10001
|
||||||
|
#define ID_ABOUT 10002
|
||||||
|
#define ID_TEST 10003
|
||||||
|
#define ID_QUIT 10004
|
||||||
|
wxMenuBar *MyMenuBarFunc();
|
||||||
|
|
||||||
|
// Declare toolbar functions
|
||||||
|
|
||||||
|
// Declare bitmap functions
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// End of generated file
|
Reference in New Issue
Block a user