projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make background colour apply to choice/combobox dropdown listbox as well as the main...
[wxWidgets.git]
/
src
/
univ
/
notebook.cpp
diff --git
a/src/univ/notebook.cpp
b/src/univ/notebook.cpp
index 80763267edf1e1840e7df8b4f7138b16a5546eb5..6f15388aa66761a1b2524dc49b6ee8c1c62e320e 100644
(file)
--- a/
src/univ/notebook.cpp
+++ b/
src/univ/notebook.cpp
@@
-44,7
+44,12
@@
// macros
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
+#if 0
+// due to unsigned type nPage is always >= 0
#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((size_t(nPage)) < GetPageCount()))
#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((size_t(nPage)) < GetPageCount()))
+#else
+#define IS_VALID_PAGE(nPage) ((size_t(nPage)) < GetPageCount())
+#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// constants
@@
-63,7
+68,7
@@
class wxNotebookSpinBtn : public wxSpinButton
{
public:
wxNotebookSpinBtn(wxNotebook *nb)
{
public:
wxNotebookSpinBtn(wxNotebook *nb)
- : wxSpinButton(nb,
-1
,
+ : wxSpinButton(nb,
wxID_ANY
,
wxDefaultPosition, wxDefaultSize,
nb->IsVertical() ? wxSP_VERTICAL : wxSP_HORIZONTAL)
{
wxDefaultPosition, wxDefaultSize,
nb->IsVertical() ? wxSP_VERTICAL : wxSP_HORIZONTAL)
{
@@
-83,7
+88,7
@@
private:
};
BEGIN_EVENT_TABLE(wxNotebookSpinBtn, wxSpinButton)
};
BEGIN_EVENT_TABLE(wxNotebookSpinBtn, wxSpinButton)
- EVT_SPIN(
-1
, wxNotebookSpinBtn::OnSpin)
+ EVT_SPIN(
wxID_ANY
, wxNotebookSpinBtn::OnSpin)
END_EVENT_TABLE()
// ============================================================================
END_EVENT_TABLE()
// ============================================================================
@@
-122,7
+127,7
@@
bool wxNotebook::Create(wxWindow *parent,
{
if ( !wxControl::Create(parent, id, pos, size, style,
wxDefaultValidator, name) )
{
if ( !wxControl::Create(parent, id, pos, size, style,
wxDefaultValidator, name) )
- return
FALSE
;
+ return
false
;
m_sizePad = GetRenderer()->GetTabPadding();
m_sizePad = GetRenderer()->GetTabPadding();
@@
-130,7
+135,7
@@
bool wxNotebook::Create(wxWindow *parent,
CreateInputHandler(wxINP_HANDLER_NOTEBOOK);
CreateInputHandler(wxINP_HANDLER_NOTEBOOK);
- return
TRUE
;
+ return
true
;
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
@@
-146,7
+151,7
@@
wxString wxNotebook::GetPageText(size_t nPage) const
bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
{
bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage),
FALSE
, _T("invalid notebook page") );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage),
false
, _T("invalid notebook page") );
if ( strText != m_titles[nPage] )
{
if ( strText != m_titles[nPage] )
{
@@
-164,7
+169,7
@@
bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
}
}
}
}
- return
TRUE
;
+ return
true
;
}
int wxNotebook::GetPageImage(size_t nPage) const
}
int wxNotebook::GetPageImage(size_t nPage) const
@@
-176,9
+181,9
@@
int wxNotebook::GetPageImage(size_t nPage) const
bool wxNotebook::SetPageImage(size_t nPage, int nImage)
{
bool wxNotebook::SetPageImage(size_t nPage, int nImage)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage),
FALSE
, _T("invalid notebook page") );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage),
false
, _T("invalid notebook page") );
- wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(),
FALSE
,
+ wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(),
false
,
_T("invalid image index in SetPageImage()") );
if ( nImage != m_images[nPage] )
_T("invalid image index in SetPageImage()") );
if ( nImage != m_images[nPage] )
@@
-195,7
+200,7
@@
bool wxNotebook::SetPageImage(size_t nPage, int nImage)
RefreshTab(nPage);
}
RefreshTab(nPage);
}
- return
TRUE
;
+ return
true
;
}
wxNotebook::~wxNotebook()
}
wxNotebook::~wxNotebook()
@@
-237,7
+242,7
@@
int wxNotebook::SetSelection(size_t nPage)
if ( selOld != INVALID_PAGE )
{
if ( selOld != INVALID_PAGE )
{
- RefreshTab(selOld,
TRUE
/* this tab was selected */);
+ RefreshTab(selOld,
true
/* this tab was selected */);
m_pages[selOld]->Hide();
}
m_pages[selOld]->Hide();
}
@@
-288,7
+293,7
@@
bool wxNotebook::InsertPage(size_t nPage,
int imageId)
{
size_t nPages = GetPageCount();
int imageId)
{
size_t nPages = GetPageCount();
- wxCHECK_MSG( nPage == nPages || IS_VALID_PAGE(nPage),
FALSE
,
+ wxCHECK_MSG( nPage == nPages || IS_VALID_PAGE(nPage),
false
,
_T("invalid notebook page in InsertPage()") );
// modify the data
_T("invalid notebook page in InsertPage()") );
// modify the data
@@
-320,7
+325,7
@@
bool wxNotebook::InsertPage(size_t nPage,
if ( nPages == 0 )
{
// always select the first tab to have at least some selection
if ( nPages == 0 )
{
// always select the first tab to have at least some selection
- bSelect =
TRUE
;
+ bSelect =
true
;
Relayout();
Refresh();
Relayout();
Refresh();
@@
-339,13
+344,13
@@
bool wxNotebook::InsertPage(size_t nPage,
pPage->Hide();
}
pPage->Hide();
}
- return
TRUE
;
+ return
true
;
}
bool wxNotebook::DeleteAllPages()
{
if ( !wxNotebookBase::DeleteAllPages() )
}
bool wxNotebook::DeleteAllPages()
{
if ( !wxNotebookBase::DeleteAllPages() )
- return
FALSE
;
+ return
false
;
// clear the other arrays as well
m_titles.Clear();
// clear the other arrays as well
m_titles.Clear();
@@
-361,7
+366,7
@@
bool wxNotebook::DeleteAllPages()
Relayout();
Relayout();
- return
TRUE
;
+ return
true
;
}
wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage)
}
wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage)
@@
-465,7
+470,7
@@
void wxNotebook::DoDrawTab(wxDC& dc, const wxRect& rect, size_t n)
wxMemoryDC dc;
dc.SelectObject(bmp);
dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
wxMemoryDC dc;
dc.SelectObject(bmp);
dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
- m_imageList->Draw(image, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL,
TRUE
);
+ m_imageList->Draw(image, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL,
true
);
dc.SelectObject(wxNullBitmap);
#else
bmp = *m_imageList->GetBitmap(image);
dc.SelectObject(wxNullBitmap);
#else
bmp = *m_imageList->GetBitmap(image);
@@
-828,7
+833,7
@@
void wxNotebook::ResizeTab(int page)
wxSize sizeTab = CalcTabSize(page);
// we only need full relayout if the page size changes
wxSize sizeTab = CalcTabSize(page);
// we only need full relayout if the page size changes
- bool needsRelayout =
FALSE
;
+ bool needsRelayout =
false
;
if ( IsVertical() )
{
if ( IsVertical() )
{
@@
-840,7
+845,7
@@
void wxNotebook::ResizeTab(int page)
if ( sizeTab.y > m_heightTab )
{
if ( sizeTab.y > m_heightTab )
{
- needsRelayout =
TRUE
;
+ needsRelayout =
true
;
m_heightTab = sizeTab.y;
}
m_heightTab = sizeTab.y;
}
@@
-1066,7
+1071,7
@@
void wxNotebook::UpdateSpinBtn()
{
// this case is special, get rid of it immediately: everything is
// visible and we don't need any spin buttons
{
// this case is special, get rid of it immediately: everything is
// visible and we don't need any spin buttons
- allTabsShown =
TRUE
;
+ allTabsShown =
true
;
// have to reset them manually as we don't call CalcLastVisibleTab()
m_firstVisible =
// have to reset them manually as we don't call CalcLastVisibleTab()
m_firstVisible =
@@
-1122,7
+1127,7
@@
void wxNotebook::UpdateSpinBtn()
}
else // all tabs are visible, we don't need spin button
{
}
else // all tabs are visible, we don't need spin button
{
- if ( m_spinbtn )
+ if ( m_spinbtn
&& m_spinbtn -> IsShown()
)
{
m_spinbtn->Hide();
}
{
m_spinbtn->Hide();
}
@@
-1296,15
+1301,15
@@
bool wxNotebook::PerformAction(const wxControlAction& action,
const wxString& strArg)
{
if ( action == wxACTION_NOTEBOOK_NEXT )
const wxString& strArg)
{
if ( action == wxACTION_NOTEBOOK_NEXT )
- SetSelection(GetNextPage(
TRUE
));
+ SetSelection(GetNextPage(
true
));
else if ( action == wxACTION_NOTEBOOK_PREV )
else if ( action == wxACTION_NOTEBOOK_PREV )
- SetSelection(GetNextPage(
FALSE
));
+ SetSelection(GetNextPage(
false
));
else if ( action == wxACTION_NOTEBOOK_GOTO )
SetSelection((int)numArg);
else
return wxControl::PerformAction(action, numArg, strArg);
else if ( action == wxACTION_NOTEBOOK_GOTO )
SetSelection((int)numArg);
else
return wxControl::PerformAction(action, numArg, strArg);
- return
TRUE
;
+ return
true
;
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
@@
-1360,7
+1365,7
@@
bool wxStdNotebookInputHandler::HandleKey(wxInputConsumer *consumer,
break;
}
break;
}
- if ( !
!action
)
+ if ( !
action.IsEmpty()
)
{
return consumer->PerformAction(action, page);
}
{
return consumer->PerformAction(action, page);
}
@@
-1380,7
+1385,7
@@
bool wxStdNotebookInputHandler::HandleMouse(wxInputConsumer *consumer,
{
consumer->PerformAction(wxACTION_NOTEBOOK_GOTO, page);
{
consumer->PerformAction(wxACTION_NOTEBOOK_GOTO, page);
- return
FALSE
;
+ return
false
;
}
}
}
}
@@
-1399,7
+1404,7
@@
wxStdNotebookInputHandler::HandleFocus(wxInputConsumer *consumer,
{
HandleFocusChange(consumer);
{
HandleFocusChange(consumer);
- return
FALSE
;
+ return
false
;
}
bool wxStdNotebookInputHandler::HandleActivation(wxInputConsumer *consumer,
}
bool wxStdNotebookInputHandler::HandleActivation(wxInputConsumer *consumer,
@@
-1408,7
+1413,7
@@
bool wxStdNotebookInputHandler::HandleActivation(wxInputConsumer *consumer,
// we react to the focus change in the same way as to the [de]activation
HandleFocusChange(consumer);
// we react to the focus change in the same way as to the [de]activation
HandleFocusChange(consumer);
- return
FALSE
;
+ return
false
;
}
void wxStdNotebookInputHandler::HandleFocusChange(wxInputConsumer *consumer)
}
void wxStdNotebookInputHandler::HandleFocusChange(wxInputConsumer *consumer)