]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/common/btncmn.cpp | |
3 | // Purpose: implementation of wxButtonBase | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2007-04-08 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org> | |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | // ============================================================================ | |
12 | // declarations | |
13 | // ============================================================================ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | // for compilers that support precompilation, includes "wx.h". | |
20 | #include "wx/wxprec.h" | |
21 | ||
22 | #ifdef __BORLANDC__ | |
23 | #pragma hdrstop | |
24 | #endif | |
25 | ||
26 | #if wxUSE_BUTTON | |
27 | ||
28 | #ifndef WX_PRECOMP | |
29 | #include "wx/button.h" | |
30 | #include "wx/toplevel.h" | |
31 | #endif //WX_PRECOMP | |
32 | ||
33 | // ============================================================================ | |
34 | // implementation | |
35 | // ============================================================================ | |
36 | ||
37 | wxWindow *wxButtonBase::SetDefault() | |
38 | { | |
39 | wxTopLevelWindow * const | |
40 | tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); | |
41 | ||
42 | wxCHECK_MSG( tlw, NULL, wxT("button without top level window?") ); | |
43 | ||
44 | return tlw->SetDefaultItem(this); | |
45 | } | |
46 | ||
47 | void wxButtonBase::SetBitmapPosition(wxDirection dir) | |
48 | { | |
49 | wxASSERT_MSG( !(dir & ~wxDIRECTION_MASK), "non-direction flag used" ); | |
50 | wxASSERT_MSG( !!(dir & wxLEFT) + | |
51 | !!(dir & wxRIGHT) + | |
52 | !!(dir & wxTOP) + | |
53 | !!(dir & wxBOTTOM) == 1, | |
54 | "exactly one direction flag must be set" ); | |
55 | ||
56 | DoSetBitmapPosition(dir); | |
57 | ||
58 | } | |
59 | #endif // wxUSE_BUTTON |