From 5ebcf581f6e8355224b00bc5b2d70b12e761b750 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 26 Apr 2002 18:28:30 +0000 Subject: [PATCH] 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 --- samples/configure | 2 + samples/configure.in | 1 + samples/mobile/Makefile.in | 2 + samples/mobile/styles/Makefile.in | 25 ++++++ samples/mobile/styles/marble.jpg | Bin 0 -> 8055 bytes samples/mobile/styles/styles.cpp | 107 ++++++++++++++++++++++++ samples/mobile/styles/styles.h | 66 +++++++++++++++ src/univ/winuniv.cpp | 131 +++++++++++++++++------------- 8 files changed, 277 insertions(+), 57 deletions(-) create mode 100644 samples/mobile/styles/Makefile.in create mode 100644 samples/mobile/styles/marble.jpg create mode 100644 samples/mobile/styles/styles.cpp create mode 100644 samples/mobile/styles/styles.h diff --git a/samples/configure b/samples/configure index a28a31bb8b..20c677220f 100755 --- a/samples/configure +++ b/samples/configure @@ -688,6 +688,7 @@ trap 'rm -fr `echo " minimal/Makefile mobile/Makefile mobile/wxedit/Makefile + mobile/styles/Makefile newgrid/Makefile notebook/Makefile png/Makefile @@ -841,6 +842,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile minimal/Makefile mobile/Makefile mobile/wxedit/Makefile + mobile/styles/Makefile newgrid/Makefile notebook/Makefile png/Makefile diff --git a/samples/configure.in b/samples/configure.in index a5af0b0fdf..773f646107 100644 --- a/samples/configure.in +++ b/samples/configure.in @@ -56,6 +56,7 @@ AC_OUTPUT([ minimal/Makefile mobile/Makefile mobile/wxedit/Makefile + mobile/styles/Makefile newgrid/Makefile notebook/Makefile png/Makefile diff --git a/samples/mobile/Makefile.in b/samples/mobile/Makefile.in index 93cdb59e51..9f7a1991f4 100644 --- a/samples/mobile/Makefile.in +++ b/samples/mobile/Makefile.in @@ -4,6 +4,8 @@ all: cd wxedit && $(MAKE) + cd styles && $(MAKE) clean: cd wxedit && $(MAKE) clean + cd styles && $(MAKE) clean diff --git a/samples/mobile/styles/Makefile.in b/samples/mobile/styles/Makefile.in new file mode 100644 index 0000000000..67ea3e5039 --- /dev/null +++ b/samples/mobile/styles/Makefile.in @@ -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) diff --git a/samples/mobile/styles/marble.jpg b/samples/mobile/styles/marble.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e2904e121b047c933912e2f6923bbbe1622c858a GIT binary patch literal 8055 zcmbW6cTf{b`|nfey@VF22?C)>2}spY0->5h6Hp=4ARm%yzia){d51h_dYwjGdnx`%x8CYp8f8#f9C$Y2FSR(xVZp; z006*!zX1OH28g(w35|--{IdYa0tg8R2nq-Y2?`1d3keB}%7}@Ih=|HdNr}rSL6nsh zA&QDBs@fVV2Ve&j6*UbsVLG}91VUNe$iz_3L|YG`3ltI-78Mbd6BCoug(^aI|DWy8 z0I(ha015*CYx|V{H6REqASfg(A}S^h1c3kd*naze49WmNKrk3202bU|#lD*>`x5~I zvVwA2rVc{#xKLqO0>mtxRwn{?*?wyB^26+6zq2ZC~nb{{#pUpj=f3vi_vbwhZc4PC?&gb1PU%!3d z`ysoJ3=$9k3kd%Q83?+tU%|2hf?B3Rat=7*&;)syS-J?skygj)7loVSKPnItr^FPs zk#7!u`VaMgq5togGycDz|A+a1kpDaY$cg|y0zQI)`}DFvuq^P;JU{{r-0y&80Y?E} zP6w5{L4|eUb@seVOlC6wOyE;QL!teDjH`mtwG@3LYJAa7Mwzs$(6f8N|(R#vdg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yeHPa4C>}}2b9xX8P%v~V-YH3x1d9fx?JDe`-RsQChHgLMBpxpVm8X^Fa4XmhR z+6y6D5y6Hz7LS$Rk`}Geg`?6j;l&`^^AM2~u9~2>>FXb#J)M)5&q5?sCc8&-2voHD z)b&>{jN=YmYH);lFUsh7jA@H} zKV^qela<-}1y#*}R~NNYCJ*XzVqOgGx%ESIoXfr#xeRn2FEG^NlZx%qXILPZ3SoGO z=Jbsc_Nl=@nwBF1LdW3U@#Wx_=t>#-Tjmy zsi<#A1Z4u~;6&$0R{U-4k>}k4`>I_hX2S&TqzkF^lXaMESku829 zw7RWJ;PmhYEp3?x(ChSrlO14RxC(5#3s;j54r^LUmmumv4LWO3Y;H5^*0weLNU65L zT#+;A952wkmt$;;&GIy{N8}Y&FO#pA)5JTZOx;(Tip=E_JStf-y2_7{!NCj-HFmI} z9mbTmf5%)93k{{LQ1HFl4w`rbR5!G|mA0t-B3|T8ZkPwL2hGwtrQqWH8ibg;PJuB1 z1eCQTQXq}8RGFz(2yik6ygtY1^r6TcQ`^MFUX8bb8jC90-M_jGnK~>#qMvwo{|n8h zbX_0}q9dhUd$E~o$2^M&P2ZbcWF3%2>^)HL(yQO8mP+7769=LIgx+FV^IC-FLGi(R z*!BbV|3Fby5(SvfAy7^d&+WpkKLEWjmaY7l>&jGUlGIMT4Q@otNg@?}3=!PF`Uzdx z?lSygZ>B?FL`kctwV()_VT%81ndxu1aLeU^wbQq&wWakuy$aud{VL3EZAl}uG&k_3 sewDdYL>{i(PV9oX?2u*VD+n2_Q;M+LWfqE_skWN1t`mI=`1AaK0XGg4C;$Ke literal 0 HcmV?d00001 diff --git a/samples/mobile/styles/styles.cpp b/samples/mobile/styles/styles.cpp new file mode 100644 index 0000000000..f1023b27e5 --- /dev/null +++ b/samples/mobile/styles/styles.cpp @@ -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; +} + diff --git a/samples/mobile/styles/styles.h b/samples/mobile/styles/styles.h new file mode 100644 index 0000000000..88b4944ef3 --- /dev/null +++ b/samples/mobile/styles/styles.h @@ -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 +#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 diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp index 9662665813..f2b90368df 100644 --- a/src/univ/winuniv.cpp +++ b/src/univ/winuniv.cpp @@ -180,39 +180,6 @@ const wxBitmap& wxWindow::GetBackgroundBitmap(int *alignment, // painting // ---------------------------------------------------------------------------- -// the event handler executed when the window background must be painted -void wxWindow::OnErase(wxEraseEvent& event) -{ - if ( !m_renderer ) - { - event.Skip(); - - return; - } - - DoDrawBackground(*event.GetDC()); - - // if we have both scrollbars, we also have a square in the corner between - // them which we must paint - if ( m_scrollbarVert && m_scrollbarHorz ) - { - wxSize size = GetSize(); - wxRect rectClient = GetClientRect(), - rectBorder = m_renderer->GetBorderDimensions(GetBorder()); - - wxRect rectCorner; - rectCorner.x = rectClient.GetRight() + 1; - rectCorner.y = rectClient.GetBottom() + 1; - rectCorner.SetRight(size.x - rectBorder.width); - rectCorner.SetBottom(size.y - rectBorder.height); - - if ( GetUpdateRegion().Contains(rectCorner) ) - { - m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner); - } - } -} - // the event handlers executed when the window must be repainted void wxWindow::OnNcPaint(wxPaintEvent& event) { @@ -263,47 +230,97 @@ void wxWindow::OnPaint(wxPaintEvent& event) } } +// the event handler executed when the window background must be painted +void wxWindow::OnErase(wxEraseEvent& event) +{ + if ( !m_renderer ) + { + event.Skip(); + + return; + } + + DoDrawBackground(*event.GetDC()); + + // if we have both scrollbars, we also have a square in the corner between + // them which we must paint + if ( m_scrollbarVert && m_scrollbarHorz ) + { + wxSize size = GetSize(); + wxRect rectClient = GetClientRect(), + rectBorder = m_renderer->GetBorderDimensions(GetBorder()); + + wxRect rectCorner; + rectCorner.x = rectClient.GetRight() + 1; + rectCorner.y = rectClient.GetBottom() + 1; + rectCorner.SetRight(size.x - rectBorder.width); + rectCorner.SetBottom(size.y - rectBorder.height); + + if ( GetUpdateRegion().Contains(rectCorner) ) + { + m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner); + } + } +} + bool wxWindow::DoDrawBackground(wxDC& dc) { - // FIXME: Leaving this code in leads to partial bg redraws - // sometimes under MSW. - // The same happens under X11 because it has a clear - // region and an update region and these are sometimes - // different. RR. wxRect rect; -// #ifndef __WXMSW__ -#if 0 - rect = GetUpdateRegion().GetBox(); - if ( !rect.width && !rect.height ) -#endif + + wxSize size = GetSize(); // Why not GetClientSize() ? + rect.x = 0; + rect.y = 0; + rect.width = size.x; + rect.height = size.y; + + if (HasTransparentBackground() && GetParent() && GetParent()->ProvidesBackground()) { - wxSize size = GetSize(); - rect.width = size.x; - rect.height = size.y; + wxASSERT( !IsTopLevel() ); + + wxPoint pos = GetPosition(); + + AdjustForParentClientOrigin( pos.x, pos.y, 0 ); + + // Adjust DC logical origin + wxCoord x,y; + dc.GetLogicalOrigin( &x, &y ); + x += pos.x; + y += pos.y; + dc.SetLogicalOrigin( x, y ); + + // Adjust draw rect + rect.x = pos.x; + rect.y = pos.y; + + // Let parent draw the background + GetParent()->EraseBackground( dc, rect ); + } + else + { + // Draw background ouselves + EraseBackground( dc, rect ); } + + return TRUE; +} +void wxWindow::EraseBackground(wxDC& dc, const wxRect& rect) +{ if ( GetBackgroundBitmap().Ok() ) { - // get the bitmap and the flags + // Get the bitmap and the flags int alignment; wxStretch stretch; wxBitmap bmp = GetBackgroundBitmap(&alignment, &stretch); wxControlRenderer::DrawBitmap(dc, bmp, rect, alignment, stretch); } - else // just fill it with bg colour if no bitmap + else { + // Just fill it with bg colour if no bitmap + m_renderer->DrawBackground(dc, wxTHEME_BG_COLOUR(this), rect, GetStateFlags()); } - - return TRUE; -} - -void wxWindow::EraseBackground(wxDC& dc, const wxRect& rect) -{ - // TODO: handle bg bitmaps here! - - m_renderer->DrawBackground(dc, wxTHEME_BG_COLOUR(this), rect, GetStateFlags()); } void wxWindow::DoDrawBorder(wxDC& dc, const wxRect& rect) -- 2.45.2