~ubuntu-branches/ubuntu/maverick/wxwidgets2.8/maverick-proposed

« back to all changes in this revision

Viewing changes to src/msw/tbar95.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2007-11-06 18:25:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071106182513-809agqds6igh7mqo
Tags: 2.8.6.1-0ubuntu1
* New upstream version, based on the upstream tarball
  wxPython-src-2.8.6.1.tar.bz2, renamed debian to debian-upstream.
* Provide a get-orig-source target to do the repackaging.
* Fix "substvar-source-version-is-deprecated" lintian warnings.
* Remove duplicate Description field in debian/control.
* Add "\" at the end of line 8 in debian/python-wxtools.menu to fix
  "bad-test-in-menu-item" lintian error.
* Provide .xpm icons to fix "menu-icon-not-in-xpm-format" lintian errors,
  changed Icon field in debian/python-wxtools.menu.
* Fix "wrong-name-for-upstream-changelog" lintian warnings.
* Remove "Application;" from Categories field in debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Switch "Apps" to "Applications" in debian/python-wxtools.menu to fix
  "menu-item-uses-apps-section" lintian warnings.
* Drop the icon extension from debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Add dpatch support.
* Add "WX_CONFIG" patch.
* debian/rules:
  - added .xpm icons to install-gtk-py-tools target
  - added "docs/changes.txt" to dh_installchangelogs in binary-common target
  - added "\" at the end of "install-examples install-msw-dev
    install-msw-dbg install-headers-msw" line in .PHONY

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// Author:      Julian Smart
5
5
// Modified by:
6
6
// Created:     04/01/98
7
 
// RCS-ID:      $Id: tbar95.cpp,v 1.192.2.2 2007/03/27 13:41:12 JS Exp $
 
7
// RCS-ID:      $Id: tbar95.cpp 48849 2007-09-21 10:33:26Z JS $
8
8
// Copyright:   (c) Julian Smart
9
9
// Licence:     wxWindows licence
10
10
/////////////////////////////////////////////////////////////////////////////
265
265
    // toolbar-specific post initialisation
266
266
    ::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
267
267
 
 
268
    // Fix a bug on e.g. the Silver theme on WinXP where control backgrounds
 
269
    // are incorrectly drawn, by forcing the background to a specific colour.
 
270
    int majorVersion, minorVersion;
 
271
    wxGetOsVersion(& majorVersion, & minorVersion);
 
272
    if (majorVersion < 6)
 
273
        SetBackgroundColour(GetBackgroundColour());
 
274
 
268
275
    return true;
269
276
}
270
277
 
362
369
        sizeBest.y = size.cy;
363
370
    }
364
371
 
365
 
    if (!IsVertical() && !(GetWindowStyle() & wxTB_NODIVIDER))
366
 
        sizeBest.y += 1;
 
372
    if (!IsVertical())
 
373
    {
 
374
        // Without the extra height, DoGetBestSize can report a size that's
 
375
        // smaller than the actual window, causing windows to overlap slightly
 
376
        // in some circumstances, leading to missing borders (especially noticeable
 
377
        // in AUI layouts).
 
378
        if (!(GetWindowStyle() & wxTB_NODIVIDER))
 
379
            sizeBest.y += 2;
 
380
        sizeBest.y ++;
 
381
    }
367
382
 
368
383
    CacheBestSize(sizeBest);
369
384
 
886
901
                                DoToggleTool(tool, true);
887
902
                            }
888
903
                        }
889
 
                        else if (tool->IsToggled())
 
904
                        else if ( tool->IsToggled() )
890
905
                        {
891
906
                            wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious();
892
907
                            int prevIndex = i - 1;
900
915
                                if ( tool->Toggle(false) )
901
916
                                    DoToggleTool(tool, false);
902
917
 
903
 
                                prevButton.fsState = TBSTATE_ENABLED;
 
918
                                prevButton.fsState &= ~TBSTATE_CHECKED;
904
919
                                nodePrev = nodePrev->GetPrevious();
905
920
                                prevIndex--;
906
921
                            }
1412
1427
    RECT rect = wxGetClientRect(GetHwnd());
1413
1428
    HDC hdc = GetHdcOf((*event.GetDC()));
1414
1429
 
 
1430
    int majorVersion, minorVersion;
 
1431
    wxGetOsVersion(& majorVersion, & minorVersion);
 
1432
 
1415
1433
#if wxUSE_UXTHEME
1416
1434
    // we may need to draw themed colour so that we appear correctly on
1417
1435
    // e.g. notebook page under XP with themes but only do it if the parent
1432
1450
                wxLogApiError(_T("DrawThemeParentBackground(toolbar)"), hr);
1433
1451
        }
1434
1452
    }
 
1453
 
 
1454
    // Only draw a rebar theme on Vista, since it doesn't jive so well with XP
 
1455
    if ( !UseBgCol() && majorVersion >= 6 )
 
1456
    {
 
1457
        wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive();
 
1458
        if ( theme )
 
1459
        {
 
1460
            wxUxThemeHandle hTheme(this, L"REBAR");
 
1461
 
 
1462
            RECT r;
 
1463
            wxRect rect = GetClientRect();
 
1464
            wxCopyRectToRECT(rect, r);
 
1465
 
 
1466
            HRESULT hr = theme->DrawThemeBackground(hTheme, hdc, 0, 0, & r, NULL);
 
1467
            if ( hr == S_OK )
 
1468
                return;
 
1469
 
 
1470
            // it can also return S_FALSE which seems to simply say that it
 
1471
            // didn't draw anything but no error really occurred
 
1472
            if ( FAILED(hr) )
 
1473
                wxLogApiError(_T("DrawThemeBackground(toolbar)"), hr);
 
1474
        }
 
1475
    }
 
1476
 
1435
1477
#endif // wxUSE_UXTHEME
1436
1478
 
1437
1479
    if ( UseBgCol() || (GetMSWToolbarStyle() & TBSTYLE_TRANSPARENT) )
1516
1558
        // no controls, nothing to erase
1517
1559
        return false;
1518
1560
 
 
1561
    wxSize clientSize = GetClientSize();
 
1562
    int majorVersion, minorVersion;
 
1563
    wxGetOsVersion(& majorVersion, & minorVersion);
 
1564
 
 
1565
    // prepare the DC on which we'll be drawing
1519
1566
    // prepare the DC on which we'll be drawing
1520
1567
    wxClientDC dc(this);
1521
1568
    dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID));
1582
1629
                if ( rectCtrl.Intersects(rectItem) )
1583
1630
                {
1584
1631
                    // yes, do erase it!
1585
 
                    dc.DrawRectangle(rectItem);
 
1632
 
 
1633
                    bool haveRefreshed = false;
 
1634
 
 
1635
#if wxUSE_UXTHEME
 
1636
                    if ( !UseBgCol() && !GetParent()->UseBgCol() )
 
1637
                    {
 
1638
                        // Don't use DrawThemeBackground
 
1639
                    }
 
1640
                    else if (!UseBgCol() && majorVersion >= 6 )
 
1641
                    {
 
1642
                        wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive();
 
1643
                        if ( theme )
 
1644
                        {
 
1645
                            wxUxThemeHandle hTheme(this, L"REBAR");
 
1646
 
 
1647
                            RECT clipRect = r;
 
1648
 
 
1649
                            // Draw the whole background since the pattern may be position sensitive;
 
1650
                            // but clip it to the area of interest.
 
1651
                            r.left = 0;
 
1652
                            r.right = clientSize.x;
 
1653
                            r.top = 0;
 
1654
                            r.bottom = clientSize.y;
 
1655
 
 
1656
                            HRESULT hr = theme->DrawThemeBackground(hTheme, (HDC) dc.GetHDC(), 0, 0, & r, & clipRect);
 
1657
                            if ( hr == S_OK )
 
1658
                                haveRefreshed = true;
 
1659
                        }
 
1660
                    }
 
1661
#endif
 
1662
 
 
1663
                    if (!haveRefreshed)
 
1664
                        dc.DrawRectangle(rectItem);
1586
1665
 
1587
1666
                    // Necessary in case we use a no-paint-on-size
1588
1667
                    // style in the parent: the controls can disappear