Vadim Zeitlin [Sat, 14 Nov 2009 16:11:09 +0000 (16:11 +0000)]
No real changes, just remove the ugly CONST_CAST macro.
Use const_cast<> directly, we don't support compilers which don't have it any
more. And CONST_CAST macro conflicts with a macro with the same name (and
similar purpose) defined in Symbian headers.
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.