added wxNotebook::AssingImageList

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2000-09-28 22:25:07 +00:00
parent 46cd520d1e
commit b656febdf0
7 changed files with 52 additions and 2 deletions

View File

@@ -123,6 +123,18 @@ Do not delete the page, it will be deleted by the notebook.
Cycles through the tabs.
\membersection{wxNotebook::AssignImageList}\label{wxnotebookassignimagelist}
\func{void}{AssignImageList}{\param{wxImageList*}{ imageList}}
Sets the image list for the page control and takes ownership of
the list.
\wxheading{See also}
\helpref{wxImageList}{wximagelist},
\helpref{SetImageList}{wxnotebooksetimagelist}
\membersection{wxNotebook::Create}\label{wxnotebookcreate}
\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
@@ -242,11 +254,13 @@ Deletes the specified page, without deleting the associated window.
\func{void}{SetImageList}{\param{wxImageList*}{ imageList}}
Sets the image list for the page control.
Sets the image list for the page control. It does not take
ownership of the image list, you must delete it yourself.
\wxheading{See also}
\helpref{wxImageList}{wximagelist}
\helpref{wxImageList}{wximagelist},
\helpref{AssignImageList}{wxnotebookassignimagelist}
\membersection{wxNotebook::SetPadding}\label{wxnotebooksetpadding}

View File

@@ -89,6 +89,7 @@ public:
// 3) set for each page it's image
// associate image list with a control
void SetImageList(wxImageList* imageList);
void AssignImageList(wxImageList* imageList);
// get pointer (may be NULL) to the associated image list
wxImageList *GetImageList() const { return m_imageList; }
@@ -157,6 +158,7 @@ public:
wxGtkNotebookPage* GetNotebookPage(int page) const;
wxImageList* m_imageList;
bool m_ownsImageList;
wxList m_pages;
int m_lastSelection; /* hack */

View File

@@ -89,6 +89,7 @@ public:
// 3) set for each page it's image
// associate image list with a control
void SetImageList(wxImageList* imageList);
void AssignImageList(wxImageList* imageList);
// get pointer (may be NULL) to the associated image list
wxImageList *GetImageList() const { return m_imageList; }
@@ -157,6 +158,7 @@ public:
wxGtkNotebookPage* GetNotebookPage(int page) const;
wxImageList* m_imageList;
bool m_ownsImageList;
wxList m_pages;
int m_lastSelection; /* hack */

View File

@@ -92,6 +92,7 @@ public:
// 3) set for each page it's image
// associate image list with a control
void SetImageList(wxImageList* imageList);
void AssignImageList(wxImageList* imageList);
// get pointer (may be NULL) to the associated image list
wxImageList* GetImageList() const { return m_pImageList; }
@@ -157,6 +158,7 @@ protected:
void ChangePage(int nOldSel, int nSel); // change pages
wxImageList *m_pImageList; // we can have an associated image list
bool m_bOwnsImageList;
wxArrayPages m_aPages; // array of pages
int m_nSelection; // the current selection (-1 if none)

View File

@@ -214,6 +214,7 @@ END_EVENT_TABLE()
void wxNotebook::Init()
{
m_imageList = (wxImageList *) NULL;
m_ownsImageList = FALSE;
m_pages.DeleteContents( TRUE );
m_lastSelection = -1;
m_themeEnabled = TRUE;
@@ -239,6 +240,7 @@ wxNotebook::~wxNotebook()
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
DeleteAllPages();
if (m_ownsImageList) delete m_imageList;
}
bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
@@ -388,7 +390,15 @@ void wxNotebook::AdvanceSelection( bool forward )
void wxNotebook::SetImageList( wxImageList* imageList )
{
if (m_ownsImageList) delete m_imageList;
m_imageList = imageList;
m_ownsImageList = FALSE;
}
void wxNotebook::AssignImageList( wxImageList* imageList )
{
SetImageList(imageList);
m_ownsImageList = TRUE;
}
bool wxNotebook::SetPageText( int page, const wxString &text )

View File

@@ -214,6 +214,7 @@ END_EVENT_TABLE()
void wxNotebook::Init()
{
m_imageList = (wxImageList *) NULL;
m_ownsImageList = FALSE;
m_pages.DeleteContents( TRUE );
m_lastSelection = -1;
m_themeEnabled = TRUE;
@@ -239,6 +240,7 @@ wxNotebook::~wxNotebook()
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
DeleteAllPages();
if (m_ownsImageList) delete m_imageList;
}
bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
@@ -388,7 +390,15 @@ void wxNotebook::AdvanceSelection( bool forward )
void wxNotebook::SetImageList( wxImageList* imageList )
{
if (m_ownsImageList) delete m_imageList;
m_imageList = imageList;
m_ownsImageList = FALSE;
}
void wxNotebook::AssignImageList( wxImageList* imageList )
{
SetImageList(imageList);
m_ownsImageList = TRUE;
}
bool wxNotebook::SetPageText( int page, const wxString &text )

View File

@@ -106,6 +106,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
void wxNotebook::Init()
{
m_pImageList = NULL;
m_bOwnsImageList = FALSE;
m_nSelection = -1;
}
@@ -188,6 +189,7 @@ bool wxNotebook::Create(wxWindow *parent,
// dtor
wxNotebook::~wxNotebook()
{
if (m_bOwnsImageList) delete m_pImageList;
}
// ----------------------------------------------------------------------------
@@ -276,10 +278,18 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
void wxNotebook::SetImageList(wxImageList* imageList)
{
if (m_bOwnsImageList) delete m_pImageList;
m_pImageList = imageList;
m_bOwnsImageList = FALSE;
TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
}
void wxNotebook::AssignImageList(wxImageList* imageList)
{
SetImageList(imageList);
m_bOwnsImageList = TRUE;
}
// ----------------------------------------------------------------------------
// wxNotebook size settings
// ----------------------------------------------------------------------------