[Git][wxwidgets/wxwidgets][master] 4 commits: Correct example of bitmap creation in wxMemoryDC documentation

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Sep 8, 2025, 5:51:34 PMSep 8
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • a7635a36
    by Vadim Zeitlin at 2025-09-08T23:02:13+02:00
    Correct example of bitmap creation in wxMemoryDC documentation
    
    Advising to use wxBitmap::CreateWithDIPSize() was wrong, as the size is
    expressed in logical pixels, CreateWithLogicalSize() should be used
    instead.
    
    Closes #25738.
    
  • 3eee44f3
    by Chris Mayo at 2025-09-08T23:03:28+02:00
    Remove unused mode_str from wxChmInputStream::OnSysSeek()
    
    This variable was (never) used, just remove it to avoid warnings.
    
    Closes #25774.
    
  • 02cd327f
    by Richard at 2025-09-08T23:07:17+02:00
    Document that wxIMPLEMENT_APP must be used in global scope
    
    As this macro defines main(), it can't be used inside any namespace.
    
    Closes #25772.
    
    Closes #25775.
    
  • 212bfaf9
    by Vadim Zeitlin at 2025-09-08T23:10:15+02:00
    Document wxIMPLEMENT_APP_NO_MAIN() too
    
    This was mentioned in the documentation of other macros but not
    documented itself, do document it now.
    

4 changed files:

Changes:

  • docs/doxygen/overviews/app.h
    ... ... @@ -62,6 +62,10 @@ You can also use wxDECLARE_APP(appClass) in a header file to declare the wxGetAp
    62 62
     function which returns a reference to the application object. Otherwise you can
    
    63 63
     only use the global @c wxTheApp pointer which is of type @c wxApp*.
    
    64 64
     
    
    65
    +Please note that wxIMPLEMENT_APP() and wxDECLARE_APP() must always be used in
    
    66
    +the global scope and not within a namespace, even if the application class is
    
    67
    +within a namespace.
    
    68
    +
    
    65 69
     
    
    66 70
     
    
    67 71
     @section overview_app_shutdown Application Shutdown
    

  • interface/wx/app.h
    ... ... @@ -1493,6 +1493,24 @@ public:
    1493 1493
     */
    
    1494 1494
     #define wxDECLARE_APP( className )
    
    1495 1495
     
    
    1496
    +/**
    
    1497
    +    This macro and tells wxWidgets which application class should be used.
    
    1498
    +
    
    1499
    +    Unlike the more usual wxIMPLEMENT_APP() macro, this macro does not define
    
    1500
    +    the entry point of the application, i.e. doesn't define @c main() or
    
    1501
    +    @c WinMain() function, so you need to implement it separately when using
    
    1502
    +    it.
    
    1503
    +
    
    1504
    +    The @a className passed to this macro must be a name of a default
    
    1505
    +    constructible class deriving from wxApp that will be instantiated by
    
    1506
    +    wxWidgets during its initialization.
    
    1507
    +
    
    1508
    +    Note that this macro requires a final semicolon.
    
    1509
    +
    
    1510
    +    @header{wx/app.h}
    
    1511
    + */
    
    1512
    +#define wxIMPLEMENT_APP_NO_MAIN( className )
    
    1513
    +
    
    1496 1514
     /**
    
    1497 1515
         This macro defines the application entry point and tells wxWidgets which
    
    1498 1516
         application class should be used.
    
    ... ... @@ -1502,8 +1520,9 @@ public:
    1502 1520
         typical GUI application it's simpler and more convenient to use this macro
    
    1503 1521
         to do both together.
    
    1504 1522
     
    
    1505
    -    The @a className passed to this macro must be a name of the class deriving
    
    1506
    -    from wxApp.
    
    1523
    +    The @a className passed to this macro must be a name of a default
    
    1524
    +    constructible class deriving from wxApp that will be instantiated by
    
    1525
    +    wxWidgets during its initialization.
    
    1507 1526
     
    
    1508 1527
         Note that this macro requires a final semicolon.
    
    1509 1528
     
    

  • interface/wx/dcmemory.h
    ... ... @@ -40,13 +40,13 @@
    40 40
     
    
    41 41
         Note that the scaling factor of the bitmap determines the scaling factor
    
    42 42
         used by this device context, so when using a memory device context as a
    
    43
    -    back buffer for a window, you should typically create the bitmap using the
    
    44
    -    same scale factor as used by the window, e.g.
    
    43
    +    back buffer for a window, you should create the bitmap using the same scale
    
    44
    +    factor as the one used by the window itself, e.g.
    
    45 45
         @code
    
    46 46
         void MyWindow::OnPaint(wxPaintEvent&)
    
    47 47
         {
    
    48 48
             wxBitmap bmp;
    
    49
    -        bmp.CreateWithDIPSize(GetClientSize(), GetDPIScaleFactor());
    
    49
    +        bmp.CreateWithLogicalSize(GetClientSize(), GetDPIScaleFactor());
    
    50 50
             {
    
    51 51
                 wxMemoryDC memdc(bmp);
    
    52 52
                 ... use memdc to draw on the bitmap ...
    

  • src/html/chm.cpp
    ... ... @@ -509,8 +509,6 @@ size_t wxChmInputStream::OnSysRead(void *buffer, size_t bufsize)
    509 509
     
    
    510 510
     wxFileOffset wxChmInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode)
    
    511 511
     {
    
    512
    -    wxString mode_str;
    
    513
    -
    
    514 512
         if ( !m_contentStream || m_contentStream->Eof() )
    
    515 513
         {
    
    516 514
             m_lasterror = wxSTREAM_EOF;
    

Reply all
Reply to author
Forward
0 new messages