Added background inheritance to wxUniv.
Added sample to show this... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15269 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
25
samples/mobile/styles/Makefile.in
Normal file
25
samples/mobile/styles/Makefile.in
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# File: makefile
|
||||
# Author: Robert Roebling
|
||||
# Created: 2002
|
||||
# Updated:
|
||||
# Copyright: (c) 2002 Robert Roebling
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for wxedit
|
||||
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../..
|
||||
program_dir = samples/mobile/styles
|
||||
|
||||
PROGRAM=styles
|
||||
|
||||
DATAFILES=marble.jpg
|
||||
|
||||
OBJECTS =$(PROGRAM).o
|
||||
DEPFILES=$(PROGRAM).d
|
||||
|
||||
include ../../../src/makeprog.env
|
||||
|
||||
@IF_GNU_MAKE@-include $(DEPFILES)
|
BIN
samples/mobile/styles/marble.jpg
Normal file
BIN
samples/mobile/styles/marble.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
107
samples/mobile/styles/styles.cpp
Normal file
107
samples/mobile/styles/styles.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: styles.cpp
|
||||
// Author: Robert Roebling
|
||||
// Created: 04/07/02
|
||||
// Copyright:
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "styles.cpp"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// Include private headers
|
||||
#include "styles.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// MyFrame
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
||||
EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(ID_QUIT, MyFrame::OnQuit)
|
||||
EVT_CLOSE(MyFrame::OnCloseWindow)
|
||||
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 )
|
||||
{
|
||||
// Create menu and status bar.
|
||||
CreateMyMenuBar();
|
||||
CreateStatusBar(1);
|
||||
SetStatusText( "Welcome to Styles!" );
|
||||
|
||||
|
||||
wxImage image;
|
||||
image.LoadFile( "marble.jpg", wxBITMAP_TYPE_JPEG );
|
||||
|
||||
wxBitmap bitmap( image );
|
||||
SetBackground( bitmap, 0, wxTILE );
|
||||
|
||||
new wxStaticText( this, -1, "This is text", wxPoint( 20,50 ) );
|
||||
|
||||
new wxCheckBox( this, -1, "This is a checkbox", wxPoint( 20,70 ) );
|
||||
}
|
||||
|
||||
void MyFrame::CreateMyMenuBar()
|
||||
{
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
file_menu->Append( ID_ABOUT, "About...", "Program info" );
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append( ID_QUIT, "Quit...", "Quit program" );
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar();
|
||||
menu_bar->Append( file_menu, "&File" );
|
||||
|
||||
SetMenuBar( menu_bar );
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout( wxCommandEvent &event )
|
||||
{
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit( wxCommandEvent &event )
|
||||
{
|
||||
Close( TRUE );
|
||||
}
|
||||
|
||||
void MyFrame::OnCloseWindow( wxCloseEvent &event )
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// MyApp
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
MyApp::MyApp()
|
||||
{
|
||||
}
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
SetVendorName("Free world");
|
||||
SetAppName("Styles");
|
||||
|
||||
MyFrame *frame = new MyFrame( NULL, -1, "Styles", wxPoint(20,20), wxSize(500,340) );
|
||||
frame->Show( TRUE );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int MyApp::OnExit()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
66
samples/mobile/styles/styles.h
Normal file
66
samples/mobile/styles/styles.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: styles.h
|
||||
// Author: Robert Roebling
|
||||
// Created: 04/07/02
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __styles_H__
|
||||
#define __styles_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "styles.cpp"
|
||||
#endif
|
||||
|
||||
// Include wxWindows' headers
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// constants
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#define ID_ABOUT 100
|
||||
#define ID_QUIT 204
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// 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:
|
||||
void CreateMyMenuBar();
|
||||
|
||||
private:
|
||||
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
|
Reference in New Issue
Block a user