Allow getting the depth of any display, not just the primary one, even
though this is not implemented for Unix ports currently.
Mostly do this for consistency with the other display-related functions.
This makes src/unix/displayx11.cpp almost readable as it's not littered
by "#ifndef __WXGTK20__" checks everywhere any more -- instead this file
is just not compiled as part of wxGTK2 at all any longer (it is still
included in wxGTK1 as well as wxX11 itself and wxMotif).
wxGTK code also can just include the new wx/unix/private/displayx11.h
instead of having to declare all the X11 functions it uses manually.
There should be no changes in behaviour, this is just a clean up.
Simplify the code by not making this function pure virtual as all the
ports except MSW had to override it just to return an empty string.
Instead, just return empty string by default as it's not critical to
force the derived classes to override this function.
Centralize all display-related code in wxDisplay class and avoid
duplicating or reimplementing it in wxDisplaySize() and
wxClientDisplayRect() functions.
See https://github.com/wxWidgets/wxWidgets/pull/955
Instead of forwarding to these functions from wxDisplay implementation
in wxUSE_DISPLAY==0 case, make the functions themselves wrappers around
wxDisplay, which may, or not, depending on the platform, have a simpler
implementation in wxUSE_DISPLAY==0 case, but is always available in any
case.
As part of this change, only use src/osx/core/display.cpp in macOS
builds, not iOS ones and update the Xcode project accordingly too.
This cuts down on code duplication, especially in wxGTK, and facilitates
further additions to wxDisplay API.
Move declaration of wxOwnerDrawnBase::ms_defaultMargin to correct file.
Do not include headers when wxUSE_UIACTIONSIMULATOR is disabled.
Add guards for wxUSE_DRAG_AND_DROP.
Use a different wxFont constructor in printing sample, which is also available in WXQT.
Avoid a heap allocation on every wxDisplay creation by caching the
wxDisplayImpl objects once they're created.
Currently we never invalidate the cache, but we should add a way to do
it in the future.
This speeds up wxDisplay::GetGeometry() benchmark by a factor of 4.
This is more consistent with the other headers, which are safe to
include even when the corresponding feature is turned off.
Also remove the now redundant wxUSE_ENH_METAFILE checks in the source
code including this header.
See https://github.com/wxWidgets/wxWidgets/pull/951
Code doing "bitmap = image" compiled in the other ports, but not in
wxMSW with WXWIN_COMPATIBILITY_3_0==1 as there was an ambiguity between
converting wxImage to wxBitmap, as intended, or converting wxImage to
wxCursor and then assigning it to wxBitmap using operator=(wxCursor)
overload.
Resolve this ambiguity by providing operator=() overload taking wxImage
directly.
This fixes widgets sample compilation under MSW after the changes of
455a45f5a8
See https://github.com/wxWidgets/wxWidgets/pull/946
Mark the function as deprecated. It should not be part of the public API. It
cannot be overridden and manually calling it has no lasting effect because
DrawCaption calls it as well.
Closes https://github.com/wxWidgets/wxWidgets/pull/943
The code handling the mouse events assumed the drop down button with was
10px, but wxAuiMSWToolBarArt uses a different width (14px). So clicking
on the left-most 4 pixels was not registered as a drop down click.
Allow the get (and set) the width of the drop down button of the
ToolBarArt.
Increase the detection area for drop down events, because the drop down
button is drawn 1 pixel larger than the actual size.
Rename some variables where dropdown was used instead of overflow.
Closes https://github.com/wxWidgets/wxWidgets/pull/939
Add an explicit cast to avoid warnings when compiling with this option.
While just casting double to float is not the best idea, it seems quite
unlikely that anybody would pass a value outside of float range to this
ctor.
wxTreebook is supposed to allow not specifying any valid window for the
top-level pages, but this didn't work any longer, probably since the
changes of 02a92e23f3 (see #4379), as a
possibly null page was dereferenced without checking, resulting in a
crash.
Fix this by adding a missing check.
Also rename DoGetNonNullPage() to TryGetNonNullPage() to make it more
clear that this function can return null and add a unit test checking
that calling AddPage(NULL) really works (or at least doesn't crash).
See https://github.com/wxWidgets/wxWidgets/pull/921
Remove SetWindowMenuLabelTranslated() which was only called once and so
didn't seem to be worth having. Also get rid of WINDOW_MENU_LABEL for
the same reason: it was used only once and imposed the use of
gettext_noop() which is not needed any longer.
Rename GetWindowMenuLabelTranslated() to have a MSW prefix in order to
indicate that it's a private MSW function and not part of the public wx
API.
Also renamed "Translated" to "Current" to (hopefully) more clearly
indicate why do we need to keep this variable.
Include both <algorithm>, to get std::swap() declaration when using
C++98, and <utility>, to do the same thing when using C++11.
This is not pretty but simpler than using preprocessor tests (which
would need to take MSVS into account in a special way) and virtually
guaranteed not to break anything.
Closes#18220.
Complete support for fractional point sizes and font weights other than
light/bold.
Also harmonize wxFont API and implementation among all ports (fixing
compilation of those of them that were broken by recent changes).
See https://github.com/wxWidgets/wxWidgets/pull/919
Window initial/minimum/maximum sizes are now treated as logical pixels.
Furthermore, many margins and paddings are now converted using
wxWindow::FromDIP() to allow their growth in accord with screen DPI.
This places buttons on toolbars more apart on high DPI screens providing
space for easier touch operations.
Closes https://github.com/wxWidgets/wxWidgets/pull/933
Use wxVector<wxListLineData*> instead of WX_DECLARE_OBJARRAY().
This modernizes the code and allows to get rid of the static variables
previously used for sorting as now we can use std::sort().
Closes https://github.com/wxWidgets/wxWidgets/pull/924
This is a preliminary ARM64 platform support for wxWidgets at "it
compiles" stage. This will allow building and testing wxWidgets based
apps for oncoming Windows 10 ARM64.
Requirements:
- Visual Studio 2017 Update 4 or later with Visual C++ compilers and
libraries for ARM64 component installed
Building:
1. Open command prompt.
2. Change directory to build\msw subfolder.
3. Run "C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" once.
4. Use `nmake TARGET_CPU=ARM64 ...` to build required flavor of wxWidget
libraries.
Notes:
1. Building of *.sln/*.vcxproj files does not support ARM64 yet. This
requires to hardcode Windows SDK to 10.0.15063.0 or later in
*.vcxproj files, which would render them non-compilable in older
Visual Studio versions. Microsoft is aware of this issue and is
planning a fix in the next version of Visual Studio.
2. wxmsw31ud_gl.dll does not build yet. Awaiting Microsoft to deliver
missing opengl32.lib for ARM64. Please, specify USE_OPENGL=0.
Closes https://github.com/wxWidgets/wxWidgets/pull/923
Implement the new {Get,Set}{FractionalPointSize,NumericWeight} methods.
Also change wxLoadQueryFont() to use wxNativeFontInfo methods as a side
effect, to reduce code duplication and reuse the existing support for
numeric weights and fractional point sizes in wxNativeFontInfo.
Replace AccountForCompatValues() with InfoFromLegacyParams() which
directly constructs wxFontInfo from the old-style parameters, applying
all the compatibility hacks internally.
There are no real changes in this commit, just simplify the code further
and make wxFontInfo more central.
It might be better to just remove it completely as legacy code is
unlikely to be built with wxQt, but for now at least deprecate it to
make this consistent with the other ports.
Reuse the same code for determining the default font size to use if it
wasn't specified in all major ports.
In particular, make wxGTK behaviour compatible with the rest and use the
normal font size in this case instead of the hardcoded value of 12pt.
Only accept fractional point sizes and numeric weights via wxFont ctor
using wxFontInfo and avoid having specific ctor/Create() overloads for
the different combinations of font properties: this is not portable (as
these ctors don't exist in the other ports) and unsustainable due to the
very real potential of combinatorial explosion as more properties are
added.
As a side-effect, fix support for stricken-through fonts under Mac,
which was broken, by adding the missing wxFontInfo::IsStrikethrough()
call.
This is similar to a recent commit which moved float to int point size
conversions to wxFontInfo and is done for the same reasons: wxFont and
wxNativeFontInfo can depend on wxFontInfo, but the converse is not true.
No real changes.
They will be also needed in wxFontInfo soon, so move them there and use
these functions from both wxFont and wxNativeFontInfo, as they can
depend on wxFontInfo but not the other way round.
No real changes.
These functions can be useful outside of src/common/fontcmn.cpp and,
potentially, even in the user code, so make them public methods of
wxFont.
No real changes, just add asserts verifying input argument value to
GetWeightClosestToNumericValue().
Implement the new wxFont pure virtual methods in this port version of
this class.
Neither arbitrary weights nor fractional point sizes are actually
supported in this port however.
Store the weight as int, not wxFontWeight, and rely on the same wrappers
as all the other ports in the port not having native wxNativeFontInfo.
This is a prerequisite for fixing wxDFB and other Unix ports not using
Pango.
Define {Get,Set}FractionalPointSize() in wxX11 wxFont implementation.
Note that only Pango-based version really supports floating point sizes
as XLFD can't express them.
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.
This reverts commit 8d1063389a which
prevents https://github.com/wxWidgets/wxWidgets/pull/919 from being
automatically merged and CI builds from running. The changes of that
commit will soon be replaced with the more extensive fixes from this PR.
Use float as the fundamental type for the font size and implement
wxNativeFontInfo::{Set,Get}PointSize() as wrappers around the new
{Set,Get}FractionalPointSize().
Update wxNativeFontInfo for all platforms and replace the use of its
SetPointSize() method with SetFractionalPointSize() in wxFont for the
platforms already supporting fractional point sizes (don't change the
others just yet).
Note that wxNativeFontInfo::{Get,Set}PointSize() are preserved for
backwards compatibility but shouldn't be used in any code inside the
library itself any more (again, this is not the case yet, but will be
soon).
To avoid separate calls to SetSize() function after calling SetHICON() use newly implemented InitFromHICON() function which allows set HICON together with its parameters in one call.
To avoid separate calls to SetWidth/Height/Size/Depth functions after calling SetHBITMAP() use newly implemented InitFromHBITMAP() function which allows to set HBITMAP together with its parameters in one call.
When using IE wxWebView backend, this event wasn't generated as expected
when the client was redirected.
Fix this by using DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION flag.
Closes https://github.com/wxWidgets/wxWidgets/pull/893
Add wxFontBase::AccountForCompatValues() and use it in all ports instead
of redoing the same comparison with wxDEFAULT in all of them.
This is done not so much to avoid the code duplication, which was
minimal anyhow, but to make the code more clear and make it easier to
remove it from all ports at once in the bright (but remote) future when
we don't need these compatibility hacks any more.
Also document that wxDEFAULT and wxNORMAL are only handled specially in
the old-style ctor taking the individual font components and not the new
one using wxFontInfo and extend the unit test to check this.
This is mostly done to fix (half of) compilation errors after
introduction of pure virtual wxFont::{Get,Set}NumericWeight() as wxFont
in wxX11 couldn't be compiled any more as it didn't define them.
This solves backward incompatibility problem introduced in 2d8bbbe3c9.
The name of base class for grid header renderers hierarchy is restored
to be wxGridHeaderLabelsRenderer. This introduces another problem: now
wxGridCornerHeaderRenderer is derived from wxGridHeaderLabelsRenderer,
not vice versa, as it was before. But it is considered less disruptive
change, compared to base class rename.
Now, every header cell can have a label, including the corner one,
so wxGridHeaderLabelsRenderer::DrawLabel() was moved up one level
in the inheritance chain. Class names were changed accordingly.
Actual storage of corner label is delegated to a grid table class,
just because it is already done that way for column and row labels.
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
* 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
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.
Make m_Parser and m_FS simple objects instead of pointers as it's
completely unnecessary to allocate them on the heap here.
Note that both wxHtmlWinParser (by explicitly including its header) and
wxFileSystem (which is implicitly included via wx/html/htmlpars.h) are
fully declared in the header, so using pointers doesn't even help with
reducing compilation dependencies.
No real changes.
This is more efficient when the same HTML is reused multiple times, e.g.
for measuring it first and then rendering it.
The new function also makes it simpler to parse HTML and manipulate it
in some way before measuring and rendering it.
Add wxWebViewEvent::GetNavigationAction() returning a value that can be
either wxWEBVIEW_NAV_ACTION_USER for the links opened by the user, or
wxWEBVIEW_NAV_ACTION_OTHER for the other ones (e.g. opened from
JavaScript code on the page).
Closes#15402.
* First attempt using ref data for colour and spliting implementation for CGColorRef and NSColor
* correcting SDK dependency
* Implementing feedback suggestions
Ignore all the mouse events other than "left up" while dragging to avoid
releasing the mouse and ending the dragging operation too soon.
This required non-trivial refactoring of the code which hopefully should
also make it slightly more clear by centralizing high level logic in
ProcessGridCellMouseEvent() itself and calling various helper functions
from it instead of spreading this logic over the entire call tree.
The code still remains pretty confusing and rewriting it to use
wxMouseEventsManager (which would need to be generalized first to become
a template class using arbitrary item type instead of just "int", as
now) would undoubtedly do it a lot of good.
Closes#18186.
No real changes, just refactor the code to extract the part of
CancelMouseCapture() which can be useful not only when the mouse capture
is lost unexpectedly, but also when we release it of our own volition,
into a separate function.
clang doesn't seem to like __declspec in typedefs, so declare the class
first using the macro expanding into __declspec and don't use it in the
typedef later.
Closes#18196.
Implement support for this attribute only in the generic version so far,
it will hopefully be implemented for the natives ones in the future.
Also add a new toggle column to the dataview sample to check how it
works: checking the items in this column enables using this attribute
for some other ones.
Closes#18180.
removing 'inline' did fix:
warning: 'virtual void wxSystemThemedControlBase::DoEnableSystemTheme(bool, wxWindow*)' redeclared without dllimport attribute after being referenced with dll linkage
but introduced
multiple definition of `wxSystemThemedControlBase::DoEnableSystemTheme(bool, wxWindow*)'.
The proposed form gets no complaints
Make the (originally) auto-generated code of this dialog slightly more
readable by replacing some auto-generated variable names with more clear
ones.
Also avoid using FindWindow(), this is useless and we already have the
window pointers.
Closes https://github.com/wxWidgets/wxWidgets/pull/872
Base class SetTitle() implementation didnd't work for this class as it
used the (invalid) HWND of not yet existing dialog, so add a hook
procedure for the common font dialog, similar to the existing one for
wxColourDialog, which allows us to set the dialog title when the dialog
is really created.
Closes https://github.com/wxWidgets/wxWidgets/pull/865Closes#18177.
Add a check ensuring that if wxCheckListBox is disabled, then so is
wxRearrangeCtrl, to avoid build errors that would happen otherwise.
Closes https://github.com/wxWidgets/wxWidgets/pull/866
It was impossible to stop sorting the control if it had been sorted
before, so implement UnsetAsSortKey() to allow doing it by destroying
the current sort descriptor.
Closes#18176.
Previously, wxEVT_{SET,KILL}_FOCUS event handlers were connected to all
children, even the indirect ones, which resulted in duplicate focus
events if a grandchildren forward its focus event to its parent window,
as happens e.g. with wxComboCtrl, which contains a text control that
forwards its focus events to the containing control itself.
This change seems globally sound, even if it might break some controls
whose children don't get the expected focus events themselves, because
the right thing to do is to fix those children. And it fixes duplicate
focus events in wxDatePickerCtrlGeneric.
Revert 1de107c037 and remove the focus
event handler which duplicated and interfered with the handler inherited
from this class to make sure that we get wxEVT_{SET,KILL}_FOCUS for the
objects of this class.
Unfortunately these events now come in pairs, due to an extra artificial
event generated by wxComboBoxExtraInputHandler::OnFocus(), which is
still wrong -- but arguably less wrong and more useful than not sending
them at all.
This fixes a compilation error in wxMSW private fonts support
implementation, which compares wxString with a wide string but, unlike a
local fix there, makes sense more broadly and should reduce the
likelihood of similar errors in the future.
It also makes comparisons with narrow C strings more efficient in the
default, Unicode, build by using wxString::Cmp() method instead of
creating a temporary wxString, as was done before.
See #18172.