Václav Slavík [Mon, 12 Sep 2011 09:23:59 +0000 (09:23 +0000)]
Fix appending of non-leaf node to wxGTK's wxDataViewCtrl.
This was accidentally broken in r68965: appending a branch node after
all others node resulted in corruption of m_nodes, as the node was never
added to the list.
Fix best size computation for wxTextCtrl without borders in wxMSW.
wxTextCtrl with wxBORDER_NONE (and possibly wxTE_READONLY) style is often used
instead of a wxStaticText to allow copying the text, so make the size of such
control the same as size of the label. This ensures that it aligns correctly
with the label vertically while before the baselines were not aligned because
a border-less text control was rendered by MSW as a label but had a too big
size.
Still resize wxSplitterWindow children even when sash position doesn't change.
Since the changes if r68876, the splitter windows were not resized correctly
if the splitter size in the direction orthogonal to its own didn't change.
This was an unintended side effect of the changes in that commit as it only
wanted to avoid calling SetSashPositionAndNotify() in this case, but
SizeWindows() should still be called.
Ensure that we do call it always from wxSplitterWindow::OnSize() to fix this.
Václav Slavík [Mon, 5 Sep 2011 14:25:31 +0000 (14:25 +0000)]
wxDataViewCtrl: enable F2 editing with multiple selection too.
This matches the native (and thus expected) behavior of Windows
Explorer: edit the first item in selection. It's also better than
ignoring user's key presses.
Václav Slavík [Sat, 3 Sep 2011 13:14:20 +0000 (13:14 +0000)]
Fix generic wxDataViewCtrl Enter handling to conform to Windows UI.
Spacebar is used to activate columns (e.g. toggle a checkbox). Enter
activates the item, i.e. sends wxEVT_COMMAND_ITEM_ACTIVATED. If that
event isn't handled, Enter acts the same as Space.
Don't warn about wxMetaFile in configure by default.
Only warn if an explicit --enable-metafile was given, otherwise just turn it
on only for the platforms that do support it, similarly to what was done for
--enable-hotkey in the previous commit.
Add --enable-hotkey switch to allow enabling hot keys support and enable it by
default under MSW and OS X that do support them but disable it elsewhere to
avoid unnecessary warnings about them being unsupported.
Vadim Zeitlin [Wed, 31 Aug 2011 17:22:11 +0000 (17:22 +0000)]
Fix deleting and clearing wxTreeListCtrl columns.
The model columns were not updated before, resulting in a mismatch between
view and model columns if ClearColumns() followed by AppendColumn() was
called.
Fixed dlmsw.cpp compilation with older SDKs and at run-time for systems prior to XP SP1.
Kernel32's SetDllDirectory is only available since XP SP1 and as such also not available in the SDK that comes by default with for example VS6. Attempt to retrieve the function from the DLL at run-time instead. Regression since r68935.
Vadim Zeitlin [Tue, 30 Aug 2011 13:40:44 +0000 (13:40 +0000)]
Better support for flat lists in wxTreeListCtrl.
Override wxDataViewModel::IsListModel() to return true if wxTreeListCtrl
doesn't have any depth. This results in better display when using the generic
implementation of wxDataViewCtrl as no space is reserved for the (unnecessary)
expanders in this case.
Vadim Zeitlin [Tue, 30 Aug 2011 13:40:40 +0000 (13:40 +0000)]
Fix computation of the item offset in generic wxDataViewCtrl code.
We need to account for the expander even for the items that don't have
children when computing their offset as their parent still does have it,
contributing to the total offset.
This corrects the fixes of r68836 to also work for the leaf items.
Also rename expanderOffset variable to more clear itemOffset.
Václav Slavík [Mon, 29 Aug 2011 17:25:38 +0000 (17:25 +0000)]
Send wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED if WXOnActivate() returned false too.
This is consistent with wxGTK implementation and generally makes sense:
when the renderer cannot handle activation, whole-item activation should
be tried next.
Václav Slavík [Mon, 29 Aug 2011 17:25:33 +0000 (17:25 +0000)]
Make generic wxDataViewToggleRenderer react to activation.
Previously it only responded to single-clicks, which was to avoid the
need to double-click checkboxes. Fixed to react to activation via
double-click or keyboard too.
Václav Slavík [Mon, 29 Aug 2011 17:25:25 +0000 (17:25 +0000)]
Activate cells from keyboard too in generic wxDataViewCtrl.
wxDataViewCtrl only called WXOnActivate() in reaction to double-click.
When Enter/Spacebar was pressed, only
wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED was sent, without calling
OnActivate() even if it was possible.
Fixed to handle both kinds of input identically.
Because there's currently no way to change current focus to a particular
column (as GtkTreeView can do), call WXOnActivate() on the first
activatable column.
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.