Statistics
| Revision:

svn-gvsig-desktop / trunk / build / distribution / launcher / izpack-launcher-1.3_linux / src / wx / include / wx / bmpbuttn.h @ 21757

History | View | Annotate | Download (3.38 KB)

1
/////////////////////////////////////////////////////////////////////////////
2
// Name:        wx/bmpbutton.h
3
// Purpose:     wxBitmapButton class interface
4
// Author:      Vadim Zeitlin
5
// Modified by:
6
// Created:     25.08.00
7
// RCS-ID:      $Id: bmpbuttn.h 6834 2006-08-24 08:23:24Z jmvivo $
8
// Copyright:   (c) 2000 Vadim Zeitlin
9
// Licence:     wxWindows licence
10
/////////////////////////////////////////////////////////////////////////////
11

    
12
#ifndef _WX_BMPBUTTON_H_BASE_
13
#define _WX_BMPBUTTON_H_BASE_
14

    
15
#if wxUSE_BMPBUTTON
16

    
17
#include "wx/bitmap.h"
18
#include "wx/button.h"
19

    
20
WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
21

    
22
// ----------------------------------------------------------------------------
23
// wxBitmapButton: a button which shows bitmaps instead of the usual string.
24
// It has different bitmaps for different states (focused/disabled/pressed)
25
// ----------------------------------------------------------------------------
26

    
27
class WXDLLEXPORT wxBitmapButtonBase : public wxButton
28
{
29
public:
30
    wxBitmapButtonBase()
31
        : m_bmpNormal(), m_bmpSelected(), m_bmpFocus(), m_bmpDisabled()
32
        , m_marginX(0), m_marginY(0)
33
        { }
34

    
35
    // set the bitmaps
36
    void SetBitmapLabel(const wxBitmap& bitmap)
37
        { m_bmpNormal = bitmap; OnSetBitmap(); }
38
    void SetBitmapSelected(const wxBitmap& sel)
39
        { m_bmpSelected = sel; OnSetBitmap(); };
40
    void SetBitmapFocus(const wxBitmap& focus)
41
        { m_bmpFocus = focus; OnSetBitmap(); };
42
    void SetBitmapDisabled(const wxBitmap& disabled)
43
        { m_bmpDisabled = disabled; OnSetBitmap(); };
44
    void SetLabel(const wxBitmap& bitmap)
45
        { SetBitmapLabel(bitmap); }
46

    
47
    // retrieve the bitmaps
48
    const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; }
49
    const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; }
50
    const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; }
51
    const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; }
52
    wxBitmap& GetBitmapLabel() { return m_bmpNormal; }
53
    wxBitmap& GetBitmapSelected() { return m_bmpSelected; }
54
    wxBitmap& GetBitmapFocus() { return m_bmpFocus; }
55
    wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; }
56

    
57
    // set/get the margins around the button
58
    virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
59
    int GetMarginX() const { return m_marginX; }
60
    int GetMarginY() const { return m_marginY; }
61

    
62
protected:
63
    // function called when any of the bitmaps changes
64
    virtual void OnSetBitmap() { }
65

    
66
    // the bitmaps for various states
67
    wxBitmap m_bmpNormal,
68
             m_bmpSelected,
69
             m_bmpFocus,
70
             m_bmpDisabled;
71

    
72
    // the margins around the bitmap
73
    int m_marginX,
74
        m_marginY;
75
private:
76
    // Prevent Virtual function hiding warnings
77
    void SetLabel(const wxString& rsLabel)
78
    { wxWindowBase::SetLabel(rsLabel); }
79
};
80

    
81
#if defined(__WXUNIVERSAL__)
82
    #include "wx/univ/bmpbuttn.h"
83
#elif defined(__WXMSW__)
84
    #include "wx/msw/bmpbuttn.h"
85
#elif defined(__WXMOTIF__)
86
    #include "wx/motif/bmpbuttn.h"
87
#elif defined(__WXGTK__)
88
    #include "wx/gtk/bmpbuttn.h"
89
#elif defined(__WXMAC__)
90
    #include "wx/mac/bmpbuttn.h"
91
#elif defined(__WXPM__)
92
    #include "wx/os2/bmpbuttn.h"
93
#elif defined(__WXSTUBS__)
94
    #include "wx/stubs/bmpbuttn.h"
95
#endif
96

    
97
#endif // wxUSE_BMPBUTTON
98

    
99
#endif // _WX_BMPBUTTON_H_BASE_