Vadim Zeitlin [Wed, 11 Nov 2009 22:30:07 +0000 (22:30 +0000)]
Set wxSL_VERTICAL style in wxSlider demo page.
wxGTK doesn't currently take wxSL_{LEFT,RIGHT,TOP,BOTTOM} styles into account
but at least make it change the slider orientation correctly depending on them.
Jaakko Salli [Wed, 11 Nov 2009 19:49:58 +0000 (19:49 +0000)]
Fix wxPropertyGrid rendering problems when used with wxAUI. It seems we cannot rely on wxWindow::GetRect() to return wxRect with x=0 here. (fixes #11433)
We had wxBase64Decode(void*,size_t,const char*,size_t) as well as
wxBase64Decode(const char*,size_t) and wxBase64Decode(wxString) already but
not a version taking the buffer and wxString, complete the set of overloads
now.
This allows the unit test to compile in STL build (where there is no implicit
conversion from wxString to const char *).
Vadim Zeitlin [Wed, 11 Nov 2009 01:50:06 +0000 (01:50 +0000)]
Implement text ellipsizing for wxDataViewCustomRenderer in wxGTK.
Add another virtual function (GtkGetTextRenderer()) to the base class which
allows us to reuse the same code setting the "ellipsize" property that we
already used for wxDataViewTextRenderer for wxDataViewCustomRenderer as well.
Vadim Zeitlin [Tue, 10 Nov 2009 18:17:31 +0000 (18:17 +0000)]
No changes, just reformat comments in osx/dataview.mm.
Wrap long lines to be able to read the comments and remove the perfectly
useless "// variable definition" and "// constant definition for
abbreviational purposes" noise.
Vadim Zeitlin [Tue, 10 Nov 2009 17:42:58 +0000 (17:42 +0000)]
Fix width of the wxDataViewTreeCtrl column under OSX/Cocoa.
Set the column resizing mode to "automatic" instead of "none" if the control
doesn't show the header. This allows the native control to properly resize the
only tree control column to always take up the entire window size (provided we
don't explicitly create it resizeable, so don't do this).
Vadim Zeitlin [Tue, 10 Nov 2009 17:42:46 +0000 (17:42 +0000)]
Add support for wxDV_NO_HEADER to OS X/Cocoa wxDataViewCtrl.
Also use this flag with the tree control in the sample to test it and also
because it doesn't make much sense to have a single column without title
anyhow.
Vadim Zeitlin [Tue, 10 Nov 2009 17:42:24 +0000 (17:42 +0000)]
Add support for custom attributes to wxOSX/Cocoa wxDataViewCustomRenderer.
Virtualize applying the attributes in a new OSXApplyAttr() function and simply
store the attribute in its wxDataViewCustomRenderer version so that it could
be reused later in Render().
The attributes now work correctly in wxOSX/Cocoa dataview sample too.
Vadim Zeitlin [Tue, 10 Nov 2009 17:42:04 +0000 (17:42 +0000)]
Don't overwrite background in custom renderer in OSX/Cocoa.
Erasing background seems to be unnecessary and was actively harmful for the
selected items which didn't appear with the correct background colour. Just
don't do it at all.
Vadim Zeitlin [Tue, 10 Nov 2009 17:41:58 +0000 (17:41 +0000)]
Add support for custom attributes to wxGTK wxDataViewCustomRenderer.
Call SetAttr() to store them in wxDataViewCustomRenderer before rendering it
and also honour the attributes in RenderText() (by reusing the same code we
already use for wxDataViewTextRenderer).
The attributes now work correctly in dataview sample under wxGTK as well.
Vadim Zeitlin [Tue, 10 Nov 2009 17:41:50 +0000 (17:41 +0000)]
Correct text position in wxDataViewCustomRenderer::RenderText() in wxGTK.
It simply ignored the passed in rectangle meaning that the text was always
drawn at the top left corner of the cell rectangle.
Also more code cleanup: collect all render call parameters in a single struct
and provide a public function to set them all at once instead of making them
public.
Vadim Zeitlin [Tue, 10 Nov 2009 17:41:42 +0000 (17:41 +0000)]
Pass full cell rectangle to WXCallRender().
There is no need to ask the item for its size in gtk_wx_cell_renderer_render()
as WXCallRender() will already do it (correctly, accounting for badly
implemented GetSize() unlike this version) internally on its own.
Vadim Zeitlin [Tue, 10 Nov 2009 17:41:22 +0000 (17:41 +0000)]
Avoid setting attributes in GTK wxDataViewRenderer if not supported.
If the native renderer doesn't support the properties which we map our
attributes to, trying to set them is useless and results in GTK+ warnings so
don't do it.
Add wxDataViewRenderer::GtkSupportsAttrs() which can be overridden to indicate
whether the renderer supports attributes or not. We probably could use
g_object_class_find_property() instead to detect it automatically but for now
these properties are all supported only by GtkCellRendererText and not
supported anywhere else so using a single virtual function seems tidier.
Vadim Zeitlin [Tue, 10 Nov 2009 17:41:11 +0000 (17:41 +0000)]
Allow custom wxDataViewCtrl renderers to easily use attributes.
Set up the DC passed to wxDataViewCustomRenderer::Render() to use the font and
colour defined by the item attribute by default so that any calls to
RenderText() from it will use them automatically.
Also added public wxDataViewCustomRenderer::GetAttr() to allow retrieving the
attribute explicitly in Render().
The column using custom renderer in the dataview sample now works as expected
in the generic version; the native ones will be corrected in the upcoming
commits.
Vadim Zeitlin [Tue, 10 Nov 2009 17:40:58 +0000 (17:40 +0000)]
Big wxDataViewCtrl renderer classes refactoring.
This commit adds no changes in functionality but paves way for the upcoming
improvements of wxDataViewCustomRenderer.
First, introduce wxDataViewCustomRendererBase class in order to allow
implementing behaviour common to custom renderers in all ports in this class
instead of triplicating it.
This required splitting monolithic dataview.h in more parts, now we have
wx/dvrenderer.h which defines wxDataViewRendererBase and the new
wxDataViewCustomRendererBase and includes wx/port/dvrenderer.h which define
wxDataViewRenderer and wx/port/dvrenderers.h which defines all the other
renderer classes.
Also bring renderers hierarchy in the generic version closer to other ports:
all standard renderer classes now inherit from wxDataViewRenderer and not
wxDataViewCustomRenderer in for consistency with the other ports.
wxDataViewRenderer itself still does derive from wxDataViewCustomRendererBase,
unlike elsewhere, but this is unavoidable considering that all generic
renderers are custom ones.
Finally do some cleanup in OS X part of the code: correct indentation,
spacing, comment style.
Vadim Zeitlin [Tue, 10 Nov 2009 17:40:37 +0000 (17:40 +0000)]
Add custom renderer column to the list model example in dataview sample.
Add a column using custom renderer to the example using a list model with
attributes to test attributes support -- currently they are ignored, but this
will be fixed soon.
Also make the custom renderer display somewhat more clear as previously it
didn't depend at all on its value.
Vadim Zeitlin [Tue, 10 Nov 2009 17:40:25 +0000 (17:40 +0000)]
Use symbolic constants for list model columns in dataview sample.
Using Col_EditableText, Col_IconText and Col_TextWithAttr instead of 0, 1 and
2 makes the sample code a bit easier to read.
Also use switch on the column value instead of nested ifs everywhere to give
compiler a chance to warn us if we forget to update some function when a new
column is added.
Vadim Zeitlin [Tue, 10 Nov 2009 00:13:57 +0000 (00:13 +0000)]
Fix discrepancy between different ways of measuring text extents under Mac.
wxGraphicsContext::GetTextExtent() didn't round the returned double result to
int but truncated it instead and so returned different extent than
GetPartialTextExtents() which did round it up.
Moreover, wxGraphicsContext::GetPartialTextExtents() didn't round it up
correctly: it wrongly added 0.5 to the value still stored as double and which
was hence rounded up (correctly, this time) when converted to int in
wxDC::GetPartialTextExtents().
These two errors combined to produce difference of up to 2 pixels between the
last offset returned by wxDC::GetPartialTextExtents() and the total string
extent returned by wxDC::GetTextExtent() which thoroughly confused the code in
wxControlBase::DoEllipsizeSingleLine() (and probably not only there).
Vadim Zeitlin [Mon, 9 Nov 2009 18:20:05 +0000 (18:20 +0000)]
Fix unit test added in r62561 to work under Windows too.
The unit test checking that slashes were allowed in UNCs too didn't work under
Windows because GetPath() returned volume as part of the path there (and also
used backslashes by default), fix it.
Vadim Zeitlin [Mon, 9 Nov 2009 01:57:47 +0000 (01:57 +0000)]
Fix fatal bug when changing wxDataViewCtrl model in wxGTK.
wxDataViewCtrl::AssociateModel() wrongly delete m_notifier itself if the
control already had a model even though the notifier was registered using
AddNotifier() which also scheduled it for deletion when the old model itself
was destroyed. This resulted in double deletion and reproducible crash
whenever the model was changed.
Vadim Zeitlin [Fri, 6 Nov 2009 20:47:52 +0000 (20:47 +0000)]
Change interpretation of font height in wxMSW to mean character height.
Accept both positive and negative height values in wxFont::SetPixelSize() in
wxMSW and map them both to a negative height when passing to MSW API in order
to request mapping against the character height and not the total cell height.
For positive heights this is more consistent with the other ports and also
expectations of people using this function. We keep the possibility to use
the negative heights inly for compatibility with the existing code which
worked around the (incorrect) interpretation of the positive height as cell
heights in the previous wxMSW versions by passing a negative height
explicitly.
Vadim Zeitlin [Fri, 6 Nov 2009 20:47:44 +0000 (20:47 +0000)]
Prefer to use standard selection colour in wxDataViewCustomRenderer.
We currently don't allow customizing the background colour of the selected
items which is always the system standard colour and so we should also use the
system standard selection foreground colour as a combination of a custom
foreground and standard background may be completely unreadable.
Notice that it is still possible to use custom colour if really needed from a
custom renderer by removing wxDATAVIEW_CELL_SELECTED from the flags before
calling the base class version of RenderText().
Vadim Zeitlin [Thu, 5 Nov 2009 14:59:55 +0000 (14:59 +0000)]
Change wxLongLongFmtSpec to be a non-wide string.
As with other ANSI/Unicode unification changes, we choose to preserve
compatibility with the existing code using wxLongLongFmtSpec in ANSI build
and require people using it in Unicode build to change their code.
Vadim Zeitlin [Wed, 4 Nov 2009 16:15:52 +0000 (16:15 +0000)]
Revert "trivial" change of r61772.
The "slight code simplification" of r61772 broke the code as it could now
crash if dangling m_Cell pointer was used during parsing. Revert it and add a
comment explaining why the code is written in the way it is.
Vadim Zeitlin [Tue, 3 Nov 2009 14:12:14 +0000 (14:12 +0000)]
Document wxDocument::SetDocumentSaved().
While this function is usually called by wx itself it may be useful to call it
explicitly in some particular situations, as documented in the function
description, so make it officially public.
Vadim Zeitlin [Sat, 31 Oct 2009 15:57:58 +0000 (15:57 +0000)]
No real changes, just fix a typo in wxDataViewModel::Compare().
Return -1 from the comparison function instead of -11 when comparing
wxDateTime values. It shouldn't matter which value is returned as long as it's
negative but it is definitely tidier.
Vadim Zeitlin [Sat, 31 Oct 2009 15:57:51 +0000 (15:57 +0000)]
Return the real column width from wxOSX wxDataViewColumn::GetWidth().
Code used to return the last programmatically set width value instead of the
real column width which could have been changed by user if the column was
resizeable, fix this by returning the current NSTableColumn:width value.
Kevin Ollivier [Fri, 30 Oct 2009 05:04:47 +0000 (05:04 +0000)]
Initial ShowWithoutActivating implementations for Mac and Windows, and attempt to improve IsActive behavior on Mac. Also adding ShowWithoutActivating() and Show/Hide tests, but until the mainloop issues are resolved, not adding them to tests.bkl.
Vadim Zeitlin [Sat, 24 Oct 2009 21:42:04 +0000 (21:42 +0000)]
Make wxDataViewModel::GetAttr() and GetAttrByRow() const.
This is an incompatible change but having to use a non-const model pointer to
call a clearly logically const version was simply too ugly so change it while
we still can.
Vadim Zeitlin [Sat, 24 Oct 2009 21:41:54 +0000 (21:41 +0000)]
Add wxDataViewListModel base class for list models.
Introduce a base class for wxDataViewIndexListModel and
wxDataViewVirtualListModel instead of duplicating the same code in both of
them making the code difficult to maintain and change.
For now this class is not documented as it is used just to avoid duplication
in the implementation but maybe we should make it public to allow defining
other flat list data models (if this can be made to work in Carbon version).
Vadim Zeitlin [Sat, 24 Oct 2009 21:41:44 +0000 (21:41 +0000)]
Create model and column in wxDataViewTreeCtrl::Create(), not ctor.
Old code created the tree model and its unique built-in column only in
wxDataViewTreeCtrl ctor but not in Create(), meaning that the behaviour was
very different depending on whether you used base class ctor call or Create()
in a derived class. This was confusing and completely inconsistent with wx API
in which using the default ctor and Create() is supposed to always have
exactly the same effect as using non-default ctor so change this to create the
model in Create() so that it's always done.
Slightly update the documentation and also add wxDataViewTreeCtrl::Init() for
consistency.
Vadim Zeitlin [Sat, 24 Oct 2009 21:41:30 +0000 (21:41 +0000)]
No real changes, just make wxDataViewCtrl::Init() private in wxGTK.
The usual convention is for Init() method to be private and to call it from
constructor, follow it in GTK implementation of wxDataViewCtrl too instead of
making it public and calling it from Create().
Vadim Zeitlin [Sat, 24 Oct 2009 01:03:36 +0000 (01:03 +0000)]
Don't show anything in the cells which should be empty in Cocoa wxDVC.
Implement a custom NSTableColumn-derived class to return nil for the cells
which shouldn't show anything at all because they are part of a container row.
This finally fixes the totally wrong display of the first page of the dataview
sample under OS X.
Vadim Zeitlin [Sat, 24 Oct 2009 01:03:24 +0000 (01:03 +0000)]
Add wxDataViewModel::HasValue().
This method allows to simply test whether we have a value at the given row and
column or not (as it happens for container items unless they too have columns).
Currently this method is not virtual and is not used by the implementations
yet but it might make sense to make it virtual and allow overriding it in the
future.
Vadim Zeitlin [Fri, 23 Oct 2009 23:49:26 +0000 (23:49 +0000)]
Use virtual functions to convert NSObject to the correct type in wxDVC.
Instead of trying to determine the type of the value which should be extracted
from the NSObject we receive from NSOutlineView, just pass it to a virtual
method in the renderer which knows which type does it need.
This fixes the problem with editing boolean/checkbox columns and makes the
code more elegant.
Vadim Zeitlin [Fri, 23 Oct 2009 23:49:16 +0000 (23:49 +0000)]
Add wxDataViewModel::ChangeValue() and use it in wxDVC implementation.
ChangeValue() is a trivial wrapper calling both SetValue() and ValueChanged().
It allows to replace many calls to SetValue() immediately followed by
ValueChanged() with a single function call which is significantly shorter and
less error-prone (e.g. most of the existing code didn't test SetValue() return
code at all).
Vadim Zeitlin [Fri, 23 Oct 2009 17:48:21 +0000 (17:48 +0000)]
Rebaked using post-0.2.7 svn version of bakefile.
Unfortunately 0.2.7 release contained a bug in msvc backend which resulted in
warnings generated for each file compiled. Apply the fix from bakefile svn to
fix this (and test if no other problems are found).
Also update all makefile.unx after changes of r62477.