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

« back to all changes in this revision

Viewing changes to src/cocoa/button.mm

  • 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:      David Elliott
5
5
// Modified by:
6
6
// Created:     2002/12/30
7
 
// RCS-ID:      $Id: button.mm,v 1.22 2006/07/25 18:47:28 VZ Exp $
 
7
// RCS-ID:      $Id: button.mm 48529 2007-09-03 17:17:35Z DE $
8
8
// Copyright:   (c) 2002 David Elliott
9
9
// Licence:     wxWidgets licence
10
10
/////////////////////////////////////////////////////////////////////////////
15
15
 
16
16
#ifndef WX_PRECOMP
17
17
    #include "wx/log.h"
 
18
    #include "wx/toplevel.h"
18
19
#endif
19
20
 
20
21
#include "wx/stockitem.h"
48
49
    [m_cocoaNSView release];
49
50
 
50
51
    [GetNSButton() setBezelStyle:NSRoundedBezelStyle];
51
 
    [GetNSButton() setTitle:wxNSStringWithWxString(GetLabelText(label))];
 
52
    CocoaSetLabelForObject(label, GetNSButton());
 
53
 
 
54
    do
 
55
    {
 
56
        NSTextAlignment mode;
 
57
        if ((style & wxBU_LEFT) && !(style & wxBU_RIGHT))
 
58
            mode = NSLeftTextAlignment;
 
59
        else if ((style & wxBU_RIGHT) && !(style & wxBU_LEFT))
 
60
            mode = NSRightTextAlignment;
 
61
        else
 
62
            break;
 
63
        [GetNSControl() setAlignment:mode];
 
64
    } while(0);
 
65
 
52
66
    [GetNSControl() sizeToFit];
53
67
 
54
68
    if(m_parent)
78
92
 
79
93
void wxButton::SetLabel(const wxString& label)
80
94
{
81
 
    [GetNSButton() setTitle:wxNSStringWithWxString(GetLabelText(label))];
 
95
    CocoaSetLabelForObject(label, GetNSButton());
82
96
}
83
97
 
84
98
wxSize wxButton::DoGetBestSize() const
92
106
    return size;
93
107
}
94
108
 
 
109
void wxButton::SetDefault()
 
110
{
 
111
    wxTopLevelWindow * const
 
112
        tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
 
113
 
 
114
    wxCHECK_RET( tlw != NULL, _T("button without top level window?") );
 
115
 
 
116
    tlw->SetDefaultItem(this);
 
117
}
 
118
 
95
119
static NSRect MakeNSButtonDefaultRect()
96
120
{
97
121
    // create at (10.0,10.0) with size 20.0x20.0 (just bogus values)