samples/controls/*.ico
samples/controls/*.bmp
samples/controls/*.rc
+samples/controls/icons/*
samples/fractal/*.cpp
samples/fractal/*.h
\wxheading{See also}
\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
-\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}.
+\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
\membersection{wxSplitterWindow::IsSplit}\label{wxsplitterwindowissplit}
\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
user. It may return FALSE to prevent the change or TRUE to allow it.
\wxheading{See also}
\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}, \helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit},\rtfsp
-\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}.
+\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}
\membersection{wxSplitterWindow::SplitVertically}\label{wxsplitterwindowsplitvertically}
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.
Add wxDC::DeviceToLogical -> wxPoint etc (convenience accessors).
Revamp Dialog Editor for new controls and properties (e.g.
window id).
-Tidy wxConfig API.
-
-Change DnD classes to use global symbols, and wxString.
-
Update manual.
wxApp changes DONE
wxMenu changes DONE
Perhaps rewrite wxFile to use FILE* descriptors, so Eof and Flush
can work.
+
+Find out how to set wxFileSelector position.
class WXDLLEXPORT wxConfigBase;
#if wxUSE_IOSTREAMH
-# include <istream.h>
-# include <ostream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+# include <iostream.h>
#else
# include <istream>
# include <ostream>
#include "wx/hash.h"
#include "wx/string.h"
+#include "wx/dialog.h"
-class wxTabView;
+class WXDLLEXPORT wxTabView;
/*
* A wxTabControl is the internal and visual representation
* of the tab.
*/
-class wxTabControl: public wxObject
+class WXDLLEXPORT wxTabControl: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxTabControl)
public:
* are 3 layers in the MS Word Options dialog.
*/
-class wxTabLayer: public wxList
+class WXDLLEXPORT wxTabLayer: public wxList
{
DECLARE_DYNAMIC_CLASS(wxTabLayer)
public:
#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
-class wxTabView: public wxObject
+class WXDLLEXPORT wxTabView: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxTabView)
public:
inline int GetTabHeight(void) const { return m_tabHeight; }
inline void SetTabSelectionHeight(int h) { m_tabSelectionHeight = h; }
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 void SetTopMargin(int margin) { m_topMargin = margin; }
* A dialog box class that is tab-friendly
*/
-class wxTabbedDialog: public wxDialog
+class WXDLLEXPORT wxTabbedDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxTabbedDialog)
* A panel class that is tab-friendly
*/
-class wxTabbedPanel: public wxPanel
+class WXDLLEXPORT wxTabbedPanel: public wxPanel
{
DECLARE_DYNAMIC_CLASS(wxTabbedPanel)
DECLARE_EVENT_TABLE()
};
-class wxPanelTabView: public wxTabView
+class WXDLLEXPORT wxPanelTabView: public wxTabView
{
DECLARE_DYNAMIC_CLASS(wxPanelTabView)
public:
inline wxWindow *GetCurrentWindow() const { return m_currentWindow; }
void ShowWindowForTab(int id);
+ inline wxList& GetWindows() const { return (wxList&) m_tabWindows; }
protected:
// List of panels, one for each tab. Indexed
class WXDLLEXPORT wxFrame;
#if wxUSE_IOSTREAMH
-# include <ostream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+# include <iostream.h>
#else
# include <ostream>
# ifdef _MSC_VER
#include <stddef.h>
#if wxUSE_IOSTREAMH
-# include <ostream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+# include <iostream.h>
#else
# include <ostream>
# ifdef _MSC_VER
virtual void Command(wxCommandEvent& event);
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
};
virtual void Command(wxCommandEvent& event);
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
};
void SetFocus();
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; }
virtual void SetEditable(bool editable);
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
};
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
inline WXWidget GetTopWidget() const { return m_mainWidget; }
virtual void ReleaseMouse();
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetMenuBarWidget() const ;
virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ;
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
void Command(wxCommandEvent& event);
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const;
/////////////////////////////////////////////////////////////////////////////
// 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
// Modified by:
// RCS-ID: $Id$
#include "wx/dynarray.h"
#include "wx/event.h"
#include "wx/control.h"
+#include "wx/generic/tabg.h"
// ----------------------------------------------------------------------------
// types
// wxNotebook
// ----------------------------------------------------------------------------
-// @@@ this class should really derive from wxTabCtrl, but the interface is not
-// exactly the same, so I can't do it right now and instead we reimplement
-// part of wxTabCtrl here
+class WXDLLEXPORT wxNotebook;
+
+// 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
{
public:
virtual bool DoPhase(int nPhase);
// 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 ChangeForegroundColour();
int m_nSelection; // the current selection (-1 if none)
+ wxTabView* m_tabView;
+
DECLARE_DYNAMIC_CLASS(wxNotebook)
DECLARE_EVENT_TABLE()
};
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; }
void Command(wxCommandEvent& event);
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
};
void Command(wxCommandEvent& event);
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
void Command(wxCommandEvent& event);
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
void Command(wxCommandEvent& event) { ProcessCommand(event); };
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
virtual bool AcceptsFocus() const { return FALSE; }
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
wxString GetLabel() const;
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; }
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
};
virtual void Command(wxCommandEvent& event);
// Implementation
- virtual void ChangeFont();
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
inline void SetModified(bool mod) { m_modified = mod; }
virtual WXRegion GetPaintRegion() const { return m_paintRegion; }
// 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 DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
// These to be overridden as needed (may change several widgets)
// copy ctors and assignment operators
wxColour( const wxColour& col );
- wxColour( const wxColour* col );
+// wxColour( const wxColour* col );
wxColour& operator = ( const wxColour& col );
// dtor
class WXDLLEXPORT wxObject_Serialize;
#if wxUSE_IOSTREAMH
-# include <ostream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+# include <iostream.h>
#else
# include <ostream>
# ifdef _MSC_VER
// replacing with includes (on advice of ungod@pasdex.com.au)
// class WXDLLEXPORT istream;
#if wxUSE_IOSTREAMH
-#include <istream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+#include <iostream.h>
#else
#include <istream>
# ifdef _MSC_VER
#include "wx/notebook.h"
#include "wx/imaglist.h"
-#ifdef __WXGTK__
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "mondrian.xpm"
#include "icons/choice.xpm"
#include "icons/combo.xpm"
#
# Makefile for tab example (UNIX).
-PROGRAM=tab
+PROGRAM=test
OBJECTS=$(PROGRAM).o
#include "wx/tab.h"
#include "test.h"
-// Declare two frames
-MyDialog *dialog = (MyDialog *) NULL;
+// If 1, use a dialog. Otherwise use a frame.
+#define USE_TABBED_DIALOG 0
+
+MyDialog* dialog = (MyDialog *) NULL;
+MyFrame* frame = (MyFrame *) NULL;
IMPLEMENT_APP(MyApp)
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->ShowModal();
// Quit immediately the dialog has been dismissed
return FALSE;
-}
-
-BEGIN_EVENT_TABLE(MyDialog, wxTabbedDialog)
- 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();
-}
+#else
+ frame = new MyFrame((wxFrame*) NULL, -1, (char *) "Tabbed Panel", wxPoint(-1, -1), wxSize(365, 390), wxDEFAULT_FRAME_STYLE);
-void MyDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
-{
- EndModal(wxID_OK);
-}
-
-void MyDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event) )
-{
- EndModal(wxID_CANCEL);
+ return TRUE;
+#endif
}
-void MyDialog::Init(void)
+void MyApp::InitTabView(wxPanelTabView* view, wxWindow* window)
{
int dialogWidth = 365;
int dialogHeight = 390;
- wxButton *okButton = new wxButton(this, wxID_OK, "Close", wxPoint(100, 330), wxSize(80, 25));
- (void)new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(185, 330), wxSize(80, 25));
- (void)new wxButton(this, wxID_HELP, "Help", wxPoint(270, 330), wxSize(80, 25));
- okButton->SetDefault();
+ m_okButton = new wxButton(window, wxID_OK, "Close", wxPoint(-1, -1), wxSize(80, 25));
+ m_cancelButton = new wxButton(window, wxID_CANCEL, "Cancel", wxPoint(-1, -1), wxSize(80, 25));
+ m_helpButton = new wxButton(window, wxID_HELP, "Help", wxPoint(-1, -1), wxSize(80, 25));
+ m_okButton->SetDefault();
- // 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((wxPanel*)this, wxTAB_STYLE_DRAW_BOX);
+ wxLayoutConstraints* c = new wxLayoutConstraints;
+ c->right.SameAs(window, wxRight, 4);
+ 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.y = 70;
// Could calculate the view width from the tab width and spacing,
return;
// 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 wxTextCtrl(panel1, -1, "1234", wxPoint(10, 40), wxSize(120, 150));
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" };
(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)),
- wxTE_MULTILINE;
+ (void)new wxTextCtrl(panel2, -1, "Some notes about the animals in this house", wxPoint(5, 100), wxSize(170, 100),
+ wxTE_MULTILINE);
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...
#ifndef __WXMSW__
this->SetSize(dialogWidth, dialogHeight-20);
#endif
- view->SetTabSelection(TEST_TAB_CAT);
+ Layout();
+
+ 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();
+ }
}
{
public:
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
{
public:
void OnOK(wxCommandEvent& 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 Init(void);
{
if ((m_lastError = GetLine(this, m_lastResult)))
return FALSE;
- if (m_lastResult[0] != exp) {
+ if (m_lastResult.GetChar(0) != exp) {
m_lastError = wxPROTO_PROTERR;
return FALSE;
}
- if (m_lastResult[3] == '-') {
+ if (m_lastResult.GetChar(3) == '-') {
wxString key = m_lastResult.Left((size_t)3);
key += ' ';
#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(wxTabLayer, wxList)
void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
{
// Old, but in some ways better (drawing opaque tabs)
-#if 0
+#ifndef wxUSE_NEW_METHOD
if (!m_view)
return;
int tabHeightInc = 0;
if (m_isSelected)
{
- tabHeightInc = (view->GetTabSelectionHeight() - view->GetTabHeight());
+ tabHeightInc = (m_view->GetTabSelectionHeight() - m_view->GetTabHeight());
tabY -= tabHeightInc;
}
- dc.SetPen(wxTRANSPARENT_PEN);
+ dc.SetPen(*wxTRANSPARENT_PEN);
// 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.
dc.DrawRectangle(tabX, tabY, (GetWidth()+1), (GetHeight() + 1 + tabHeightInc));
}
// 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
// a bit if the tab below happens to be selected. Check.
dc.DrawLine(tabX, tabY, tabX, (tabY + GetHeight() + tabHeightInc - subtractThis));
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
if (((tabX + GetWidth()) >= m_view->GetViewRect().x + m_view->GetViewRect().width) && (m_view->GetTabStyle() & wxTAB_STYLE_DRAW_BOX))
(tabX + GetWidth()), (bottomY-1));
// Draw black line to emphasize shadow
- dc.SetPen(wxBLACK_PEN);
+ dc.SetPen(*wxBLACK_PEN);
dc.DrawLine((tabX + GetWidth() + 1), (tabY+1),
(tabX + GetWidth() + 1), bottomY);
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
- if ( GetColPosition() < maxPositions )
+ if ( GetRowPosition() < (maxPositions - 1) )
topY = tabY + GetHeight() + tabHeightInc;
// Shadow
dc.DrawLine((tabX + GetWidth()), tabY, (tabX + GetWidth()), topY);
// Draw black line to emphasize shadow
- dc.SetPen(wxBLACK_PEN);
+ dc.SetPen(*wxBLACK_PEN);
dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1),
topY);
}
(tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc - subtractThis));
// Draw black line to emphasize shadow
- dc.SetPen(wxBLACK_PEN);
+ dc.SetPen(*wxBLACK_PEN);
dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1),
(tabY + GetHeight() + tabHeightInc - subtractThis));
}
int textY = tabY + m_view->GetVerticalTabTextSpacing() + tabHeightInc;
if (m_isSelected)
- dc.SetFont(m_view->GetSelectedTabFont());
+ dc.SetFont(*m_view->GetSelectedTabFont());
else
- dc.SetFont(GetFont());
+ dc.SetFont(*GetFont());
wxColour col(m_view->GetTextColour());
- dc.SetTextForeground(&col);
-// dc.SetTextForeground(&(m_view->GetTextColour()));
+ dc.SetTextForeground(col);
dc.SetBackgroundMode(wxTRANSPARENT);
- float textWidth, textHeight;
+ long textWidth, textHeight;
dc.GetTextExtent(GetLabel(), &textWidth, &textHeight);
int textX = (int)(tabX + (GetWidth() - textWidth)/2.0);
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
dc.DrawLine(m_view->GetViewRect().x, (tabY + GetHeight() + tabHeightInc),
dc.DrawLine((tabX + GetWidth()), (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;
int tabInc = 0;
}
// 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)
{
// First, find which layer we should be adding to.
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)
{
wxNode *layerNode = m_layers.First();
layerNode = nextLayerNode;
}
}
-
+
+
// Layout tabs (optional, e.g. if resizing window)
void wxTabView::Layout(void)
{
}
-#if 0
+#ifndef wxUSE_NEW_METHOD
if (GetTabStyle() & wxTAB_STYLE_DRAW_BOX)
{
dc.SetPen(GetShadowPen());
dc.DrawLine(
(GetViewRect().x + 1),
(GetViewRect().y + GetViewRect().height),
- (GetViewRect().x + GetViewRect().width),
+ (GetViewRect().x + GetViewRect().width + 1),
(GetViewRect().y + GetViewRect().height)
);
dc.DrawLine(
(GetViewRect().x),
(GetViewRect().y + GetViewRect().height + 1),
- (GetViewRect().x + GetViewRect().width),
+ (GetViewRect().x + GetViewRect().width + 2),
(GetViewRect().y + GetViewRect().height + 1)
);
}
/*
- * wxDialogTabView
+ * wxPanelTabView
*/
IMPLEMENT_CLASS(wxPanelTabView, wxTabView)
{
}
-wxColour::wxColour( char red, char green, char blue )
+wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
{
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
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();
m_refData = new wxColourRefData();
{
}
-wxColour::wxColour( char red, char green, char blue )
+wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
{
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
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();
m_refData = new wxColourRefData();
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize();
+
+ wxInitializeStockLists();
wxInitializeStockObjects();
#if wxUSE_WX_RESOURCES
m_mainWidget = (WXWidget) buttonWidget;
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
ChangeBackgroundColour ();
DoSetBitmap();
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
-
-
return TRUE;
}
XtAddCallback ((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
(XtPointer) this);
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
item->ProcessCommand (event);
}
-void wxButton::ChangeFont()
+void wxButton::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxButton::ChangeBackgroundColour()
XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
- SetFont(* parent->GetFont());
-
return TRUE;
}
item->ProcessCommand (event);
}
-void wxCheckBox::ChangeFont()
+void wxCheckBox::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxCheckBox::ChangeBackgroundColour()
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);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
WXWidget *new_widgetList = new WXWidget[m_noStrings + 1];
int i;
- for (i = 0; i < m_noStrings; i++)
- new_widgetList[i] = m_widgetList[i];
+ if (m_widgetList)
+ for (i = 0; i < m_noStrings; i++)
+ new_widgetList[i] = m_widgetList[i];
+
new_widgetList[m_noStrings] = (WXWidget) w;
+
if (m_widgetList)
delete[] m_widgetList;
m_widgetList = new_widgetList;
}
}
-void wxChoice::ChangeFont()
+void wxChoice::ChangeFont(bool keepOriginalSize)
{
// Note that this causes the widget to be resized back
// to its original size! We therefore have to set the size
XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL);
XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);
+ /* TODO: why does this cause a crash in XtWidgetToApplicationContext?
int i;
for (i = 0; i < m_noStrings; i++)
XtVaSetValues ((Widget) m_widgetList[i], XmNfontList, fontList, NULL);
+ */
GetSize(& width1, & height1);
- if (width != width1 || height != height1)
+ if (keepOriginalSize && (width != width1 || height != height1))
{
SetSize(-1, -1, width, height);
}
SetValue(value);
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
}
}
-void wxComboBox::ChangeFont()
+void wxComboBox::ChangeFont(bool keepOriginalSize)
{
// Don't use the base class wxChoice's ChangeFont
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxComboBox::ChangeBackgroundColour()
XmStringFree(str);
}
+ m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
+ ChangeFont(FALSE);
+
wxAddWindowToTable(dialogShell, this);
// Intercept CLOSE messages from the window manager
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? */
XmRemoveWMProtocols(shell, &WM_DELETE_WINDOW, 1);
XmAddWMProtocols(shell, &WM_DELETE_WINDOW, 1);
(XtPointer)this);
ChangeBackgroundColour();
- SetFont(* parent->GetFont());
return TRUE;
}
*/
}
-void wxDialog::ChangeFont()
+void wxDialog::ChangeFont(bool keepOriginalSize)
{
// TODO
}
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
m_foregroundColour = *wxBLACK;
+ m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
if ( id > -1 )
m_windowId = id;
m_mainWidget = m_frameWidget;
+ ChangeFont(FALSE);
+
// This patch comes from Torsten Liermann lier@lier1.muc.de
if (XmIsMotifWMRunning( (Widget) m_frameShell ))
{
return m_clientArea;
}
-void wxFrame::ChangeFont()
+void wxFrame::ChangeFont(bool keepOriginalSize)
{
// TODO
}
if (height == -1)
height = 80;
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
// return m_gaugePos;
}
-void wxGauge::ChangeFont()
+void wxGauge::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxGauge::ChangeBackgroundColour()
XtAddCallback (listWidget, XmNdefaultActionCallback, (XtCallbackProc) wxListBoxDefaultActionProc,
(XtPointer) this);
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, width, height);
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
return (WXWidget) XtParent( (Widget) m_mainWidget );
}
-void wxListBox::ChangeFont()
+void wxListBox::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxListBox::ChangeBackgroundColour()
#include <wx/log.h>
#include <wx/imaglist.h>
#include <wx/notebook.h>
+#include <wx/dcclient.h>
// ----------------------------------------------------------------------------
// macros
#if !USE_SHARED_LIBRARIES
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
-
EVT_SIZE(wxNotebook::OnSize)
+ EVT_PAINT(wxNotebook::OnPaint)
+ EVT_MOUSE_EVENTS(wxNotebook::OnMouseEvent)
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE()
// common part of all ctors
void wxNotebook::Init()
{
+ m_tabView = (wxNotebookTabView*) NULL;
m_pImageList = NULL;
m_nSelection = -1;
}
if ( parent != NULL )
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
wxNotebook::~wxNotebook()
{
+ delete m_tabView;
}
// ----------------------------------------------------------------------------
// remove one page from the notebook
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 );
// TODO: delete native widget page
m_aPages.Remove(nPage);
return TRUE;
+*/
}
// remove all pages
bool wxNotebook::DeleteAllPages()
{
- // TODO: delete native widget pages
+ m_tabView->ClearTabs(TRUE);
int nPageCount = GetPageCount();
int nPage;
wxASSERT( pPage != NULL );
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
m_aPages.Insert(pPage, nPage);
s_bFirstTime = FALSE;
}
- // TODO: all this may or may not be necessary for your platform
-
- // emulate page change (it's esp. important to do it first time because
- // otherwise our page would stay invisible)
- int nSel = m_nSelection;
- m_nSelection = -1;
- SetSelection(nSel);
-
- // fit the notebook page to the tab control's display area
- int w, h;
- GetSize(&w, &h);
-
- unsigned int nCount = m_aPages.Count();
- for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
- wxNotebookPage *pPage = m_aPages[nPage];
- pPage->SetSize(0, 0, w, h);
- if ( pPage->GetAutoLayout() )
- pPage->Layout();
+ 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
+ // otherwise our page would stay invisible)
+ int nSel = m_nSelection;
+ m_nSelection = -1;
+ SetSelection(nSel);
+
+ // fit the notebook page to the tab control's display area
+
+ unsigned int nCount = m_aPages.Count();
+ for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
+ wxNotebookPage *pPage = m_aPages[nPage];
+ pPage->SetSize(rect.x + 2, rect.y + 2, rect.width - 2, rect.height - 2);
+ if ( pPage->GetAutoLayout() )
+ pPage->Layout();
+ }
+ Refresh();
}
// Processing continues to next OnSize
m_nSelection = nSel;
}
-void wxNotebook::ChangeFont()
+void wxNotebook::ChangeFont(bool keepOriginalSize)
{
- // TODO
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxNotebook::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
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
+
}
SetSelection (0);
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
XtManageChild (radioBoxWidget);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
ProcessCommand (event);
}
-void wxRadioBox::ChangeFont()
+void wxRadioBox::ChangeFont(bool keepOriginalSize)
{
// TODO
}
m_mainWidget = (WXWidget) radioButtonWidget;
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
XtManageChild (radioButtonWidget);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
ProcessCommand (event);
}
-void wxRadioButton::ChangeFont()
+void wxRadioButton::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxRadioButton::ChangeBackgroundColour()
ProcessCommand(event);
}
-void wxScrollBar::ChangeFont()
+void wxScrollBar::ChangeFont(bool keepOriginalSize)
{
// TODO
}
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
+ m_windowFont = parent->GetFont();
+
+ ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
ProcessCommand (event);
}
-void wxSlider::ChangeFont()
+void wxSlider::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxSlider::ChangeBackgroundColour()
// TODO
}
-void wxSpinButton::ChangeFont()
+void wxSpinButton::ChangeFont(bool keepOriginalSize)
{
// TODO
}
XmNlabelType, XmPIXMAP,
NULL);
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
-
ChangeBackgroundColour ();
return TRUE;
}
}
-void wxStaticBitmap::ChangeFont()
+void wxStaticBitmap::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxStaticBitmap::ChangeBackgroundColour()
}
}
-void wxStaticBox::ChangeFont()
+void wxStaticBox::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxStaticBox::ChangeBackgroundColour()
XmStringFree (text);
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
-
ChangeBackgroundColour ();
return TRUE;
}
-void wxStaticText::ChangeFont()
+void wxStaticText::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxStaticText::ChangeBackgroundColour()
XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
}
}
-void wxTextCtrl::ChangeFont()
+void wxTextCtrl::ChangeFont(bool keepOriginalSize)
{
- wxWindow::ChangeFont();
+ wxWindow::ChangeFont(keepOriginalSize);
}
void wxTextCtrl::ChangeBackgroundColour()
m_mainWidget = (WXWidget) toolbar;
+ m_windowFont = parent->GetFont();
+ ChangeFont(FALSE);
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
- SetFont(* parent->GetFont());
ChangeBackgroundColour();
return TRUE;
void wxToolBar::SetToolBitmapSize(const wxSize& size)
{
+ // TODO not necessary?
m_defaultWidth = size.x; m_defaultHeight = size.y;
- // TODO
}
wxSize wxToolBar::GetMaxSize() const
{
- // TODO
- return wxSize(0, 0);
+ int w, h;
+ GetSize(& w, & h);
+
+ return wxSize(w, h);
}
// The button size is bigger than the bitmap size
wxSize wxToolBar::GetToolSize() const
{
- // TODO
+ // TODO not necessary?
return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
}
ChangeForegroundColour();
}
-void wxWindow::ChangeFont()
+void wxWindow::ChangeFont(bool keepOriginalSize)
{
// Note that this causes the widget to be resized back
// to its original size! We therefore have to set the size
NULL);
GetSize(& width1, & height1);
- if (width != width1 || height != height1)
+ if (keepOriginalSize && (width != width1 || height != height1))
{
SetSize(-1, -1, width, height);
}
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize();
+
+ wxInitializeStockLists();
wxInitializeStockObjects();
#if wxUSE_WX_RESOURCES