Fix check for extended locale functions in CMake HAVE_LOCALE_T is misnamed, as it must only be defined not just when locale_t type is available but when the functions using it, such as strxxx_l(), are available. Due to the confusion about the nature of this symbol, CMake didn't check for it correctly and only checked for its existence, but musl (used by e.g. Alpine) does define the type without providing any of the functions using it, which resulted in build errors later. Fix this by checking for both the type and the functions in CMake too, just as we do in configure. See #25749, #25750. (cherry picked from commit 170c38631458dcef648c31b9d98dcc20a8c57f9c)
Fix broken wxMenuItem bitmap setting on macOS This reverts most of 337940f and 616e7c8 (with small bits of c0dbe80) and replaces the error-prone implementation with a simple and straightforward one. On macOS, NSImage is a direct equivalent of wxBitmapBundle and looking up and converting a specific-scale bitmap when the menu is attached is unnecessary busywork. Instead, switch wxMenuItemImpl to use wxBitmapBundle too. This is private API, so there are no compatibility concerns. Among the bugs in the previous implementation were: - ignoring bitmaps set in the global Mac menu - ignoring bitmaps set in the Mac-specific application menu - loosing compatibility with NSImage-backed wxBitmap and rendering them without appearance awareness and in low resolution in the global menu See #25744.
Initialize value to suppress false positive warning from MSVC MSVC gives a "possibly uninitialized variable" warning even if this can't happen as FromString() always fills it in if it returns true. Initialize the variable just to avoid this warning. See #25771. (cherry picked from commit affc1b2da1e51c1c107dd8f83b839d73ce84a7e8)
Document that wxIMPLEMENT_APP must be used in global scope As this macro defines main(), it can't be used inside any namespace. See #25772, #25775. (cherry picked from commit 02cd327f0ef4f48587240d8f16ab5f74a20a8596)
Document wxIMPLEMENT_APP_NO_MAIN() too This was mentioned in the documentation of other macros but not documented itself, do document it now. (cherry picked from commit 212bfaf97731543e0bd16cbd598bd9fee8ca133e)
Don't leak surface every time wxOverlay is used in wxGTK Free the old surface pointer before overwriting it with the new one in wxOverlayImpl::EndDrawing(). This resulted in huge memory leaks when using wxOverlay repeatedly, e.g. while dragging something around the window. See #24500. (cherry picked from commit 34e68666838b4538fc1910eda3fb0fd7a27bcc30)
Fix Shift-TAB behaviour when notebook is the only active child This is similar to 082d1fd28a (Fix TAB behaviour in a panel with notebook as only active child, 2025-05-24) but fixes Shift-TAB handling, and not TAB, by making it wrap around to notebook itself in this case. See #25443. (cherry picked from commit 329162e4f4c008c4e706aa72c5e50702a7016a13)
Don't link with unnecessary and now removed AGL framework This framework has apparently been deprecated since quite some time and was removed from macOS 26, so linking with it resulted in an error. Don't do this any longer. See #25798. (cherry picked from commit dd3f2509499e0e6aac4ebf8dab72b5d496c5bfbc)
Make wxGenericCalendarCtrl DPI aware Adjust the code to compile with C++98. See #25762. (cherry picked from commit 18711b55baecb6246bf7daa629874688c9e125ae)
Silence warning about non-virtual dtor on VC++ <=2017 Explicitly defining a destructor in wxMSWOwnerDrawnButtonBase causes precisely the kind of compiler warnings (C4265) that the definition was meant to suppress on GCC. C4265 is not enabled by default in VC++, but if you have it enabled, you'll get plenty of pointless warnings through anything that #includes wx/msw/ownerdrawnbutton.h. This is also the only spot in wx headers that triggers C4265. Closes #25828.
... | ... | @@ -672,13 +672,20 @@ if(wxUSE_FSWATCHER) |
672 | 672 | endif()
|
673 | 673 | |
674 | 674 | if(wxUSE_XLOCALE)
|
675 | + list(APPEND xlocale_headers locale.h stdlib.h)
|
|
675 | 676 | check_include_file(xlocale.h HAVE_XLOCALE_H)
|
676 | - set(CMAKE_EXTRA_INCLUDE_FILES locale.h)
|
|
677 | 677 | if(HAVE_XLOCALE_H)
|
678 | - list(APPEND CMAKE_EXTRA_INCLUDE_FILES xlocale.h)
|
|
678 | + list(APPEND xlocale_headers xlocale.h)
|
|
679 | 679 | endif()
|
680 | - check_type_size(locale_t LOCALE_T)
|
|
681 | - set(CMAKE_EXTRA_INCLUDE_FILES)
|
|
680 | + wx_check_c_source_compiles("
|
|
681 | + locale_t t;
|
|
682 | + strtod_l(NULL, NULL, t);
|
|
683 | + strtol_l(NULL, NULL, 0, t);
|
|
684 | + strtoul_l(NULL, NULL, 0, t);
|
|
685 | +"
|
|
686 | + HAVE_LOCALE_T
|
|
687 | + ${xlocale_headers}
|
|
688 | + )
|
|
682 | 689 | endif()
|
683 | 690 | |
684 | 691 | # Check sizes of various types
|
... | ... | @@ -32397,7 +32397,7 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then |
32397 | 32397 | |
32398 | 32398 | |
32399 | 32399 | if test "$wxUSE_OSX_COCOA" = 1; then
|
32400 | - OPENGL_LIBS="-framework OpenGL -framework AGL"
|
|
32400 | + OPENGL_LIBS="-framework OpenGL"
|
|
32401 | 32401 | elif test "$wxUSE_MSW" = 1; then
|
32402 | 32402 | OPENGL_LIBS="-lopengl32 -lglu32"
|
32403 | 32403 | elif test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_GTK" = 1 -o "$wxUSE_QT" = 1; then
|
... | ... | @@ -3871,7 +3871,7 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then |
3871 | 3871 | dnl look in glcanvas.h for the list of platforms supported by wxGlCanvas:
|
3872 | 3872 | |
3873 | 3873 | if test "$wxUSE_OSX_COCOA" = 1; then
|
3874 | - OPENGL_LIBS="-framework OpenGL -framework AGL"
|
|
3874 | + OPENGL_LIBS="-framework OpenGL"
|
|
3875 | 3875 | elif test "$wxUSE_MSW" = 1; then
|
3876 | 3876 | OPENGL_LIBS="-lopengl32 -lglu32"
|
3877 | 3877 | elif test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_GTK" = 1 -o "$wxUSE_QT" = 1; then
|
... | ... | @@ -257,6 +257,7 @@ All: |
257 | 257 | - Backport several CMake enhancements from 3.3 (Maarten Bent, #25448).
|
258 | 258 | - Fix using wxSOCKET_NOWAIT_READ and wxSOCKET_WAITALL_WRITE together (#17114).
|
259 | 259 | - Make wxPlatformInfo::Get() thread-safe (#25459).
|
260 | +- Fix CMake build under Alpine Linux and other systems using musl (#25749).
|
|
260 | 261 | |
261 | 262 | All (GUI):
|
262 | 263 | |
... | ... | @@ -269,6 +270,7 @@ wxGTK: |
269 | 270 | |
270 | 271 | - Fix handling total window size with GNOME with X11 (#25348).
|
271 | 272 | - Fix height of read-only wxBitmapComboBox (#25468).
|
273 | +- Fix memory leak when using wxOverlay (#24500).
|
|
272 | 274 | - Fix wxGLCanvas scale when using EGL/Wayland in high DPI (Popax21, #23733).
|
273 | 275 | - Fix missing wxEVT_CHAR for Ctrl-Letter in non-US layouts (#25384).
|
274 | 276 | - Fix regression when unmaximizing windows under XFCE/MATE (#25708).
|
... | ... | @@ -290,6 +292,7 @@ wxOSX: |
290 | 292 | - Do not activate "Close" button on Cmd-C (nobugshere, #25346).
|
291 | 293 | - Fix memory leak in wxColour::Set() (#25569).
|
292 | 294 | - Fix regression with configure build under macOS < 12 (#25675).
|
295 | +- Fix build under macOS 26 Tahoe (#25798).
|
|
293 | 296 | |
294 | 297 | |
295 | 298 | 3.2.8.1: (released 2025-05-25)
|
... | ... | @@ -61,6 +61,10 @@ You can also use wxDECLARE_APP(appClass) in a header file to declare the wxGetAp |
61 | 61 | function which returns a reference to the application object. Otherwise you can
|
62 | 62 | only use the global @c wxTheApp pointer which is of type @c wxApp*.
|
63 | 63 | |
64 | +Please note that wxIMPLEMENT_APP() and wxDECLARE_APP() must always be used in
|
|
65 | +the global scope and not within a namespace, even if the application class is
|
|
66 | +within a namespace.
|
|
67 | + |
|
64 | 68 | |
65 | 69 | |
66 | 70 | @section overview_app_shutdown Application Shutdown
|
... | ... | @@ -10,6 +10,15 @@ |
10 | 10 | #ifndef _WX_MSW_OWNERDRAWNBUTTON_H_
|
11 | 11 | #define _WX_MSW_OWNERDRAWNBUTTON_H_
|
12 | 12 | |
13 | +// With MSVC 2017 and earlier, explicitly defining the destructor below
|
|
14 | +// _causes_ exactly the kind of compiler warnings (C4265) the definition
|
|
15 | +// was meant to avoid (on GCC). With later versions of MSVC, there is no
|
|
16 | +// warning either way. We'll disable C4265 temporarily here.
|
|
17 | +#ifdef _MSC_VER
|
|
18 | +#pragma warning(push)
|
|
19 | +#pragma warning(disable: 4265) // non-virtual destructor with virtual functions
|
|
20 | +#endif
|
|
21 | + |
|
13 | 22 | // ----------------------------------------------------------------------------
|
14 | 23 | // wxMSWOwnerDrawnButton: base class for any kind of Windows buttons
|
15 | 24 | // ----------------------------------------------------------------------------
|
... | ... | @@ -129,4 +138,8 @@ protected: |
129 | 138 | bool IsOwnerDrawn() const { return MSWIsOwnerDrawn(); }
|
130 | 139 | };
|
131 | 140 | |
141 | +#ifdef _MSC_VER
|
|
142 | +#pragma warning(pop)
|
|
143 | +#endif
|
|
144 | + |
|
132 | 145 | #endif // _WX_MSW_OWNERDRAWNBUTTON_H_ |
... | ... | @@ -160,7 +160,7 @@ public : |
160 | 160 | }
|
161 | 161 | |
162 | 162 | virtual ~wxMenuItemImpl() ;
|
163 | - virtual void SetBitmap( const wxBitmap& bitmap ) = 0;
|
|
163 | + virtual void SetBitmap( const wxBitmapBundle& bitmap ) = 0;
|
|
164 | 164 | virtual void Enable( bool enable ) = 0;
|
165 | 165 | virtual void Check( bool check ) = 0;
|
166 | 166 | virtual void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) = 0;
|
... | ... | @@ -72,7 +72,7 @@ public: |
72 | 72 | virtual void Attach(wxMenuBarBase *menubar) wxOVERRIDE;
|
73 | 73 | #endif
|
74 | 74 | |
75 | - void SetupBitmaps();
|
|
75 | + void SetupBitmaps(); //unused
|
|
76 | 76 | |
77 | 77 | protected:
|
78 | 78 | // hide special menu items like exit, preferences etc
|
... | ... | @@ -172,7 +172,7 @@ public: |
172 | 172 | static wxMenuBar* MacGetCommonMenuBar() { return s_macCommonMenuBar; }
|
173 | 173 | |
174 | 174 | virtual void Attach(wxFrame *frame) wxOVERRIDE;
|
175 | - void SetupBitmaps();
|
|
175 | + void SetupBitmaps(); // unused
|
|
176 | 176 | |
177 | 177 | |
178 | 178 | static WXHMENU MacGetWindowMenuHMenu() { return s_macWindowMenuHandle ; }
|
... | ... | @@ -38,6 +38,7 @@ public: |
38 | 38 | |
39 | 39 | // override base class virtuals
|
40 | 40 | virtual void SetItemLabel(const wxString& strName) wxOVERRIDE;
|
41 | + virtual void SetBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE;
|
|
41 | 42 | |
42 | 43 | virtual void Enable(bool bDoEnable = true) wxOVERRIDE;
|
43 | 44 | virtual void Check(bool bDoCheck = true) wxOVERRIDE;
|
... | ... | @@ -1234,6 +1234,24 @@ public: |
1234 | 1234 | */
|
1235 | 1235 | #define wxDECLARE_APP( className )
|
1236 | 1236 | |
1237 | +/**
|
|
1238 | + This macro and tells wxWidgets which application class should be used.
|
|
1239 | + |
|
1240 | + Unlike the more usual wxIMPLEMENT_APP() macro, this macro does not define
|
|
1241 | + the entry point of the application, i.e. doesn't define @c main() or
|
|
1242 | + @c WinMain() function, so you need to implement it separately when using
|
|
1243 | + it.
|
|
1244 | + |
|
1245 | + The @a className passed to this macro must be a name of a default
|
|
1246 | + constructible class deriving from wxApp that will be instantiated by
|
|
1247 | + wxWidgets during its initialization.
|
|
1248 | + |
|
1249 | + Note that this macro requires a final semicolon.
|
|
1250 | + |
|
1251 | + @header{wx/app.h}
|
|
1252 | + */
|
|
1253 | +#define wxIMPLEMENT_APP_NO_MAIN( className )
|
|
1254 | + |
|
1237 | 1255 | /**
|
1238 | 1256 | This macro defines the application entry point and tells wxWidgets which
|
1239 | 1257 | application class should be used.
|
... | ... | @@ -1243,8 +1261,9 @@ public: |
1243 | 1261 | typical GUI application it's simpler and more convenient to use this macro
|
1244 | 1262 | to do both together.
|
1245 | 1263 | |
1246 | - The @a className passed to this macro must be a name of the class deriving
|
|
1247 | - from wxApp.
|
|
1264 | + The @a className passed to this macro must be a name of a default
|
|
1265 | + constructible class deriving from wxApp that will be instantiated by
|
|
1266 | + wxWidgets during its initialization.
|
|
1248 | 1267 | |
1249 | 1268 | Note that this macro requires a final semicolon.
|
1250 | 1269 |
... | ... | @@ -390,9 +390,8 @@ bool MyApp::OnInit() |
390 | 390 | wxUILocale::UseDefault();
|
391 | 391 | |
392 | 392 | // Create the main application window
|
393 | - MyFrame *frame = new MyFrame("Calendar wxWidgets sample"
|
|
394 | - ,wxPoint(50, 50), wxSize(460, 340)
|
|
395 | - );
|
|
393 | + MyFrame* frame = new MyFrame("Calendar wxWidgets sample");
|
|
394 | + frame->SetSize(frame->FromDIP(wxSize(460, 340)));
|
|
396 | 395 | |
397 | 396 | frame->Show(true);
|
398 | 397 |
... | ... | @@ -266,7 +266,7 @@ wxIntegerValidatorBase::FromString(const wxString& s, |
266 | 266 | else
|
267 | 267 | {
|
268 | 268 | // Parse as unsigned to ensure we don't accept minus sign here.
|
269 | - ULongestValueType uvalue;
|
|
269 | + ULongestValueType uvalue = 0;
|
|
270 | 270 | if ( !wxNumberFormatter::FromString(s, &uvalue) )
|
271 | 271 | return false;
|
272 | 272 |
... | ... | @@ -674,8 +674,10 @@ size_t wxGenericCalendarCtrl::GetWeek(const wxDateTime& date) const |
674 | 674 | // the same space
|
675 | 675 | |
676 | 676 | // the constants used for the layout
|
677 | -#define VERT_MARGIN 5 // distance between choice and calendar
|
|
678 | -#define HORZ_MARGIN 5 // spin
|
|
677 | +static const int VERT_MARGIN = 5; // distance between choice and calendar
|
|
678 | +static const int HORZ_MARGIN = 5; // distance between choice and spin
|
|
679 | +static const int DAY_MARGIN = 2; // distance between day rows and column
|
|
680 | +static const int WEEK_MARGIN = 4; // extra width of the week column
|
|
679 | 681 | |
680 | 682 | wxSize wxGenericCalendarCtrl::DoGetBestSize() const
|
681 | 683 | {
|
... | ... | @@ -683,7 +685,7 @@ wxSize wxGenericCalendarCtrl::DoGetBestSize() const |
683 | 685 | const_cast<wxGenericCalendarCtrl *>(this)->RecalcGeometry();
|
684 | 686 | |
685 | 687 | wxCoord width = 7*m_widthCol + m_calendarWeekWidth,
|
686 | - height = 7*m_heightRow + m_rowOffset + VERT_MARGIN;
|
|
688 | + height = 7*m_heightRow + m_rowOffset + FromDIP(VERT_MARGIN);
|
|
687 | 689 | |
688 | 690 | if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) )
|
689 | 691 | {
|
... | ... | @@ -691,9 +693,9 @@ wxSize wxGenericCalendarCtrl::DoGetBestSize() const |
691 | 693 | const wxSize bestSizeSpin = m_spinYear->GetBestSize();
|
692 | 694 | |
693 | 695 | height += wxMax(bestSizeChoice.y, bestSizeSpin.y)
|
694 | - + VERT_MARGIN;
|
|
696 | + + FromDIP(VERT_MARGIN);
|
|
695 | 697 | |
696 | - wxCoord w2 = bestSizeChoice.x + HORZ_MARGIN + bestSizeSpin.x;
|
|
698 | + wxCoord w2 = bestSizeChoice.x + FromDIP(HORZ_MARGIN) + bestSizeSpin.x;
|
|
697 | 699 | if ( width < w2 )
|
698 | 700 | width = w2;
|
699 | 701 | }
|
... | ... | @@ -714,20 +716,20 @@ void wxGenericCalendarCtrl::DoMoveWindow(int x, int y, int width, int height) |
714 | 716 | if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) && m_staticMonth )
|
715 | 717 | {
|
716 | 718 | wxSize sizeChoice = m_choiceMonth->GetEffectiveMinSize();
|
717 | - wxSize sizeStatic = m_staticMonth->GetSize();
|
|
718 | - wxSize sizeSpin = m_spinYear->GetSize();
|
|
719 | + wxSize sizeStatic = m_staticMonth->GetEffectiveMinSize();
|
|
720 | + wxSize sizeSpin = m_spinYear->GetEffectiveMinSize();
|
|
719 | 721 | |
720 | 722 | int maxHeight = wxMax(sizeSpin.y, sizeChoice.y);
|
721 | 723 | int dy = (maxHeight - sizeStatic.y) / 2;
|
722 | - m_choiceMonth->Move(x, y + (maxHeight - sizeChoice.y)/2);
|
|
724 | + m_choiceMonth->SetSize(x, y + (maxHeight - sizeChoice.y)/2, sizeChoice.x, -1);
|
|
723 | 725 | m_staticMonth->SetSize(x, y + dy, sizeChoice.x, -1);
|
724 | 726 | |
725 | - int xDiff = sizeChoice.x + HORZ_MARGIN;
|
|
727 | + int xDiff = sizeChoice.x + FromDIP(HORZ_MARGIN);
|
|
726 | 728 | |
727 | 729 | m_spinYear->SetSize(x + xDiff, y + (maxHeight - sizeSpin.y)/2, width - xDiff, maxHeight);
|
728 | 730 | m_staticYear->SetSize(x + xDiff, y + dy, width - xDiff, sizeStatic.y);
|
729 | 731 | |
730 | - yDiff = maxHeight + VERT_MARGIN;
|
|
732 | + yDiff = maxHeight + FromDIP(VERT_MARGIN);
|
|
731 | 733 | }
|
732 | 734 | else // no controls on the top
|
733 | 735 | {
|
... | ... | @@ -774,11 +776,11 @@ void wxGenericCalendarCtrl::RecalcGeometry() |
774 | 776 | }
|
775 | 777 | |
776 | 778 | m_calendarWeekWidth = HasFlag( wxCAL_SHOW_WEEK_NUMBERS )
|
777 | - ? dc.GetTextExtent( wxString::Format( wxT( "%d" ), 42 )).GetWidth() + 4 : 0;
|
|
779 | + ? dc.GetTextExtent( wxString::Format( wxT( "%d" ), 42 )).GetWidth() + FromDIP(WEEK_MARGIN) : 0;
|
|
778 | 780 | |
779 | 781 | // leave some margins
|
780 | - m_widthCol += 2;
|
|
781 | - m_heightRow += 2;
|
|
782 | + m_widthCol += FromDIP(DAY_MARGIN);
|
|
783 | + m_heightRow += FromDIP(DAY_MARGIN);
|
|
782 | 784 | |
783 | 785 | m_rowOffset = HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) ? m_heightRow : 0; // conditional in relation to style
|
784 | 786 | }
|
... | ... | @@ -848,10 +850,12 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) |
848 | 850 | if ( AllowMonthChange() )
|
849 | 851 | {
|
850 | 852 | wxDateTime ldpm = wxDateTime(1,m_date.GetMonth(), m_date.GetYear()) - wxDateSpan::Day(); // last day prev month
|
853 | + int rectx = FromDIP(4);
|
|
854 | + int recty = FromDIP(3);
|
|
851 | 855 | // Check if range permits change
|
852 | 856 | if ( IsDateInRange(ldpm) && ( ( ldpm.GetYear() == m_date.GetYear() ) ? true : AllowYearChange() ) )
|
853 | 857 | {
|
854 | - m_leftArrowRect = wxRect(larrowx - 3, arrowy - 3, (arrowheight / 2) + 8, (arrowheight + 6));
|
|
858 | + m_leftArrowRect = wxRect(larrowx - rectx + 1, arrowy - recty, (arrowheight / 2) + 2 * rectx, (arrowheight + 2 * recty));
|
|
855 | 859 | dc.SetBrush(*wxBLACK_BRUSH);
|
856 | 860 | dc.SetPen(*wxBLACK_PEN);
|
857 | 861 | dc.DrawPolygon(3, leftarrow, larrowx , arrowy, wxWINDING_RULE);
|
... | ... | @@ -861,7 +865,7 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) |
861 | 865 | wxDateTime fdnm = wxDateTime(1,m_date.GetMonth(), m_date.GetYear()) + wxDateSpan::Month(); // first day next month
|
862 | 866 | if ( IsDateInRange(fdnm) && ( ( fdnm.GetYear() == m_date.GetYear() ) ? true : AllowYearChange() ) )
|
863 | 867 | {
|
864 | - m_rightArrowRect = wxRect(rarrowx - 4, arrowy - 3, (arrowheight / 2) + 8, (arrowheight + 6));
|
|
868 | + m_rightArrowRect = wxRect(rarrowx - rectx, arrowy - recty, (arrowheight / 2) + 2 * rectx, (arrowheight + 2 * recty));
|
|
865 | 869 | dc.SetBrush(*wxBLACK_BRUSH);
|
866 | 870 | dc.SetPen(*wxBLACK_PEN);
|
867 | 871 | dc.DrawPolygon(3, rightarrow, rarrowx , arrowy, wxWINDING_RULE);
|
... | ... | @@ -896,7 +900,9 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) |
896 | 900 | n = wd;
|
897 | 901 | wxCoord dayw, dayh;
|
898 | 902 | dc.GetTextExtent(m_weekdays[n], &dayw, &dayh);
|
899 | - dc.DrawText(m_weekdays[n], x0 + (wd*m_widthCol) + ((m_widthCol- dayw) / 2), y); // center the day-name
|
|
903 | + int dayx = x0 + (wd * m_widthCol) + ((m_widthCol - dayw) / 2);
|
|
904 | + int dayy = y + m_heightRow / 2 - dayh / 2;
|
|
905 | + dc.DrawText(m_weekdays[n], dayx, dayy); // center the day-name
|
|
900 | 906 | }
|
901 | 907 | }
|
902 | 908 | |
... | ... | @@ -917,7 +923,11 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) |
917 | 923 | {
|
918 | 924 | const int weekNr = date.GetWeekOfYear();
|
919 | 925 | wxString text = wxString::Format( wxT( "%d" ), weekNr );
|
920 | - dc.DrawText( text, m_calendarWeekWidth - dc.GetTextExtent( text ).GetWidth() - 2, y + m_heightRow * i );
|
|
926 | + wxCoord weekw, weekh;
|
|
927 | + dc.GetTextExtent(text, &weekw, &weekh);
|
|
928 | + int weekx = m_calendarWeekWidth - weekw - (FromDIP(WEEK_MARGIN) / 2);
|
|
929 | + int weeky = (i * m_heightRow) + (y + m_heightRow / 2 - weekh / 2);
|
|
930 | + dc.DrawText(text, weekx, weeky);
|
|
921 | 931 | date += wxDateSpan::Week();
|
922 | 932 | }
|
923 | 933 | }
|
... | ... | @@ -955,8 +965,8 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) |
955 | 965 | // don't use wxDate::Format() which prepends 0s
|
956 | 966 | unsigned int day = date.GetDay();
|
957 | 967 | wxString dayStr = wxString::Format(wxT("%u"), day);
|
958 | - wxCoord width;
|
|
959 | - dc.GetTextExtent(dayStr, &width, NULL);
|
|
968 | + wxCoord width, height;
|
|
969 | + dc.GetTextExtent(dayStr, &width, &height);
|
|
960 | 970 | |
961 | 971 | bool changedColours = false,
|
962 | 972 | changedFont = false;
|
... | ... | @@ -1018,7 +1028,7 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) |
1018 | 1028 | }
|
1019 | 1029 | |
1020 | 1030 | wxCoord x = wd*m_widthCol + (m_widthCol - width) / 2 + x0;
|
1021 | - dc.DrawText(dayStr, x, y + 1);
|
|
1031 | + dc.DrawText(dayStr, x, y + m_heightRow / 2 - height / 2);
|
|
1022 | 1032 | |
1023 | 1033 | if ( !isSel && attr && attr->HasBorder() )
|
1024 | 1034 | {
|
... | ... | @@ -1036,16 +1046,17 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) |
1036 | 1046 | dc.SetPen(pen);
|
1037 | 1047 | dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
1038 | 1048 | |
1049 | + int shapeSize = wxMin(m_widthCol, m_heightRow) - 1;
|
|
1050 | + wxRect shapeRect(x + width / 2 - shapeSize / 2, y, shapeSize, shapeSize);
|
|
1051 | + |
|
1039 | 1052 | switch ( attr->GetBorder() )
|
1040 | 1053 | {
|
1041 | 1054 | case wxCAL_BORDER_SQUARE:
|
1042 | - dc.DrawRectangle(x - 2, y,
|
|
1043 | - width + 4, m_heightRow);
|
|
1055 | + dc.DrawRectangle(shapeRect);
|
|
1044 | 1056 | break;
|
1045 | 1057 | |
1046 | 1058 | case wxCAL_BORDER_ROUND:
|
1047 | - dc.DrawEllipse(x - 2, y,
|
|
1048 | - width + 4, m_heightRow);
|
|
1059 | + dc.DrawEllipse(shapeRect);
|
|
1049 | 1060 | break;
|
1050 | 1061 | |
1051 | 1062 | default:
|
... | ... | @@ -1116,15 +1127,6 @@ void wxGenericCalendarCtrl::RefreshDate(const wxDateTime& date) |
1116 | 1127 | rect.width = 7*m_widthCol;
|
1117 | 1128 | rect.height = m_heightRow;
|
1118 | 1129 | |
1119 | -#ifdef __WXMSW__
|
|
1120 | - // VZ: for some reason, the selected date seems to occupy more space under
|
|
1121 | - // MSW - this is probably some bug in the font size calculations, but I
|
|
1122 | - // don't know where exactly. This fix is ugly and leads to more
|
|
1123 | - // refreshes than really needed, but without it the selected days
|
|
1124 | - // leaves even more ugly underscores on screen.
|
|
1125 | - rect.Inflate(0, 1);
|
|
1126 | -#endif // MSW
|
|
1127 | - |
|
1128 | 1130 | #if DEBUG_PAINT
|
1129 | 1131 | wxLogDebug("*** refreshing week %d at (%d, %d)-(%d, %d)\n",
|
1130 | 1132 | GetWeek(date),
|
... | ... | @@ -167,6 +167,8 @@ void wxOverlayImpl::EndDrawing(wxDC* dc) |
167 | 167 | return;
|
168 | 168 | |
169 | 169 | cairo_pattern_t* pattern = cairo_pop_group(m_cr);
|
170 | + if (m_surface)
|
|
171 | + cairo_surface_destroy(m_surface);
|
|
170 | 172 | cairo_pattern_get_surface(pattern, &m_surface);
|
171 | 173 | cairo_surface_reference(m_surface);
|
172 | 174 | cairo_pattern_destroy(pattern);
|
... | ... | @@ -1030,7 +1030,17 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) |
1030 | 1030 | // focus is currently on notebook tab and should leave
|
1031 | 1031 | // it backwards (Shift-TAB)
|
1032 | 1032 | event.SetCurrentFocus(this);
|
1033 | - parent->HandleWindowEvent(event);
|
|
1033 | + if ( !parent->HandleWindowEvent(event) )
|
|
1034 | + {
|
|
1035 | + // if the parent didn't handle this event, the notebook
|
|
1036 | + // must be its only child accepting focus, so let the page
|
|
1037 | + // handle it to wrap around to the last control in tab order
|
|
1038 | + if ( m_selection != wxNOT_FOUND )
|
|
1039 | + {
|
|
1040 | + wxWindow* page = m_pages[m_selection];
|
|
1041 | + page->HandleWindowEvent(event);
|
|
1042 | + }
|
|
1043 | + }
|
|
1034 | 1044 | }
|
1035 | 1045 | else if ( isFromParent || isFromSelf )
|
1036 | 1046 | {
|
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | #include "wx/menu.h"
|
20 | 20 | #endif // WX_PRECOMP
|
21 | 21 | |
22 | +#include "wx/private/bmpbndl.h"
|
|
22 | 23 | #include "wx/osx/private.h"
|
23 | 24 | #include "wx/osx/private/available.h"
|
24 | 25 | |
... | ... | @@ -249,9 +250,9 @@ public : |
249 | 250 | |
250 | 251 | ~wxMenuItemCocoaImpl();
|
251 | 252 | |
252 | - void SetBitmap( const wxBitmap& bitmap ) wxOVERRIDE
|
|
253 | + void SetBitmap( const wxBitmapBundle& bitmap ) wxOVERRIDE
|
|
253 | 254 | {
|
254 | - [m_osxMenuItem setImage:bitmap.GetNSImage()];
|
|
255 | + [m_osxMenuItem setImage:wxOSXGetImageFromBundle(bitmap)];
|
|
255 | 256 | }
|
256 | 257 | |
257 | 258 | void Enable( bool enable ) wxOVERRIDE
|
... | ... | @@ -192,7 +192,7 @@ public : |
192 | 192 | |
193 | 193 | ~wxMenuItemCocoaImpl();
|
194 | 194 | |
195 | - void SetBitmap( const wxBitmap& bitmap ) wxOVERRIDE
|
|
195 | + void SetBitmap( const wxBitmapBundle& bitmap ) wxOVERRIDE
|
|
196 | 196 | {
|
197 | 197 | }
|
198 | 198 |
... | ... | @@ -156,14 +156,6 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *item, size_t pos) |
156 | 156 | // if we're already attached to the menubar, we must update it
|
157 | 157 | if ( IsAttached() && GetMenuBar()->IsAttached() )
|
158 | 158 | {
|
159 | - if ( item->IsSubMenu() )
|
|
160 | - {
|
|
161 | - item->GetSubMenu()->SetupBitmaps();
|
|
162 | - }
|
|
163 | - if ( !item->IsSeparator() )
|
|
164 | - {
|
|
165 | - item->UpdateItemBitmap();
|
|
166 | - }
|
|
167 | 159 | GetMenuBar()->Refresh();
|
168 | 160 | }
|
169 | 161 | #endif // wxUSE_MENUBAR
|
... | ... | @@ -418,38 +410,17 @@ void wxMenu::HandleMenuClosed() |
418 | 410 | void wxMenu::Attach(wxMenuBarBase *menubar)
|
419 | 411 | {
|
420 | 412 | wxMenuBase::Attach(menubar);
|
421 | - |
|
422 | - if (menubar->IsAttached())
|
|
423 | - {
|
|
424 | - SetupBitmaps();
|
|
425 | - }
|
|
426 | 413 | }
|
427 | 414 | #endif
|
428 | 415 | |
429 | 416 | void wxMenu::SetInvokingWindow(wxWindow* win)
|
430 | 417 | {
|
431 | 418 | wxMenuBase::SetInvokingWindow(win);
|
432 | - |
|
433 | - if ( win )
|
|
434 | - SetupBitmaps();
|
|
435 | 419 | }
|
436 | 420 | |
437 | 421 | void wxMenu::SetupBitmaps()
|
438 | 422 | {
|
439 | - for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
|
|
440 | - node;
|
|
441 | - node = node->GetNext() )
|
|
442 | - {
|
|
443 | - wxMenuItem *item = node->GetData();
|
|
444 | - if ( item->IsSubMenu() )
|
|
445 | - {
|
|
446 | - item->GetSubMenu()->SetupBitmaps();
|
|
447 | - }
|
|
448 | - if ( !item->IsSeparator() )
|
|
449 | - {
|
|
450 | - item->UpdateItemBitmap();
|
|
451 | - }
|
|
452 | - }
|
|
423 | + // unused, kept for ABI compatibility
|
|
453 | 424 | }
|
454 | 425 | |
455 | 426 | #if wxUSE_MENUBAR
|
... | ... | @@ -694,17 +665,12 @@ wxString wxMenuBar::GetMenuLabel(size_t pos) const |
694 | 665 | |
695 | 666 | void wxMenuBar::SetupBitmaps()
|
696 | 667 | {
|
697 | - for ( wxMenuList::const_iterator it = m_menus.begin(); it != m_menus.end(); ++it )
|
|
698 | - {
|
|
699 | - (*it)->SetupBitmaps();
|
|
700 | - }
|
|
668 | + // unused, kept for ABI compatibility
|
|
701 | 669 | }
|
702 | 670 | |
703 | 671 | void wxMenuBar::Attach(wxFrame *frame)
|
704 | 672 | {
|
705 | 673 | wxMenuBarBase::Attach(frame);
|
706 | - |
|
707 | - SetupBitmaps();
|
|
708 | 674 | }
|
709 | 675 | |
710 | 676 | // ---------------------------------------------------------------------------
|
... | ... | @@ -153,6 +153,11 @@ void wxMenuItem::SetItemLabel(const wxString& text) |
153 | 153 | UpdateItemText() ;
|
154 | 154 | }
|
155 | 155 | |
156 | +void wxMenuItem::SetBitmap(const wxBitmapBundle& bitmap)
|
|
157 | +{
|
|
158 | + wxMenuItemBase::SetBitmap(bitmap);
|
|
159 | + UpdateItemBitmap();
|
|
160 | +}
|
|
156 | 161 | |
157 | 162 | void wxMenuItem::UpdateItemBitmap()
|
158 | 163 | {
|
... | ... | @@ -161,7 +166,7 @@ void wxMenuItem::UpdateItemBitmap() |
161 | 166 | |
162 | 167 | if ( m_bitmap.IsOk() )
|
163 | 168 | {
|
164 | - GetPeer()->SetBitmap(GetBitmap());
|
|
169 | + GetPeer()->SetBitmap(m_bitmap);
|
|
165 | 170 | }
|
166 | 171 | }
|
167 | 172 |
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help