Fixed drawing a check box in the undetermined state for non-themed MSW apps.
wxRendererMSW::DoDrawFrameControl (used for systems prior to XP or when theming is disabled) didn't check for the wxCONTROL_UNDETERMINED flag yet. Set the appropriate styles when the flag is used to fix drawing check boxes in their third state (as used in for example the treelist sample).
Vadim Zeitlin [Mon, 29 Aug 2011 14:46:56 +0000 (14:46 +0000)]
Make it possible to TAB to wxTreeListCtrl contents.
Even though wxTreeListCtrl contains just one child window it still needs to
derive from wxNavigationEnabled<> to allow focus getting to its sole child.
The alpha channel was not detected because of wrong hasAlpha determination. Also TIFFReadRGBAImage[Oriented] doesn't appear to decode an alpha channel for images that are greyscale so decode greyscale with alpha images using TIFFReadScanline.
Fixed copying only 1/3 of scanline when saving TIFF image in rare cases.
If our calculated image pitch is not equal to what TIFFScanlineSize returns a scanline buffer would be used. In that case the number of bytes being copied was equal to the image's width instead of pitch (width times 3).
Added support for loading black and white TIFF images with alpha.
As TIFFReadRGBAImage[Oriented] can't deal with all images make use of TIFFReadScanline to decode per scanline. Currently only the case of a black and white image with alpha (for a total of 2 bits per pixel) is handled.
Read TIFF images from top to bottom instead of bottom to top.
Use TIFFReadRGBAImageOriented with a parameter of ORIENTATION_TOPLEFT instead of using TIFFReadRGBAImage (which uses ORIENTATION_BOTTOMLEFT) to read images in a more logical order and simplify code.
Fixed accessing out-of-bounds image coordinates while writing a black and white TIFF image.
The code assumed that the image's width is a multiple of 8, and attempted to always write per 8 pixels instead of sometimes having to write fewer pixels for the last column.
Also fixed compilo from previous commit due to not removing old code.
Fixed calculated image pitch being off-by-one in some cases.
The variable linebytes sometimes counted one extra byte, which is OK for allocating but not when accessing the image later on. Calculate the value in a slightly different way and made the variable const.
Robin Dunn [Sat, 27 Aug 2011 23:26:53 +0000 (23:26 +0000)]
* Implement dynamic loading of the Cairo DLL on Windows similar to how it was
done for GDI+.
* Enable the use of the wxCairoContext on MSW.
* Enable creating a wxGCDC from an exisiting wxGraphicsContext.
* Since it's possible for a DLL that is using wx to not be on the PATH nor in
the same location as the .exe, change the wxDynamicLibrary::RawLoad method to
explicitly look first in the same place as the main wx-using binary. This way
it will find DLLs that are in the same folder as the wx-using binary even if
that would not be in the normal DLL search path.
* Change wxDCImpl and wxDC::GetLogicalScale to be const methods.
Václav Slavík [Sat, 27 Aug 2011 16:44:42 +0000 (16:44 +0000)]
Remove DestroyTreeHelper(), make GetChildNodes() const, add RemoveChild().
There's no reason for DestroyTreeHelper() code, that's what destructors
are for. On a related note, make removal of children from a node more
explicit too.
Vadim Zeitlin [Sat, 27 Aug 2011 14:11:28 +0000 (14:11 +0000)]
Make wxBU_EXACTFIT fir the button text more exactly.
Too big margins were added for the buttons with wxBU_EXACTFIT style making
them larger than strictly necessary. Reduce the margins to make them really
as small as possible.
Vadim Zeitlin [Sat, 27 Aug 2011 14:11:25 +0000 (14:11 +0000)]
Added wxFLP_SMALL and wxDIRP_SMALL styles for wx{File,Dir}PickerCtrl.
These styles allow to use a smaller browse button as the standard one takes
too much space, often leaving too little of it for the more important text
control part.
Notice that both styles are, in fact, equal to wxPB_SMALL but only file and
directory pickers currently use it as it doesn't make sense for the colour and
font pickers.
Vadim Zeitlin [Sat, 27 Aug 2011 14:11:13 +0000 (14:11 +0000)]
Add wxTextEntry::AutoCompleteDirectories().
As we already had MSW-specific AutoCompleteFileNames(), we can just as well
also add the also useful AutoCompleteDirectories() to be used with the text
controls used for path entry.
Vadim Zeitlin [Sat, 27 Aug 2011 14:11:03 +0000 (14:11 +0000)]
Add new wxTreeListCtrl class.
This is a facade for wxDataViewCtrl allowing to easily work with multi-column
trees, possibly with an optional checkbox in the first column. Its API is very
similar to wxTreeListCtrl and it provides a simple migration path from the
latter.
Add the class itself, documentation for it and minimal unit tests.
Václav Slavík [Sat, 27 Aug 2011 13:24:25 +0000 (13:24 +0000)]
Notify GtkTreeView if a node stops being a parent.
GtkTreeView requires the row-has-child-toggled signal to be emitted in
this situation, so do it from ItemDeleted handler.
Curiously, it handles adding the first child automatically. That's good,
because detecting this situation when adding the first child wouldn't be
trivial and so not having to do it is a plus. (Emitting it on every node
addition doesn't sound like a terribly bright idea.)
Václav Slavík [Sat, 27 Aug 2011 13:24:22 +0000 (13:24 +0000)]
Save memory in wxDataViewTreeNode.
Put data that are meaningful only for non-leaf nodes into a separate
struct that is only allocated for branch nodes. This makes branch
nodes larger by sizeof(void*), but leaf nodes save >50% of memory.
Václav Slavík [Sat, 27 Aug 2011 13:24:19 +0000 (13:24 +0000)]
Simplified generic wxDataViewCtrl's tree structure.
Use just one type, wxDataViewTreeNode, to represent any kind of node.
Previously a complicated structure that represented leaves and non-leaf
nodes differently was used. This make the code way too complicated and
caused some smaller bugs (see e.g. #13256).
As a side effect, this change makes the control react correctly to
changes in IsContainer() return values.
Vadim Zeitlin [Sat, 27 Aug 2011 12:13:23 +0000 (12:13 +0000)]
Set colours and fonts for all elements of the generic wxSearchCtrl.
Derive generic wxSearchCtrl from wxCompositeWindow<> to ensure that calls to
its Set{Fore,Back}groundColour() are propagated to all its children, otherwise
they applied only to the composite control itself but not e.g. its text part.
Also update the bitmaps when the background colour changes to ensure that it
appears as transparent.
Vadim Zeitlin [Sat, 27 Aug 2011 12:13:18 +0000 (12:13 +0000)]
Allow returning NULL windows from GetCompositeWindowParts().
wxCompositeWindow::GetCompositeWindowParts() becomes simpler to implement in
the derived classes with optionally shown elements if NULL windows are allowed
(and ignored) in the list returned by it.
Removed wxNotebook::DoGetBestClientSize to let wxBookCtrlBase::DoGetBestSize do its job and fix the best size of a wxNotebook (formerly when running the notebook sample the notebook was not wide enough).
Many wxUniv controls had a way too small best size which was noticeable when running e.g. the widgets sample. Regression started in r61169 where wxWindowBase::DoGetClientBestSize() was introduced but that virtual function already existed in wxUniv's wxWindow. Removing wxUniv's wxWindow::DoGetBestSize and wxWindow::DoGetBestClientSize fixes sizing issues.
The AdjustSize renderer function for wxUniv's GTK and MSW theme adjusted the size of a scrollbar while it already had the correct size, resulting in scrollbars being twice as wide. Fixed by not adjusting the size of a scrollbar anymore in AdjustSize.
Fixed buttons having no border in wxUniv by default.
Buttons had a border of wxBORDER_NONE resulting in wxButton::DoDraw not drawing the button's border. Fixed by adding wxAnyButton::GetDefaultBorder() for wxUniv which returns wxBORDER_STATIC. Regression since r67931.
Vadim Zeitlin [Wed, 24 Aug 2011 11:48:18 +0000 (11:48 +0000)]
Try harder to set the requester splitter position in wxSplitterWindow.
The code in wxSplitterWindow tried to remember the requested position and set
the real sash position to it later, even if the initial window size was too
small to allow for it, but it didn't work because the requested position was
forgotten after the first size event, even though it was quite possible that
this event didn't really change the window size from the initial, small, one.
Try to make this more robust by ignoring the size events which don't really
change the window size. Also set m_lastSize correctly initially.
Now setting the sash position does work even if the splitter itself is inside
nested sizers (which results in many size events).
Vadim Zeitlin [Tue, 23 Aug 2011 15:44:04 +0000 (15:44 +0000)]
Compilation fix for non-OSX: don't use m_rawControlDown there.
m_rawControlDown is supposed to be only used under OS X so put an #ifdef
__WXOSX__ around it in wxKeyboardState::GetModifiers() to fix compilation
under the other platforms.
Vadim Zeitlin [Tue, 23 Aug 2011 15:11:25 +0000 (15:11 +0000)]
Simplify checks for event vetoing in generic wxDataViewCtrl code.
Don't return the whole event object from SendExpanderEvent() just to check if
it wasn't vetoed, simply return a boolean value indicating if this was the
case from this function itself.
This makes it both more efficient and easier to use.
Vadim Zeitlin [Tue, 23 Aug 2011 15:11:22 +0000 (15:11 +0000)]
Fix completely wrong logic for veto checking in generic wxDVC.
The code sending the event must check whether the event was vetoed or not, not
whether it was skipped or not. This is the minimal change resulting in correct
behaviour even if an event handler does skip the event.
Vadim Zeitlin [Tue, 23 Aug 2011 11:04:44 +0000 (11:04 +0000)]
Mention wxLocale in wxNumValidator documentation.
Using setlocale() can thoroughly confuse wxNumValidator because it results in
a mismatch between the decimal and/or thousands separators it uses, returned
by wxLocale, and the actual separators in the strings, formatted by the CRT.
So mention in the documentation that using setlocale() is a bad idea.
Vadim Zeitlin [Tue, 23 Aug 2011 11:04:37 +0000 (11:04 +0000)]
Check for decimal separator inconsistency in wxLocale::GetInfo().
Under wxMSW it's possible to have mismatch between the CRT locale (used by
various printf-related functions) and the system locale (queried by
wxLocale::GetInfo()).
Warn if such a mismatch occurs and tell people to use wxLocale instead of just
setlocale() to change the locale.
Added wxBITMAP_TYPE_TIFF and wxBITMAP_TYPE_TIFF_RESOURCE.
Having wxBITMAP_TYPE_TIFF and wxBITMAP_TYPE_TIFF_RESOURCE is more consistent with already using the complete short name of an image format elsewhere (e.g. wxBITMAP_TYPE_JPEG, not wxBTMAP_TYPE_JPG, and wxTIFFHandler as opposed to wxTIFHandler). Renamed all existing occurrences and kept the old enum values for backwards compatibility.
Also renamed occurrences of wxBITMAP_TYPE_RESOURCE to the already existing wxBITMAP_TYPE_BMP_RESOURCE.
Fixed linking errors related to wxAnyButton in wxUniv.
Native wxAnyButton headers were being included but the sources aren't used in wxUniv. Fixed this by not including any native header in wxUniv and instead made wxAnyButton a typedef of wxAnyButtonBase.
Make use of HasImageList() and GetImageList() instead of accessing the now private m_imageList directly. Fixed for wxUniv, wxGTK1, and wxOS2 (the latter 2 blindly). Changes are similar to r68856 and should have been a part of that.
Vadim Zeitlin [Mon, 22 Aug 2011 15:31:38 +0000 (15:31 +0000)]
Don't refresh not yet realized widget in wxGTK wxDataViewCtrl.
If the text of any of wxDataViewCtrl cells was set before the control was
realized (e.g. during its creation), the code tried to refresh the not yet
shown widget resulting in GTK+ errors.
Avoid this by only refreshing the tree if it's realized.
Vadim Zeitlin [Mon, 22 Aug 2011 15:31:36 +0000 (15:31 +0000)]
Return non-const pointer from wxDataViewRendererBase::GetView().
Non-const wxWindow pointers are unfortunately needed quite often in wx API so
return a non-const pointer here to allow using it with e.g. wxRendererNative
(whose methods all take non-const wxWindow pointers) in the derived classes.
Vadim Zeitlin [Mon, 22 Aug 2011 15:31:33 +0000 (15:31 +0000)]
Add wxDataViewIconText::IsSameAs() and make comparison operators members.
Add IsSameAs() to make it simpler to call from the derived class operator==()
implementation.
Also make comparison operators themselves members instead of global functions
to avoid considering them as matches for all operator==() uses in the program,
there is really no need for this as we do _not_ want to allow implicitly
converting something to wxDataViewIconText when comparing.
Vadim Zeitlin [Mon, 22 Aug 2011 12:18:33 +0000 (12:18 +0000)]
Add @genericAppearance Doxygen macro.
This allows to provide just a single image (in "generic" subdirectory) for the
generic controls that look the same in all ports instead of having to create
three identical ones (in "wxmsw", "wxgtk" and "wxmac" subdirectories) that are
required by @appearance.
Vadim Zeitlin [Mon, 22 Aug 2011 12:13:39 +0000 (12:13 +0000)]
Fix the coordinates in wxDataViewCustomRenderer::LeftClick() in generic wxDVC.
The code in generic wxDataViewCtrl implementation didn't take the space taken
by tree expander button nor the indentation of child nodes into account, so
the coordinates passed to LeftClick() could be completely wrong.
Fix this by offsetting them to ensure that click coordinates are always
relative to the cell client area.
Vadim Zeitlin [Sun, 21 Aug 2011 14:08:56 +0000 (14:08 +0000)]
Refactor: replace wxTreeItemId and wxDataViewItem with new wxItemId<>.
Add wxItemId<> template which can be used to identify items in different
{tree,list}-like controls, including wxDataViewCtrl (where it replaces, in
backwards compatible way, wxDataViewItem), wxTreeCtrl (where it replaces
wxTreeItemId) and the upcoming wxTreeListCtrl.
Vadim Zeitlin [Sun, 21 Aug 2011 14:08:49 +0000 (14:08 +0000)]
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.
Vadim Zeitlin [Sun, 21 Aug 2011 14:08:43 +0000 (14:08 +0000)]
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.
Vadim Zeitlin [Sun, 21 Aug 2011 12:06:16 +0000 (12:06 +0000)]
Replace wxComboBox::IsEmpty() with Is{List,Text}Empty().
IsEmpty() didn't exist in all ports (notably not wxMSW) and its meaning was
unclear anyhow, so remove it even from the ports where it did exist and add
clear Is{List,Text}Empty() replacements instead.
Václav Slavík [Sun, 21 Aug 2011 09:07:02 +0000 (09:07 +0000)]
Fix autosize columns width calculation in generic wxDataViewCtrl.
Column widths were recomputed too soon -- after the model changed, but
before the control's own data structures were updated to reflect the
change. This could lead to incorrect calculations or worse, crashes.