From 64afee8513c2ce6f9a5deefe31d270532f7ffe32 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sat, 27 Dec 2008 14:58:12 +0000 Subject: [PATCH] remove the long deprecated wxTabCtrl class git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 57 +- configure.in | 8 - include/wx/chkconf.h | 8 - include/wx/motif/chkconf.h | 5 - include/wx/motif/setup0.h | 8 - include/wx/msw/setup0.h | 8 - include/wx/msw/tabctrl.h | 158 ---- include/wx/msw/wince/setup.h | 8 - include/wx/os2/setup0.h | 8 - include/wx/os2/tabctrl.h | 137 ---- include/wx/osx/carbon/tabctrl.h | 154 ---- include/wx/osx/iphone/chkconf.h | 7 +- include/wx/osx/setup0.h | 16 +- include/wx/osx/tabctrl.h | 5 - include/wx/palmos/setup0.h | 8 - include/wx/palmos/tabctrl.h | 157 ---- include/wx/setup_gccxml.h | 2 - include/wx/setup_inc.h | 8 - include/wx/tab.h | 22 - include/wx/tabctrl.h | 32 - include/wx/univ/setup0.h | 8 - setup.h.in | 2 - setup.h_vms | 8 +- src/generic/tabg.cpp | 1292 ------------------------------- src/msw/tabctrl.cpp | 432 ----------- src/os2/tabctrl.cpp | 360 --------- src/osx/carbon/tabctrl.cpp | 18 - src/osx/tabctrl_osx.cpp | 190 ----- src/palmos/tabctrl.cpp | 182 ----- 29 files changed, 11 insertions(+), 3297 deletions(-) delete mode 100644 include/wx/msw/tabctrl.h delete mode 100644 include/wx/os2/tabctrl.h delete mode 100644 include/wx/osx/carbon/tabctrl.h delete mode 100644 include/wx/osx/tabctrl.h delete mode 100644 include/wx/palmos/tabctrl.h delete mode 100644 include/wx/tab.h delete mode 100644 include/wx/tabctrl.h delete mode 100644 src/generic/tabg.cpp delete mode 100644 src/msw/tabctrl.cpp delete mode 100644 src/os2/tabctrl.cpp delete mode 100644 src/osx/carbon/tabctrl.cpp delete mode 100644 src/osx/tabctrl_osx.cpp delete mode 100644 src/palmos/tabctrl.cpp diff --git a/configure b/configure index 96fc43521e..2576e949e8 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 57498 2008-12-22 14:03:09Z RR . +# From configure.in Id: configure.in 57523 2008-12-24 01:28:55Z VZ . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for wxWidgets 2.9.0. # @@ -1831,7 +1831,6 @@ Optional Features: --enable-statline use wxStaticLine class --enable-stattext use wxStaticText class --enable-statusbar use wxStatusBar class - --enable-tabdialog use wxTabControl class --enable-taskbaricon use wxTaskBarIcon class --enable-textctrl use wxTextCtrl class --enable-togglebtn use wxToggleButton class @@ -2962,7 +2961,6 @@ DEFAULT_wxUSE_LIBSDL=no DEFAULT_wxUSE_ACCESSIBILITY=no DEFAULT_wxUSE_GRAPHICS_CONTEXT=no DEFAULT_wxUSE_IPV6=no -DEFAULT_wxUSE_TAB_DIALOG=no DEFAULT_wxUSE_GSTREAMER8=no DEFAULT_wxUSE_UNICODE_UTF8=auto @@ -9507,7 +9505,6 @@ if test "$wxUSE_CONTROLS" = "yes"; then DEFAULT_wxUSE_STATBOX=yes DEFAULT_wxUSE_STATLINE=yes DEFAULT_wxUSE_STATUSBAR=yes - DEFAULT_wxUSE_TAB_DIALOG=yes DEFAULT_wxUSE_TOGGLEBTN=yes DEFAULT_wxUSE_TOOLBAR=yes DEFAULT_wxUSE_TOOLBAR_NATIVE=yes @@ -9561,7 +9558,6 @@ elif test "$wxUSE_CONTROLS" = "no"; then DEFAULT_wxUSE_STATBOX=no DEFAULT_wxUSE_STATLINE=no DEFAULT_wxUSE_STATUSBAR=no - DEFAULT_wxUSE_TAB_DIALOG=no DEFAULT_wxUSE_TOGGLEBTN=no DEFAULT_wxUSE_TOOLBAR=no DEFAULT_wxUSE_TOOLBAR_NATIVE=no @@ -11686,50 +11682,6 @@ fi echo "${ECHO_T}$result" >&6; } - enablestring= - defaultval=$wxUSE_ALL_FEATURES - if test -z "$defaultval"; then - if test x"$enablestring" = xdisable; then - defaultval=yes - else - defaultval=no - fi - fi - - { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-tabdialog" >&5 -echo $ECHO_N "checking for --${enablestring:-enable}-tabdialog... $ECHO_C" >&6; } - # Check whether --enable-tabdialog was given. -if test "${enable_tabdialog+set}" = set; then - enableval=$enable_tabdialog; - if test "$enableval" = yes; then - wx_cv_use_tabdialog='wxUSE_TAB_DIALOG=yes' - else - wx_cv_use_tabdialog='wxUSE_TAB_DIALOG=no' - fi - -else - - wx_cv_use_tabdialog='wxUSE_TAB_DIALOG=${'DEFAULT_wxUSE_TAB_DIALOG":-$defaultval}" - -fi - - - eval "$wx_cv_use_tabdialog" - - if test x"$enablestring" = xdisable; then - if test $wxUSE_TAB_DIALOG = yes; then - result=no - else - result=yes - fi - else - result=$wxUSE_TAB_DIALOG - fi - - { echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6; } - - enablestring= defaultval=$wxUSE_ALL_FEATURES if test -z "$defaultval"; then @@ -46124,13 +46076,6 @@ _ACEOF SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS statbar" fi -if test "$wxUSE_TAB_DIALOG" = "yes"; then - cat >>confdefs.h <<\_ACEOF -#define wxUSE_TAB_DIALOG 1 -_ACEOF - -fi - if test "$wxUSE_TEXTCTRL" = "yes"; then cat >>confdefs.h <<\_ACEOF #define wxUSE_TEXTCTRL 1 diff --git a/configure.in b/configure.in index 09f4c0c348..adb40eb93f 100644 --- a/configure.in +++ b/configure.in @@ -372,7 +372,6 @@ dnl features disabled by default DEFAULT_wxUSE_ACCESSIBILITY=no DEFAULT_wxUSE_GRAPHICS_CONTEXT=no DEFAULT_wxUSE_IPV6=no -DEFAULT_wxUSE_TAB_DIALOG=no DEFAULT_wxUSE_GSTREAMER8=no dnl automatic features @@ -838,7 +837,6 @@ if test "$wxUSE_CONTROLS" = "yes"; then DEFAULT_wxUSE_STATBOX=yes DEFAULT_wxUSE_STATLINE=yes DEFAULT_wxUSE_STATUSBAR=yes - DEFAULT_wxUSE_TAB_DIALOG=yes DEFAULT_wxUSE_TOGGLEBTN=yes DEFAULT_wxUSE_TOOLBAR=yes DEFAULT_wxUSE_TOOLBAR_NATIVE=yes @@ -892,7 +890,6 @@ elif test "$wxUSE_CONTROLS" = "no"; then DEFAULT_wxUSE_STATBOX=no DEFAULT_wxUSE_STATLINE=no DEFAULT_wxUSE_STATUSBAR=no - DEFAULT_wxUSE_TAB_DIALOG=no DEFAULT_wxUSE_TOGGLEBTN=no DEFAULT_wxUSE_TOOLBAR=no DEFAULT_wxUSE_TOOLBAR_NATIVE=no @@ -952,7 +949,6 @@ WX_ARG_FEATURE(statbox, [ --enable-statbox use wxStaticBox class], w WX_ARG_FEATURE(statline, [ --enable-statline use wxStaticLine class], wxUSE_STATLINE) WX_ARG_FEATURE(stattext, [ --enable-stattext use wxStaticText class], wxUSE_STATTEXT) WX_ARG_FEATURE(statusbar, [ --enable-statusbar use wxStatusBar class], wxUSE_STATUSBAR) -WX_ARG_FEATURE(tabdialog, [ --enable-tabdialog use wxTabControl class], wxUSE_TAB_DIALOG) WX_ARG_FEATURE(taskbaricon, [ --enable-taskbaricon use wxTaskBarIcon class], wxUSE_TASKBARICON) WX_ARG_FEATURE(textctrl, [ --enable-textctrl use wxTextCtrl class], wxUSE_TEXTCTRL) WX_ARG_FEATURE(togglebtn, [ --enable-togglebtn use wxToggleButton class], wxUSE_TOGGLEBTN) @@ -6785,10 +6781,6 @@ if test "$wxUSE_STATUSBAR" = "yes"; then SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS statbar" fi -if test "$wxUSE_TAB_DIALOG" = "yes"; then - AC_DEFINE(wxUSE_TAB_DIALOG) -fi - if test "$wxUSE_TEXTCTRL" = "yes"; then AC_DEFINE(wxUSE_TEXTCTRL) USES_CONTROLS=1 diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 35c988dbb8..5793394fd5 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -936,14 +936,6 @@ # endif #endif /* !defined(wxUSE_STATUSBAR) */ -#ifndef wxUSE_TAB_DIALOG -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TAB_DIALOG must be defined." -# else -# define wxUSE_TAB_DIALOG 0 -# endif -#endif /* !defined(wxUSE_TAB_DIALOG) */ - #ifndef wxUSE_TASKBARICON # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_TASKBARICON must be defined." diff --git a/include/wx/motif/chkconf.h b/include/wx/motif/chkconf.h index aebce7c088..f1e17b1615 100644 --- a/include/wx/motif/chkconf.h +++ b/include/wx/motif/chkconf.h @@ -11,11 +11,6 @@ /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ -#if wxUSE_NOTEBOOK && !wxUSE_TAB_DIALOG -# undef wxUSE_TAB_DIALOG -# define wxUSE_TAB_DIALOG 1 -#endif - #if !defined(wxUSE_GADGETS) # define wxUSE_GADGETS 0 #endif diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h index 9fe1df35cd..4e927062a3 100644 --- a/include/wx/motif/setup0.h +++ b/include/wx/motif/setup0.h @@ -778,14 +778,6 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - // wxTaskBarIcon is a small notification icon shown in the system toolbar or // dock. // diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 90f4a097cd..16b8dd9f43 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -778,14 +778,6 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - // wxTaskBarIcon is a small notification icon shown in the system toolbar or // dock. // diff --git a/include/wx/msw/tabctrl.h b/include/wx/msw/tabctrl.h deleted file mode 100644 index e0fbd24baa..0000000000 --- a/include/wx/msw/tabctrl.h +++ /dev/null @@ -1,158 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: tabctrl.h -// Purpose: wxTabCtrl class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TABCTRL_H_ -#define _WX_TABCTRL_H_ - -class WXDLLIMPEXP_FWD_CORE wxImageList; - -/* - * Flags returned by HitTest - */ - -#define wxTAB_HITTEST_NOWHERE 1 -#define wxTAB_HITTEST_ONICON 2 -#define wxTAB_HITTEST_ONLABEL 4 -#define wxTAB_HITTEST_ONITEM 6 - -class WXDLLIMPEXP_CORE wxTabCtrl: public wxControl -{ - DECLARE_DYNAMIC_CLASS(wxTabCtrl) - public: - /* - * Public interface - */ - - wxTabCtrl(); - - inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")) - { - Create(parent, id, pos, size, style, name); - } - virtual ~wxTabCtrl(); - -// Accessors - - // Get the selection - int GetSelection() const; - - // Get the tab with the current keyboard focus - int GetCurFocus() const; - - // Get the associated image list - wxImageList* GetImageList() const; - - // Get the number of items - int GetItemCount() const; - - // Get the rect corresponding to the tab - bool GetItemRect(int item, wxRect& rect) const; - - // Get the number of rows - int GetRowCount() const; - - // Get the item text - wxString GetItemText(int item) const ; - - // Get the item image - int GetItemImage(int item) const; - - // Get the item data - void* GetItemData(int item) const; - - // Set the selection - int SetSelection(int item); - - // Set the image list - void SetImageList(wxImageList* imageList); - - // Set the text for an item - bool SetItemText(int item, const wxString& text); - - // Set the image for an item - bool SetItemImage(int item, int image); - - // Set the data for an item - bool SetItemData(int item, void* data); - - // Set the size for a fixed-width tab control - void SetItemSize(const wxSize& size); - - // Set the padding between tabs - void SetPadding(const wxSize& padding); - -// Operations - - bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")); - - // Delete all items - bool DeleteAllItems(); - - // Delete an item - bool DeleteItem(int item); - - // Hit test - int HitTest(const wxPoint& pt, long& flags); - - // Insert an item - bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL); - - // Implementation - - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - -protected: - wxImageList* m_imageList; - -DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxTabCtrl) -}; - -class WXDLLIMPEXP_CORE wxTabEvent : public wxNotifyEvent -{ -public: - wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = -1, int nOldSel = -1) - : wxNotifyEvent(commandType, id) - { - m_nSel = nSel; - m_nOldSel = nOldSel; - } - - // accessors - // the currently selected page (-1 if none) - int GetSelection() const { return m_nSel; } - void SetSelection(int nSel) { m_nSel = nSel; } - // the page that was selected before the change (-1 if none) - int GetOldSelection() const { return m_nOldSel; } - void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } - -private: - int m_nSel, // currently selected page - m_nOldSel; // previously selected page - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent) -}; - -typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); - -#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \ - id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), -#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \ - id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), - -#endif - // _WX_TABCTRL_H_ diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h index e31784dba3..f436ef8d00 100644 --- a/include/wx/msw/wince/setup.h +++ b/include/wx/msw/wince/setup.h @@ -778,14 +778,6 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - // wxTaskBarIcon is a small notification icon shown in the system toolbar or // dock. // diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h index 95a7152fed..5f3c7670f5 100644 --- a/include/wx/os2/setup0.h +++ b/include/wx/os2/setup0.h @@ -778,14 +778,6 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - // wxTaskBarIcon is a small notification icon shown in the system toolbar or // dock. // diff --git a/include/wx/os2/tabctrl.h b/include/wx/os2/tabctrl.h deleted file mode 100644 index 5f56241c04..0000000000 --- a/include/wx/os2/tabctrl.h +++ /dev/null @@ -1,137 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: tabctrl.h -// Purpose: wxTabCtrl class -// Author: David Webster -// Modified by: -// Created: ??/??/98 -// RCS-ID: $Id$ -// Copyright: (c) David Webster -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TABCTRL_H_ -#define _WX_TABCTRL_H_ - -class wxImageList; - -/* - * Flags returned by HitTest - */ - -#define wxTAB_HITTEST_NOWHERE 1 -#define wxTAB_HITTEST_ONICON 2 -#define wxTAB_HITTEST_ONLABEL 4 -#define wxTAB_HITTEST_ONITEM 6 - -class WXDLLIMPEXP_CORE wxTabCtrl: public wxControl -{ - DECLARE_DYNAMIC_CLASS(wxTabCtrl) - public: - /* - * Public interface - */ - - wxTabCtrl(); - - inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")) - { - Create(parent, id, pos, size, style, name); - } - virtual ~wxTabCtrl(); - -// Accessors - - // Get the selection - int GetSelection() const; - - // Get the tab with the current keyboard focus - int GetCurFocus() const; - - // Get the associated image list - wxImageList* GetImageList() const; - - // Get the number of items - int GetItemCount() const; - - // Get the rect corresponding to the tab - bool GetItemRect(int item, wxRect& rect) const; - - // Get the number of rows - int GetRowCount() const; - - // Get the item text - wxString GetItemText(int item) const ; - - // Get the item image - int GetItemImage(int item) const; - - // Get the item data - void* GetItemData(int item) const; - - // Set the selection - int SetSelection(int item); - - // Set the image list - void SetImageList(wxImageList* imageList); - - // Set the text for an item - bool SetItemText(int item, const wxString& text); - - // Set the image for an item - bool SetItemImage(int item, int image); - - // Set the data for an item - bool SetItemData(int item, void* data); - - // Set the size for a fixed-width tab control - void SetItemSize(const wxSize& size); - - // Set the padding between tabs - void SetPadding(const wxSize& padding); - -// Operations - - bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")); - - // Delete all items - bool DeleteAllItems(); - - // Delete an item - bool DeleteItem(int item); - - // Hit test - int HitTest(const wxPoint& pt, long& flags); - - // Insert an item - bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL); - - virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - -protected: - wxImageList* m_imageList; - -DECLARE_EVENT_TABLE() -}; - -class WXDLLIMPEXP_CORE wxTabEvent: public wxCommandEvent -{ - DECLARE_DYNAMIC_CLASS(wxTabEvent) - - public: - wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0); -}; - -typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); - -#define EVT_TAB_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGED, \ - id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL }, -#define EVT_TAB_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGING, \ - id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL }, - -#endif - // _WX_TABCTRL_H_ diff --git a/include/wx/osx/carbon/tabctrl.h b/include/wx/osx/carbon/tabctrl.h deleted file mode 100644 index 30cf54fbc1..0000000000 --- a/include/wx/osx/carbon/tabctrl.h +++ /dev/null @@ -1,154 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: tabctrl.h -// Purpose: wxTabCtrl class -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// RCS-ID: $Id$ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TABCTRL_H_ -#define _WX_TABCTRL_H_ - -#include "wx/control.h" - -class wxImageList; - -/* - * Flags returned by HitTest - */ - -#define wxTAB_HITTEST_NOWHERE 1 -#define wxTAB_HITTEST_ONICON 2 -#define wxTAB_HITTEST_ONLABEL 4 -#define wxTAB_HITTEST_ONITEM 6 - -class WXDLLIMPEXP_CORE wxTabCtrl: public wxControl -{ - DECLARE_DYNAMIC_CLASS(wxTabCtrl) - public: - /* - * Public interface - */ - - wxTabCtrl(); - - inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")) - { - Create(parent, id, pos, size, style, name); - } - virtual ~wxTabCtrl(); - -// Accessors - - // Get the selection - int GetSelection() const; - - // Get the tab with the current keyboard focus - int GetCurFocus() const; - - // Get the associated image list - wxImageList* GetImageList() const; - - // Get the number of items - int GetItemCount() const; - - // Get the rect corresponding to the tab - bool GetItemRect(int item, wxRect& rect) const; - - // Get the number of rows - int GetRowCount() const; - - // Get the item text - wxString GetItemText(int item) const ; - - // Get the item image - int GetItemImage(int item) const; - - // Get the item data - void* GetItemData(int item) const; - - // Set the selection - int SetSelection(int item); - - // Set the image list - void SetImageList(wxImageList* imageList); - - // Set the text for an item - bool SetItemText(int item, const wxString& text); - - // Set the image for an item - bool SetItemImage(int item, int image); - - // Set the data for an item - bool SetItemData(int item, void* data); - - // Set the size for a fixed-width tab control - void SetItemSize(const wxSize& size); - - // Set the padding between tabs - void SetPadding(const wxSize& padding); - -// Operations - - bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")); - - // Delete all items - bool DeleteAllItems(); - - // Delete an item - bool DeleteItem(int item); - - // Hit test - int HitTest(const wxPoint& pt, long& flags); - - // Insert an item - bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL); - - void Command(wxCommandEvent& event); - -protected: - wxImageList* m_imageList; - -DECLARE_EVENT_TABLE() -}; - -class WXDLLIMPEXP_CORE wxTabEvent : public wxNotifyEvent -{ -public: - wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = -1, int nOldSel = -1) - : wxNotifyEvent(commandType, id) - { - m_nSel = nSel; - m_nOldSel = nOldSel; - } - - // accessors - // the currently selected page (-1 if none) - int GetSelection() const { return m_nSel; } - void SetSelection(int nSel) { m_nSel = nSel; } - // the page that was selected before the change (-1 if none) - int GetOldSelection() const { return m_nOldSel; } - void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } - -private: - int m_nSel, // currently selected page - m_nOldSel; // previously selected page - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent) -}; - -typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); - -#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \ - id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), -#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \ - id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), - -#endif - // _WX_TABCTRL_H_ diff --git a/include/wx/osx/iphone/chkconf.h b/include/wx/osx/iphone/chkconf.h index 8825251fde..1040d3c951 100644 --- a/include/wx/osx/iphone/chkconf.h +++ b/include/wx/osx/iphone/chkconf.h @@ -12,11 +12,11 @@ #ifndef _WX_OSX_IPHONE_CHKCONF_H_ #define _WX_OSX_IPHONE_CHKCONF_H_ -/* - * text rendering system +/* + * text rendering system */ -/* we have different options and we turn on all that make sense +/* we have different options and we turn on all that make sense * under a certain platform */ @@ -141,7 +141,6 @@ #define wxUSE_WIZARDDLG 0 #define wxUSE_TOOLBAR_NATIVE 0 #define wxUSE_FINDREPLDLG 0 -#define wxUSE_TAB_DIALOG 0 #define wxUSE_TASKBARICON 0 diff --git a/include/wx/osx/setup0.h b/include/wx/osx/setup0.h index 7a0d0a5804..e7ca7c52f3 100644 --- a/include/wx/osx/setup0.h +++ b/include/wx/osx/setup0.h @@ -779,14 +779,6 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - // wxTaskBarIcon is a small notification icon shown in the system toolbar or // dock. // @@ -1282,17 +1274,17 @@ // override some settings for Metrowerks // // VZ: isn't this file only used when building with Metrowerks anyhow? -// CS: no, it is also used by the XCode projects +// CS: no, it is also used by the XCode projects #ifdef __MWERKS__ #undef wxUSE_DEBUG_CONTEXT #define wxUSE_DEBUG_CONTEXT 1 #undef wxUSE_STD_IOSTREAM - // CS: I have to set this to 0 now, as shared builds are having problems + // CS: I have to set this to 0 now, as shared builds are having problems #define wxUSE_STD_IOSTREAM 0 #endif -#undef wxUSE_GRAPHICS_CONTEXT +#undef wxUSE_GRAPHICS_CONTEXT #define wxUSE_GRAPHICS_CONTEXT 1 @@ -1310,7 +1302,7 @@ // Set to 0 for no libmspack #define wxUSE_LIBMSPACK 0 -// native toolbar does support embedding controls, but not comples panels, please test +// native toolbar does support embedding controls, but not comples panels, please test #define wxOSX_USE_NATIVE_TOOLBAR 1 // make sure we have the proper dispatcher for the console event loop diff --git a/include/wx/osx/tabctrl.h b/include/wx/osx/tabctrl.h deleted file mode 100644 index 47742c1677..0000000000 --- a/include/wx/osx/tabctrl.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/tabctrl.h" -#else -#include "wx/osx/carbon/tabctrl.h" -#endif diff --git a/include/wx/palmos/setup0.h b/include/wx/palmos/setup0.h index d25999c067..0885cc9aeb 100644 --- a/include/wx/palmos/setup0.h +++ b/include/wx/palmos/setup0.h @@ -778,14 +778,6 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - // wxTaskBarIcon is a small notification icon shown in the system toolbar or // dock. // diff --git a/include/wx/palmos/tabctrl.h b/include/wx/palmos/tabctrl.h deleted file mode 100644 index 6a2b60eec1..0000000000 --- a/include/wx/palmos/tabctrl.h +++ /dev/null @@ -1,157 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/palmos/tabctrl.h -// Purpose: wxTabCtrl class -// Author: William Osborne - minimal working wxPalmOS port -// Modified by: -// Created: 10/13/04 -// RCS-ID: $Id$ -// Copyright: (c) William Osborne -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TABCTRL_H_ -#define _WX_TABCTRL_H_ - -class wxImageList; - -// WXDLLIMPEXP_DATA_CORE(extern const wxChar) wxToolBarNameStr[]; - -/* - * Flags returned by HitTest - */ - -#define wxTAB_HITTEST_NOWHERE 1 -#define wxTAB_HITTEST_ONICON 2 -#define wxTAB_HITTEST_ONLABEL 4 -#define wxTAB_HITTEST_ONITEM 6 - -class WXDLLIMPEXP_CORE wxTabCtrl: public wxControl -{ - DECLARE_DYNAMIC_CLASS(wxTabCtrl) - public: - /* - * Public interface - */ - - wxTabCtrl(); - - inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")) - { - Create(parent, id, pos, size, style, name); - } - virtual ~wxTabCtrl(); - -// Accessors - - // Get the selection - int GetSelection() const; - - // Get the tab with the current keyboard focus - int GetCurFocus() const; - - // Get the associated image list - wxImageList* GetImageList() const; - - // Get the number of items - int GetItemCount() const; - - // Get the rect corresponding to the tab - bool GetItemRect(int item, wxRect& rect) const; - - // Get the number of rows - int GetRowCount() const; - - // Get the item text - wxString GetItemText(int item) const ; - - // Get the item image - int GetItemImage(int item) const; - - // Get the item data - void* GetItemData(int item) const; - - // Set the selection - int SetSelection(int item); - - // Set the image list - void SetImageList(wxImageList* imageList); - - // Set the text for an item - bool SetItemText(int item, const wxString& text); - - // Set the image for an item - bool SetItemImage(int item, int image); - - // Set the data for an item - bool SetItemData(int item, void* data); - - // Set the size for a fixed-width tab control - void SetItemSize(const wxSize& size); - - // Set the padding between tabs - void SetPadding(const wxSize& padding); - -// Operations - - bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxT("tabCtrl")); - - // Delete all items - bool DeleteAllItems(); - - // Delete an item - bool DeleteItem(int item); - - // Hit test - int HitTest(const wxPoint& pt, long& flags); - - // Insert an item - bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL); - - // Implementation - - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - -protected: - wxImageList* m_imageList; - -DECLARE_EVENT_TABLE() - DECLARE_NO_COPY_CLASS(wxTabCtrl) -}; - -class WXDLLIMPEXP_CORE wxTabEvent : public wxNotifyEvent -{ -public: - wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = -1, int nOldSel = -1) - : wxNotifyEvent(commandType, id) - { - m_nSel = nSel; - m_nOldSel = nOldSel; - } - - // accessors - // the currently selected page (-1 if none) - int GetSelection() const { return m_nSel; } - void SetSelection(int nSel) { m_nSel = nSel; } - // the page that was selected before the change (-1 if none) - int GetOldSelection() const { return m_nOldSel; } - void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } - -private: - int m_nSel, // currently selected page - m_nOldSel; // previously selected page - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent) -}; - -typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); - -#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \ - id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), -#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \ - id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), - -#endif - // _WX_TABCTRL_H_ diff --git a/include/wx/setup_gccxml.h b/include/wx/setup_gccxml.h index 013ad18c1f..7b8c078753 100644 --- a/include/wx/setup_gccxml.h +++ b/include/wx/setup_gccxml.h @@ -372,8 +372,6 @@ #define wxUSE_TOOLBOOK 1 -#define wxUSE_TAB_DIALOG 0 - #define wxUSE_TASKBARICON 1 #define wxUSE_GRID 1 diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index 13e650db66..f6df77f7d3 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -774,14 +774,6 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - // wxTaskBarIcon is a small notification icon shown in the system toolbar or // dock. // diff --git a/include/wx/tab.h b/include/wx/tab.h deleted file mode 100644 index d605d5935a..0000000000 --- a/include/wx/tab.h +++ /dev/null @@ -1,22 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tab.h -// Purpose: Generic tab class base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id$ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TAB_H_BASE_ -#define _WX_TAB_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_TAB_DIALOG -#include "wx/generic/tabg.h" -#endif - -#endif - // _WX_TAB_H_BASE_ diff --git a/include/wx/tabctrl.h b/include/wx/tabctrl.h deleted file mode 100644 index 4bbf65eaf2..0000000000 --- a/include/wx/tabctrl.h +++ /dev/null @@ -1,32 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/tabctrl.h -// Purpose: wxTabCtrl base header -// Author: Julian Smart -// Modified by: -// Created: -// Copyright: (c) Julian Smart -// RCS-ID: $Id$ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TABCTRL_H_BASE_ -#define _WX_TABCTRL_H_BASE_ - -#include "wx/defs.h" - -#if wxUSE_TAB_DIALOG - -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGING; - -#if defined(__WXMSW__) - #include "wx/msw/tabctrl.h" -#elif defined(__WXMAC__) - #include "wx/osx/tabctrl.h" -#elif defined(__WXPM__) - #include "wx/os2/tabctrl.h" -#endif - -#endif // wxUSE_TAB_DIALOG - -#endif // _WX_TABCTRL_H_BASE_ diff --git a/include/wx/univ/setup0.h b/include/wx/univ/setup0.h index a6910382af..4ee844bb60 100644 --- a/include/wx/univ/setup0.h +++ b/include/wx/univ/setup0.h @@ -777,14 +777,6 @@ // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 -// wxTabDialog is a generic version of wxNotebook but it is incompatible with -// the new class. It shouldn't be used in new code. -// -// Default is 0. -// -// Recommended setting: 0 (use wxNotebook) -#define wxUSE_TAB_DIALOG 0 - // wxTaskBarIcon is a small notification icon shown in the system toolbar or // dock. // diff --git a/setup.h.in b/setup.h.in index 560c32a3e5..90a263b3f9 100644 --- a/setup.h.in +++ b/setup.h.in @@ -376,8 +376,6 @@ #define wxUSE_TOOLBOOK 0 -#define wxUSE_TAB_DIALOG 0 - #define wxUSE_TASKBARICON 0 #define wxUSE_GRID 0 diff --git a/setup.h_vms b/setup.h_vms index 8656fa6213..ef0536dc47 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -220,7 +220,7 @@ typedef pid_t GPid; #if defined(__DMC__) || defined(__WATCOMC__) \ || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 + #define wxUSE_STD_DEFAULT 0 #else #define wxUSE_STD_DEFAULT 0 #endif @@ -403,8 +403,6 @@ typedef pid_t GPid; #define wxUSE_TOOLBOOK 1 -#define wxUSE_TAB_DIALOG 1 - #define wxUSE_TASKBARICON 1 #define wxUSE_GRID 1 @@ -838,7 +836,7 @@ typedef pid_t GPid; /* define with the name of timezone variable */ #undef WX_TIMEZONE - + /* The type of 3rd argument to getsockname() - usually size_t or int */ #define WX_SOCKLEN_T size_t @@ -1223,7 +1221,7 @@ typedef pid_t GPid; Win32 adjustments section --------------------------------------------------------------------- */ - + #ifdef __WIN32__ /* we need to define wxUSE_XPM_IN_MSW for MSW compilation for compatibil diff --git a/src/generic/tabg.cpp b/src/generic/tabg.cpp deleted file mode 100644 index 365b1c78f6..0000000000 --- a/src/generic/tabg.cpp +++ /dev/null @@ -1,1292 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/tabg.cpp -// Purpose: Generic tabbed dialogs -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TAB_DIALOG - -#ifndef WX_PRECOMP - #include "wx/settings.h" - #include "wx/intl.h" - #include "wx/dcclient.h" - #include "wx/math.h" -#endif - -#include -#include -#include - -#include "wx/tab.h" -#include "wx/listimpl.cpp" - -WX_DEFINE_LIST(wxTabLayerList) - -// 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) - -wxTabControl::wxTabControl(wxTabView *v) -{ - m_view = v; - m_isSelected = false; - m_offsetX = 0; - m_offsetY = 0; - m_width = 0; - m_height = 0; - m_id = 0; - m_rowPosition = 0; - m_colPosition = 0; -} - -wxTabControl::~wxTabControl(void) -{ -} - -void wxTabControl::OnDraw(wxDC& dc, bool lastInRow) -{ - // Old, but in some ways better (drawing opaque tabs) -#ifndef wxUSE_NEW_METHOD - if (!m_view) - return; - - // Top-left of tab view area - int viewX = m_view->GetViewRect().x; - int viewY = m_view->GetViewRect().y; - - // Top-left of tab control - int tabX = GetX() + viewX; - int tabY = GetY() + viewY; - int tabHeightInc = 0; - if (m_isSelected) - { - tabHeightInc = (m_view->GetTabSelectionHeight() - m_view->GetTabHeight()); - tabY -= tabHeightInc; - } - - dc.SetPen(*wxTRANSPARENT_PEN); - - // Draw grey background - if (m_view->GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR) - { - if(m_view->GetBackgroundBrush()) - dc.SetBrush(*m_view->GetBackgroundBrush()); - - // Add 1 because the pen is transparent. Under Motif, may be different. -#ifdef __WXMOTIF__ - dc.DrawRectangle(tabX, tabY, (GetWidth()+1), (GetHeight() + tabHeightInc)); -#else - dc.DrawRectangle(tabX, tabY, (GetWidth()+1), (GetHeight() + 1 + tabHeightInc)); -#endif - } - - // Draw highlight and shadow - 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. - wxTabControl *tabBeneath = NULL; - int subtractThis = 0; - if (GetColPosition() > 0) - tabBeneath = m_view->FindTabControlForPosition(GetColPosition() - 1, GetRowPosition()); - if (tabBeneath && tabBeneath->IsSelected()) - subtractThis = (m_view->GetTabSelectionHeight() - m_view->GetTabHeight()); - - // Vertical highlight: if first tab, draw to bottom of view - if (tabX == m_view->GetViewRect().x && (m_view->GetTabStyle() & wxTAB_STYLE_DRAW_BOX)) - dc.DrawLine(tabX, tabY, tabX, (m_view->GetViewRect().y + m_view->GetViewRect().height)); - else if (tabX == m_view->GetViewRect().x) - // Not box drawing, just to top of view. - dc.DrawLine(tabX, tabY, tabX, (m_view->GetViewRect().y)); - else - dc.DrawLine(tabX, tabY, tabX, (tabY + GetHeight() + tabHeightInc - subtractThis)); - - dc.DrawLine(tabX, tabY, (tabX + GetWidth()), tabY); - 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)) - { - int bottomY = m_view->GetViewRect().y + m_view->GetViewRect().height + GetY() + m_view->GetTabHeight() + m_view->GetTopMargin(); - // Add a tab height since we wish to draw to the bottom of the view. - dc.DrawLine((tabX + GetWidth()), tabY, - (tabX + GetWidth()), bottomY); - - // Calculate the far-right of the view, since we don't wish to - // draw inside that - int rightOfView = m_view->GetViewRect().x + m_view->GetViewRect().width + 1; - - // Draw the horizontal bit to connect to the view rectangle - dc.DrawLine((wxMax((tabX + GetWidth() - m_view->GetHorizontalTabOffset()), rightOfView)), (bottomY-1), - (tabX + GetWidth()), (bottomY-1)); - - // Draw black line to emphasize shadow - dc.SetPen(*wxBLACK_PEN); - dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), - (tabX + GetWidth() + 1), bottomY); - - // Draw the horizontal bit to connect to the view rectangle - dc.DrawLine((wxMax((tabX + GetWidth() - m_view->GetHorizontalTabOffset()), rightOfView)), (bottomY), - (tabX + GetWidth() + 1), (bottomY)); - } - else - { - if (lastInRow) - { - // 25/5/97 UNLESS it's less than the max number of positions in this row - - int topY = m_view->GetViewRect().y - m_view->GetTopMargin(); - - int maxPositions = ((wxTabLayer *)m_view->GetLayers().Item(0)->GetData())->GetCount(); - - // Only down to the bottom of the tab, not to the top of the view - if ( GetRowPosition() < (maxPositions - 1) ) - topY = tabY + GetHeight() + tabHeightInc; - -#ifdef __WXMOTIF__ - topY -= 1; -#endif - - // Shadow - dc.DrawLine((tabX + GetWidth()), tabY, (tabX + GetWidth()), topY); - // Draw black line to emphasize shadow - dc.SetPen(*wxBLACK_PEN); - dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1), - topY); - } - else - { - // Calculate the top of the tab beneath. It's the height of the tab, MINUS - // a bit if the tab below (and next col along) happens to be selected. Check. - wxTabControl *tabBeneath = NULL; - int subtractThis = 0; - if (GetColPosition() > 0) - tabBeneath = m_view->FindTabControlForPosition(GetColPosition() - 1, GetRowPosition() + 1); - if (tabBeneath && tabBeneath->IsSelected()) - subtractThis = (m_view->GetTabSelectionHeight() - m_view->GetTabHeight()); - -#ifdef __WXMOTIF__ - subtractThis += 1; -#endif - - // Draw only to next tab down. - dc.DrawLine((tabX + GetWidth()), tabY, - (tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc - subtractThis)); - - // Draw black line to emphasize shadow - dc.SetPen(*wxBLACK_PEN); - dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1), - (tabY + GetHeight() + tabHeightInc - subtractThis)); - } - } - - // Draw centered text - int textY = tabY + m_view->GetVerticalTabTextSpacing() + tabHeightInc; - - if (m_isSelected) - dc.SetFont(* m_view->GetSelectedTabFont()); - else - dc.SetFont(* GetFont()); - - wxColour col(m_view->GetTextColour()); - dc.SetTextForeground(col); - dc.SetBackgroundMode(wxTRANSPARENT); - wxCoord textWidth, textHeight; - dc.GetTextExtent(GetLabel(), &textWidth, &textHeight); - - int textX = (int)(tabX + (GetWidth() - textWidth)/2.0); - if (textX < (tabX + 2)) - textX = (tabX + 2); - - dc.SetClippingRegion(tabX, tabY, GetWidth(), GetHeight()); - dc.DrawText(GetLabel(), textX, textY); - dc.DestroyClippingRegion(); - - if (m_isSelected) - { - 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), - tabX, (tabY + GetHeight() + tabHeightInc)); - - // Draw white highlight from the tab's right side to the right hand edge of the view - dc.DrawLine((tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc), - m_view->GetViewRect().x + m_view->GetViewRect().width, (tabY + GetHeight() + tabHeightInc)); - } -#else - // New HEL version with rounder tabs - - if (!m_view) return; - - int tabInc = 0; - if (m_isSelected) - { - tabInc = m_view->GetTabSelectionHeight() - m_view->GetTabHeight(); - } - int tabLeft = GetX() + m_view->GetViewRect().x; - int tabTop = GetY() + m_view->GetViewRect().y - tabInc; - int tabRight = tabLeft + m_view->GetTabWidth(); - int left = m_view->GetViewRect().x; - int top = tabTop + m_view->GetTabHeight() + tabInc; - int right = left + m_view->GetViewRect().width; - int bottom = top + m_view->GetViewRect().height; - - if (m_isSelected) - { - // TAB is selected - draw TAB and the View's full outline - - dc.SetPen(*(m_view->GetHighlightPen())); - wxPoint pnts[10]; - int n = 0; - pnts[n].x = left; pnts[n++].y = bottom; - pnts[n].x = left; pnts[n++].y = top; - pnts[n].x = tabLeft; pnts[n++].y = top; - pnts[n].x = tabLeft; pnts[n++].y = tabTop + 2; - pnts[n].x = tabLeft + 2; pnts[n++].y = tabTop; - pnts[n].x = tabRight - 1; pnts[n++].y = tabTop; - dc.DrawLines(n, pnts); - if (!lastInRow) - { - dc.DrawLine( - (tabRight + 2), - top, - right, - top - ); - } - - dc.SetPen(*(m_view->GetShadowPen())); - dc.DrawLine( - tabRight, - tabTop + 2, - tabRight, - top - ); - dc.DrawLine( - right, - top, - right, - bottom - ); - dc.DrawLine( - right, - bottom, - left, - bottom - ); - - dc.SetPen(*wxBLACK_PEN); - dc.DrawPoint( - tabRight, - tabTop + 1 - ); - dc.DrawPoint( - tabRight + 1, - tabTop + 2 - ); - if (lastInRow) - { - dc.DrawLine( - tabRight + 1, - bottom, - tabRight + 1, - tabTop + 1 - ); - } - else - { - dc.DrawLine( - tabRight + 1, - tabTop + 2, - tabRight + 1, - top - ); - dc.DrawLine( - right + 1, - top, - right + 1, - bottom + 1 - ); - } - dc.DrawLine( - right + 1, - bottom + 1, - left + 1, - bottom + 1 - ); - } - else - { - // TAB is not selected - just draw TAB outline and RH edge - // if the TAB is the last in the row - - int maxPositions = ((wxTabLayer*)m_view->GetLayers().Item(0)->GetData())->GetCount(); - wxTabControl* tabBelow = 0; - wxTabControl* tabBelowRight = 0; - if (GetColPosition() > 0) - { - tabBelow = m_view->FindTabControlForPosition( - GetColPosition() - 1, - GetRowPosition() - ); - } - if (!lastInRow && GetColPosition() > 0) - { - tabBelowRight = m_view->FindTabControlForPosition( - GetColPosition() - 1, - GetRowPosition() + 1 - ); - } - - float raisedTop = top - m_view->GetTabSelectionHeight() + - m_view->GetTabHeight(); - - dc.SetPen(*(m_view->GetHighlightPen())); - wxPoint pnts[10]; - int n = 0; - - pnts[n].x = tabLeft; - - if (tabBelow && tabBelow->IsSelected()) - { - pnts[n++].y = (long)raisedTop; - } - else - { - pnts[n++].y = top; - } - pnts[n].x = tabLeft; pnts[n++].y = tabTop + 2; - pnts[n].x = tabLeft + 2; pnts[n++].y = tabTop; - pnts[n].x = tabRight - 1; pnts[n++].y = tabTop; - dc.DrawLines(n, pnts); - - dc.SetPen(*(m_view->GetShadowPen())); - if (GetRowPosition() >= maxPositions - 1) - { - dc.DrawLine( - tabRight, - (tabTop + 2), - tabRight, - bottom - ); - dc.DrawLine( - tabRight, - bottom, - (tabRight - m_view->GetHorizontalTabOffset()), - bottom - ); - } - else - { - if (tabBelowRight && tabBelowRight->IsSelected()) - { - dc.DrawLine( - tabRight, - (long)raisedTop, - tabRight, - tabTop + 1 - ); - } - else - { - dc.DrawLine( - tabRight, - top - 1, - tabRight, - tabTop + 1 - ); - } - } - - dc.SetPen(*wxBLACK_PEN); - dc.DrawPoint( - tabRight, - tabTop + 1 - ); - dc.DrawPoint( - tabRight + 1, - tabTop + 2 - ); - if (GetRowPosition() >= maxPositions - 1) - { - // draw right hand edge to bottom of view - dc.DrawLine( - tabRight + 1, - bottom + 1, - tabRight + 1, - tabTop + 2 - ); - dc.DrawLine( - tabRight + 1, - bottom + 1, - (tabRight - m_view->GetHorizontalTabOffset()), - bottom + 1 - ); - } - else - { - // draw right hand edge of TAB - if (tabBelowRight && tabBelowRight->IsSelected()) - { - dc.DrawLine( - tabRight + 1, - (long)(raisedTop - 1), - tabRight + 1, - tabTop + 2 - ); - } - else - { - dc.DrawLine( - tabRight + 1, - top - 1, - tabRight + 1, - tabTop + 2 - ); - } - } - } - - // Draw centered text - dc.SetPen(*wxBLACK_PEN); - if (m_isSelected) - { - dc.SetFont(*(m_view->GetSelectedTabFont())); - } - else - { - dc.SetFont(*(GetFont())); - } - - wxColour col(m_view->GetTextColour()); - dc.SetTextForeground(col); - dc.SetBackgroundMode(wxTRANSPARENT); - long textWidth, textHeight; - dc.GetTextExtent(GetLabel(), &textWidth, &textHeight); - - float textX = (tabLeft + tabRight - textWidth) / 2; - float textY = (tabInc + tabTop + m_view->GetVerticalTabTextSpacing()); - - dc.DrawText(GetLabel(), (long)textX, (long)textY); -#endif -} - -bool wxTabControl::HitTest(int x, int y) const -{ - // Top-left of tab control - int tabX1 = GetX() + m_view->GetViewRect().x; - int tabY1 = GetY() + m_view->GetViewRect().y; - - // Bottom-right - int tabX2 = tabX1 + GetWidth(); - int tabY2 = tabY1 + GetHeight(); - - if (x >= tabX1 && y >= tabY1 && x <= tabX2 && y <= tabY2) - return true; - else - return false; -} - -IMPLEMENT_DYNAMIC_CLASS(wxTabView, wxObject) - -wxTabView::wxTabView(long style) -{ - m_noTabs = 0; - m_tabStyle = style; - m_tabSelection = -1; - m_tabHeight = 20; - m_tabSelectionHeight = m_tabHeight + 2; - m_tabWidth = 80; - m_tabHorizontalOffset = 10; - m_tabHorizontalSpacing = 2; - m_tabVerticalTextSpacing = 3; - m_topMargin = 5; - m_tabViewRect.x = 20; - m_tabViewRect.y = 20; - m_tabViewRect.width = 300; - m_tabViewRect.x = 300; - m_highlightColour = *wxWHITE; - m_shadowColour = wxColour(128, 128, 128); - // m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); - m_textColour = *wxBLACK; - m_highlightPen = wxWHITE_PEN; - m_shadowPen = wxGREY_PEN; - // SetBackgroundColour(m_backgroundColour); - m_tabFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - m_tabSelectedFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - m_window = (wxWindow *) NULL; -} - -wxTabView::~wxTabView() -{ - ClearTabs(true); -} - -// 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. - wxTabLayerList::compatibility_iterator node = m_layers.GetLast(); - if (!node) - { - wxTabLayer *newLayer = new wxTabLayer; - node = m_layers.Append(newLayer); - } - // Check if adding another tab control would go off the - // right-hand edge of the layer. - wxTabLayer *tabLayer = (wxTabLayer *)node->GetData(); - wxList::compatibility_iterator lastTabNode = tabLayer->GetLast(); - if (lastTabNode) - { - wxTabControl *lastTab = (wxTabControl *)lastTabNode->GetData(); - // Start another layer (row). - // Tricky choice: can't just check if will be overlapping the edge, because - // this happens anyway for 2nd and subsequent rows. - // Should check this for 1st row, and then subsequent rows should not exceed 1st - // in length. - if (((tabLayer == m_layers.GetFirst()->GetData()) && ((lastTab->GetX() + 2*lastTab->GetWidth() + GetHorizontalTabSpacing()) - > GetViewRect().width)) || - ((tabLayer != m_layers.GetFirst()->GetData()) && (tabLayer->GetCount() == ((wxTabLayer *)m_layers.GetFirst()->GetData())->GetCount()))) - { - tabLayer = new wxTabLayer; - m_layers.Append(tabLayer); - lastTabNode = wxList::compatibility_iterator(); - } - } - int layer = m_layers.GetCount() - 1; - - wxTabControl *tabControl = existingTab; - if (!existingTab) - tabControl = OnCreateTabControl(); - tabControl->SetRowPosition(tabLayer->GetCount()); - tabControl->SetColPosition(layer); - - wxTabControl *lastTab = (wxTabControl *) NULL; - if (lastTabNode) - lastTab = (wxTabControl *)lastTabNode->GetData(); - - // Top of new tab - int verticalOffset = (- GetTopMargin()) - ((layer+1)*GetTabHeight()); - // Offset from view top-left - int horizontalOffset = 0; - if (!lastTab) - horizontalOffset = layer*GetHorizontalTabOffset(); - else - horizontalOffset = lastTab->GetX() + GetTabWidth() + GetHorizontalTabSpacing(); - - tabControl->SetPosition(horizontalOffset, verticalOffset); - tabControl->SetSize(GetTabWidth(), GetTabHeight()); - tabControl->SetId(id); - tabControl->SetLabel(label); - tabControl->SetFont(* GetTabFont()); - - tabLayer->Append(tabControl); - m_noTabs ++; - - return tabControl; -} - -// Remove the tab without deleting the window -bool wxTabView::RemoveTab(int id) -{ - wxTabLayerList::compatibility_iterator layerNode = m_layers.GetFirst(); - while (layerNode) - { - wxTabLayer *layer = (wxTabLayer *)layerNode->GetData(); - wxList::compatibility_iterator tabNode = layer->GetFirst(); - while (tabNode) - { - wxTabControl *tab = (wxTabControl *)tabNode->GetData(); - if (tab->GetId() == id) - { - if (id == m_tabSelection) - m_tabSelection = -1; - delete tab; - layer->Erase(tabNode); - m_noTabs --; - - // The layout has changed - LayoutTabs(); - return true; - } - tabNode = tabNode->GetNext(); - } - layerNode = layerNode->GetNext(); - } - return false; -} - -bool wxTabView::SetTabText(int id, const wxString& label) -{ - wxTabControl* control = FindTabControlForId(id); - if (!control) - return false; - control->SetLabel(label); - return true; -} - -wxString wxTabView::GetTabText(int id) const -{ - wxTabControl* control = FindTabControlForId(id); - if (!control) - return wxEmptyString; - else - return control->GetLabel(); -} - -// 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; - - wxTabLayerList::compatibility_iterator layerNode = m_layers.GetFirst(); - while (layerNode) - { - wxTabLayer *layer = (wxTabLayer *)layerNode->GetData(); - wxList::compatibility_iterator tabNode = layer->GetFirst(); - while (tabNode) - { - wxTabControl *tab = (wxTabControl *)tabNode->GetData(); - - if (tab->GetY() < minY) - minY = tab->GetY(); - - tabNode = tabNode->GetNext(); - } - layerNode = layerNode->GetNext(); - } - - return - minY; -} - -void wxTabView::ClearTabs(bool deleteTabs) -{ - wxTabLayerList::compatibility_iterator layerNode = m_layers.GetFirst(); - while (layerNode) - { - wxTabLayer *layer = (wxTabLayer *)layerNode->GetData(); - wxList::compatibility_iterator tabNode = layer->GetFirst(); - while (tabNode) - { - wxTabControl *tab = (wxTabControl *)tabNode->GetData(); - if (deleteTabs) - delete tab; - wxList::compatibility_iterator next = tabNode->GetNext(); - layer->Erase(tabNode); - tabNode = next; - } - wxTabLayerList::compatibility_iterator nextLayerNode = layerNode->GetNext(); - delete layer; - m_layers.Erase(layerNode); - layerNode = nextLayerNode; - } - m_noTabs = 0; - m_tabSelection = -1; -} - - -// Layout tabs (optional, e.g. if resizing window) -void wxTabView::LayoutTabs(void) -{ - // Make a list of the tab controls, deleting the wxTabLayers. - wxList controls; - - wxTabLayerList::compatibility_iterator layerNode = m_layers.GetFirst(); - while (layerNode) - { - wxTabLayer *layer = (wxTabLayer *)layerNode->GetData(); - wxList::compatibility_iterator tabNode = layer->GetFirst(); - while (tabNode) - { - wxTabControl *tab = (wxTabControl *)tabNode->GetData(); - controls.Append(tab); - wxList::compatibility_iterator next = tabNode->GetNext(); - layer->Erase(tabNode); - tabNode = next; - } - wxTabLayerList::compatibility_iterator nextLayerNode = layerNode->GetNext(); - delete layer; - m_layers.Erase(layerNode); - layerNode = nextLayerNode; - } - - wxTabControl *lastTab = (wxTabControl *) NULL; - - wxTabLayer *currentLayer = new wxTabLayer; - m_layers.Append(currentLayer); - - wxList::compatibility_iterator node = controls.GetFirst(); - while (node) - { - wxTabControl *tabControl = (wxTabControl *)node->GetData(); - if (lastTab) - { - // Start another layer (row). - // Tricky choice: can't just check if will be overlapping the edge, because - // this happens anyway for 2nd and subsequent rows. - // Should check this for 1st row, and then subsequent rows should not exceed 1st - // in length. - if (((currentLayer == m_layers.GetFirst()->GetData()) && ((lastTab->GetX() + 2*lastTab->GetWidth() + GetHorizontalTabSpacing()) - > GetViewRect().width)) || - ((currentLayer != m_layers.GetFirst()->GetData()) && (currentLayer->GetCount() == ((wxTabLayer *)m_layers.GetFirst()->GetData())->GetCount()))) - { - currentLayer = new wxTabLayer; - m_layers.Append(currentLayer); - lastTab = (wxTabControl *) NULL; - } - } - - int layer = m_layers.GetCount() - 1; - - tabControl->SetRowPosition(currentLayer->GetCount()); - tabControl->SetColPosition(layer); - - // Top of new tab - int verticalOffset = (- GetTopMargin()) - ((layer+1)*GetTabHeight()); - // Offset from view top-left - int horizontalOffset = 0; - if (!lastTab) - horizontalOffset = layer*GetHorizontalTabOffset(); - else - horizontalOffset = lastTab->GetX() + GetTabWidth() + GetHorizontalTabSpacing(); - - tabControl->SetPosition(horizontalOffset, verticalOffset); - tabControl->SetSize(GetTabWidth(), GetTabHeight()); - - currentLayer->Append(tabControl); - lastTab = tabControl; - - node = node->GetNext(); - } - - // Move the selected tab to the bottom - wxTabControl *control = FindTabControlForId(m_tabSelection); - if (control) - MoveSelectionTab(control); - -} - -// Draw all tabs -void wxTabView::Draw(wxDC& dc) -{ - // Don't draw anything if there are no tabs. - if (GetNumberOfTabs() == 0) - return; - - // Draw top margin area (beneath tabs and above view area) - if (GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR) - { - dc.SetPen(*wxTRANSPARENT_PEN); - if(GetBackgroundBrush()) - dc.SetBrush(*GetBackgroundBrush()); - - // Add 1 because the pen is transparent. Under Motif, may be different. - dc.DrawRectangle( - m_tabViewRect.x, - (m_tabViewRect.y - m_topMargin), - (m_tabViewRect.width + 1), - (m_topMargin + 1) - ); - } - - // Draw layers in reverse order - wxTabLayerList::compatibility_iterator node = m_layers.GetLast(); - while (node) - { - wxTabLayer *layer = (wxTabLayer *)node->GetData(); - wxList::compatibility_iterator node2 = layer->GetFirst(); - while (node2) - { - wxTabControl *control = (wxTabControl *)node2->GetData(); - control->OnDraw(dc, (!node2->GetNext())); - node2 = node2->GetNext(); - } - - node = node->GetPrevious(); - } - - -#ifndef wxUSE_NEW_METHOD - if (GetTabStyle() & wxTAB_STYLE_DRAW_BOX) - { - dc.SetPen(* GetShadowPen()); - - // Draw bottom line - dc.DrawLine( - (GetViewRect().x + 1), - (GetViewRect().y + GetViewRect().height), - (GetViewRect().x + GetViewRect().width + 1), - (GetViewRect().y + GetViewRect().height) - ); - - // Draw right line - dc.DrawLine( - (GetViewRect().x + GetViewRect().width), - (GetViewRect().y - GetTopMargin() + 1), - (GetViewRect().x + GetViewRect().width), - (GetViewRect().y + GetViewRect().height) - ); - - dc.SetPen(* wxBLACK_PEN); - - // Draw bottom line - dc.DrawLine( - (GetViewRect().x), - (GetViewRect().y + GetViewRect().height + 1), -#if defined(__WXMOTIF__) - (GetViewRect().x + GetViewRect().width + 1), -#else - (GetViewRect().x + GetViewRect().width + 2), -#endif - - (GetViewRect().y + GetViewRect().height + 1) - ); - - // Draw right line - dc.DrawLine( - (GetViewRect().x + GetViewRect().width + 1), - (GetViewRect().y - GetTopMargin()), - (GetViewRect().x + GetViewRect().width + 1), - (GetViewRect().y + GetViewRect().height + 1) - ); - } -#endif -} - -// Process mouse event, return false if we didn't process it -bool wxTabView::OnEvent(wxMouseEvent& event) -{ - if (!event.LeftDown()) - return false; - - wxCoord x, y; - event.GetPosition(&x, &y); - - wxTabControl *hitControl = (wxTabControl *) NULL; - - wxTabLayerList::compatibility_iterator node = m_layers.GetFirst(); - while (node) - { - wxTabLayer *layer = (wxTabLayer *)node->GetData(); - wxList::compatibility_iterator node2 = layer->GetFirst(); - while (node2) - { - wxTabControl *control = (wxTabControl *)node2->GetData(); - if (control->HitTest((int)x, (int)y)) - { - hitControl = control; - node = wxTabLayerList::compatibility_iterator(); - node2 = wxList::compatibility_iterator(); - } - else - node2 = node2->GetNext(); - } - - if (node) - node = node->GetNext(); - } - - if (!hitControl) - return false; - - wxTabControl *currentTab = FindTabControlForId(m_tabSelection); - - if (hitControl == currentTab) - return false; - - ChangeTab(hitControl); - - return true; -} - -bool wxTabView::ChangeTab(wxTabControl *control) -{ - wxTabControl *currentTab = FindTabControlForId(m_tabSelection); - int oldTab = -1; - if (currentTab) - oldTab = currentTab->GetId(); - - if (control == currentTab) - return true; - - if (m_layers.GetCount() == 0) - return false; - - if (!OnTabPreActivate(control->GetId(), oldTab)) - return false; - - // Move the tab to the bottom - MoveSelectionTab(control); - - if (currentTab) - currentTab->SetSelected(false); - - control->SetSelected(true); - m_tabSelection = control->GetId(); - - OnTabActivate(control->GetId(), oldTab); - - // Leave window refresh for the implementing window - - return true; -} - -// Move the selected tab to the bottom layer, if necessary, -// without calling app activation code -bool wxTabView::MoveSelectionTab(wxTabControl *control) -{ - if (m_layers.GetCount() == 0) - return false; - - wxTabLayer *firstLayer = (wxTabLayer *)m_layers.GetFirst()->GetData(); - - // Find what column this tab is at, so we can swap with the one at the bottom. - // If we're on the bottom layer, then no need to swap. - if (!firstLayer->Member(control)) - { - // Do a swap - int col = 0; - wxList::compatibility_iterator thisNode = FindTabNodeAndColumn(control, &col); - if (!thisNode) - return false; - wxList::compatibility_iterator otherNode = firstLayer->Item(col); - if (!otherNode) - return false; - - // If this is already in the bottom layer, return now - if (otherNode == thisNode) - return true; - - wxTabControl *otherTab = (wxTabControl *)otherNode->GetData(); - - // We now have pointers to the tab to be changed to, - // and the tab on the first layer. Swap tab structures and - // position details. - - int thisX = control->GetX(); - int thisY = control->GetY(); - int thisColPos = control->GetColPosition(); - int otherX = otherTab->GetX(); - int otherY = otherTab->GetY(); - int otherColPos = otherTab->GetColPosition(); - - control->SetPosition(otherX, otherY); - control->SetColPosition(otherColPos); - otherTab->SetPosition(thisX, thisY); - otherTab->SetColPosition(thisColPos); - - // Swap the data for the nodes - thisNode->SetData(otherTab); - otherNode->SetData(control); - } - return true; -} - -// Called when a tab is activated -void wxTabView::OnTabActivate(int /*activateId*/, int /*deactivateId*/) -{ -} - -void wxTabView::SetHighlightColour(const wxColour& col) -{ - m_highlightColour = col; - m_highlightPen = wxThePenList->FindOrCreatePen(col); -} - -void wxTabView::SetShadowColour(const wxColour& col) -{ - m_shadowColour = col; - m_shadowPen = wxThePenList->FindOrCreatePen(col); -} - -void wxTabView::SetBackgroundColour(const wxColour& col) -{ - m_backgroundColour = col; - m_backgroundPen = wxThePenList->FindOrCreatePen(col); - m_backgroundBrush = wxTheBrushList->FindOrCreateBrush(col); -} - -// this may be called with sel = zero (which doesn't match any page) -// when wxMotif deletes a page -// so return the first tab... - -void wxTabView::SetTabSelection(int sel, bool activateTool) -{ - if ( sel==m_tabSelection ) - return; - - int oldSel = m_tabSelection; - wxTabControl *control = FindTabControlForId(sel); - if (sel == 0) sel=control->GetId(); - wxTabControl *oldControl = FindTabControlForId(m_tabSelection); - - if (!OnTabPreActivate(sel, oldSel)) - return; - - if (control) - control->SetSelected((sel != -1)); // TODO ?? - else if (sel != -1) - { - wxFAIL_MSG(_("Could not find tab for id")); - return; - } - - if (oldControl) - oldControl->SetSelected(false); - - m_tabSelection = sel; - - if (control) - MoveSelectionTab(control); - - if (activateTool) - OnTabActivate(sel, oldSel); -} - -// Find tab control for id -// this may be called with zero (which doesn't match any page) -// so return the first control... -wxTabControl *wxTabView::FindTabControlForId(int id) const -{ - wxTabLayerList::compatibility_iterator node1 = m_layers.GetFirst(); - while (node1) - { - wxTabLayer *layer = (wxTabLayer *)node1->GetData(); - wxList::compatibility_iterator node2 = layer->GetFirst(); - while (node2) - { - wxTabControl *control = (wxTabControl *)node2->GetData(); - if (control->GetId() == id || id == 0) - return control; - node2 = node2->GetNext(); - } - node1 = node1->GetNext(); - } - return (wxTabControl *) NULL; -} - -// Find tab control for layer, position (starting from zero) -wxTabControl *wxTabView::FindTabControlForPosition(int layer, int position) const -{ - wxTabLayerList::compatibility_iterator node1 = m_layers.Item(layer); - if (!node1) - return (wxTabControl *) NULL; - wxTabLayer *tabLayer = (wxTabLayer *)node1->GetData(); - wxList::compatibility_iterator node2 = tabLayer->Item(position); - if (!node2) - return (wxTabControl *) NULL; - return (wxTabControl *)node2->GetData(); -} - -// Find the node and the column at which this control is positioned. -wxList::compatibility_iterator wxTabView::FindTabNodeAndColumn(wxTabControl *control, int *col) const -{ - wxTabLayerList::compatibility_iterator node1 = m_layers.GetFirst(); - while (node1) - { - wxTabLayer *layer = (wxTabLayer *)node1->GetData(); - int c = 0; - wxList::compatibility_iterator node2 = layer->GetFirst(); - while (node2) - { - wxTabControl *cnt = (wxTabControl *)node2->GetData(); - if (cnt == control) - { - *col = c; - return node2; - } - node2 = node2->GetNext(); - c ++; - } - node1 = node1->GetNext(); - } - return wxList::compatibility_iterator(); -} - -int wxTabView::CalculateTabWidth(int noTabs, bool adjustView) -{ - m_tabWidth = (int)((m_tabViewRect.width - ((noTabs - 1)*GetHorizontalTabSpacing()))/noTabs); - if (adjustView) - { - m_tabViewRect.width = noTabs*m_tabWidth + ((noTabs-1)*GetHorizontalTabSpacing()); - } - return m_tabWidth; -} - -/* - * wxTabbedDialog - */ - -IMPLEMENT_CLASS(wxTabbedDialog, wxDialog) - -BEGIN_EVENT_TABLE(wxTabbedDialog, wxDialog) - EVT_CLOSE(wxTabbedDialog::OnCloseWindow) - EVT_MOUSE_EVENTS(wxTabbedDialog::OnMouseEvent) - EVT_PAINT(wxTabbedDialog::OnPaint) -END_EVENT_TABLE() - -wxTabbedDialog::wxTabbedDialog(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos, const wxSize& size, - long windowStyle, const wxString& name): - wxDialog(parent, id, title, pos, size, windowStyle, name) -{ - m_tabView = (wxTabView *) NULL; -} - -wxTabbedDialog::~wxTabbedDialog(void) -{ - if (m_tabView) - delete m_tabView; -} - -void wxTabbedDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event) ) -{ - Destroy(); -} - -void wxTabbedDialog::OnMouseEvent(wxMouseEvent& event ) -{ - if (m_tabView) - m_tabView->OnEvent(event); -} - -void wxTabbedDialog::OnPaint(wxPaintEvent& WXUNUSED(event) ) -{ - wxPaintDC dc(this); - if (m_tabView) - m_tabView->Draw(dc); -} - -/* - * wxTabbedPanel - */ - -IMPLEMENT_CLASS(wxTabbedPanel, wxPanel) - -BEGIN_EVENT_TABLE(wxTabbedPanel, wxPanel) - EVT_MOUSE_EVENTS(wxTabbedPanel::OnMouseEvent) - EVT_PAINT(wxTabbedPanel::OnPaint) -END_EVENT_TABLE() - -wxTabbedPanel::wxTabbedPanel(wxWindow *parent, wxWindowID id, const wxPoint& pos, - const wxSize& size, long windowStyle, const wxString& name): - wxPanel(parent, id, pos, size, windowStyle, name) -{ - m_tabView = (wxTabView *) NULL; -} - -wxTabbedPanel::~wxTabbedPanel(void) -{ - delete m_tabView; -} - -void wxTabbedPanel::OnMouseEvent(wxMouseEvent& event) -{ - if (m_tabView) - m_tabView->OnEvent(event); -} - -void wxTabbedPanel::OnPaint(wxPaintEvent& WXUNUSED(event) ) -{ - wxPaintDC dc(this); - if (m_tabView) - m_tabView->Draw(dc); -} - -/* - * wxPanelTabView - */ - -IMPLEMENT_CLASS(wxPanelTabView, wxTabView) - -wxPanelTabView::wxPanelTabView(wxPanel *pan, long style) - : wxTabView(style) -{ - m_panel = pan; - m_currentWindow = (wxWindow *) NULL; - - if (m_panel->IsKindOf(CLASSINFO(wxTabbedDialog))) - ((wxTabbedDialog *)m_panel)->SetTabView(this); - else if (m_panel->IsKindOf(CLASSINFO(wxTabbedPanel))) - ((wxTabbedPanel *)m_panel)->SetTabView(this); - - SetWindow(m_panel); -} - -wxPanelTabView::~wxPanelTabView(void) -{ - ClearWindows(true); -} - -// Called when a tab is activated -void wxPanelTabView::OnTabActivate(int activateId, int deactivateId) -{ - if (!m_panel) - return; - - wxWindow *oldWindow = ((deactivateId == -1) ? 0 : GetTabWindow(deactivateId)); - wxWindow *newWindow = GetTabWindow(activateId); - - if (oldWindow) - oldWindow->Show(false); - if (newWindow) - newWindow->Show(true); - - m_panel->Refresh(); -} - - -void wxPanelTabView::AddTabWindow(int id, wxWindow *window) -{ - wxASSERT(m_tabWindows.find(id) == m_tabWindows.end()); - m_tabWindows[id] = window; - window->Show(false); -} - -wxWindow *wxPanelTabView::GetTabWindow(int id) const -{ - wxIntToWindowHashMap::const_iterator it = m_tabWindows.find(id); - return it == m_tabWindows.end() ? NULL : it->second; -} - -void wxPanelTabView::ClearWindows(bool deleteWindows) -{ - if (deleteWindows) - WX_CLEAR_HASH_MAP(wxIntToWindowHashMap, m_tabWindows); - m_tabWindows.clear(); -} - -void wxPanelTabView::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 // wxUSE_TAB_DIALOG diff --git a/src/msw/tabctrl.cpp b/src/msw/tabctrl.cpp deleted file mode 100644 index ddb0255c42..0000000000 --- a/src/msw/tabctrl.cpp +++ /dev/null @@ -1,432 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/tabctrl.cpp -// Purpose: wxTabCtrl -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TAB_DIALOG - -#ifndef WX_PRECOMP - #include "wx/msw/wrapcctl.h" // include "properly" - #include "wx/wx.h" - #include "wx/app.h" -#endif - -#include "wx/msw/private.h" - -#include "wx/tabctrl.h" -#include "wx/msw/imaglist.h" - -IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent) - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING) - -BEGIN_EVENT_TABLE(wxTabCtrl, wxControl) - EVT_SYS_COLOUR_CHANGED(wxTabCtrl::OnSysColourChanged) -END_EVENT_TABLE() - -wxTabCtrl::wxTabCtrl() -{ - m_imageList = NULL; -} - -bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name) -{ - m_imageList = NULL; - - m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), - GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); - m_foregroundColour = *wxBLACK ; - - SetName(name); - - int x = pos.x; - int y = pos.y; - int width = size.x; - int height = size.y; - - m_windowStyle = style; - - SetParent(parent); - - if (width <= 0) - width = 100; - if (height <= 0) - height = 30; - if (x < 0) - x = 0; - if (y < 0) - y = 0; - - m_windowId = (id < 0 ? NewControlId() : id); - - long tabStyle = WS_CHILD | WS_VISIBLE; - if (m_windowStyle & wxTC_MULTILINE) - tabStyle |= TCS_MULTILINE; - if (m_windowStyle & wxTC_RIGHTJUSTIFY) - tabStyle |= TCS_RIGHTJUSTIFY; - if (m_windowStyle & wxTC_FIXEDWIDTH) - tabStyle |= TCS_FIXEDWIDTH; - if (m_windowStyle & wxTC_OWNERDRAW) - tabStyle |= TCS_OWNERDRAWFIXED; - if (m_windowStyle & wxBORDER) - tabStyle |= WS_BORDER; - -#ifndef __WXWINCE__ - tabStyle |= TCS_TOOLTIPS; -#endif - - // Create the toolbar control. - HWND hWndTabCtrl = CreateWindowEx(0L, // No extended styles. - WC_TABCONTROL, // Class name for the tab control - wxEmptyString, // No default text. - tabStyle, // Styles and defaults. - x, y, width, height, // Standard size and position. - (HWND) parent->GetHWND(), // Parent window - (HMENU)m_windowId.GetValue(), // ID. - wxGetInstance(), // Current instance. - NULL ); // No class data. - - m_hWnd = (WXHWND) hWndTabCtrl; - if (parent) parent->AddChild(this); - - SubclassWin((WXHWND) hWndTabCtrl); - - SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - - return true; -} - -wxTabCtrl::~wxTabCtrl() -{ - UnsubclassWin(); -} - -bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) -{ - wxTabEvent event(wxEVT_NULL, m_windowId); - wxEventType eventType wxDUMMY_INITIALIZE(wxEVT_NULL); - NMHDR* hdr1 = (NMHDR*) lParam; - switch ( hdr1->code ) - { - case TCN_SELCHANGE: - eventType = wxEVT_COMMAND_TAB_SEL_CHANGED; - break; - - case TCN_SELCHANGING: - eventType = wxEVT_COMMAND_TAB_SEL_CHANGING; - break; - -#ifndef __WXWINCE__ - case TTN_NEEDTEXT: - { - // TODO -// if (!tool->m_shortHelpString.empty()) -// ttText->lpszText = (char *) (const char *)tool->m_shortHelpString; - } -#endif - default : - return wxControl::MSWOnNotify(idCtrl, lParam, result); - } - - event.SetEventObject( this ); - event.SetEventType(eventType); - event.SetInt(idCtrl) ; - event.SetSelection(idCtrl); - - return HandleWindowEvent(event); -} - -// Responds to colour changes, and passes event on to children. -void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event) -{ - m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), - GetGValue(GetSysColor(COLOR_BTNFACE)), - GetBValue(GetSysColor(COLOR_BTNFACE))); - - Refresh(); - - // Propagate the event to the non-top-level children - wxWindow::OnSysColourChanged(event); -} - -// Delete all items -bool wxTabCtrl::DeleteAllItems() -{ - return ( TabCtrl_DeleteAllItems( (HWND) GetHWND() ) != FALSE ); -} - -// Delete an item -bool wxTabCtrl::DeleteItem(int item) -{ - return ( TabCtrl_DeleteItem( (HWND) GetHWND(), item) != FALSE ); -} - -// Get the selection -int wxTabCtrl::GetSelection() const -{ - return (int) TabCtrl_GetCurSel( (HWND) GetHWND() ); -} - -// Get the tab with the current keyboard focus -int wxTabCtrl::GetCurFocus() const -{ - return (int) TabCtrl_GetCurFocus( (HWND) GetHWND() ); -} - -// Get the associated image list -wxImageList* wxTabCtrl::GetImageList() const -{ - return m_imageList; -} - -// Get the number of items -int wxTabCtrl::GetItemCount() const -{ - return (int) TabCtrl_GetItemCount( (HWND) GetHWND() ); -} - -// Get the rect corresponding to the tab -bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const -{ - RECT rect; - if ( !TabCtrl_GetItemRect( (HWND) GetHWND(), item, & rect) ) - return false; - else - { - wxrect.x = rect.left; wxrect.y = rect.top; - wxrect.width = rect.right - rect.left; - wxrect.height = rect.bottom - rect.top; - return true; - } -} - -// Get the number of rows -int wxTabCtrl::GetRowCount() const -{ - return (int) TabCtrl_GetRowCount( (HWND) GetHWND() ); -} - -// Get the item text -wxString wxTabCtrl::GetItemText(int item) const -{ - wxChar buf[256]; - wxString str(wxEmptyString); - TC_ITEM tcItem; - tcItem.mask = TCIF_TEXT; - tcItem.pszText = buf; - tcItem.cchTextMax = 256; - - if (TabCtrl_GetItem( (HWND) GetHWND(), item, & tcItem) ) - str = tcItem.pszText; - - return str; -} - -// Get the item image -int wxTabCtrl::GetItemImage(int item) const -{ - TC_ITEM tcItem; - tcItem.mask = TCIF_IMAGE; - - if (TabCtrl_GetItem( (HWND) GetHWND(), item, & tcItem) ) - return tcItem.iImage; - else - return -1; -} - -// Get the item data -void* wxTabCtrl::GetItemData(int item) const -{ - TC_ITEM tcItem; - tcItem.mask = TCIF_PARAM; - - if (TabCtrl_GetItem( (HWND) GetHWND(), item, & tcItem) ) - return (void*) tcItem.lParam; - else - return 0; -} - -// Hit test -int wxTabCtrl::HitTest(const wxPoint& pt, long& flags) -{ - TC_HITTESTINFO hitTestInfo; - hitTestInfo.pt.x = pt.x; - hitTestInfo.pt.y = pt.y; - int item = TabCtrl_HitTest( (HWND) GetHWND(), & hitTestInfo ) ; - flags = 0; - - if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE) - flags |= wxTAB_HITTEST_NOWHERE; - if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON) - flags |= wxTAB_HITTEST_ONICON; - if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL) - flags |= wxTAB_HITTEST_ONLABEL; - - return item; -} - -// Insert an item -bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data) -{ - wxChar buf[256]; - TC_ITEM tcItem; - tcItem.mask = TCIF_PARAM; - tcItem.lParam = (long) data; - if (!text.empty()) - { - tcItem.mask |= TCIF_TEXT; - wxStrcpy(buf, (const wxChar*) text); - tcItem.pszText = buf; - tcItem.cchTextMax = 256; - } - if (imageId != -1) - { - tcItem.mask |= TCIF_IMAGE; - tcItem.iImage = imageId; - } - - return (TabCtrl_InsertItem( (HWND) GetHWND(), item, & tcItem) != -1); -} - -// Set the selection -int wxTabCtrl::SetSelection(int item) -{ - return (int) TabCtrl_SetCurSel( (HWND) GetHWND(), item ); -} - -// Set the image list -void wxTabCtrl::SetImageList(wxImageList* imageList) -{ - m_imageList = imageList; - (void) TabCtrl_SetImageList( (HWND) GetHWND(), (HIMAGELIST) imageList->GetHIMAGELIST() ); -} - -// Set the text for an item -bool wxTabCtrl::SetItemText(int item, const wxString& text) -{ - wxChar buf[256]; - TC_ITEM tcItem; - tcItem.mask = TCIF_TEXT; - wxStrcpy(buf, (const wxChar*) text); - tcItem.pszText = buf; - tcItem.cchTextMax = 256; - - return ( TabCtrl_SetItem( (HWND) GetHWND(), item, & tcItem) != 0 ); -} - -// Set the image for an item -bool wxTabCtrl::SetItemImage(int item, int image) -{ - TC_ITEM tcItem; - tcItem.mask = TCIF_IMAGE; - tcItem.iImage = image; - - return ( TabCtrl_SetItem( (HWND) GetHWND(), item, & tcItem) != 0 ); -} - -// Set the data for an item -bool wxTabCtrl::SetItemData(int item, void* data) -{ - TC_ITEM tcItem; - tcItem.mask = TCIF_PARAM; - tcItem.lParam = (long) data; - - return ( TabCtrl_SetItem( (HWND) GetHWND(), item, & tcItem) != 0 ); -} - -// Set the size for a fixed-width tab control -void wxTabCtrl::SetItemSize(const wxSize& size) -{ - TabCtrl_SetItemSize( (HWND) GetHWND(), size.x, size.y ); -} - -// Set the padding between tabs -void wxTabCtrl::SetPadding(const wxSize& padding) -{ - TabCtrl_SetPadding( (HWND) GetHWND(), padding.x, padding.y ); -} - -#if 0 -// These are the default colors used to map the bitmap colors -// to the current system colors - -#define BGR_BUTTONTEXT (RGB(000,000,000)) // black -#define BGR_BUTTONSHADOW (RGB(128,128,128)) // dark grey -#define BGR_BUTTONFACE (RGB(192,192,192)) // bright grey -#define BGR_BUTTONHILIGHT (RGB(255,255,255)) // white -#define BGR_BACKGROUNDSEL (RGB(255,000,000)) // blue -#define BGR_BACKGROUND (RGB(255,000,255)) // magenta - -void wxMapBitmap(HBITMAP hBitmap, int width, int height) -{ - COLORMAP ColorMap[] = { - {BGR_BUTTONTEXT, COLOR_BTNTEXT}, // black - {BGR_BUTTONSHADOW, COLOR_BTNSHADOW}, // dark grey - {BGR_BUTTONFACE, COLOR_BTNFACE}, // bright grey - {BGR_BUTTONHILIGHT, COLOR_BTNHIGHLIGHT},// white - {BGR_BACKGROUNDSEL, COLOR_HIGHLIGHT}, // blue - {BGR_BACKGROUND, COLOR_WINDOW} // magenta - }; - - int NUM_MAPS = (sizeof(ColorMap)/sizeof(COLORMAP)); - int n; - for ( n = 0; n < NUM_MAPS; n++) - { - ColorMap[n].to = ::GetSysColor(ColorMap[n].to); - } - - HBITMAP hbmOld; - HDC hdcMem = CreateCompatibleDC(NULL); - - if (hdcMem) - { - hbmOld = SelectObject(hdcMem, hBitmap); - - int i, j, k; - for ( i = 0; i < width; i++) - { - for ( j = 0; j < height; j++) - { - COLORREF pixel = ::GetPixel(hdcMem, i, j); -/* - BYTE red = GetRValue(pixel); - BYTE green = GetGValue(pixel); - BYTE blue = GetBValue(pixel); -*/ - - for ( k = 0; k < NUM_MAPS; k ++) - { - if ( ColorMap[k].from == pixel ) - { - /* COLORREF actualPixel = */ ::SetPixel(hdcMem, i, j, ColorMap[k].to); - break; - } - } - } - } - - - SelectObject(hdcMem, hbmOld); - DeleteObject(hdcMem); - } - -} -#endif - -#endif // wxUSE_TAB_DIALOG diff --git a/src/os2/tabctrl.cpp b/src/os2/tabctrl.cpp deleted file mode 100644 index 2d4191e90d..0000000000 --- a/src/os2/tabctrl.cpp +++ /dev/null @@ -1,360 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/os2/tabctrl.cpp -// Purpose: wxTabCtrl -// Author: David Webster -// Modified by: -// Created: 10/17/99 -// RCS-ID: $Id$ -// Copyright: (c) David Webster -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if wxUSE_TAB_DIALOG - -#ifndef WX_PRECOMP - #include "wx/wx.h" - #include "wx/app.h" -#endif - -#include "malloc.h" - -#define INCL_PM -#include - -//#include "wx/msw/dib.h" -#include "wx/os2/tabctrl.h" -#include "wx/os2/private.h" -#include "wx/imaglist.h" - -IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl) - -BEGIN_EVENT_TABLE(wxTabCtrl, wxControl) -END_EVENT_TABLE() - -wxTabCtrl::wxTabCtrl() -{ - m_imageList = NULL; -} - -bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name) -{ - m_imageList = NULL; - - m_backgroundColour = *wxWHITE; // TODO: wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), -// GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); - m_foregroundColour = *wxBLACK ; - - SetName(name); - - int x = pos.x; - int y = pos.y; - int width = size.x; - int height = size.y; - - m_windowStyle = style; - - SetFont(* (wxTheFontList->FindOrCreateFont(11, wxSWISS, wxNORMAL, wxNORMAL))); - - SetParent(parent); - - if (width <= 0) - width = 100; - if (height <= 0) - height = 30; - if (x < 0) - x = 0; - if (y < 0) - y = 0; - - m_windowId = (id < 0 ? NewControlId() : id); - - // Create the toolbar control. - HWND hWndTabCtrl = 0; - // TODO: create tab control - - m_hWnd = (WXHWND) hWndTabCtrl; - if (parent) parent->AddChild(this); - - SubclassWin((WXHWND) hWndTabCtrl); - - return false; -} - -wxTabCtrl::~wxTabCtrl() -{ - UnsubclassWin(); -} - -bool wxTabCtrl::OS2OnNotify(int idCtrl, - WXLPARAM WXUNUSED(lParam), - WXLPARAM *WXUNUSED(result) ) -{ - wxTabEvent event(wxEVT_NULL, m_windowId); - wxEventType eventType = wxEVT_NULL; -// TODO: -/* - NMHDR* hdr1 = (NMHDR*) lParam; - switch ( hdr1->code ) - { - case TCN_SELCHANGE: - eventType = wxEVT_COMMAND_TAB_SEL_CHANGED; - break; - - case TCN_SELCHANGING: - eventType = wxEVT_COMMAND_TAB_SEL_CHANGING; - break; - - case TTN_NEEDTEXT: - { - // TODO -// if (tool->m_shortHelpString != "") -// ttText->lpszText = (char *) (const char *)tool->m_shortHelpString; - } - - default : - return wxControl::OS2OnNotify(idCtrl, lParam, result); - } -*/ - event.SetEventObject( this ); - event.SetEventType(eventType); - event.SetInt(idCtrl) ; - - return ProcessEvent(event); -} - -// Responds to colour changes, and passes event on to children. -void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event) -{ - // TODO: -/* - m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), - GetGValue(GetSysColor(COLOR_BTNFACE)), - GetBValue(GetSysColor(COLOR_BTNFACE))); - - Refresh(); -*/ - // Propagate the event to the non-top-level children - wxWindow::OnSysColourChanged(event); -} - - -// Delete all items -bool wxTabCtrl::DeleteAllItems() -{ - // TODO - return false; -} - -// Delete an item -bool wxTabCtrl::DeleteItem(int WXUNUSED(item)) -{ - // TODO - return false; -} - -// Get the selection -int wxTabCtrl::GetSelection() const -{ - // TODO - return 0; -} - -// Get the tab with the current keyboard focus -int wxTabCtrl::GetCurFocus() const -{ - // TODO - return 0; -} - -// Get the associated image list -wxImageList* wxTabCtrl::GetImageList() const -{ - return m_imageList; -} - -// Get the number of items -int wxTabCtrl::GetItemCount() const -{ - // TODO - return 0; -} - -// Get the rect corresponding to the tab -bool wxTabCtrl::GetItemRect(int WXUNUSED(item), - wxRect& WXUNUSED(wxrect)) const -{ - // TODO - return false; -} - -// Get the number of rows -int wxTabCtrl::GetRowCount() const -{ - // TODO - return 0; -} - -// Get the item text -wxString wxTabCtrl::GetItemText(int WXUNUSED(item)) const -{ - // TODO - return wxEmptyString; -} - -// Get the item image -int wxTabCtrl::GetItemImage(int WXUNUSED(item)) const -{ - // TODO - return 0; -} - -// Get the item data -void* wxTabCtrl::GetItemData(int WXUNUSED(item)) const -{ - // TODO - return NULL; -} - -// Hit test -int wxTabCtrl::HitTest(const wxPoint& WXUNUSED(pt), long& WXUNUSED(flags)) -{ - // TODO - return 0; -} - -// Insert an item -bool wxTabCtrl::InsertItem(int WXUNUSED(item), - const wxString& WXUNUSED(text), - int WXUNUSED(imageId), - void* WXUNUSED(data)) -{ - // TODO - return false; -} - -// Set the selection -int wxTabCtrl::SetSelection(int WXUNUSED(item)) -{ - // TODO - return 0; -} - -// Set the image list -void wxTabCtrl::SetImageList(wxImageList* WXUNUSED(imageList)) -{ - // TODO -} - -// Set the text for an item -bool wxTabCtrl::SetItemText(int WXUNUSED(item), const wxString& WXUNUSED(text)) -{ - // TODO - return false; -} - -// Set the image for an item -bool wxTabCtrl::SetItemImage(int WXUNUSED(item), int WXUNUSED(image)) -{ - // TODO - return false; -} - -// Set the data for an item -bool wxTabCtrl::SetItemData(int WXUNUSED(item), void* WXUNUSED(data)) -{ - // TODO - return false; -} - -// Set the size for a fixed-width tab control -void wxTabCtrl::SetItemSize(const wxSize& WXUNUSED(size)) -{ - // TODO -} - -// Set the padding between tabs -void wxTabCtrl::SetPadding(const wxSize& WXUNUSED(padding)) -{ - // TODO -} - -#if 0 -// These are the default colors used to map the bitmap colors -// to the current system colors - -#define BGR_BUTTONTEXT (RGB(000,000,000)) // black -#define BGR_BUTTONSHADOW (RGB(128,128,128)) // dark grey -#define BGR_BUTTONFACE (RGB(192,192,192)) // bright grey -#define BGR_BUTTONHILIGHT (RGB(255,255,255)) // white -#define BGR_BACKGROUNDSEL (RGB(255,000,000)) // blue -#define BGR_BACKGROUND (RGB(255,000,255)) // magenta - -void wxMapBitmap(HBITMAP hBitmap, int width, int height) -{ - COLORMAP ColorMap[] = { - {BGR_BUTTONTEXT, COLOR_BTNTEXT}, // black - {BGR_BUTTONSHADOW, COLOR_BTNSHADOW}, // dark grey - {BGR_BUTTONFACE, COLOR_BTNFACE}, // bright grey - {BGR_BUTTONHILIGHT, COLOR_BTNHIGHLIGHT},// white - {BGR_BACKGROUNDSEL, COLOR_HIGHLIGHT}, // blue - {BGR_BACKGROUND, COLOR_WINDOW} // magenta - }; - - int NUM_MAPS = (sizeof(ColorMap)/sizeof(COLORMAP)); - int n; - for ( n = 0; n < NUM_MAPS; n++) - { - ColorMap[n].to = ::GetSysColor(ColorMap[n].to); - } - - HBITMAP hbmOld; - HDC hdcMem = CreateCompatibleDC(NULL); - - if (hdcMem) - { - hbmOld = SelectObject(hdcMem, hBitmap); - - int i, j, k; - for ( i = 0; i < width; i++) - { - for ( j = 0; j < height; j++) - { - COLORREF pixel = ::GetPixel(hdcMem, i, j); -/* - BYTE red = GetRValue(pixel); - BYTE green = GetGValue(pixel); - BYTE blue = GetBValue(pixel); -*/ - - for ( k = 0; k < NUM_MAPS; k ++) - { - if ( ColorMap[k].from == pixel ) - { - /* COLORREF actualPixel = */ ::SetPixel(hdcMem, i, j, ColorMap[k].to); - break; - } - } - } - } - - - SelectObject(hdcMem, hbmOld); - DeleteObject(hdcMem); - } - -} -#endif - -// Tab event -IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxCommandEvent) - -wxTabEvent::wxTabEvent(wxEventType commandType, int id) - :wxCommandEvent(commandType, id) -{ -} - -#endif // wxUSE_TAB_DIALOG diff --git a/src/osx/carbon/tabctrl.cpp b/src/osx/carbon/tabctrl.cpp deleted file mode 100644 index 16bb6fe4d3..0000000000 --- a/src/osx/carbon/tabctrl.cpp +++ /dev/null @@ -1,18 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/tabctrl.cpp -// Purpose: wxTabCtrl -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// RCS-ID: $Id$ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_TAB_DIALOG - -// superseeded by wxNotebook implementation, skeleton moved to src/osx/ - -#endif // wxUSE_TAB_DIALOG diff --git a/src/osx/tabctrl_osx.cpp b/src/osx/tabctrl_osx.cpp deleted file mode 100644 index ba577edb90..0000000000 --- a/src/osx/tabctrl_osx.cpp +++ /dev/null @@ -1,190 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/tabctrl_osx.cpp -// Purpose: wxTabCtrl -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// RCS-ID: $Id: tabctrl.cpp 54129 2008-06-11 19:30:52Z SC $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_TAB_DIALOG - -#include "wx/tabctrl.h" - -#ifndef WX_PRECOMP - #include "wx/control.h" -#endif - -#include "wx/osx/private.h" - -IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent) - -// this control has been superseeded by the native wxNotebook implementation, but -// we leave the skeleton here, just in case it might become useful ... - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING) - - -BEGIN_EVENT_TABLE(wxTabCtrl, wxControl) -END_EVENT_TABLE() - - -wxTabCtrl::wxTabCtrl() -{ - m_macIsUserPane = false; - m_imageList = NULL; -} - -bool wxTabCtrl::Create( wxWindow *parent, - wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name ) -{ - m_macIsUserPane = false; - m_imageList = NULL; - - if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) - return false; - - m_peer = wxWidgetImpl::CreateTabView( this, parent, id, pos, size, style, GetExtraStyle ); - - MacPostControlCreate( pos, size ); - - return true; -} - -wxTabCtrl::~wxTabCtrl() -{ -} - -void wxTabCtrl::Command(wxCommandEvent& event) -{ -} - -bool wxTabCtrl::DeleteAllItems() -{ - // TODO: - return false; -} - -bool wxTabCtrl::DeleteItem(int item) -{ - // TODO: - return false; -} - -int wxTabCtrl::GetSelection() const -{ - // TODO: - return 0; -} - -// Get the tab with the current keyboard focus -// -int wxTabCtrl::GetCurFocus() const -{ - // TODO: - return 0; -} - -wxImageList * wxTabCtrl::GetImageList() const -{ - return m_imageList; -} - -int wxTabCtrl::GetItemCount() const -{ - // TODO: - return 0; -} - -// Get the rect corresponding to the tab -bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const -{ - // TODO: - return false; -} - -int wxTabCtrl::GetRowCount() const -{ - // TODO: - return 0; -} - -wxString wxTabCtrl::GetItemText(int item) const -{ - // TODO: - return wxEmptyString; -} - -int wxTabCtrl::GetItemImage(int item) const -{ - // TODO: - return 0; -} - -void* wxTabCtrl::GetItemData(int item) const -{ - // TODO: - return NULL; -} - -int wxTabCtrl::HitTest(const wxPoint& pt, long& flags) -{ - // TODO: - return 0; -} - -bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data) -{ - // TODO: - return false; -} - -int wxTabCtrl::SetSelection(int item) -{ - // TODO: - return 0; -} - -void wxTabCtrl::SetImageList(wxImageList* imageList) -{ - // TODO: -} - -bool wxTabCtrl::SetItemText(int item, const wxString& text) -{ - // TODO: - return false; -} - -bool wxTabCtrl::SetItemImage(int item, int image) -{ - // TODO: - return false; -} - -bool wxTabCtrl::SetItemData(int item, void* data) -{ - // TODO: - return false; -} - -// Set the size for a fixed-width tab control -void wxTabCtrl::SetItemSize(const wxSize& size) -{ - // TODO: -} - -// Set the padding between tabs -void wxTabCtrl::SetPadding(const wxSize& padding) -{ - // TODO: -} - -#endif // wxUSE_TAB_DIALOG diff --git a/src/palmos/tabctrl.cpp b/src/palmos/tabctrl.cpp deleted file mode 100644 index 17f24e9420..0000000000 --- a/src/palmos/tabctrl.cpp +++ /dev/null @@ -1,182 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/palmos/tabctrl.cpp -// Purpose: wxTabCtrl -// Author: William Osborne - minimal working wxPalmOS port -// Modified by: -// Created: 10/13/04 -// RCS-ID: $Id$ -// Copyright: (c) William Osborne -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TAB_DIALOG - -#ifndef WX_PRECOMP - #include "wx/wx.h" - #include "wx/app.h" -#endif - -#if defined(__WIN95__) - -#include "wx/tabctrl.h" -#include "wx/palmos/imaglist.h" - -IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent) - -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING) - -BEGIN_EVENT_TABLE(wxTabCtrl, wxControl) -END_EVENT_TABLE() - -wxTabCtrl::wxTabCtrl() -{ -} - -bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name) -{ - return false; -} - -wxTabCtrl::~wxTabCtrl() -{ -} - -bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) -{ - return false; -} - -// Delete all items -bool wxTabCtrl::DeleteAllItems() -{ - return false; -} - -// Delete an item -bool wxTabCtrl::DeleteItem(int item) -{ - return false; -} - -// Get the selection -int wxTabCtrl::GetSelection() const -{ - return 0; -} - -// Get the tab with the current keyboard focus -int wxTabCtrl::GetCurFocus() const -{ - return 0; -} - -// Get the associated image list -wxImageList* wxTabCtrl::GetImageList() const -{ - return NULL; -} - -// Get the number of items -int wxTabCtrl::GetItemCount() const -{ - return 0; -} - -// Get the rect corresponding to the tab -bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const -{ - return false; -} - -// Get the number of rows -int wxTabCtrl::GetRowCount() const -{ - return 0; -} - -// Get the item text -wxString wxTabCtrl::GetItemText(int item) const -{ - wxString str(wxEmptyString); - - return str; -} - -// Get the item image -int wxTabCtrl::GetItemImage(int item) const -{ - return -1; -} - -// Get the item data -void* wxTabCtrl::GetItemData(int item) const -{ - return 0; -} - -// Hit test -int wxTabCtrl::HitTest(const wxPoint& pt, long& flags) -{ - return 0; -} - -// Insert an item -bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data) -{ - return false; -} - -// Set the selection -int wxTabCtrl::SetSelection(int item) -{ - return 0; -} - -// Set the image list -void wxTabCtrl::SetImageList(wxImageList* imageList) -{ -} - -// Set the text for an item -bool wxTabCtrl::SetItemText(int item, const wxString& text) -{ - return false; -} - -// Set the image for an item -bool wxTabCtrl::SetItemImage(int item, int image) -{ - return false; -} - -// Set the data for an item -bool wxTabCtrl::SetItemData(int item, void* data) -{ - return false; -} - -// Set the size for a fixed-width tab control -void wxTabCtrl::SetItemSize(const wxSize& size) -{ -} - -// Set the padding between tabs -void wxTabCtrl::SetPadding(const wxSize& padding) -{ -} - - -#endif - // __WIN95__ - -#endif // wxUSE_TAB_DIALOG -- 2.47.2