Vadim Zeitlin [Tue, 24 Nov 2009 00:01:25 +0000 (00:01 +0000)]
Don't change file access time implicitly when setting it explicitly.
wxFileHandle helper class used in wxFileName::SetTimes() under MSW modified
the file access time by setting it to the current time because it opened the
file in a wrong mode.
Vadim Zeitlin [Sun, 22 Nov 2009 11:24:09 +0000 (11:24 +0000)]
Define wxNO_RTTI if RTTI support is disabled for g++ or MSVC.
For g++ it could have been possible to define wxNO_RTTI in configure itself
but it seems better/simpler/more maintainable to do it in C++ code. As for
MSVC, we already define wxNO_RTTI correctly if build/msw/makefile.vc is used
but not if (modified or rebaked) project files are used and detecting RTTI
support in the code is the only way to fix it.
Jaakko Salli [Sat, 21 Nov 2009 11:39:32 +0000 (11:39 +0000)]
Added a new documentation overview section 'Caveats When Not Using C++ RTTI', describing possible problems with Bind() and wxAny when C++ RTTI is disabled.
Jaakko Salli [Thu, 19 Nov 2009 19:27:24 +0000 (19:27 +0000)]
Added typeinfo.h which implements wxTypeId, using C++ RTTI if available. wxAny and Unbind<>() code are updated to use it. Added and updated related unit tests.
Vadim Zeitlin [Thu, 19 Nov 2009 01:36:54 +0000 (01:36 +0000)]
Compilation fix for wxUSE_STL build: another missing _str().
Use utf8_str() to convert wxString to GTK+ string instead of relying on
implicit conversion which doesn't exist when wxUSE_STL==1 (and also when using
wchar_t-based Unicode build).
Vadim Zeitlin [Wed, 18 Nov 2009 03:45:32 +0000 (03:45 +0000)]
Fix handling of invalid paths with multiple columns in wxFileName.
SplitVolume() didn't handle colons in the initial position correctly which
surprised SetPath() and led to accessing an out-of-range string element. Fix
SplitVolume() and also add a check to SetPath() itself as it seems like it
could be called with a path containing the volume only.
Vadim Zeitlin [Wed, 18 Nov 2009 03:18:24 +0000 (03:18 +0000)]
Remove unnecessary manual face name selection code.
The change of r60391 made specifying the face name explicitly unnecessary but
left the code which filled "facename" array in wxNativeFontInfo::SetFamily()
with face names even though it was never used -- simply remove this code.
Vadim Zeitlin [Wed, 18 Nov 2009 03:18:16 +0000 (03:18 +0000)]
Implement wxFont::GetFaceName() to return the face name being really used.
Since the change of r60391 empty face name was returned for all fonts created
using the standard wxFont constructor (so basically all fonts except for those
created from native font info and the default/normal font which we retrieve
from the system). Use Windows GetOutlineTextMetrics() function to get the real
face name being used independently of the way the font was created.
Kevin Ollivier [Sun, 15 Nov 2009 01:36:30 +0000 (01:36 +0000)]
ShowWithoutActivating fix for OS X Cocoa, and also add support for shaped windows at least when the image being drawn has proper alpha/mask set. I'm not sure if we can support it by setting a region on the TLW, as the way to do this in Cocoa is just to make the TLW's background transparent and use alpha in whatever you draw.
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).