Motif and other mods

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-10-26 17:10:25 +00:00
parent f4a4bd13d4
commit 4b5f3fe655
60 changed files with 618 additions and 203 deletions

View File

@@ -393,6 +393,7 @@ samples/controls/*.xpm
samples/controls/*.ico samples/controls/*.ico
samples/controls/*.bmp samples/controls/*.bmp
samples/controls/*.rc samples/controls/*.rc
samples/controls/icons/*
samples/fractal/*.cpp samples/fractal/*.cpp
samples/fractal/*.h samples/fractal/*.h

View File

@@ -143,7 +143,7 @@ This should be called if you wish to initially view only a single pane in the sp
\wxheading{See also} \wxheading{See also}
\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}. \helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
\membersection{wxSplitterWindow::IsSplit}\label{wxsplitterwindowissplit} \membersection{wxSplitterWindow::IsSplit}\label{wxsplitterwindowissplit}
@@ -191,7 +191,7 @@ may wish to delete the window.
\membersection{wxSplitterWindow::OnSashPositionChange}\label{wxsplitterwindowonsashpositionchange} \membersection{wxSplitterWindow::OnSashPositionChange}\label{wxsplitterwindowonsashpositionchange}
\func{virtual bool}{OnSashPositionChange}{\param{int }{newSashPosition} \func{virtual bool}{OnSashPositionChange}{\param{int }{newSashPosition}}
Application-overridable function called when the sash position is changed by Application-overridable function called when the sash position is changed by
user. It may return FALSE to prevent the change or TRUE to allow it. user. It may return FALSE to prevent the change or TRUE to allow it.
@@ -299,7 +299,7 @@ window is not currently split using \helpref{IsSplit}{wxsplitterwindowissplit}.
\wxheading{See also} \wxheading{See also}
\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}, \helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit},\rtfsp \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}, \helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit},\rtfsp
\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}. \helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}
\membersection{wxSplitterWindow::SplitVertically}\label{wxsplitterwindowsplitvertically} \membersection{wxSplitterWindow::SplitVertically}\label{wxsplitterwindowsplitvertically}

View File

@@ -7,9 +7,6 @@ HIGH PRIORITY
Find/add wxThread sample - Arthur T-D? Find/add wxThread sample - Arthur T-D?
wxControl dimensions should be optionally based on dialog font
size for portability (dialog units as per Windows).
Implement wxDC floating point transformations. Implement wxDC floating point transformations.
Add wxDC::DeviceToLogical -> wxPoint etc (convenience accessors). Add wxDC::DeviceToLogical -> wxPoint etc (convenience accessors).
@@ -17,10 +14,6 @@ Add wxDC::DeviceToLogical -> wxPoint etc (convenience accessors).
Revamp Dialog Editor for new controls and properties (e.g. Revamp Dialog Editor for new controls and properties (e.g.
window id). window id).
Tidy wxConfig API.
Change DnD classes to use global symbols, and wxString.
Update manual. Update manual.
wxApp changes DONE wxApp changes DONE
wxMenu changes DONE wxMenu changes DONE
@@ -187,3 +180,5 @@ more efficient).
Perhaps rewrite wxFile to use FILE* descriptors, so Eof and Flush Perhaps rewrite wxFile to use FILE* descriptors, so Eof and Flush
can work. can work.
Find out how to set wxFileSelector position.

View File

@@ -37,8 +37,8 @@ class WXDLLEXPORT wxFileHistory;
class WXDLLEXPORT wxConfigBase; class WXDLLEXPORT wxConfigBase;
#if wxUSE_IOSTREAMH #if wxUSE_IOSTREAMH
# include <istream.h> // N.B. BC++ doesn't have istream.h, ostream.h
# include <ostream.h> # include <iostream.h>
#else #else
# include <istream> # include <istream>
# include <ostream> # include <ostream>

View File

@@ -20,15 +20,16 @@
#include "wx/hash.h" #include "wx/hash.h"
#include "wx/string.h" #include "wx/string.h"
#include "wx/dialog.h"
class wxTabView; class WXDLLEXPORT wxTabView;
/* /*
* A wxTabControl is the internal and visual representation * A wxTabControl is the internal and visual representation
* of the tab. * of the tab.
*/ */
class wxTabControl: public wxObject class WXDLLEXPORT wxTabControl: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxTabControl) DECLARE_DYNAMIC_CLASS(wxTabControl)
public: public:
@@ -82,7 +83,7 @@ protected:
* are 3 layers in the MS Word Options dialog. * are 3 layers in the MS Word Options dialog.
*/ */
class wxTabLayer: public wxList class WXDLLEXPORT wxTabLayer: public wxList
{ {
DECLARE_DYNAMIC_CLASS(wxTabLayer) DECLARE_DYNAMIC_CLASS(wxTabLayer)
public: public:
@@ -98,7 +99,7 @@ class wxTabLayer: public wxList
#define wxTAB_STYLE_DRAW_BOX 1 // Draws 3D boxes round tab layers #define wxTAB_STYLE_DRAW_BOX 1 // Draws 3D boxes round tab layers
#define wxTAB_STYLE_COLOUR_INTERIOR 2 // Colours interior of tabs, otherwise draws outline #define wxTAB_STYLE_COLOUR_INTERIOR 2 // Colours interior of tabs, otherwise draws outline
class wxTabView: public wxObject class WXDLLEXPORT wxTabView: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxTabView) DECLARE_DYNAMIC_CLASS(wxTabView)
public: public:
@@ -163,6 +164,10 @@ public:
inline void SetTabSelectionHeight(int h) { m_tabSelectionHeight = h; } inline void SetTabSelectionHeight(int h) { m_tabSelectionHeight = h; }
inline int GetTabSelectionHeight(void) const { return m_tabSelectionHeight; } inline int GetTabSelectionHeight(void) const { return m_tabSelectionHeight; }
// Returns the total height of the tabs component -- this may be several
// times the height of a tab, if there are several tab layers (rows).
int GetTotalTabHeight();
inline int GetTopMargin(void) const { return m_topMargin; } inline int GetTopMargin(void) const { return m_topMargin; }
inline void SetTopMargin(int margin) { m_topMargin = margin; } inline void SetTopMargin(int margin) { m_topMargin = margin; }
@@ -260,7 +265,7 @@ protected:
* A dialog box class that is tab-friendly * A dialog box class that is tab-friendly
*/ */
class wxTabbedDialog: public wxDialog class WXDLLEXPORT wxTabbedDialog: public wxDialog
{ {
DECLARE_DYNAMIC_CLASS(wxTabbedDialog) DECLARE_DYNAMIC_CLASS(wxTabbedDialog)
@@ -289,7 +294,7 @@ DECLARE_EVENT_TABLE()
* A panel class that is tab-friendly * A panel class that is tab-friendly
*/ */
class wxTabbedPanel: public wxPanel class WXDLLEXPORT wxTabbedPanel: public wxPanel
{ {
DECLARE_DYNAMIC_CLASS(wxTabbedPanel) DECLARE_DYNAMIC_CLASS(wxTabbedPanel)
@@ -313,7 +318,7 @@ protected:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
class wxPanelTabView: public wxTabView class WXDLLEXPORT wxPanelTabView: public wxTabView
{ {
DECLARE_DYNAMIC_CLASS(wxPanelTabView) DECLARE_DYNAMIC_CLASS(wxPanelTabView)
public: public:
@@ -330,6 +335,7 @@ public:
inline wxWindow *GetCurrentWindow() const { return m_currentWindow; } inline wxWindow *GetCurrentWindow() const { return m_currentWindow; }
void ShowWindowForTab(int id); void ShowWindowForTab(int id);
inline wxList& GetWindows() const { return (wxList&) m_tabWindows; }
protected: protected:
// List of panels, one for each tab. Indexed // List of panels, one for each tab. Indexed

View File

@@ -57,7 +57,8 @@ class WXDLLEXPORT wxLogFrame;
class WXDLLEXPORT wxFrame; class WXDLLEXPORT wxFrame;
#if wxUSE_IOSTREAMH #if wxUSE_IOSTREAMH
# include <ostream.h> // N.B. BC++ doesn't have istream.h, ostream.h
# include <iostream.h>
#else #else
# include <ostream> # include <ostream>
# ifdef _MSC_VER # ifdef _MSC_VER

View File

@@ -28,7 +28,8 @@
#include <stddef.h> #include <stddef.h>
#if wxUSE_IOSTREAMH #if wxUSE_IOSTREAMH
# include <ostream.h> // N.B. BC++ doesn't have istream.h, ostream.h
# include <iostream.h>
#else #else
# include <ostream> # include <ostream>
# ifdef _MSC_VER # ifdef _MSC_VER

View File

@@ -46,7 +46,7 @@ class WXDLLEXPORT wxButton: public wxControl
virtual void Command(wxCommandEvent& event); virtual void Command(wxCommandEvent& event);
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
}; };

View File

@@ -47,7 +47,7 @@ class WXDLLEXPORT wxCheckBox: public wxControl
virtual void Command(wxCommandEvent& event); virtual void Command(wxCommandEvent& event);
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
}; };

View File

@@ -68,7 +68,7 @@ class WXDLLEXPORT wxChoice: public wxControl
void SetFocus(); void SetFocus();
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; } WXWidget GetTopWidget() const { return m_formWidget; }

View File

@@ -74,7 +74,7 @@ class WXDLLEXPORT wxComboBox: public wxChoice
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
}; };

View File

@@ -94,7 +94,7 @@ public:
void OnSysColourChanged(wxSysColourChangedEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event);
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
inline WXWidget GetTopWidget() const { return m_mainWidget; } inline WXWidget GetTopWidget() const { return m_mainWidget; }

View File

@@ -145,7 +145,7 @@ public:
virtual void ReleaseMouse(); virtual void ReleaseMouse();
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
WXWidget GetMenuBarWidget() const ; WXWidget GetMenuBarWidget() const ;

View File

@@ -61,7 +61,7 @@ class WXDLLEXPORT wxGauge: public wxControl
virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ; virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ;
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();

View File

@@ -90,7 +90,7 @@ class WXDLLEXPORT wxListBox: public wxControl
void Command(wxCommandEvent& event); void Command(wxCommandEvent& event);
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const; WXWidget GetTopWidget() const;

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: notebook.h // Name: notebook.h
// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) // Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog)
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
// RCS-ID: $Id$ // RCS-ID: $Id$
@@ -21,6 +21,7 @@
#include "wx/dynarray.h" #include "wx/dynarray.h"
#include "wx/event.h" #include "wx/event.h"
#include "wx/control.h" #include "wx/control.h"
#include "wx/generic/tabg.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// types // types
@@ -59,9 +60,38 @@ private:
// wxNotebook // wxNotebook
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// @@@ this class should really derive from wxTabCtrl, but the interface is not class WXDLLEXPORT wxNotebook;
// exactly the same, so I can't do it right now and instead we reimplement
// part of wxTabCtrl here // This reuses wxTabView to draw the tabs.
class WXDLLEXPORT wxNotebookTabView: public wxTabView
{
DECLARE_DYNAMIC_CLASS(wxNotebookTabView)
public:
wxNotebookTabView(wxNotebook* notebook, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR);
~wxNotebookTabView(void);
// Called when a tab is activated
virtual void OnTabActivate(int activateId, int deactivateId);
/*
// Specific to this class
void AddTabWindow(int id, wxWindow *window);
wxWindow *GetTabWindow(int id) const ;
void ClearWindows(bool deleteWindows = TRUE);
inline wxWindow *GetCurrentWindow() const { return m_currentWindow; }
void ShowWindowForTab(int id);
*/
protected:
/*
// List of panels, one for each tab. Indexed
// by tab ID.
wxList m_tabWindows;
wxWindow* m_currentWindow;
*/
wxNotebook* m_notebook;
};
class wxNotebook : public wxControl class wxNotebook : public wxControl
{ {
public: public:
@@ -163,7 +193,15 @@ public:
virtual bool DoPhase(int nPhase); virtual bool DoPhase(int nPhase);
// Implementation // Implementation
virtual void ChangeFont();
// wxNotebook on Motif uses a generic wxTabView to implement itself.
inline wxTabView *GetTabView() const { return m_tabView; }
inline void SetTabView(wxTabView *v) { m_tabView = v; }
void OnMouseEvent(wxMouseEvent& event);
void OnPaint(wxPaintEvent& event);
virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
@@ -179,6 +217,8 @@ protected:
int m_nSelection; // the current selection (-1 if none) int m_nSelection; // the current selection (-1 if none)
wxTabView* m_tabView;
DECLARE_DYNAMIC_CLASS(wxNotebook) DECLARE_DYNAMIC_CLASS(wxNotebook)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -69,7 +69,7 @@ public:
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; } WXWidget GetTopWidget() const { return m_formWidget; }

View File

@@ -49,7 +49,7 @@ public:
void Command(wxCommandEvent& event); void Command(wxCommandEvent& event);
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
}; };

View File

@@ -57,7 +57,7 @@ public:
void Command(wxCommandEvent& event); void Command(wxCommandEvent& event);
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();

View File

@@ -78,7 +78,7 @@ public:
void Command(wxCommandEvent& event); void Command(wxCommandEvent& event);
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();

View File

@@ -65,7 +65,7 @@ class WXDLLEXPORT wxSpinButton: public wxControl
void Command(wxCommandEvent& event) { ProcessCommand(event); }; void Command(wxCommandEvent& event) { ProcessCommand(event); };
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();

View File

@@ -57,7 +57,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
virtual bool AcceptsFocus() const { return FALSE; } virtual bool AcceptsFocus() const { return FALSE; }
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();

View File

@@ -52,7 +52,7 @@ class WXDLLEXPORT wxStaticBox: public wxControl
wxString GetLabel() const; wxString GetLabel() const;
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; } WXWidget GetTopWidget() const { return m_formWidget; }

View File

@@ -48,7 +48,7 @@ class WXDLLEXPORT wxStaticText: public wxControl
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
}; };

View File

@@ -127,7 +127,7 @@ public:
virtual void Command(wxCommandEvent& event); virtual void Command(wxCommandEvent& event);
// Implementation // Implementation
virtual void ChangeFont(); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
inline void SetModified(bool mod) { m_modified = mod; } inline void SetModified(bool mod) { m_modified = mod; }

View File

@@ -488,7 +488,7 @@ public:
virtual WXRegion GetPaintRegion() const { return m_paintRegion; } virtual WXRegion GetPaintRegion() const { return m_paintRegion; }
// Change properties // Change properties
virtual void ChangeFont(); // Change to the current font (often overridden) virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour); virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
virtual void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE); virtual void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
// These to be overridden as needed (may change several widgets) // These to be overridden as needed (may change several widgets)

View File

@@ -31,7 +31,7 @@ public:
// copy ctors and assignment operators // copy ctors and assignment operators
wxColour( const wxColour& col ); wxColour( const wxColour& col );
wxColour( const wxColour* col ); // wxColour( const wxColour* col );
wxColour& operator = ( const wxColour& col ); wxColour& operator = ( const wxColour& col );
// dtor // dtor

View File

@@ -37,7 +37,8 @@ class WXDLLEXPORT wxHashTable;
class WXDLLEXPORT wxObject_Serialize; class WXDLLEXPORT wxObject_Serialize;
#if wxUSE_IOSTREAMH #if wxUSE_IOSTREAMH
# include <ostream.h> // N.B. BC++ doesn't have istream.h, ostream.h
# include <iostream.h>
#else #else
# include <ostream> # include <ostream>
# ifdef _MSC_VER # ifdef _MSC_VER

View File

@@ -923,7 +923,8 @@ inline bool operator>=(const char * s1, const wxString& s2) { return s2.Cmp(s1)
// replacing with includes (on advice of ungod@pasdex.com.au) // replacing with includes (on advice of ungod@pasdex.com.au)
// class WXDLLEXPORT istream; // class WXDLLEXPORT istream;
#if wxUSE_IOSTREAMH #if wxUSE_IOSTREAMH
#include <istream.h> // N.B. BC++ doesn't have istream.h, ostream.h
#include <iostream.h>
#else #else
#include <istream> #include <istream>
# ifdef _MSC_VER # ifdef _MSC_VER

View File

@@ -26,7 +26,7 @@
#include "wx/notebook.h" #include "wx/notebook.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
#ifdef __WXGTK__ #if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "mondrian.xpm" #include "mondrian.xpm"
#include "icons/choice.xpm" #include "icons/choice.xpm"
#include "icons/combo.xpm" #include "icons/combo.xpm"

View File

@@ -9,7 +9,7 @@
# #
# Makefile for tab example (UNIX). # Makefile for tab example (UNIX).
PROGRAM=tab PROGRAM=test
OBJECTS=$(PROGRAM).o OBJECTS=$(PROGRAM).o

View File

@@ -23,60 +23,63 @@
#include "wx/tab.h" #include "wx/tab.h"
#include "test.h" #include "test.h"
// Declare two frames // If 1, use a dialog. Otherwise use a frame.
#define USE_TABBED_DIALOG 0
MyDialog* dialog = (MyDialog *) NULL; MyDialog* dialog = (MyDialog *) NULL;
MyFrame* frame = (MyFrame *) NULL;
IMPLEMENT_APP(MyApp) IMPLEMENT_APP(MyApp)
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
// Create the main frame window // Create the main window
#if USE_TABBED_DIALOG
dialog = new MyDialog((wxFrame *) NULL, -1, (char *) "Tabbed Dialog", wxPoint(-1, -1), wxSize(365, 390), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE); dialog = new MyDialog((wxFrame *) NULL, -1, (char *) "Tabbed Dialog", wxPoint(-1, -1), wxSize(365, 390), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE);
dialog->ShowModal(); dialog->ShowModal();
// Quit immediately the dialog has been dismissed // Quit immediately the dialog has been dismissed
return FALSE; return FALSE;
#else
frame = new MyFrame((wxFrame*) NULL, -1, (char *) "Tabbed Panel", wxPoint(-1, -1), wxSize(365, 390), wxDEFAULT_FRAME_STYLE);
return TRUE;
#endif
} }
BEGIN_EVENT_TABLE(MyDialog, wxTabbedDialog) void MyApp::InitTabView(wxPanelTabView* view, wxWindow* window)
EVT_BUTTON(wxID_OK, MyDialog::OnOK)
EVT_BUTTON(wxID_CANCEL, MyDialog::OnOK)
// EVT_MENU(TEST_ABOUT, MyDialog::OnAbout)
END_EVENT_TABLE()
MyDialog::MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, const long windowStyle):
wxTabbedDialog(parent, id, title, pos, size, windowStyle)
{
Init();
}
void MyDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
{
EndModal(wxID_OK);
}
void MyDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event) )
{
EndModal(wxID_CANCEL);
}
void MyDialog::Init(void)
{ {
int dialogWidth = 365; int dialogWidth = 365;
int dialogHeight = 390; int dialogHeight = 390;
wxButton *okButton = new wxButton(this, wxID_OK, "Close", wxPoint(100, 330), wxSize(80, 25)); m_okButton = new wxButton(window, wxID_OK, "Close", wxPoint(-1, -1), wxSize(80, 25));
(void)new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(185, 330), wxSize(80, 25)); m_cancelButton = new wxButton(window, wxID_CANCEL, "Cancel", wxPoint(-1, -1), wxSize(80, 25));
(void)new wxButton(this, wxID_HELP, "Help", wxPoint(270, 330), wxSize(80, 25)); m_helpButton = new wxButton(window, wxID_HELP, "Help", wxPoint(-1, -1), wxSize(80, 25));
okButton->SetDefault(); m_okButton->SetDefault();
// Note, omit the wxTAB_STYLE_COLOUR_INTERIOR, so we will guarantee a match wxLayoutConstraints* c = new wxLayoutConstraints;
// with the panel background, and save a bit of time. c->right.SameAs(window, wxRight, 4);
wxPanelTabView *view = new wxPanelTabView((wxPanel*)this, wxTAB_STYLE_DRAW_BOX); c->bottom.SameAs(window, wxBottom, 4);
c->height.AsIs();
c->width.AsIs();
m_helpButton->SetConstraints(c);
wxRectangle rect; c = new wxLayoutConstraints;
c->right.SameAs(m_helpButton, wxLeft, 4);
c->bottom.SameAs(window, wxBottom, 4);
c->height.AsIs();
c->width.AsIs();
m_cancelButton->SetConstraints(c);
c = new wxLayoutConstraints;
c->right.SameAs(m_cancelButton, wxLeft, 4);
c->bottom.SameAs(window, wxBottom, 4);
c->height.AsIs();
c->width.AsIs();
m_okButton->SetConstraints(c);
wxRect rect;
rect.x = 5; rect.x = 5;
rect.y = 70; rect.y = 70;
// Could calculate the view width from the tab width and spacing, // Could calculate the view width from the tab width and spacing,
@@ -119,29 +122,155 @@ void MyDialog::Init(void)
return; return;
// Add some panels // Add some panels
wxPanel *panel1 = new wxPanel(this, -1, wxPoint(rect.x + 20, rect.y + 10), wxSize(290, 220), wxTAB_TRAVERSAL); wxPanel *panel1 = new wxPanel(window, -1, wxPoint(rect.x + 20, rect.y + 10), wxSize(290, 220), wxTAB_TRAVERSAL);
(void)new wxButton(panel1, -1, "Press me", wxPoint(10, 10)); (void)new wxButton(panel1, -1, "Press me", wxPoint(10, 10));
(void)new wxTextCtrl(panel1, -1, "1234", wxPoint(10, 40), wxSize(120, 150)); (void)new wxTextCtrl(panel1, -1, "1234", wxPoint(10, 40), wxSize(120, 150));
view->AddTabWindow(TEST_TAB_CAT, panel1); view->AddTabWindow(TEST_TAB_CAT, panel1);
wxPanel *panel2 = new wxPanel(this, -1, wxPoint(rect.x + 20, rect.y + 10), wxSize(290, 220)); wxPanel *panel2 = new wxPanel(window, -1, wxPoint(rect.x + 20, rect.y + 10), wxSize(290, 220));
wxString animals[] = { "Fox", "Hare", "Rabbit", "Sabre-toothed tiger", "T Rex" }; wxString animals[] = { "Fox", "Hare", "Rabbit", "Sabre-toothed tiger", "T Rex" };
(void)new wxListBox(panel2, -1, wxPoint(5, 5), wxSize(170, 80), 5, animals); (void)new wxListBox(panel2, -1, wxPoint(5, 5), wxSize(170, 80), 5, animals);
(void)new wxTextCtrl(panel2, -1, "Some notes about the animals in this house", wxPoint(5, 100), wxSize(170, 100)), (void)new wxTextCtrl(panel2, -1, "Some notes about the animals in this house", wxPoint(5, 100), wxSize(170, 100),
wxTE_MULTILINE; wxTE_MULTILINE);
view->AddTabWindow(TEST_TAB_DOG, panel2); view->AddTabWindow(TEST_TAB_DOG, panel2);
view->SetTabSelection(TEST_TAB_CAT);
}
BEGIN_EVENT_TABLE(MyDialog, wxTabbedDialog)
EVT_BUTTON(wxID_OK, MyDialog::OnOK)
EVT_BUTTON(wxID_CANCEL, MyDialog::OnOK)
END_EVENT_TABLE()
MyDialog::MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, const long windowStyle):
wxTabbedDialog(parent, id, title, pos, size, windowStyle)
{
Init();
}
void MyDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
{
EndModal(wxID_OK);
}
void MyDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event) )
{
EndModal(wxID_CANCEL);
}
void MyDialog::Init(void)
{
int dialogWidth = 365;
int dialogHeight = 390;
// Note, omit the wxTAB_STYLE_COLOUR_INTERIOR, so we will guarantee a match
// with the panel background, and save a bit of time.
wxPanelTabView *view = new wxPanelTabView(this, wxTAB_STYLE_DRAW_BOX);
wxGetApp().InitTabView(view, this);
// Don't know why this is necessary under Motif... // Don't know why this is necessary under Motif...
#ifndef __WXMSW__ #ifndef __WXMSW__
this->SetSize(dialogWidth, dialogHeight-20); this->SetSize(dialogWidth, dialogHeight-20);
#endif #endif
view->SetTabSelection(TEST_TAB_CAT); Layout();
this->Centre(wxBOTH); this->Centre(wxBOTH);
} }
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_BUTTON(wxID_OK, MyFrame::OnOK)
EVT_BUTTON(wxID_CANCEL, MyFrame::OnOK)
EVT_SIZE(MyFrame::OnSize)
END_EVENT_TABLE()
MyFrame::MyFrame(wxFrame* parent, const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, const long windowStyle):
wxFrame(parent, id, title, pos, size, windowStyle)
{
m_panel = (wxTabbedPanel*) NULL;
m_view = (wxPanelTabView*) NULL;
Init();
}
void MyFrame::OnOK(wxCommandEvent& WXUNUSED(event) )
{
this->Destroy();
}
void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event) )
{
this->Destroy();
}
void MyFrame::Init(void)
{
int dialogWidth = 365;
int dialogHeight = 390;
m_panel = new wxTabbedPanel(this, -1);
// Note, omit the wxTAB_STYLE_COLOUR_INTERIOR, so we will guarantee a match
// with the panel background, and save a bit of time.
m_view = new wxPanelTabView(m_panel, wxTAB_STYLE_DRAW_BOX);
wxGetApp().InitTabView(m_view, m_panel);
this->Centre(wxBOTH);
Show(TRUE);
}
void MyFrame::OnSize(wxSizeEvent& event)
{
wxFrame::OnSize(event);
int cw, ch;
GetClientSize(& cw, & ch);
if (m_view && m_panel)
{
m_panel->Layout();
int tabHeight = m_view->GetTotalTabHeight();
wxRect rect;
rect.x = 4;
rect.y = tabHeight + 4;
rect.width = cw - 8;
rect.height = ch - 4 - rect.y - 30; // 30 for buttons
m_view->SetViewRect(rect);
m_view->Layout();
// Need to do it a 2nd time to get the tab height with
// the new view width
tabHeight = m_view->GetTotalTabHeight();
rect.x = 4;
rect.y = tabHeight + 4;
rect.width = cw - 8;
rect.height = ch - 4 - rect.y - 30; // 30 for buttons
m_view->SetViewRect(rect);
m_view->Layout();
// Move all the panels to the new view position and size
wxNode* node = m_view->GetWindows().First();
while (node)
{
wxWindow* win = (wxWindow*) node->Data();
win->SetSize(rect.x+2, rect.y+2, rect.width-4, rect.height-4);
node = node->Next();
}
m_panel->Refresh();
}
}

View File

@@ -14,8 +14,15 @@ class MyApp: public wxApp
{ {
public: public:
bool OnInit(void); bool OnInit(void);
void InitTabView(wxPanelTabView* view, wxWindow* window);
wxButton* m_okButton;
wxButton* m_cancelButton;
wxButton* m_helpButton;
}; };
DECLARE_APP(MyApp)
class MyDialog: public wxTabbedDialog class MyDialog: public wxTabbedDialog
{ {
public: public:
@@ -24,6 +31,37 @@ public:
void OnOK(wxCommandEvent& event); void OnOK(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);
void Init(void);
DECLARE_EVENT_TABLE()
};
class MyFrame: public wxFrame
{
public:
MyFrame(wxFrame* parent, const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, const long windowStyle = wxDEFAULT_FRAME_STYLE);
void OnOK(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void OnSize(wxSizeEvent& event);
void Init(void);
protected:
wxTabbedPanel* m_panel;
wxPanelTabView* m_view;
DECLARE_EVENT_TABLE()
};
class MyTabbedPanel: public wxTabbedPanel
{
public:
MyTabbedPanel(wxWindow* parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size, const long windowStyle = 0);
void OnOK(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent& event);
// void OnAbout(wxCommandEvent& event); // void OnAbout(wxCommandEvent& event);
void Init(void); void Init(void);

View File

@@ -158,12 +158,12 @@ bool wxFTP::GetResult(char exp)
{ {
if ((m_lastError = GetLine(this, m_lastResult))) if ((m_lastError = GetLine(this, m_lastResult)))
return FALSE; return FALSE;
if (m_lastResult[0] != exp) { if (m_lastResult.GetChar(0) != exp) {
m_lastError = wxPROTO_PROTERR; m_lastError = wxPROTO_PROTERR;
return FALSE; return FALSE;
} }
if (m_lastResult[3] == '-') { if (m_lastResult.GetChar(3) == '-') {
wxString key = m_lastResult.Left((size_t)3); wxString key = m_lastResult.Left((size_t)3);
key += ' '; key += ' ';

View File

@@ -31,6 +31,10 @@
#include "wx/tab.h" #include "wx/tab.h"
// not defined: use old, square tab implementation (fills in tabs)
// defined: use new, rounded tab implementation (doesn't colour in tabs)
// #define wxUSE_NEW_METHOD
IMPLEMENT_DYNAMIC_CLASS(wxTabControl, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxTabControl, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxTabLayer, wxList) IMPLEMENT_DYNAMIC_CLASS(wxTabLayer, wxList)
@@ -56,7 +60,7 @@ wxTabControl::~wxTabControl(void)
void wxTabControl::OnDraw(wxDC& dc, bool lastInRow) void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
{ {
// Old, but in some ways better (drawing opaque tabs) // Old, but in some ways better (drawing opaque tabs)
#if 0 #ifndef wxUSE_NEW_METHOD
if (!m_view) if (!m_view)
return; return;
@@ -70,23 +74,23 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
int tabHeightInc = 0; int tabHeightInc = 0;
if (m_isSelected) if (m_isSelected)
{ {
tabHeightInc = (view->GetTabSelectionHeight() - view->GetTabHeight()); tabHeightInc = (m_view->GetTabSelectionHeight() - m_view->GetTabHeight());
tabY -= tabHeightInc; tabY -= tabHeightInc;
} }
dc.SetPen(wxTRANSPARENT_PEN); dc.SetPen(*wxTRANSPARENT_PEN);
// Draw grey background // Draw grey background
if (view->GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR) if (m_view->GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR)
{ {
dc.SetBrush(m_view->GetBackgroundBrush()); dc.SetBrush(*m_view->GetBackgroundBrush());
// Add 1 because the pen is transparent. Under Motif, may be different. // Add 1 because the pen is transparent. Under Motif, may be different.
dc.DrawRectangle(tabX, tabY, (GetWidth()+1), (GetHeight() + 1 + tabHeightInc)); dc.DrawRectangle(tabX, tabY, (GetWidth()+1), (GetHeight() + 1 + tabHeightInc));
} }
// Draw highlight and shadow // Draw highlight and shadow
dc.SetPen(m_view->GetHighlightPen()); dc.SetPen(*m_view->GetHighlightPen());
// Calculate the top of the tab beneath. It's the height of the tab, MINUS // Calculate the top of the tab beneath. It's the height of the tab, MINUS
// a bit if the tab below happens to be selected. Check. // a bit if the tab below happens to be selected. Check.
@@ -107,7 +111,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
dc.DrawLine(tabX, tabY, tabX, (tabY + GetHeight() + tabHeightInc - subtractThis)); dc.DrawLine(tabX, tabY, tabX, (tabY + GetHeight() + tabHeightInc - subtractThis));
dc.DrawLine(tabX, tabY, (tabX + GetWidth()), tabY); dc.DrawLine(tabX, tabY, (tabX + GetWidth()), tabY);
dc.SetPen(m_view->GetShadowPen()); dc.SetPen(*m_view->GetShadowPen());
// Test if we're outside the right-hand edge of the view area // Test if we're outside the right-hand edge of the view area
if (((tabX + GetWidth()) >= m_view->GetViewRect().x + m_view->GetViewRect().width) && (m_view->GetTabStyle() & wxTAB_STYLE_DRAW_BOX)) if (((tabX + GetWidth()) >= m_view->GetViewRect().x + m_view->GetViewRect().width) && (m_view->GetTabStyle() & wxTAB_STYLE_DRAW_BOX))
@@ -126,7 +130,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
(tabX + GetWidth()), (bottomY-1)); (tabX + GetWidth()), (bottomY-1));
// Draw black line to emphasize shadow // Draw black line to emphasize shadow
dc.SetPen(wxBLACK_PEN); dc.SetPen(*wxBLACK_PEN);
dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), dc.DrawLine((tabX + GetWidth() + 1), (tabY+1),
(tabX + GetWidth() + 1), bottomY); (tabX + GetWidth() + 1), bottomY);
@@ -145,13 +149,13 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
int maxPositions = ((wxTabLayer *)m_view->GetLayers().Nth(0)->Data())->Number(); int maxPositions = ((wxTabLayer *)m_view->GetLayers().Nth(0)->Data())->Number();
// Only down to the bottom of the tab, not to the top of the view // Only down to the bottom of the tab, not to the top of the view
if ( GetColPosition() < maxPositions ) if ( GetRowPosition() < (maxPositions - 1) )
topY = tabY + GetHeight() + tabHeightInc; topY = tabY + GetHeight() + tabHeightInc;
// Shadow // Shadow
dc.DrawLine((tabX + GetWidth()), tabY, (tabX + GetWidth()), topY); dc.DrawLine((tabX + GetWidth()), tabY, (tabX + GetWidth()), topY);
// Draw black line to emphasize shadow // Draw black line to emphasize shadow
dc.SetPen(wxBLACK_PEN); dc.SetPen(*wxBLACK_PEN);
dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1), dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1),
topY); topY);
} }
@@ -171,7 +175,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
(tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc - subtractThis)); (tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc - subtractThis));
// Draw black line to emphasize shadow // Draw black line to emphasize shadow
dc.SetPen(wxBLACK_PEN); dc.SetPen(*wxBLACK_PEN);
dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1), dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1),
(tabY + GetHeight() + tabHeightInc - subtractThis)); (tabY + GetHeight() + tabHeightInc - subtractThis));
} }
@@ -181,15 +185,14 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
int textY = tabY + m_view->GetVerticalTabTextSpacing() + tabHeightInc; int textY = tabY + m_view->GetVerticalTabTextSpacing() + tabHeightInc;
if (m_isSelected) if (m_isSelected)
dc.SetFont(m_view->GetSelectedTabFont()); dc.SetFont(*m_view->GetSelectedTabFont());
else else
dc.SetFont(GetFont()); dc.SetFont(*GetFont());
wxColour col(m_view->GetTextColour()); wxColour col(m_view->GetTextColour());
dc.SetTextForeground(&col); dc.SetTextForeground(col);
// dc.SetTextForeground(&(m_view->GetTextColour()));
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
float textWidth, textHeight; long textWidth, textHeight;
dc.GetTextExtent(GetLabel(), &textWidth, &textHeight); dc.GetTextExtent(GetLabel(), &textWidth, &textHeight);
int textX = (int)(tabX + (GetWidth() - textWidth)/2.0); int textX = (int)(tabX + (GetWidth() - textWidth)/2.0);
@@ -197,7 +200,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
if (m_isSelected) if (m_isSelected)
{ {
dc.SetPen(m_view->GetHighlightPen()); dc.SetPen(*m_view->GetHighlightPen());
// Draw white highlight from the tab's left side to the left hand edge of the view // Draw white highlight from the tab's left side to the left hand edge of the view
dc.DrawLine(m_view->GetViewRect().x, (tabY + GetHeight() + tabHeightInc), dc.DrawLine(m_view->GetViewRect().x, (tabY + GetHeight() + tabHeightInc),
@@ -207,10 +210,9 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
dc.DrawLine((tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc), dc.DrawLine((tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc),
m_view->GetViewRect().x + m_view->GetViewRect().width, (tabY + GetHeight() + tabHeightInc)); m_view->GetViewRect().x + m_view->GetViewRect().width, (tabY + GetHeight() + tabHeightInc));
} }
#endif #else
// New HEL version with rounder tabs // New HEL version with rounder tabs
#if 1
if (!m_view) return; if (!m_view) return;
int tabInc = 0; int tabInc = 0;
@@ -518,6 +520,9 @@ wxTabView::~wxTabView()
} }
// Automatically positions tabs // Automatically positions tabs
// TODO: this should just add the tab to a list, and then
// a layout function (e.g. Realize) should be called when all tabs have been added.
// The view rect could easily change as the view window is resized.
wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *existingTab) wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *existingTab)
{ {
// First, find which layer we should be adding to. // First, find which layer we should be adding to.
@@ -581,6 +586,32 @@ wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *exi
return tabControl; return tabControl;
} }
// Returns the total height of the tabs component -- this may be several
// times the height of a tab, if there are several tab layers (rows).
int wxTabView::GetTotalTabHeight()
{
int minY = 0;
wxNode *layerNode = m_layers.First();
while (layerNode)
{
wxTabLayer *layer = (wxTabLayer *)layerNode->Data();
wxNode *tabNode = layer->First();
while (tabNode)
{
wxTabControl *tab = (wxTabControl *)tabNode->Data();
if (tab->GetY() < minY)
minY = tab->GetY();
tabNode = tabNode->Next();
}
layerNode = layerNode->Next();
}
return - minY;
}
void wxTabView::ClearTabs(bool deleteTabs) void wxTabView::ClearTabs(bool deleteTabs)
{ {
wxNode *layerNode = m_layers.First(); wxNode *layerNode = m_layers.First();
@@ -604,6 +635,7 @@ void wxTabView::ClearTabs(bool deleteTabs)
} }
} }
// Layout tabs (optional, e.g. if resizing window) // Layout tabs (optional, e.g. if resizing window)
void wxTabView::Layout(void) void wxTabView::Layout(void)
{ {
@@ -720,7 +752,7 @@ void wxTabView::Draw(wxDC& dc)
} }
#if 0 #ifndef wxUSE_NEW_METHOD
if (GetTabStyle() & wxTAB_STYLE_DRAW_BOX) if (GetTabStyle() & wxTAB_STYLE_DRAW_BOX)
{ {
dc.SetPen(GetShadowPen()); dc.SetPen(GetShadowPen());
@@ -729,7 +761,7 @@ void wxTabView::Draw(wxDC& dc)
dc.DrawLine( dc.DrawLine(
(GetViewRect().x + 1), (GetViewRect().x + 1),
(GetViewRect().y + GetViewRect().height), (GetViewRect().y + GetViewRect().height),
(GetViewRect().x + GetViewRect().width), (GetViewRect().x + GetViewRect().width + 1),
(GetViewRect().y + GetViewRect().height) (GetViewRect().y + GetViewRect().height)
); );
@@ -747,7 +779,7 @@ void wxTabView::Draw(wxDC& dc)
dc.DrawLine( dc.DrawLine(
(GetViewRect().x), (GetViewRect().x),
(GetViewRect().y + GetViewRect().height + 1), (GetViewRect().y + GetViewRect().height + 1),
(GetViewRect().x + GetViewRect().width), (GetViewRect().x + GetViewRect().width + 2),
(GetViewRect().y + GetViewRect().height + 1) (GetViewRect().y + GetViewRect().height + 1)
); );
@@ -1088,7 +1120,7 @@ void wxTabbedPanel::OnPaint(wxPaintEvent& WXUNUSED(event) )
} }
/* /*
* wxDialogTabView * wxPanelTabView
*/ */
IMPLEMENT_CLASS(wxPanelTabView, wxTabView) IMPLEMENT_CLASS(wxPanelTabView, wxTabView)

View File

@@ -67,7 +67,7 @@ wxColour::wxColour()
{ {
} }
wxColour::wxColour( char red, char green, char blue ) wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
{ {
m_refData = new wxColourRefData(); m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT; M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
@@ -128,7 +128,7 @@ bool wxColour::operator != ( const wxColour& col)
return m_refData != col.m_refData; return m_refData != col.m_refData;
} }
void wxColour::Set( const unsigned char red, const unsigned char green, const unsigned char blue ) void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
{ {
UnRef(); UnRef();
m_refData = new wxColourRefData(); m_refData = new wxColourRefData();

View File

@@ -67,7 +67,7 @@ wxColour::wxColour()
{ {
} }
wxColour::wxColour( char red, char green, char blue ) wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
{ {
m_refData = new wxColourRefData(); m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT; M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
@@ -128,7 +128,7 @@ bool wxColour::operator != ( const wxColour& col)
return m_refData != col.m_refData; return m_refData != col.m_refData;
} }
void wxColour::Set( const unsigned char red, const unsigned char green, const unsigned char blue ) void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
{ {
UnRef(); UnRef();
m_refData = new wxColourRefData(); m_refData = new wxColourRefData();

View File

@@ -79,6 +79,8 @@ bool wxApp::Initialize()
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING); wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize(); wxTheColourDatabase->Initialize();
wxInitializeStockLists();
wxInitializeStockObjects(); wxInitializeStockObjects();
#if wxUSE_WX_RESOURCES #if wxUSE_WX_RESOURCES

View File

@@ -90,6 +90,9 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
m_mainWidget = (WXWidget) buttonWidget; m_mainWidget = (WXWidget) buttonWidget;
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
ChangeBackgroundColour (); ChangeBackgroundColour ();
DoSetBitmap(); DoSetBitmap();
@@ -100,9 +103,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
return TRUE; return TRUE;
} }

View File

@@ -74,11 +74,12 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
XtAddCallback ((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback, XtAddCallback ((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
(XtPointer) this); (XtPointer) this);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -135,9 +136,9 @@ void wxButtonCallback (Widget w, XtPointer clientData, XtPointer ptr)
item->ProcessCommand (event); item->ProcessCommand (event);
} }
void wxButton::ChangeFont() void wxButton::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxButton::ChangeBackgroundColour() void wxButton::ChangeBackgroundColour()

View File

@@ -66,12 +66,13 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE); XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour(); ChangeBackgroundColour();
SetFont(* parent->GetFont());
return TRUE; return TRUE;
} }
@@ -151,9 +152,9 @@ void wxCheckBoxCallback (Widget w, XtPointer clientData,
item->ProcessCommand (event); item->ProcessCommand (event);
} }
void wxCheckBox::ChangeFont() void wxCheckBox::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxCheckBox::ChangeBackgroundColour() void wxCheckBox::ChangeBackgroundColour()

View File

@@ -125,9 +125,11 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL); XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
AttachWidget (parent, m_buttonWidget, m_formWidget, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_buttonWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -173,9 +175,12 @@ void wxChoice::Append(const wxString& item)
WXWidget *new_widgetList = new WXWidget[m_noStrings + 1]; WXWidget *new_widgetList = new WXWidget[m_noStrings + 1];
int i; int i;
if (m_widgetList)
for (i = 0; i < m_noStrings; i++) for (i = 0; i < m_noStrings; i++)
new_widgetList[i] = m_widgetList[i]; new_widgetList[i] = m_widgetList[i];
new_widgetList[m_noStrings] = (WXWidget) w; new_widgetList[m_noStrings] = (WXWidget) w;
if (m_widgetList) if (m_widgetList)
delete[] m_widgetList; delete[] m_widgetList;
m_widgetList = new_widgetList; m_widgetList = new_widgetList;
@@ -420,7 +425,7 @@ void wxChoiceCallback (Widget w, XtPointer clientData,
} }
} }
void wxChoice::ChangeFont() void wxChoice::ChangeFont(bool keepOriginalSize)
{ {
// Note that this causes the widget to be resized back // Note that this causes the widget to be resized back
// to its original size! We therefore have to set the size // to its original size! We therefore have to set the size
@@ -434,11 +439,13 @@ void wxChoice::ChangeFont()
XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL); XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL);
XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL); XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);
/* TODO: why does this cause a crash in XtWidgetToApplicationContext?
int i; int i;
for (i = 0; i < m_noStrings; i++) for (i = 0; i < m_noStrings; i++)
XtVaSetValues ((Widget) m_widgetList[i], XmNfontList, fontList, NULL); XtVaSetValues ((Widget) m_widgetList[i], XmNfontList, fontList, NULL);
*/
GetSize(& width1, & height1); GetSize(& width1, & height1);
if (width != width1 || height != height1) if (keepOriginalSize && (width != width1 || height != height1))
{ {
SetSize(-1, -1, width, height); SetSize(-1, -1, width, height);
} }

View File

@@ -83,10 +83,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
SetValue(value); SetValue(value);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -207,10 +209,10 @@ void wxComboBoxCallback (Widget w, XtPointer clientData,
} }
} }
void wxComboBox::ChangeFont() void wxComboBox::ChangeFont(bool keepOriginalSize)
{ {
// Don't use the base class wxChoice's ChangeFont // Don't use the base class wxChoice's ChangeFont
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxComboBox::ChangeBackgroundColour() void wxComboBox::ChangeBackgroundColour()

View File

@@ -139,12 +139,15 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
XmStringFree(str); XmStringFree(str);
} }
m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
ChangeFont(FALSE);
wxAddWindowToTable(dialogShell, this); wxAddWindowToTable(dialogShell, this);
// Intercept CLOSE messages from the window manager // Intercept CLOSE messages from the window manager
Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False); Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False);
/* MATTHEW: [8] Remove and add WM_DELETE_WINDOW so ours is only handler */ /* Remove and add WM_DELETE_WINDOW so ours is only handler */
/* Why do we have to do this for wxDialog, but not wxFrame? */ /* Why do we have to do this for wxDialog, but not wxFrame? */
XmRemoveWMProtocols(shell, &WM_DELETE_WINDOW, 1); XmRemoveWMProtocols(shell, &WM_DELETE_WINDOW, 1);
XmAddWMProtocols(shell, &WM_DELETE_WINDOW, 1); XmAddWMProtocols(shell, &WM_DELETE_WINDOW, 1);
@@ -236,7 +239,6 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
(XtPointer)this); (XtPointer)this);
ChangeBackgroundColour(); ChangeBackgroundColour();
SetFont(* parent->GetFont());
return TRUE; return TRUE;
} }
@@ -745,7 +747,7 @@ static void wxUnmapBulletinBoard(Widget dialog, wxDialog *client,XtPointer call)
*/ */
} }
void wxDialog::ChangeFont() void wxDialog::ChangeFont(bool keepOriginalSize)
{ {
// TODO // TODO
} }

View File

@@ -128,6 +128,7 @@ bool wxFrame::Create(wxWindow *parent,
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE); m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
if ( id > -1 ) if ( id > -1 )
m_windowId = id; m_windowId = id;
@@ -222,6 +223,8 @@ bool wxFrame::Create(wxWindow *parent,
m_mainWidget = m_frameWidget; m_mainWidget = m_frameWidget;
ChangeFont(FALSE);
// This patch comes from Torsten Liermann lier@lier1.muc.de // This patch comes from Torsten Liermann lier@lier1.muc.de
if (XmIsMotifWMRunning( (Widget) m_frameShell )) if (XmIsMotifWMRunning( (Widget) m_frameShell ))
{ {
@@ -1040,7 +1043,7 @@ WXWidget wxFrame::GetClientWidget() const
return m_clientArea; return m_clientArea;
} }
void wxFrame::ChangeFont() void wxFrame::ChangeFont(bool keepOriginalSize)
{ {
// TODO // TODO
} }

View File

@@ -123,10 +123,12 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
if (height == -1) if (height == -1)
height = 80; height = 80;
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -188,9 +190,9 @@ int wxGauge::GetValue() const
// return m_gaugePos; // return m_gaugePos;
} }
void wxGauge::ChangeFont() void wxGauge::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxGauge::ChangeBackgroundColour() void wxGauge::ChangeBackgroundColour()

View File

@@ -107,11 +107,13 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
XtAddCallback (listWidget, XmNdefaultActionCallback, (XtCallbackProc) wxListBoxDefaultActionProc, XtAddCallback (listWidget, XmNdefaultActionCallback, (XtCallbackProc) wxListBoxDefaultActionProc,
(XtPointer) this); (XtPointer) this);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, width, height); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, width, height);
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW); m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -741,9 +743,9 @@ WXWidget wxListBox::GetTopWidget() const
return (WXWidget) XtParent( (Widget) m_mainWidget ); return (WXWidget) XtParent( (Widget) m_mainWidget );
} }
void wxListBox::ChangeFont() void wxListBox::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxListBox::ChangeBackgroundColour() void wxListBox::ChangeBackgroundColour()

View File

@@ -24,6 +24,7 @@
#include <wx/log.h> #include <wx/log.h>
#include <wx/imaglist.h> #include <wx/imaglist.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/dcclient.h>
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// macros // macros
@@ -39,8 +40,9 @@
#if !USE_SHARED_LIBRARIES #if !USE_SHARED_LIBRARIES
BEGIN_EVENT_TABLE(wxNotebook, wxControl) BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange) EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize) EVT_SIZE(wxNotebook::OnSize)
EVT_PAINT(wxNotebook::OnPaint)
EVT_MOUSE_EVENTS(wxNotebook::OnMouseEvent)
EVT_SET_FOCUS(wxNotebook::OnSetFocus) EVT_SET_FOCUS(wxNotebook::OnSetFocus)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -60,6 +62,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
// common part of all ctors // common part of all ctors
void wxNotebook::Init() void wxNotebook::Init()
{ {
m_tabView = (wxNotebookTabView*) NULL;
m_pImageList = NULL; m_pImageList = NULL;
m_nSelection = -1; m_nSelection = -1;
} }
@@ -103,14 +106,19 @@ bool wxNotebook::Create(wxWindow *parent,
if ( parent != NULL ) if ( parent != NULL )
parent->AddChild(this); parent->AddChild(this);
// TODO // It's like a normal window...
if (!wxWindow::Create(parent, id, pos, size, style, name))
return FALSE; return FALSE;
SetTabView(new wxNotebookTabView(this));
return TRUE;
} }
// dtor // dtor
wxNotebook::~wxNotebook() wxNotebook::~wxNotebook()
{ {
delete m_tabView;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -192,6 +200,10 @@ void wxNotebook::SetImageList(wxImageList* imageList)
// remove one page from the notebook // remove one page from the notebook
bool wxNotebook::DeletePage(int nPage) bool wxNotebook::DeletePage(int nPage)
{ {
wxFAIL_MSG("Sorry, DeletePage not implemented for Motif wxNotebook because wxTabView doesn't support it.");
return FALSE;
/*
wxCHECK( IS_VALID_PAGE(nPage), FALSE ); wxCHECK( IS_VALID_PAGE(nPage), FALSE );
// TODO: delete native widget page // TODO: delete native widget page
@@ -200,12 +212,13 @@ bool wxNotebook::DeletePage(int nPage)
m_aPages.Remove(nPage); m_aPages.Remove(nPage);
return TRUE; return TRUE;
*/
} }
// remove all pages // remove all pages
bool wxNotebook::DeleteAllPages() bool wxNotebook::DeleteAllPages()
{ {
// TODO: delete native widget pages m_tabView->ClearTabs(TRUE);
int nPageCount = GetPageCount(); int nPageCount = GetPageCount();
int nPage; int nPage;
@@ -236,7 +249,12 @@ bool wxNotebook::InsertPage(int nPage,
wxASSERT( pPage != NULL ); wxASSERT( pPage != NULL );
wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE ); wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
// TODO: insert native widget page m_tabView->AddTab(nPage, strText);
/*
if (bSelect)
m_tabView->SetTabSelection(nPage, TRUE);
*/
// save the pointer to the page // save the pointer to the page
m_aPages.Insert(pPage, nPage); m_aPages.Insert(pPage, nPage);
@@ -265,7 +283,34 @@ void wxNotebook::OnSize(wxSizeEvent& event)
s_bFirstTime = FALSE; s_bFirstTime = FALSE;
} }
// TODO: all this may or may not be necessary for your platform if (m_tabView)
{
int cw, ch;
GetClientSize(& cw, & ch);
int tabHeight = m_tabView->GetTotalTabHeight();
wxRect rect;
rect.x = 4;
rect.y = tabHeight + 4;
rect.width = cw - 8;
rect.height = ch - 4 - rect.y ;
m_tabView->SetViewRect(rect);
m_tabView->Layout();
// Need to do it a 2nd time to get the tab height with
// the new view width, since changing the view width changes the
// tab layout.
tabHeight = m_tabView->GetTotalTabHeight();
rect.x = 4;
rect.y = tabHeight + 4;
rect.width = cw - 8;
rect.height = ch - 4 - rect.y ;
m_tabView->SetViewRect(rect);
m_tabView->Layout();
// emulate page change (it's esp. important to do it first time because // emulate page change (it's esp. important to do it first time because
// otherwise our page would stay invisible) // otherwise our page would stay invisible)
@@ -274,16 +319,16 @@ void wxNotebook::OnSize(wxSizeEvent& event)
SetSelection(nSel); SetSelection(nSel);
// fit the notebook page to the tab control's display area // fit the notebook page to the tab control's display area
int w, h;
GetSize(&w, &h);
unsigned int nCount = m_aPages.Count(); unsigned int nCount = m_aPages.Count();
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) { for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
wxNotebookPage *pPage = m_aPages[nPage]; wxNotebookPage *pPage = m_aPages[nPage];
pPage->SetSize(0, 0, w, h); pPage->SetSize(rect.x + 2, rect.y + 2, rect.width - 2, rect.height - 2);
if ( pPage->GetAutoLayout() ) if ( pPage->GetAutoLayout() )
pPage->Layout(); pPage->Layout();
} }
Refresh();
}
// Processing continues to next OnSize // Processing continues to next OnSize
event.Skip(); event.Skip();
@@ -365,18 +410,105 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
m_nSelection = nSel; m_nSelection = nSel;
} }
void wxNotebook::ChangeFont() void wxNotebook::ChangeFont(bool keepOriginalSize)
{ {
// TODO wxWindow::ChangeFont(keepOriginalSize);
} }
void wxNotebook::ChangeBackgroundColour() void wxNotebook::ChangeBackgroundColour()
{ {
// TODO wxWindow::ChangeBackgroundColour();
} }
void wxNotebook::ChangeForegroundColour() void wxNotebook::ChangeForegroundColour()
{ {
// TODO wxWindow::ChangeForegroundColour();
} }
void wxNotebook::OnMouseEvent(wxMouseEvent& event)
{
if (m_tabView)
m_tabView->OnEvent(event);
}
void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
wxPaintDC dc(this);
if (m_tabView)
m_tabView->Draw(dc);
}
/*
* wxNotebookTabView
*/
IMPLEMENT_CLASS(wxNotebookTabView, wxTabView)
wxNotebookTabView::wxNotebookTabView(wxNotebook *notebook, long style): wxTabView(style)
{
m_notebook = notebook;
// m_currentWindow = (wxWindow *) NULL;
m_notebook->SetTabView(this);
SetWindow(m_notebook);
}
wxNotebookTabView::~wxNotebookTabView(void)
{
// ClearWindows(TRUE);
}
// Called when a tab is activated
void wxNotebookTabView::OnTabActivate(int activateId, int deactivateId)
{
if (!m_notebook)
return;
wxWindow *oldWindow = ((deactivateId == -1) ? 0 : m_notebook->GetPage(deactivateId));
wxWindow *newWindow = m_notebook->GetPage(activateId);
if (oldWindow)
oldWindow->Show(FALSE);
if (newWindow)
newWindow->Show(TRUE);
m_notebook->Refresh();
}
#if 0
void wxNotebookTabView::AddTabWindow(int id, wxWindow *window)
{
m_tabWindows.Append((long)id, window);
window->Show(FALSE);
}
wxWindow *wxNotebookTabView::GetTabWindow(int id) const
{
wxNode *node = m_tabWindows.Find((long)id);
if (!node)
return (wxWindow *) NULL;
return (wxWindow *)node->Data();
}
void wxNotebookTabView::ClearWindows(bool deleteWindows)
{
if (deleteWindows)
m_tabWindows.DeleteContents(TRUE);
m_tabWindows.Clear();
m_tabWindows.DeleteContents(FALSE);
}
void wxNotebookTabView::ShowWindowForTab(int id)
{
wxWindow *newWindow = GetTabWindow(id);
if (newWindow == m_currentWindow)
return;
if (m_currentWindow)
m_currentWindow->Show(FALSE);
newWindow->Show(TRUE);
newWindow->Refresh();
}
#endif

View File

@@ -172,12 +172,14 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
} }
SetSelection (0); SetSelection (0);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
XtManageChild (radioBoxWidget); XtManageChild (radioBoxWidget);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -391,7 +393,7 @@ void wxRadioBox::Command (wxCommandEvent & event)
ProcessCommand (event); ProcessCommand (event);
} }
void wxRadioBox::ChangeFont() void wxRadioBox::ChangeFont(bool keepOriginalSize)
{ {
// TODO // TODO
} }

View File

@@ -81,12 +81,14 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
m_mainWidget = (WXWidget) radioButtonWidget; m_mainWidget = (WXWidget) radioButtonWidget;
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
XtManageChild (radioButtonWidget); XtManageChild (radioButtonWidget);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -111,9 +113,9 @@ void wxRadioButton::Command (wxCommandEvent & event)
ProcessCommand (event); ProcessCommand (event);
} }
void wxRadioButton::ChangeFont() void wxRadioButton::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxRadioButton::ChangeBackgroundColour() void wxRadioButton::ChangeBackgroundColour()

View File

@@ -152,7 +152,7 @@ void wxScrollBar::Command(wxCommandEvent& event)
ProcessCommand(event); ProcessCommand(event);
} }
void wxScrollBar::ChangeFont() void wxScrollBar::ChangeFont(bool keepOriginalSize)
{ {
// TODO // TODO
} }

View File

@@ -99,10 +99,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this); XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -247,9 +249,9 @@ void wxSlider::Command (wxCommandEvent & event)
ProcessCommand (event); ProcessCommand (event);
} }
void wxSlider::ChangeFont() void wxSlider::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxSlider::ChangeBackgroundColour() void wxSlider::ChangeBackgroundColour()

View File

@@ -68,7 +68,7 @@ void wxSpinButton::SetRange(int minVal, int maxVal)
// TODO // TODO
} }
void wxSpinButton::ChangeFont() void wxSpinButton::ChangeFont(bool keepOriginalSize)
{ {
// TODO // TODO
} }

View File

@@ -66,11 +66,12 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
XmNlabelType, XmPIXMAP, XmNlabelType, XmPIXMAP,
NULL); NULL);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour (); ChangeBackgroundColour ();
return TRUE; return TRUE;
@@ -119,9 +120,9 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
} }
} }
void wxStaticBitmap::ChangeFont() void wxStaticBitmap::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxStaticBitmap::ChangeBackgroundColour() void wxStaticBitmap::ChangeBackgroundColour()

View File

@@ -181,9 +181,9 @@ void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags)
} }
} }
void wxStaticBox::ChangeFont() void wxStaticBox::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxStaticBox::ChangeBackgroundColour() void wxStaticBox::ChangeBackgroundColour()

View File

@@ -64,19 +64,20 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
XmStringFree (text); XmStringFree (text);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour (); ChangeBackgroundColour ();
return TRUE; return TRUE;
} }
void wxStaticText::ChangeFont() void wxStaticText::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxStaticText::ChangeBackgroundColour() void wxStaticText::ChangeBackgroundColour()

View File

@@ -143,10 +143,12 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this); XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -636,9 +638,9 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
} }
} }
void wxTextCtrl::ChangeFont() void wxTextCtrl::ChangeFont(bool keepOriginalSize)
{ {
wxWindow::ChangeFont(); wxWindow::ChangeFont(keepOriginalSize);
} }
void wxTextCtrl::ChangeBackgroundColour() void wxTextCtrl::ChangeBackgroundColour()

View File

@@ -98,10 +98,12 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
m_mainWidget = (WXWidget) toolbar; m_mainWidget = (WXWidget) toolbar;
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return TRUE;
@@ -297,20 +299,22 @@ bool wxToolBar::CreateTools()
void wxToolBar::SetToolBitmapSize(const wxSize& size) void wxToolBar::SetToolBitmapSize(const wxSize& size)
{ {
// TODO not necessary?
m_defaultWidth = size.x; m_defaultHeight = size.y; m_defaultWidth = size.x; m_defaultHeight = size.y;
// TODO
} }
wxSize wxToolBar::GetMaxSize() const wxSize wxToolBar::GetMaxSize() const
{ {
// TODO int w, h;
return wxSize(0, 0); GetSize(& w, & h);
return wxSize(w, h);
} }
// The button size is bigger than the bitmap size // The button size is bigger than the bitmap size
wxSize wxToolBar::GetToolSize() const wxSize wxToolBar::GetToolSize() const
{ {
// TODO // TODO not necessary?
return wxSize(m_defaultWidth + 8, m_defaultHeight + 7); return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
} }

View File

@@ -3070,7 +3070,7 @@ void wxWindow::SetForegroundColour(const wxColour& col)
ChangeForegroundColour(); ChangeForegroundColour();
} }
void wxWindow::ChangeFont() void wxWindow::ChangeFont(bool keepOriginalSize)
{ {
// Note that this causes the widget to be resized back // Note that this causes the widget to be resized back
// to its original size! We therefore have to set the size // to its original size! We therefore have to set the size
@@ -3086,7 +3086,7 @@ void wxWindow::ChangeFont()
NULL); NULL);
GetSize(& width1, & height1); GetSize(& width1, & height1);
if (width != width1 || height != height1) if (keepOriginalSize && (width != width1 || height != height1))
{ {
SetSize(-1, -1, width, height); SetSize(-1, -1, width, height);
} }

View File

@@ -69,6 +69,8 @@ bool wxApp::Initialize()
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING); wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize(); wxTheColourDatabase->Initialize();
wxInitializeStockLists();
wxInitializeStockObjects(); wxInitializeStockObjects();
#if wxUSE_WX_RESOURCES #if wxUSE_WX_RESOURCES