Commit Graph

1887 Commits

Author SHA1 Message Date
Vadim Zeitlin
c98879e379 Add wxFont::SetFractionalPointSize()
Changing SetPointSize() argument type from int to float wasn't 100%
backwards-compatible as it notably started resulting in warnings (from
at least MSVC) about conversions from int to float in the existing code.

To avoid these warnings and for symmetry with GetFractionalPointSize(),
add SetFractionalPointSize() taking float argument and preserve the
argument of type int in SetPointSize() for compatibility.

SetPointSize() is now just a wrapper forwarding to the more general
SetFractionalPointSize().

Notice that the other ports still remain broken, this commit only
updates the currently working wxGTK, wxMac and wxMSW.
2018-09-17 15:24:40 +02:00
Vadim Zeitlin
8ff36f98f3 Move {Get,Set}Weight() implementations to wxFontBase
Implement these methods in the base class in terms of
{Get,Set}NumericWeight() in order to avoid having to do it for each
platform.

No real changes.
2018-09-06 03:13:23 +02:00
Vadim Zeitlin
967ff67459 Merge branch 'adv-merge'
Move the entire contents of wxAdv library into wxCore.

In the future, wxAdv will disappear entirely, but for now keep it as an
empty placeholder to allow the existing make/project files to work.

See https://github.com/wxWidgets/wxWidgets/pull/900
2018-09-02 15:43:02 +02:00
Stefan Csomor
4580cdb9ad
Extending wxFont API & OSX Core Text Implementation (#877)
* Switch to pure Core Text Implementation, Start extended Font API

* mac fixes

* First msw implementation

* Fixing paste error

* fixing typo

* Rearranging lines to former fallthrough order

* Blind fixes for covering new abstract methods

* Blind gtk implementations

* Fixing according to travis ..

* Removing method defined in base

* formatting adaptions

* Extending the schema definition for new weights

* fixing typo, using wxRound, other fixes according to comments

* changes according to suggestions

* fixing init order, before the init of m_info was overridden by Init()

* redo

* redo

* redo

* Cleanup

Removing obsolete code snippets, proper traces for font names

* Moving common code

Only the Get/SetNumericWeight calls should now be implemented in the native part, the ‚old‘ Get/SetWeight are common code and use the numeric counterparts.

* Updating docs

* commit wa missing changes.txt

* Doc fixes

* Full stops added
2018-09-01 19:42:18 +02:00
Vadim Zeitlin
3ffa651a34 Move wxAdv library contents into wxCore
This basically removes the "adv" library, even though it's still
preserved for compatibility with user make/project files referring to
it.

It is done because the distinction between "adv" and "core" was never
really clear (e.g. why wxTreeCtrl was in core but wxTreeListCtrl in
adv?) and it prevented some core classes from using adv ones.
2018-08-27 21:13:04 +02:00
Vadim Zeitlin
4af7d4e0d5 Also implement wxDataViewColumn::UnsetAsSortKey() for wxGTK
Allow to reset the sort order in native GTK+ implementation too.

See #18176.
2018-07-28 02:54:44 +02:00
Vadim Zeitlin
03a13591b9 Add wxDataViewToggleRenderer::ShowAsRadio()
This allows showing radio buttons in wxDataViewCtrl easily and natively.

Notice that this approach, adding an extra function to the existing
renderer class instead of creating some new wxDataViewRadioRenderer (see
https://github.com/wxWidgets/wxWidgets/pull/809), was finally chosen
because it is simpler to implement and, more importantly, because it
will be more natural to generalize if/when we also add a 3-state
check/radio renderer.

Closes https://github.com/wxWidgets/wxWidgets/pull/853
2018-07-11 23:48:14 +02:00
Vadim Zeitlin
c5530b1abf Switch to using DoGetClippingRect() instead of DoGetClippingBox()
The new method returns a boolean flag which indicates whether there is
any clipping region or not and so is preferable to using the old one and
checking its return value to determine this, which can't be done
reliably.
2018-06-19 00:20:47 +02:00
Paul Cornett
102be6a3cc Add GtkStyleContext helper class
Manages ownership of GtkStyleContext and GtkWidgetPath, provides functions
for creating and querying style contexts.
2018-06-05 09:21:25 -07:00
Vadim Zeitlin
7eef4a4549 Fix build with GTK+ < 2.20 due to undefined key code constants
Include gdk/gdkkeysyms.h from wx/gtk/private/gtk2-compat.h as it must be
included before it for the compatibility header to define the new names
for the key constants even when using old GTK+ versions.
2018-05-22 17:01:07 +02:00
Vadim Zeitlin
c0b0562533 Avoid many -Wparentheses warnings from gtk/gtk.h with gcc8
Add wx/gtk/private/wrapgtk.h wrapping gtk/gtk.h in pragmas disabling
these warnings and include it everywhere instead of directly including
gtk/gtk.h.

Also include wx/gtk/private/gtk2-compat.h from this wrapper header as it
was included by 90% of the files including gtk/gtk.h itself and it seems
to be better and simpler to just always include it.
2018-05-21 12:34:04 +02:00
Jeff Bland
8b18bbb9c7 Fix uses of wxPalette without check for wxUSE_PALETTE 2018-05-18 18:49:05 -06:00
Vadim Zeitlin
f53923dd31 Left-align wxSpinCtrl contents by default
The default alignment of the text in wxSpinCtrl was changed to "right"
in 7e4952db83, which added alignment
support (see #10621), but this made it inconsistent with the native
up-down control under MSW and, perhaps more importantly, with spin
controls created from XRC as the default style was never modified there
and did not include wxALIGN_RIGHT.

Resolve this inconsistency by reverting to left-aligning the text by
default.
2018-05-12 19:14:00 +02:00
Paul Cornett
9bfa890480 Build fixes for __WXUNIVERSAL__==1 2018-05-11 10:16:49 -07:00
Vadim Zeitlin
d97c055514 Introduce platform-dependent wxTLWGeometry class
Previously, TLW geometry was implicitly defined as just its position,
size and the maximized/iconized state by wxPersistentTLW code. This
already wasn't enough for wxGTK which added the decoration sizes to the
geometry being saved/restored, but this had to be done using conditional
compilation, which was not ideal. And it didn't allow using an entirely
different geometry representation as will be done for wxMSW soon.

Change the code to use wxTLWGeometry class defining the geometry, as
used by the current port, explicitly and move wxPersistentTLW logic into
it, as wxPersistentXXX classes are supposed to be very simple, which
wasn't really the case.

Also provide public SaveGeometry() and RestoreToGeometry() methods in
wxTopLevelWindow, which can be useful even to people not using
wxPersistentTLW for whatever reason.

There should be no changes in behaviour so far.
2018-04-29 19:51:10 +02:00
Vadim Zeitlin
311b2aee5f Check for liblzma headers in configure too and add wxUSE_LIBLZMA
Prepare for using liblzma in wxWidgets code by adding the necessary
option and updating the configure check for it (which had been already
present due to libtiff possible dependency on liblzma).

No real changes yet.
2018-04-06 15:39:39 +02:00
Paul Cornett
05454e778c Build fix for GTK+ < 2.18
Broken by 986f61f33e
2018-03-12 10:06:23 -07:00
Vadim Zeitlin
e5a1a29e77 Fix wxGTK build with glib < 2.32 and streamline the code a bit
Define g_signal_handlers_disconnect_by_data() if it's not available,
i.e. when using glib older than 2.32 where it was added, to fix the
build under old systems such as CentOS 6 broken by the changes of
8278f7b618 (see #18084).

Also use it elsewhere instead of g_signal_handlers_disconnect_matched()
as it's more readable.

Closes https://github.com/wxWidgets/wxWidgets/pull/760
2018-03-11 22:22:45 +01:00
Vadim Zeitlin
a957df3fc1 Add missing wxOVERRIDE for overridden GtkGetValueFromString
This fixes a (harmless) warning in clang wxGTK builds.
2018-02-06 13:29:32 +01:00
Vadim Zeitlin
eee4f5969f Merge branch 'dvc-more-fixes'
More, mostly event-related, wxDataViewCtrl fixes.

See https://github.com/wxWidgets/wxWidgets/pull/718
2018-02-05 14:04:42 +01:00
Scott Talbert
1f2173b9be Fix custom scheme handling in wxWebView WebKit2 implementation
The custom scheme handling implementation had been inherited from the
original WebKit1 implementation.  It attempted to intercept navigation
and resource load requests and then inject the resources.  It seems that
this method doesn't work in WebKit2, but fortunately, there is native
support in WebKit2 for custom URI schemes through the
webkit_web_context_register_uri_scheme() API.

Also extend wxGtkError to allow creating it from an existing GError
object as a side-effect of these changes.

See https://github.com/wxWidgets/wxWidgets/pull/716
2018-02-05 14:04:41 +01:00
Vadim Zeitlin
a00b8dec8b Reduce code duplication in wxGTK wxDataViewRenderer classes
The code was more complicated than necessary, with the base class
providing both virtual GtkOnCellChanged() and GtkOnTextEdited() that
were both overridden to achieve the same thing, namely customizing how
the value entered by user is converted to wxVariant, in different
derived classes.

Make GtkOnTextEdited() non-virtual and remove GtkOnCellChanged()
completely and add a new simple GtkGetValueFromString() which is called
from GtkOnTextEdited() to do the conversion.

This removes the existing code duplication and will make it simpler to
modify this code in the future, without changing the behaviour.
2018-02-05 00:01:52 +01:00
Vadim Zeitlin
508a409f7e Suppress focus loss on opening combobox popup in wxGTK
Make GTKHandleFocusOut() virtual and override it in wxChoice in order to
avoid generating wxEVT_KILL_FOCUS events when the combobox dropdown
button is clicked.

This is important because it allows fatal problems when using a
combobox-based in-place editor in wxDataViewCtrl as getting these events
totally broke the UI before.

See #17034.
2018-02-04 14:51:58 +01:00
Vadim Zeitlin
1148b2e0fe Make GTKHandleDeferredFocusOut() non-static
Slightly simplify the code by making it a member function.

No real changes.
2018-02-03 23:56:44 +01:00
Vadim Zeitlin
f063dde4f5 Merge branch 'gtk-dyn-autocomplete'
Implement dynamic wxTextEntry autocompletion for wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/690

Closes #18061.
2018-01-27 19:28:09 +01:00
Vadim Zeitlin
1d45a8e50a Merge branch 'gtk-dc-ppi'
Return display DPI from display-related wxDC classes in wxGTK3.

See https://github.com/wxWidgets/wxWidgets/pull/680
2018-01-27 19:25:30 +01:00
Vadim Zeitlin
02f2159aea Split wxTextAutoCompleteData in two subclasses
Doing two different things in the same class, using m_isDynamicCompleter
to determine which kind of completion is used, was not very clear, so
create two simple classes each of which does one and one thing only and
create the one we need in wxTextEntry methods.

Note that wxTextAutoCompleteDynamic can assume to always have a valid
wxTextCompleter as otherwise no wxTextAutoCompleteData is needed at all,
which results in more simplifications.

There should be no changes in behaviour.
2018-01-27 01:17:50 +01:00
AliKet
18983cf538 Implement dynamic auto-completion for wxGTK
Make completion using custom wxTextCompleter work in wxGTK too.

Closes #18061.
2018-01-26 23:43:34 +01:00
Vadim Zeitlin
ee0dd4edb1 Replace wxGTKCairoDCImpl::m_{width,height} with m_size
This allows to avoid initializing the variables to 0 in all the
overloaded ctors: wxSize default ctor already does it.

It's also more convenient to use GetScaledSize() rather than assigning
m_width and m_height separately, even if the rest of the code is broadly
unchanged.
2018-01-25 14:56:43 +01:00
Vadim Zeitlin
4c8e701d84 Remove wxGTKCairoDCImpl ctor taking dummy int
We can reuse another ctor taking wxWindow* instead. Although this does
require an ugly cast, it's more explicit than just passing 0 which
could, in principle, match both the ctor taking wxWindow* and another
one taking double, and so is still preferable.
2018-01-25 14:56:43 +01:00
Vadim Zeitlin
0be81cb34b Add wxGTKCairoDCImpl::SetSize() helper
Avoid repeating gdk_window_get_{width,height}() calls in several places.
2018-01-25 14:56:43 +01:00
Vadim Zeitlin
a1cb2eb12a Also return display DPI from wxScreenDC in wxGTK3
This is similar to the previous commit and is done for the same reasons:
screen DC needs to use the same DPI as the screen itself, instead of the
default Cairo 72 DPI.
2018-01-25 14:56:43 +01:00
Vadim Zeitlin
4ad1a3d969 Return display PPI from wxDC::GetPPI() in wxGTK3
For wxDC associated with a window, such as wx{Window,Client,Paint}DC,
this method should return the window PPI, not the hard coded 72 DPI of
Cairo graphics context.

This still doesn't work correctly when using multiple monitors with
different DPI settings, but is still a (modest) improvement.
2018-01-25 14:35:11 +01:00
Vadim Zeitlin
afe0e776b9 Remove confusing "base_type" typedef from wxGTK3 wxDC code
This typedef isn't really useful in base class initializer lists and it
wasn't really used anywhere else.
2018-01-25 14:32:49 +01:00
Vadim Zeitlin
0cea0a67f1 Use RAII SelectionEventsSuppressor in wxGTK wxDataViewCtrl code
This is simpler and safer than always remembering to call
GtkDisableSelectionEvents() and GtkEnableSelectionEvents() in pairs.

No real changes.
2018-01-24 23:09:29 +01:00
Vadim Zeitlin
8c06a24da4 Move m_labelWin to wxStaticBoxBase itself
It will be reused by all platforms and is not specific to wxGTK.

This also means WXDestroyWithoutChildren() doesn't need to be virtual
any longer.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
7c849276f8 Add support for using arbitrary windows as wxStaticBox labels
This commit implements the new feature in wxGTK and updates the sample
and the documentation.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
29bd25b757 Add GTKDoApplyWidgetStyle() helper
This allows to call the protected wxWindowGTK::DoApplyWidgetStyle()
method when it's really necessary, e.g. when forwarding to it from
DoApplyWidgetStyle() implementation for another window.
2017-12-24 22:35:45 +01:00
Vadim Zeitlin
87afebd6f2 Inline wxStaticBox ctors in wxGTK
No real changes, just make the trivial ctors of this class inline for
consistency with the new ctor about to be added.
2017-12-24 22:35:45 +01:00
Paul Cornett
b573315e7f Add wx_is_at_least_gtk3() helper 2017-12-19 09:41:26 -08:00
Paul Cornett
b2ea617145 Avoid deprecated gtk_text_iter_begins_tag() 2017-12-17 21:51:36 -08:00
Paul Cornett
ba4da9fdf9 Use "new" GDK keysym names
Old names are no longer available with GTK+4
2017-12-17 21:51:16 -08:00
Vadim Zeitlin
f4af243e5c Enable wxUSE_GRAPHICS_CONTEXT for MinGW >= 4.8
It seems that MinGW-w32 started distributing GDI+ headers since this
version and MinGW-w64 might have supported them for even longer, but
it's difficult to test for the MinGW distribution used in this header,
as it is included before wx/msw/gccpriv.h which defines
__MINGW32_TOOLCHAIN__ and __MINGW64_TOOLCHAIN__ symbols and changing
this is tricky due to relative order of defining UNICODE and
wxUSE_UNICODE and including MinGW headers, which can only be included
once UNICODE is set properly.

But while the fully correct solution is difficult, just checking for the
compiler version should solve the problem in 99.99% of the cases in
practice as there should be vanishingly few people using MinGW-w64 with
gcc < 4.8 currently, so this simple solution is good enough.

Closes #17973.
2017-12-08 19:42:21 +01:00
Paul Cornett
696a5ba3dd Fix for modified state not set after next change following a ChangeValue()
See #17540
2017-12-05 06:41:08 -08:00
Vadim Zeitlin
3e0adbf541 Merge branch 'gesture-events'
Integrate GSoC 2017 work by Prashant Kumar implementing support for
gesture events.

Closes https://github.com/wxWidgets/wxWidgets/pull/551

Closes https://github.com/wxWidgets/wxWidgets/pull/565
2017-12-02 18:46:53 +01:00
Vadim Zeitlin
302fc5190a Merge branch 'gtk2-version-checks'
Simplify GTK+ 2 version checks with a helper function.

See https://github.com/wxWidgets/wxWidgets/pull/614
2017-11-25 22:18:31 +01:00
Vadim Zeitlin
778340a286 Merge branch 'private-fonts'
Add support for using application-private fonts.

Closes #13568.

Closes https://github.com/wxWidgets/wxWidgets/pull/591
2017-11-24 22:58:09 +01:00
Vadim Zeitlin
b040dab0ca Add wxUSE_PRIVATE_FONTS and drop wxHAS_PRIVATE_FONTS
Handle this feature as all the other ones and provide a configure switch
and a setup.h option to disable it if necessary, as it may be desirable
to do it, especially under Linux, to avoid extra dependency on pangoft2
if this functionality is unnecessary.
2017-11-24 22:56:17 +01:00
Vadim Zeitlin
d6af0236c5 Simplify GTK+ 2 version checks with a helper function
Use wx_is_at_least_gtk2(minor) instead of gtk_check_version(2, minor)
because it is more clear and also works as expected (i.e. returns true)
when using GTK+ 3 instead of creating difficult to notice bugs in the
code by failing the version check in this case.

See #18004.
2017-11-23 13:15:31 +01:00
Vadim Zeitlin
1863f494f3 Use wxExternalField for gestures data in wxGTK too
Don't waste memory on gesture data in all windows.
2017-11-22 03:05:03 +01:00