Various fixes for wxMotif
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10906 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxAcceleratorTable;
|
class WXDLLEXPORT wxAcceleratorTable;
|
||||||
class WXDLLEXPORT wxMenuItem;
|
class WXDLLEXPORT wxMenuItem;
|
||||||
|
class WXDLLEXPORT wxKeyEvent;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
@@ -74,6 +75,11 @@ public:
|
|||||||
bool operator!=(const wxAcceleratorEntry& entry) const
|
bool operator!=(const wxAcceleratorEntry& entry) const
|
||||||
{ return !(*this == entry); }
|
{ return !(*this == entry); }
|
||||||
|
|
||||||
|
#ifdef __WXMOTIF__
|
||||||
|
// Implementation use only
|
||||||
|
bool MatchesEvent(const wxKeyEvent& event) const ;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_flags; // combination of wxACCEL_XXX constants
|
int m_flags; // combination of wxACCEL_XXX constants
|
||||||
int m_keyCode; // ASCII or virtual keycode
|
int m_keyCode; // ASCII or virtual keycode
|
||||||
|
@@ -31,9 +31,12 @@
|
|||||||
class WXDLLEXPORT wxImageList;
|
class WXDLLEXPORT wxImageList;
|
||||||
class WXDLLEXPORT wxWindow;
|
class WXDLLEXPORT wxWindow;
|
||||||
|
|
||||||
|
// Already defined in wx/notebook.h
|
||||||
|
#if 0
|
||||||
// array of notebook pages
|
// array of notebook pages
|
||||||
typedef wxWindow wxNotebookPage; // so far, any window can be a page
|
typedef wxWindow wxNotebookPage; // so far, any window can be a page
|
||||||
WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages);
|
WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages);
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxNotebook
|
// wxNotebook
|
||||||
@@ -56,7 +59,7 @@ protected:
|
|||||||
wxNotebook* m_notebook;
|
wxNotebook* m_notebook;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxNotebook : public wxControl
|
class wxNotebook : public wxNotebookBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// ctors
|
// ctors
|
||||||
@@ -82,9 +85,6 @@ public:
|
|||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
// ---------
|
// ---------
|
||||||
// get number of pages in the dialog
|
|
||||||
int GetPageCount() const;
|
|
||||||
|
|
||||||
// Find the position of the wxNotebookPage, -1 if not found.
|
// Find the position of the wxNotebookPage, -1 if not found.
|
||||||
int FindPagePosition(wxNotebookPage* page) const;
|
int FindPagePosition(wxNotebookPage* page) const;
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
|
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
|
||||||
int SetSelection(int nPage);
|
int SetSelection(int nPage);
|
||||||
// cycle thru the tabs
|
// cycle thru the tabs
|
||||||
void AdvanceSelection(bool bForward = TRUE);
|
// void AdvanceSelection(bool bForward = TRUE);
|
||||||
// get the currently selected page
|
// get the currently selected page
|
||||||
int GetSelection() const { return m_nSelection; }
|
int GetSelection() const { return m_nSelection; }
|
||||||
|
|
||||||
@@ -101,24 +101,14 @@ public:
|
|||||||
bool SetPageText(int nPage, const wxString& strText);
|
bool SetPageText(int nPage, const wxString& strText);
|
||||||
wxString GetPageText(int nPage) const;
|
wxString GetPageText(int nPage) const;
|
||||||
|
|
||||||
// image list stuff: each page may have an image associated with it. All
|
// get the number of rows for a control with wxNB_MULTILINE style (not all
|
||||||
// the images belong to an image list, so you have to
|
// versions support it - they will always return 1 then)
|
||||||
// 1) create an image list
|
virtual int GetRowCount() const ;
|
||||||
// 2) associate it with the notebook
|
|
||||||
// 3) set for each page it's image
|
|
||||||
// associate image list with a control
|
|
||||||
void SetImageList(wxImageList* imageList);
|
|
||||||
// get pointer (may be NULL) to the associated image list
|
|
||||||
wxImageList* GetImageList() const { return m_pImageList; }
|
|
||||||
|
|
||||||
// sets/returns item's image index in the current image list
|
// sets/returns item's image index in the current image list
|
||||||
int GetPageImage(int nPage) const;
|
int GetPageImage(int nPage) const;
|
||||||
bool SetPageImage(int nPage, int nImage);
|
bool SetPageImage(int nPage, int nImage);
|
||||||
|
|
||||||
// currently it's always 1 because wxGTK doesn't support multi-row
|
|
||||||
// tab controls
|
|
||||||
int GetRowCount() const;
|
|
||||||
|
|
||||||
// control the appearance of the notebook pages
|
// control the appearance of the notebook pages
|
||||||
// set the size (the same for all pages)
|
// set the size (the same for all pages)
|
||||||
void SetPageSize(const wxSize& size);
|
void SetPageSize(const wxSize& size);
|
||||||
@@ -138,20 +128,12 @@ public:
|
|||||||
bool RemovePage(wxNotebookPage* page);
|
bool RemovePage(wxNotebookPage* page);
|
||||||
// remove all pages
|
// remove all pages
|
||||||
bool DeleteAllPages();
|
bool DeleteAllPages();
|
||||||
// adds a new page to the notebook (it will be deleted ny the notebook,
|
|
||||||
// don't delete it yourself). If bSelect, this page becomes active.
|
|
||||||
bool AddPage(wxNotebookPage *pPage,
|
|
||||||
const wxString& strText,
|
|
||||||
bool bSelect = FALSE,
|
|
||||||
int imageId = -1);
|
|
||||||
// the same as AddPage(), but adds it at the specified position
|
// the same as AddPage(), but adds it at the specified position
|
||||||
bool InsertPage(int nPage,
|
bool InsertPage(int nPage,
|
||||||
wxNotebookPage *pPage,
|
wxNotebookPage *pPage,
|
||||||
const wxString& strText,
|
const wxString& strText,
|
||||||
bool bSelect = FALSE,
|
bool bSelect = FALSE,
|
||||||
int imageId = -1);
|
int imageId = -1);
|
||||||
// get the panel which represents the given page
|
|
||||||
wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
|
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
// ---------
|
// ---------
|
||||||
@@ -189,9 +171,11 @@ protected:
|
|||||||
// helper functions
|
// helper functions
|
||||||
void ChangePage(int nOldSel, int nSel); // change pages
|
void ChangePage(int nOldSel, int nSel); // change pages
|
||||||
|
|
||||||
|
#if 0
|
||||||
wxImageList *m_pImageList; // we can have an associated image list
|
wxImageList *m_pImageList; // we can have an associated image list
|
||||||
wxArrayPages m_aPages; // array of pages
|
wxArrayPages m_aPages; // array of pages
|
||||||
|
#endif
|
||||||
|
|
||||||
int m_nSelection; // the current selection (-1 if none)
|
int m_nSelection; // the current selection (-1 if none)
|
||||||
|
|
||||||
wxTabView* m_tabView;
|
wxTabView* m_tabView;
|
||||||
|
@@ -256,7 +256,7 @@ public:
|
|||||||
wxList& GetItems() const { return (wxList &)m_items; }
|
wxList& GetItems() const { return (wxList &)m_items; }
|
||||||
#endif // WXWIN_COMPATIBILITY
|
#endif // WXWIN_COMPATIBILITY
|
||||||
|
|
||||||
#if wxUSE_MENU_CALLBACK
|
#if wxUSE_MENU_CALLBACK || defined(__WXMOTIF__)
|
||||||
// wxWin 1.6x compatible menu event handling
|
// wxWin 1.6x compatible menu event handling
|
||||||
wxFunction GetCallback() const { return m_callback; }
|
wxFunction GetCallback() const { return m_callback; }
|
||||||
void Callback(const wxFunction func) { m_callback = func; }
|
void Callback(const wxFunction func) { m_callback = func; }
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxAcceleratorTable;
|
class WXDLLEXPORT wxAcceleratorTable;
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Hold Ctrl key down
|
// Hold Ctrl key down
|
||||||
#define wxACCEL_ALT 0x01
|
#define wxACCEL_ALT 0x01
|
||||||
|
|
||||||
@@ -66,6 +67,7 @@ public:
|
|||||||
int m_keyCode; // ASCII or virtual keycode
|
int m_keyCode; // ASCII or virtual keycode
|
||||||
int m_command; // Command id to generate
|
int m_command; // Command id to generate
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
class WXDLLEXPORT wxAcceleratorTable: public wxObject
|
class WXDLLEXPORT wxAcceleratorTable: public wxObject
|
||||||
{
|
{
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_POPUPWIN
|
#if wxUSE_POPUPWIN && !defined(__WXMOTIF__)
|
||||||
|
|
||||||
#include "wx/popupwin.h"
|
#include "wx/popupwin.h"
|
||||||
|
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/generic/helpxlp.h"
|
#include "wx/generic/helpxlp.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
|
#include "wx/msgdlg.h"
|
||||||
|
|
||||||
#if wxUSE_HELP
|
#if wxUSE_HELP
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@@ -73,7 +73,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
|
|||||||
void wxNotebook::Init()
|
void wxNotebook::Init()
|
||||||
{
|
{
|
||||||
m_tabView = (wxNotebookTabView*) NULL;
|
m_tabView = (wxNotebookTabView*) NULL;
|
||||||
m_pImageList = NULL;
|
|
||||||
m_nSelection = -1;
|
m_nSelection = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,11 +128,6 @@ wxNotebook::~wxNotebook()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxNotebook accessors
|
// wxNotebook accessors
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
int wxNotebook::GetPageCount() const
|
|
||||||
{
|
|
||||||
return m_aPages.Count();
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxNotebook::GetRowCount() const
|
int wxNotebook::GetRowCount() const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
@@ -158,6 +152,7 @@ int wxNotebook::SetSelection(int nPage)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void wxNotebook::AdvanceSelection(bool bForward)
|
void wxNotebook::AdvanceSelection(bool bForward)
|
||||||
{
|
{
|
||||||
int nSel = GetSelection();
|
int nSel = GetSelection();
|
||||||
@@ -167,6 +162,7 @@ void wxNotebook::AdvanceSelection(bool bForward)
|
|||||||
else
|
else
|
||||||
SetSelection(nSel == 0 ? nMax : nSel - 1);
|
SetSelection(nSel == 0 ? nMax : nSel - 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
|
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
|
||||||
{
|
{
|
||||||
@@ -218,12 +214,6 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNotebook::SetImageList(wxImageList* imageList)
|
|
||||||
{
|
|
||||||
m_pImageList = imageList;
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxNotebook operations
|
// wxNotebook operations
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -235,8 +225,8 @@ bool wxNotebook::DeletePage(int nPage)
|
|||||||
|
|
||||||
if (m_nSelection != -1)
|
if (m_nSelection != -1)
|
||||||
{
|
{
|
||||||
m_aPages[m_nSelection]->Show(FALSE);
|
m_pages[m_nSelection]->Show(FALSE);
|
||||||
m_aPages[m_nSelection]->Lower();
|
m_pages[m_nSelection]->Lower();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNotebookPage* pPage = GetPage(nPage);
|
wxNotebookPage* pPage = GetPage(nPage);
|
||||||
@@ -246,10 +236,10 @@ bool wxNotebook::DeletePage(int nPage)
|
|||||||
m_tabView->RemoveTab((int) (long) pPage);
|
m_tabView->RemoveTab((int) (long) pPage);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete m_aPages[nPage];
|
m_pages.Remove(pPage);
|
||||||
m_aPages.Remove(nPage);
|
delete pPage;
|
||||||
|
|
||||||
if (m_aPages.GetCount() == 0)
|
if (m_pages.GetCount() == 0)
|
||||||
{
|
{
|
||||||
m_nSelection = -1;
|
m_nSelection = -1;
|
||||||
m_tabView->SetTabSelection(-1, FALSE);
|
m_tabView->SetTabSelection(-1, FALSE);
|
||||||
@@ -285,8 +275,8 @@ bool wxNotebook::RemovePage(int nPage)
|
|||||||
{
|
{
|
||||||
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
|
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
|
||||||
|
|
||||||
m_aPages[nPage]->Show(FALSE);
|
m_pages[nPage]->Show(FALSE);
|
||||||
// m_aPages[nPage]->Lower();
|
// m_pages[nPage]->Lower();
|
||||||
|
|
||||||
wxNotebookPage* pPage = GetPage(nPage);
|
wxNotebookPage* pPage = GetPage(nPage);
|
||||||
#if defined (__WIN16__)
|
#if defined (__WIN16__)
|
||||||
@@ -295,9 +285,9 @@ bool wxNotebook::RemovePage(int nPage)
|
|||||||
m_tabView->RemoveTab((int) (long) pPage);
|
m_tabView->RemoveTab((int) (long) pPage);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_aPages.Remove(nPage);
|
m_pages.Remove(pPage);
|
||||||
|
|
||||||
if (m_aPages.GetCount() == 0)
|
if (m_pages.GetCount() == 0)
|
||||||
{
|
{
|
||||||
m_nSelection = -1;
|
m_nSelection = -1;
|
||||||
m_tabView->SetTabSelection(-1, TRUE);
|
m_tabView->SetTabSelection(-1, TRUE);
|
||||||
@@ -342,7 +332,7 @@ int wxNotebook::FindPagePosition(wxNotebookPage* page) const
|
|||||||
int nPageCount = GetPageCount();
|
int nPageCount = GetPageCount();
|
||||||
int nPage;
|
int nPage;
|
||||||
for ( nPage = 0; nPage < nPageCount; nPage++ )
|
for ( nPage = 0; nPage < nPageCount; nPage++ )
|
||||||
if (m_aPages[nPage] == page)
|
if (m_pages[nPage] == page)
|
||||||
return nPage;
|
return nPage;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -355,22 +345,13 @@ bool wxNotebook::DeleteAllPages()
|
|||||||
int nPageCount = GetPageCount();
|
int nPageCount = GetPageCount();
|
||||||
int nPage;
|
int nPage;
|
||||||
for ( nPage = 0; nPage < nPageCount; nPage++ )
|
for ( nPage = 0; nPage < nPageCount; nPage++ )
|
||||||
delete m_aPages[nPage];
|
delete m_pages[nPage];
|
||||||
|
|
||||||
m_aPages.Clear();
|
m_pages.Clear();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add a page to the notebook
|
|
||||||
bool wxNotebook::AddPage(wxNotebookPage *pPage,
|
|
||||||
const wxString& strText,
|
|
||||||
bool bSelect,
|
|
||||||
int imageId)
|
|
||||||
{
|
|
||||||
return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// same as AddPage() but does it at given position
|
// same as AddPage() but does it at given position
|
||||||
bool wxNotebook::InsertPage(int nPage,
|
bool wxNotebook::InsertPage(int nPage,
|
||||||
wxNotebookPage *pPage,
|
wxNotebookPage *pPage,
|
||||||
@@ -391,7 +372,7 @@ bool wxNotebook::InsertPage(int nPage,
|
|||||||
pPage->Show(FALSE);
|
pPage->Show(FALSE);
|
||||||
|
|
||||||
// save the pointer to the page
|
// save the pointer to the page
|
||||||
m_aPages.Insert(pPage, nPage);
|
m_pages.Insert(pPage, nPage);
|
||||||
|
|
||||||
if (bSelect)
|
if (bSelect)
|
||||||
{
|
{
|
||||||
@@ -500,9 +481,9 @@ bool wxNotebook::RefreshLayout(bool force)
|
|||||||
|
|
||||||
// fit the notebook page to the tab control's display area
|
// fit the notebook page to the tab control's display area
|
||||||
|
|
||||||
unsigned int nCount = m_aPages.Count();
|
unsigned int nCount = m_pages.Count();
|
||||||
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
|
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
|
||||||
wxNotebookPage *pPage = m_aPages[nPage];
|
wxNotebookPage *pPage = m_pages[nPage];
|
||||||
if (pPage->IsShown())
|
if (pPage->IsShown())
|
||||||
{
|
{
|
||||||
wxRect clientRect = GetAvailableClientSize();
|
wxRect clientRect = GetAvailableClientSize();
|
||||||
@@ -533,7 +514,7 @@ void wxNotebook::OnSetFocus(wxFocusEvent& event)
|
|||||||
{
|
{
|
||||||
// set focus to the currently selected page if any
|
// set focus to the currently selected page if any
|
||||||
if ( m_nSelection != -1 )
|
if ( m_nSelection != -1 )
|
||||||
m_aPages[m_nSelection]->SetFocus();
|
m_pages[m_nSelection]->SetFocus();
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
@@ -586,11 +567,11 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
|
|||||||
wxASSERT( nOldSel != nSel ); // impossible
|
wxASSERT( nOldSel != nSel ); // impossible
|
||||||
|
|
||||||
if ( nOldSel != -1 ) {
|
if ( nOldSel != -1 ) {
|
||||||
m_aPages[nOldSel]->Show(FALSE);
|
m_pages[nOldSel]->Show(FALSE);
|
||||||
m_aPages[nOldSel]->Lower();
|
m_pages[nOldSel]->Lower();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNotebookPage *pPage = m_aPages[nSel];
|
wxNotebookPage *pPage = m_pages[nSel];
|
||||||
|
|
||||||
wxRect clientRect = GetAvailableClientSize();
|
wxRect clientRect = GetAvailableClientSize();
|
||||||
pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
|
pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
|
||||||
|
@@ -663,10 +663,10 @@ void wxMDIClientWindow::DoGetPosition(int *x, int *y) const
|
|||||||
wxWindow::DoGetPosition(x, y);
|
wxWindow::DoGetPosition(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicitly call default scroll behaviour
|
void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
|
||||||
void wxMDIClientWindow::OnScroll(wxScrollEvent& WXUNUSED(event))
|
|
||||||
{
|
{
|
||||||
Default(); // Default processing
|
// Default(); // Default processing: OBSOLETE FUNCTION
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
|
void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
|
||||||
|
Reference in New Issue
Block a user