Commit Graph
21555 Commits
Author SHA1 Message Date
Vadim Zeitlin de3b760fc6 Revert "Add support for multiple headers with same name to wxWebRequest"
This reverts commit 8395e5733d because
HTTP standard says that senders MUST NOT generate multiple lines with
the same header, with the only exception of Set-Cookie, so we shouldn't
provide a way to do it.

That commit also introduced a nasty regression with the programs calling
AddCommonHeader("User-Agent") not working at all any more after it
because WinHTTP refuses to send a request with multiple copies of this
header.

Also partially reverts 1000d67c13 which
was done later but is logically part of the same commit that is being
reverted.

See #24881.
2024-12-20 02:23:24 +01:00
Vadim Zeitlin 348f9060ce Merge branch 'css-col-db'
Change values of standard colours to follow CSS standard.

See #25002.
2024-12-16 01:59:02 +01:00
Vadim Zeitlin df9403500f Merge branch 'aui-book-layout'
Add support for serializing wxAuiNotebook layout.

See #24998.
2024-12-16 01:56:06 +01:00
Vadim Zeitlin fe7df68383 Add support for saving and restoring wxAuiNotebook layout
This includes multiple tab controls and pages order and uses new
wxAuiSerializer and wxAuiDeserializer notebook-specific functions.
These functions are pure virtual, which may be inconvenient if the
program doesn't use wxAuiNotebook at all or doesn't allow splitting or
reordering their pages, as it forces to still define them in this case,
but this is arguably not too burdensome and making them pure virtual
helps to attract attention to the fact that they need to be implemented
for saving notebook layouts.

Update the sample to show how to support notebook layout serialization
in the simplest possible way, by creating a separate top-level XML tag
for the notebooks. It could be tidier to put information about them
inside the corresponding pane tags, but doing it like this is simpler
and more clear, which is important for the sample code.

Closes #24950.
2024-12-16 01:54:27 +01:00
Vadim Zeitlin 55be0ed986 Stop using GDK functions for parsing colours names
This shouldn't be necessary now as they use the same CSS colour names
that we use too by default and like this switching to "Traditional"
colour names also changes wxGTK behaviour to use wxMSW colour values.
2024-12-16 01:26:36 +01:00
Vadim Zeitlin 1c06d46a9f Use CSS colour values in wxColourDatabase by default
Allow reverting to using the traditional values for the conflicting
colours by calling UseScheme(Traditional) if really needed.

This is another attempt for changing wxColourDatabase to use more
standard colour values, after the previous attempt in bb131fdbc5
(updated colour definitions to the new official X version (patch
771272), 2003-07-17) which was reverted almost immediately after in
5e2ab1ea5d (reverted the last change (colour values changes), it cerated
too many problems, 2003-07-19), see #6031. Unlike the previous ones, it
provides an escape hatch in the form of UseScheme() and also leaves
traditional wx colour names not clashing with CSS ones still available.

Also update the "drawing" sample to allow showing both colour schemes,
and extend its view port to fit all the colour names vertically.

See #23518.
2024-12-13 23:51:34 +01:00
Vadim Zeitlin 7a56a3eb3b Don't use wxColourDatabase for stock pen/brush initialization
This makes things simpler, removing an interdependence between
wxStockGDI and wxColourDatabase, and isolates the grey and medium grey
pens and brushes from the upcoming change to the value of the latter
colour in wxColourDatabase.

Note that we intentionally don't add wxGREY and wxMEDIUM_GREY macros,
unlike for the existing stock colours, as they are not really necessary
and it doesn't seem worth to add them just for consistency, especially
because it's easy to imagine some existing code already defining them,
especially the former one.

No real changes yet.
2024-12-13 23:07:52 +01:00
Vadim Zeitlin 7a26088b55 Avoid markup text memory leak in wxStaticText
Add forgotten destructor.

This should have been even more part of hastily pushed 0f26d71bb7 (Merge
branch 'msw-stattext-markup', 2024-12-12), see #25000.
2024-12-13 00:15:37 +01:00
Vadim Zeitlin 9aedc796b2 Implement support for markup in wxMSW wxStaticText
Use generic-like implementation, i.e. simply draw the label ourselves in
this case.
2024-12-12 20:38:05 +01:00
Vadim Zeitlin 6df975fdb2 Allow to check if wxMarkupText has changed when setting it
This can/will be used for avoidiing to do anything if the markup hasn't
really changed.
2024-12-12 20:38:05 +01:00
Vadim Zeitlin 1ab3bacfc1 Remove redundant wxMarkupText::SetMarkup()
This does the same thing as the function inherited from the base class,
so just remove it.
2024-12-12 20:38:05 +01:00
Vadim Zeitlin 93016c95e0 Add wxAuiNotebook::UnsplitAll()
This function can be useful on its own, but will also used by the
upcoming notebook layout deserialization code.
2024-12-09 21:33:15 +01:00
Vadim Zeitlin 98e19b462c Add private wxAuiNotebook::GetMainTabCtrl() helper
Allow getting the main, i.e. central, tab container easily.
2024-12-09 21:33:14 +01:00
Vadim Zeitlin db8e0dee87 Add trivial wxAuiNotebookPage::RemoveAll() helper
This is more clear and efficient than deleting all pages one by one.
2024-12-09 21:33:14 +01:00
Vadim Zeitlin b997e3432e Extract wxAuiDockLayoutInfo, add functions for copying just it
This new struct will be used by wxAuiNotebook too in upcoming commits,
so extract it from wxAuiPaneLayoutInfo and extract the code used for
copying the layout information between it and wxAuiPaneInfo to the new
functions to allow reusing them from wxAuiNotebook code.
2024-12-09 21:33:14 +01:00
Vadim Zeitlin 33ead6fb6a Stop passing window to insert separately to wxAuiTabContainer
It's already part of wxAuiNotebookPage also passed to its AddPage() and
InsertPage() functions and there is no need to pass it as a separate
parameter.

This changes these functions in a backwards-incompatible way, and even
though they were never really supposed to be public, provide
backwards-compatible overloads for them just in case somebody used them.

No real changes, just simplify the code.
2024-12-09 21:33:14 +01:00
Vadim Zeitlin bfa27c2bb0 Merge branch 'aui-book-order' into master
Stop changing logical page order in wxAuiNotebook when pages are reordered.

See #24996.
2024-12-09 21:32:42 +01:00
Vadim Zeitlin f41bea84db Add wxAuiNotebook::GetPagePosition()
This can be useful to find the actual page position on screen, inside
its containing tab control, as opposed to its logical index.

Use the new function to show pages in their visual order in the AUI
sample.
2024-12-09 17:31:34 +01:00
Vadim Zeitlin 399868cbb7 Never change the logical page order in wxAuiNotebook
Always keep the pages in wxAuiNotebook::m_tabs in the order in which
they were added or inserted and only change their order in the tab
controls when they are interactively reordered by user.

Refactor page insertion code so that the new InsertPageAt() helper
function can be called from the code handling dragging tab to another
wxAuiNotebook too, instead of reproducing what it does there.

Also test InsertPage() in the sample.

This effectively reverts ab67e8874d (Fix wrong tab order in
wxAuiNotebook after dragging., 2012-12-23), see #10848.
2024-12-09 17:27:22 +01:00
Vadim Zeitlin d6cc23c12f Don't make wxAuiNotebook::Split() virtual
It doesn't make much sense to override it in user code.
2024-12-09 17:25:08 +01:00
Vadim Zeitlin 65118b7ea1 Merge branch 'aui-layout-no-docks'
Stop serializing docks separately in wxAUI.

See #24235, #24992.
2024-12-09 17:24:28 +01:00
Vadim Zeitlin 3fc7d67215 Don't serialize docks information in wxAUI
We can simplify things by serializing the dock size, which is the only
information about them which is not recomputed by wxAUI itself when
redoing layout, as part of the panes layout data.

This is a bit inelegant because the same size is stored for all panes
that are part of the same dock, but it makes writing serializers and
deserializers significantly simpler, as they now only have to deal with
one kind of objects, and so seems to be worth it, especially because
with the previous approach we stored even more redundant data, with the
dock direction, layer and row duplicated between the dock itself and all
the panes contained in it.

This change will also make it much simpler to serialize the layout of
nested AUI managers, such as the one used by wxAuiNotebook, later.
2024-12-09 17:21:29 +01:00
Vadim Zeitlin 0abce57a36 Use new wxAuiPaneLayoutInfo for serialization
Using wxAuiPaneInfo for serialization was confusing as it has some
fields that must be serialized, some fields that can be serialized but
don't have to be, and some fields which should never be serialized.

Add wxAuiPaneLayoutInfo which contains just the subset of the fields
that always must be serialized to make things more clear.

Update the sample to avoid serializing fields which can never be changed
directly by the user.
2024-12-09 13:55:17 +01:00
Vadim Zeitlin 8c67124321 Make wxAuiTabContainer::TabHitTest() more convenient to use too
Avoid output parameters in another function, similarly to what was done
for ButtonHitTest() in the parent commit.
2024-12-09 13:52:57 +01:00
Vadim Zeitlin 862ec865a3 Make wxAuiTabContainer::ButtonHitTest() more convenient to use
No real changes, just return the button directly from this function
instead of using an output parameter for it.

Still preserve the old signature for compatibility, as it doesn't cost
much and it's not clear whether this function was supposed to be public
or not: lack of documentation is not a good indicator here, as none of
the functions in this class are documented, so err on the side of
caution.
2024-12-09 13:43:07 +01:00
Vadim Zeitlin 1f471d21f3 Extract code for main tab creation into CreateMainTabCtrl()
No real changes, this is just a pure refactoring in preparation for the
upcoming changes.
2024-12-09 01:46:50 +01:00
Vadim Zeitlin ea675cee91 Add wxAuiTabContainer::DoUpdateActive() helper
This combines calls to DoShowHide() and Refresh() (which can't be called
by DoShowHide() itself because it has no window to call it on), which
were almost invariably called together, so this simplifies the calling
code and also makes the function intention, and the fact that it needs
to be called after changing the active page, more clear.
2024-12-09 01:46:27 +01:00
Vadim Zeitlin 4304358b1b Add wxAuiTabContainer::RemovePageAt()
When we already have the page index, it's just strange to call
RemovePage() which loops over all the pages to find it again -- so don't
do it and call the new function directly instead.
2024-12-07 16:16:42 +01:00
Vadim Zeitlin 3be543c303 Simplify deleting/removing pages from wxAuiNotebook
Use DeletePage() and RemovePage() inherited from the base class and just
override and implement DoRemovePage() instead of providing a dummy stub
for the latter.

This omits the code implementing special handling of wxAuiMDIChildFrame
but it's not really clear why did it have to be there, it looks like it
can be deleted as any other child window.
2024-12-07 15:57:00 +01:00
Vadim Zeitlin 95b8abe3fe Allow wxAuiDeserializer::CreatePaneWindow() to modify pane info
wxAuiPaneInfo fields such as "caption" or "icon" wouldn't normally be
serialized and so CreatePaneWindow() should be allowed to fill them in.
2024-12-03 18:02:56 +01:00
Vadim Zeitlin d78b464c5a Merge branch 'aui-cleanup'
Some AUI cleanup and code modernization.

See #24988.
2024-12-03 18:02:10 +01:00
Vadim Zeitlin 8ad9310049 Add const overload of wxAuiManager::GetAllPanes()
This is useful for iterating over all panes without modifying them
(which is by far the most common thing for which this function is used).
2024-12-02 03:08:16 +01:00
Vadim Zeitlin 1c25ef6f29 Add wxAuiNotebook::CreateTabFrame() helper function
This allows to have only one version of the code creating a new tab
frame instead of having 3 identical copies of it.

No real changes.
2024-12-02 02:58:25 +01:00
Vadim Zeitlin 36780eb089 Make wxAuiTabContainer::GetPages() const
It's never used to modify the pages array, so make it const to make this
explicit -- and to allow using it from const member functions.
2024-12-02 02:58:25 +01:00
Vadim Zeitlin 606fe68cc5 Remove unnecessary wxAuiNotebook::HasMultiplePages() override
This function does the same thing as the default base class version, so
we don't need it and it can be removed.

No real changes.
2024-12-02 02:58:25 +01:00
Vadim Zeitlin af01273598 Remove commented out in wxAuiNotebook::AcceptsFocus()
This was commented out since c7bfb76a2c (A number of focus handling
improvements [...], 2007-08-18), just remove it entirely.

No real changes.
2024-12-02 02:58:25 +01:00
Vadim Zeitlin 6476b4ed57 Ensure that wxWebSessionImpl remains alive for long enough
This object shouldn't be destroyed as long as there are any
wxWebRequests using it still alive, as destroying them after the session
would result in a crash, so replace a (possibly dangling) reference to
wxWebSessionImpl in wxWebRequestImpl with a shared pointer, which keeps
it alive for as long as necessary.

See #24969.
2024-12-02 01:22:33 +01:00
Vadim Zeitlin 79f06970a8 Make wxTextCtrl::SetLabel() consistently do nothing everywhere
Previously it did the same thing as SetValue() in wxMSW but didn't do
anything in wxGTK (and probably other ports), which made it easy to
write code that only worked under Windows but mysteriously didn't show
any text under Linux.

Change it to not do anything anywhere and add an assert to help
detecting wrong uses of this function.

Also add a unit test checking this behaviour.

See #24982.
2024-12-02 01:16:37 +01:00
Vadim Zeitlin c3baf494ff Merge branch 'html-ids'
Add support for HTML ID attribute.

See #24968.
2024-11-27 01:09:48 +01:00
Vadim Zeitlin 3c5bbbf314 Merge branch 'cmdline-parser-usage'
Allow specifying synopsis for wxCmdLineParser::Usage() and wrap its
output.

See #24967.
2024-11-27 01:09:12 +01:00
Vadim Zeitlin e37adaba30 Define wxCharNN as typedefs for charNN_t, not wxUintNN
This makes more sense, as they're supposed to be character types, not
integer ones, and fixes the build with libc++ 19 which doesn't provide
std::char_traits specializations for types other than char, wchar_t and
charNN_t, so that std::basic_string<wxUint32> can't be compiled with it
any more without specializing std::char_traits on our own which we'd
rather avoid.

See #24959.

Closes #24958.
2024-11-27 01:06:02 +01:00
Vadim Zeitlin 7af7c55ed0 Use the standard naming convention for WX_GL_COMPAT_PROFILE
Use "WX" prefix for it, just as for all the other constants in the same
enum instead of the lower-case "wx" (which is still preserved for
compatibility).

See #24965.

Closes #24964.
2024-11-27 01:05:49 +01:00
oltolmandVadim Zeitlin b948a387b8 Parse HTML tag IDs to allow navigating to them later
Remember the value of ID tags attributes in the cell and find them later
when we're looking for them.

To make it easier to initialize the ID of the cells, add wxHtmlCell ctor
taking wxHtmlTag which gets the ID directly from it, and add wxHtmlTag
arguments to derived cell classes ctors too. In some cases, however, we
still need to use the new CopyId() function to set the ID of an already
existing cell.

Closes #17728.

Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
2024-11-23 16:11:02 +01:00
Vadim Zeitlin 27343f5bed Initialize wxHtmlContainerCell members in their declarations too
We still need a non-default ctor, but it is much simpler now.

No real changes.
2024-11-23 16:11:02 +01:00
Vadim Zeitlin c2213eda28 Use compiler-generated default ctor for wxHtmlCell
Initialize members in their declarations instead of doing it in a
trivial ctor.

Note that m_Pos[XY] remain uninitialized, just as they were before.
2024-11-23 16:11:02 +01:00
Vadim Zeitlin 3e06ddd34e Add wxHtmlCell::CheckIsAnchor() helper
It is not used yet, but will be soon and in the meanwhile it allows to
make the ugly cast from "void*" to "wxString*" in just a single place.
2024-11-23 16:11:02 +01:00
Vadim Zeitlin f72551fd98 Fix wrong example in comment for wxHtmlCell::Find()
Using wxHTML_COND_ISANCHOR requires passing a pointer to wxString, not
"const char*", as the parameter.
2024-11-23 16:11:02 +01:00
oltolm fbe5098149 Add wxHtmlCell::HasId()
This is just a simple helper that will be used soon.
2024-11-23 16:11:02 +01:00
Vadim Zeitlin 0eda5ed3ec Wrap help text shown by wxCmdLineParser at terminal width
By default, wrap the options descriptions to make output prettier.

It is also possible to disable this by explicitly passing
wxCMD_LINE_WRAP_NONE to Parse() and related functions or always wrap at
80 columns, for example.
2024-11-22 23:29:53 +01:00
Vadim Zeitlin 4897743c58 Add a simple function wrapping lines at given width
This could be enhanced, e.g. break lines at characters other than
spaces, support Unicode better etc, but for now add just a very simple
function that should be suitable for wrapping help message in
wxCmdLineParser, where it will be used next.
2024-11-22 23:02:58 +01:00