Commit Graph

77 Commits

Author SHA1 Message Date
Vadim Zeitlin
b88d5e08ce Fix adding pages without associated window to wxTreebook
wxTreebook is supposed to allow not specifying any valid window for the
top-level pages, but this didn't work any longer, probably since the
changes of 02a92e23f3 (see #4379), as a
possibly null page was dereferenced without checking, resulting in a
crash.

Fix this by adding a missing check.

Also rename DoGetNonNullPage() to TryGetNonNullPage() to make it more
clear that this function can return null and add a unit test checking
that calling AddPage(NULL) really works (or at least doesn't crash).

See https://github.com/wxWidgets/wxWidgets/pull/921
2018-09-18 00:33:59 +02:00
Vadim Zeitlin
bee28c2730 Use wxVector<> for wxBookCtrlBase::m_pages array
Get rid of another macro-based array in favour of wxVector<>.

No real changes.
2018-03-31 01:45:10 +02:00
Vadim Zeitlin
02a92e23f3 Reuse wxBookCtrlBase::DoSetSelection() in wxTreebook too
Avoid duplicating base class DoSetSelection() implementation in
wxTreebook, just extend it slightly by using DoGetNonNullPage() to allow
using a (sub-)page if the page associated to the selected item is null
and reuse it.

Also get rid of wxTreebook::m_actualSelection, it seems completely
unnecessary to bother keeping and updating it when we can just find it
whenever we need (which actually seems to only have been the case in the
now removed DoSetSelection() implementation anyhow).

As a side effect of this, wxTreebook pages should now be sizer correctly
when switching to them as DoSetSelection() in the base class does call
SetSize() on the page before showing it, unlike the previously used
version in wxTreebook, which omitted this call for some reason.

There should be no other user-visible changes.

Closes #4379.
2018-03-31 01:45:06 +02:00
Vadim Zeitlin
4839932227 Allow tabbing to the windows inside non-notebook wxBookCtrl
Remove wxBookCtrlBase::AcceptsFocus() returning false as it didn't make
any sense: even though wxBookCtrlBase doesn't, indeed, accept focus on
itself, it does accept it for its children and returning false prevented
the focus from ever getting inside it.

This fixes, for example, keyboard navigation in a window containing
wxSimplebook and TAB can now be used to move to the controls inside it
from the outside.

Also remove the now unnecessary AcceptsFocus() override which was just
undoing the damage of the base class method and is not needed any more.
2018-01-18 22:59:45 +01:00
Iwbnwif Yiw
015ffbb0ef Make background of book controls in wxMSW be the same as parent
This improves their appearance especially when they're used as children of
wxNotebook, which uses a different background colour than plain wxPanel by
default.

This generalizes what was already done for wxChoicebook in 6cab632f
(see #12503) to all book controls.

Closes #16878.
2016-07-02 15:04:19 +02:00
Artur Wieczorek
1237e932ad Fix setting wxBK_HITTEST_xxx flags in wxNotebook::HitTest
The state represented by TCHT_ONITEM Win API flag is not a superposition
TCHT_ONITEMICON and TCHT_ONITLABEL states but it represents a separate state.
The fact that binary value of TCHT_ONITEM is bitwise-OR operation on
TCHT_ONITEMICON and TCHT_ONITEMLABEL doesn't matter here. The same applies to
wxBK_HITTEST_xxx flags where state represented by wxBK_HITTEST_ONITEM is not a
superposition of wxBK_HITTEST_ONICON and wxBK_HITTEST_ONLABEL.

Add note to wxBookCtrl::HitTest documentation that wxBK_HITTEST_ONICON,
wxBK_HITTEST_ONLABEL, wxBK_HITTEST_ONITEM are mutually exclusive bits.

See https://github.com/wxWidgets/wxWidgets/pull/159
2016-01-31 03:06:33 +01:00
Dimitri Schoolwerth
8f8d58d193 Use wx-prefixed macros throughout the repository.
Change {DECLARE,IMPLEMENT}_*CLASS and {DECLARE,BEGIN,END}_EVENT_TABLE
occurrences to use the wx-prefixed version of the macros.
2015-04-23 22:00:35 +04:00
Paul Cornett
8b4ae731d3 use wxOVERRIDE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-03-30 00:02:23 +00:00
Paul Cornett
967a94c91a remove WXWIN_COMPATIBILITY_2_6, add WXWIN_COMPATIBILITY_3_0
closes #15792

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-01-04 20:07:33 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Vadim Zeitlin
4f9ccec517 Add wxBookCtrlBase::DoSetSelectionAfterRemoval() and use it in wxSimplebook.
This fixes the wrong handling of the selection in wxSimplebook when the
currently selected page was deleted.

Also extend the unit tests to check for this bug.

Closes #15188.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-06-23 16:39:39 +00:00
Vadim Zeitlin
ce7fe42e84 Provide shorter synonyms for wxEVT_XXX constants.
Use the same short names as are used by the event table macros for the event
type constants themselves. This makes them much more comfortable to use, e.g.
Bind(wxEVT_BUTTON) compared to Bind(wxEVT_COMMAND_BUTTON_CLICKED).

The old long names are still kept for backwards compatibility and shouldn't be
removed as it doesn't really cost anything to continue providing them, but all
new event types should only use the short versions.

Closes #10661.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-25 10:11:03 +00:00
Vadim Zeitlin
ce4ae5639b Added wxBookCtrlBase::FindPage().
Add helper function to find the index of the given page.

Closes #15125.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73734 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-03-29 19:53:13 +00:00
Vadim Zeitlin
2e18fe7139 Virtualize showing/hiding the pages in wxBookCtrlBase.
No real changes, just make it possible to change how the pages are hidden and
shown in the derived classes. This is not used by any of them yet, but will be
used by wxSimplebook soon.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72406 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-08-30 20:21:29 +00:00
Vadim Zeitlin
005b12d8be Make wxBookCtrlBase::GetPage() virtual to fix it for wxAuiNotebook.
wxAuiNotebook doesn't store its page in the base class m_pages array, so
calling GetPage() on it via a wxBookCtrl pointer resulted in a crash.

Make GetPage() virtual to allow overriding it at wxAuiNotebook level.

Closes #13768.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71908 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-30 23:41:27 +00:00
Steve Lamerton
c78da4eb62 Make wxBookCtrlBase::GetSelection virtual, as per the documentation.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69082 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-09-14 08:24:06 +00:00
Vadim Zeitlin
1871b9facb No changes, just use symbolic NO_IMAGE constant instead of -1 or wxNOT_FOUND.
Existing declarations used -1 in several places to indicate the absence of the
image which wasn't especially clear and was also inconsistent with other
places that used wxNOT_FOUND which didn't make much sense in this context.

Add a new symbolic constant NO_IMAGE in wxWithImages and use it in the classes
deriving from it. This still doesn't help with wx{Tree,List}Ctrl but improves
clarity for the other classes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68810 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-08-21 14:08:49 +00:00
Vadim Zeitlin
abfdefede3 Add wxWithImages helper mix-in with {Set,Get,Assign}ImageList() methods.
Avoid defining SetImageList() in several different places in wx API as not
only this resulted in (trivial) code duplication but this method also had
different semantics before: it didn't take ownership of the pointer passed to
it in wxTreeCtrl, wxListCtrl and wxBookCtrl and derived classes but did take
its ownership in wxDataViewTreeCtrl and wxRichTextFormattingDialog.

Harmonize this for all the classes now: SetImageList() never takes ownership
while AssignImageList() (which is now available in all classes having
SetImageList()) always does.

Also add convenience wxWithImages::GetImage() helper to avoid (more) code
duplication in wxDataViewTreeCtrl code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68809 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-08-21 14:08:43 +00:00
Vadim Zeitlin
60d5c563d2 Avoid events when implicitly selecting first wxBookCtrl page.
The first page added to a wxBookCtrlBase-derived control is always selected,
even if "bSelect" argument of AddPage() was false. This is necessary because
a non-empty book control must always have a selection but the "selection
changed" event generated when doing it is unexpected.

Fix this by not generating any events when the first page is implicitly
selected.

Closes #12075.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-31 13:33:34 +00:00
Vadim Zeitlin
681be2ef80 Refactor: use wxBookCtrlBase::m_selection in all derived classes.
All book control classes with the exception of wxGTK wxNotebook stored the
currently selected page in m_selection or m_nSelection (or, in wxUniv
wxNotebook case, m_sel) variable. Remove all of them and add m_selection
directly to the base class itself so that it can be reused everywhere.

Closes #12622.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 16:54:36 +00:00
Vadim Zeitlin
7e837615b9 No real changes, just replace -1 with wxNOT_FOUND in wxBookCtrl code.
Make the code consistently use wxNOT_FOUND instead of -1 everywhere.

See #12622.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65930 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 16:54:24 +00:00
Vadim Zeitlin
175363f6b8 Implement wxBookCtrlBase::CalcSizeFromPage() in the base class.
The definition of this method was needlessly duplicated in all of
wx{Choice,List,Tool,Tree}book and in all of them except the first one it
didn't account correctly for the case when the size of the controller was
greater than the size of the page.

Avoid the duplication and fix the best size determination in such case by
providing a single, correct version of the function in the base class itself.

Closes #11793.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63632 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-05 23:55:19 +00:00
Vadim Zeitlin
1d2b7f06a3 No changes, just remove redundant GetControllerSize() definitions.
For some reasons wxBookCtrlBase::GetControllerSize() was redefined in several
derived classes even though it did exactly the same thing in all of them.

Leave only the base class version and remove the other ones.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-05 23:55:09 +00:00
Julian Smart
95835bc453 Made DoSize and GetPageRect virtual for easier derivation without duplicating a lot of code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-13 09:22:23 +00:00
Vadim Zeitlin
c0c133e13b add wx-prefixed and semicolon-requiring versions of DECLARE_NO_{COPY,ASSIGN}_CLASS macros
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-08 11:45:59 +00:00
Vadim Zeitlin
3c77890141 add more flexible and safer template Connect() overloads (#10000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58039 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-12 14:26:13 +00:00
Vadim Zeitlin
3e97a90518 use a single wxBookCtrlEvent class for all wxBookCtrlBase-derived controls (#9667)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-01 13:46:46 +00:00
Francesco Montorsi
53a2db124c substitute WXDLLEXPORT with WXDLLIMPEXP_CORE and WXDLLEXPORT_DATA with WXDLLIMPEXP_DATA_CORE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52834 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-03-26 15:06:00 +00:00
Vadim Zeitlin
3056dddc54 remove the unnecessary non-const GetPage() overload
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51338 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-22 19:31:10 +00:00
Julian Smart
dc797d8e1b More border rationalisation. GetDefaultBorder is now mostly defined in base class files.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-11-13 12:10:34 +00:00
Julian Smart
a047aff270 Added wxBORDER_THEME, wxWindow::GetDefaultBorderForControl(), wxWindow::CanApplyThemeBorder().
wxTextCtrl and wxSearchCtrl now get the correct border on wxMSW, and the wxRichTextCtrl sample
also now demonstrates correct borders.



git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-08-07 19:22:43 +00:00
Václav Slavík
b5dbe15d0b added WXDLLIMPEXP_FWD_FOO macros in addition to WXDLLIMPEXP_FOO for use with forward declarations (in preparation for GCC visibility support)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-09 10:09:52 +00:00
Vadim Zeitlin
3368424ae8 don't accept focus in book control itself
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-25 22:55:35 +00:00
Vadim Zeitlin
e8a147a6c3 invalidate best size of the book controller too when the pages are added/removed, this fixes a lot of sizing problems with treebook
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-11-04 12:20:09 +00:00
Robin Dunn
170acdc90e GetBestFittingSize --> GetEffectiveMinSize
SetBestFittingSize --> SetInitialSize
SetBestSize  --> SetInitialSize
SetInitialBestSize --> SetInitialSize


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42816 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-31 08:50:17 +00:00
Vadim Zeitlin
73a0b98c1b define bookctrl (and -derived) classes flags in their headers instead of defs.h; don't deprecate the control-specific flags
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42159 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-20 11:32:30 +00:00
Vadim Zeitlin
deb325e3b2 avoid conflict between wxBookCtrlBase::DoSetSelection() and the derived classes; refactor more common code into the base class
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-09 21:29:12 +00:00
Vadim Zeitlin
1d6fcbcc70 added wxBookCtrl::ChangeSelection() which is the same as SetSelection() but doesn't send the page change events (second part of patch 1553551)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-08 17:37:23 +00:00
Włodzimierz Skiba
f41cf3716e BookCtrl event handler added to default book layer.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41622 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-04 09:33:52 +00:00
Vadim Zeitlin
e71c530e03 added HasMultiplePages()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40354 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-07-28 23:46:32 +00:00
Włodzimierz Skiba
9804d5404a wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-07-05 12:21:13 +00:00
Julian Smart
90f9b8ef0c Reverted last wxBookCtrl change and added alignment check to notebook
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-06-06 12:53:31 +00:00
Julian Smart
926395e16b Each book control should say what its default orientation. Use this info
if no alignment style, otherwise assertion will happen in GetPageRect.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-06-06 11:05:22 +00:00
Vadim Zeitlin
a18c21f000 show help for the page under mouse when the [?] button is used to request help
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39342 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-05-26 02:23:24 +00:00
Vadim Zeitlin
851b88c310 moved wxNotebook::HitTest() to the base book control class; implemented it for wxList/Treebook
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39339 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-05-26 02:09:44 +00:00
Włodzimierz Skiba
e0d5d9af8b All book controls shares wxBK_* flags [bug #1469980].
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-04-13 18:24:38 +00:00
Julian Smart
87cf52d8ac On screens with restricted space, it's useful to be able to add controls
to e.g. the wxChoice control of a wxChoicebook. GetControlSizer
allows an app to do that, and we also add a control margin which
may or may not be respected by individual book controls.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38698 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-04-13 14:22:32 +00:00
Włodzimierz Skiba
a5325ad672 Back to 'unsigned int' after reasearch of 'size_t' problems.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38329 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-03-24 07:51:55 +00:00
Włodzimierz Skiba
05fd6a8b82 More size_t in interface.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38110 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-03-15 18:46:24 +00:00
Julian Smart
da817fa6eb Changed function to SetFitToCurrentPage
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37356 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-02-06 17:51:11 +00:00