1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/commandlinkbuttong.cpp
3 // Purpose: wxGenericCommandLinkButton
4 // Author: Rickard Westerlund
7 // Copyright: (c) 2010 wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ----------------------------------------------------------------------------
13 // ----------------------------------------------------------------------------
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #if wxUSE_COMMANDLINKBUTTON
24 #include "wx/commandlinkbutton.h"
25 #include "wx/artprov.h"
27 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCommandLinkButton, wxButton, "wx/commandlinkbutton.h")
29 wxDEFINE_FLAGS( wxCommandLinkButtonStyle )
30 wxBEGIN_FLAGS( wxCommandLinkButtonStyle )
31 // new style border flags, we put them first to
32 // use them for streaming out
33 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
34 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
35 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
36 wxFLAGS_MEMBER(wxBORDER_RAISED)
37 wxFLAGS_MEMBER(wxBORDER_STATIC)
38 wxFLAGS_MEMBER(wxBORDER_NONE)
40 // old style border flags
41 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
42 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
43 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
44 wxFLAGS_MEMBER(wxRAISED_BORDER)
45 wxFLAGS_MEMBER(wxSTATIC_BORDER)
46 wxFLAGS_MEMBER(wxBORDER)
48 // standard window styles
49 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
50 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
51 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
52 wxFLAGS_MEMBER(wxWANTS_CHARS)
53 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
54 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
55 wxFLAGS_MEMBER(wxVSCROLL)
56 wxFLAGS_MEMBER(wxHSCROLL)
58 wxFLAGS_MEMBER(wxBU_AUTODRAW)
59 wxFLAGS_MEMBER(wxBU_LEFT)
60 wxFLAGS_MEMBER(wxBU_RIGHT)
61 wxFLAGS_MEMBER(wxBU_TOP)
62 wxFLAGS_MEMBER(wxBU_BOTTOM)
63 wxEND_FLAGS( wxCommandLinkButtonStyle )
65 wxBEGIN_PROPERTIES_TABLE(wxCommandLinkButton)
66 wxPROPERTY( MainLabel, wxString, SetMainLabel, GetMainLabel, wxString(), \
67 0 /*flags*/, wxT("The main label"), wxT("group") )
69 wxPROPERTY( Note, wxString, SetNote, GetNote, wxString(), \
70 0 /*flags*/, wxT("The link URL"), wxT("group") )
71 wxPROPERTY_FLAGS( WindowStyle, wxCommandLinkButtonStyle, long, SetWindowStyleFlag, \
72 GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
73 wxT("The link style"), wxT("group")) // style
74 wxEND_PROPERTIES_TABLE()
76 wxEMPTY_HANDLERS_TABLE(wxCommandLinkButton)
78 wxCONSTRUCTOR_7( wxCommandLinkButton, wxWindow*, Parent, wxWindowID, Id, wxString, \
79 MainLabel, wxString, Note, wxPoint, Position, wxSize, Size, long, WindowStyle )
81 // ----------------------------------------------------------------------------
82 // Generic command link button
83 // ----------------------------------------------------------------------------
85 bool wxGenericCommandLinkButton::Create(wxWindow *parent,
87 const wxString& mainLabel,
92 const wxValidator& validator,
95 if ( !wxButton::Create(parent,
97 mainLabel + '\n' + note,
105 if ( !HasNativeBitmap() )
112 void wxGenericCommandLinkButton::SetDefaultBitmap()
114 SetBitmap(wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_BUTTON));
117 #endif // wxUSE_COMMANDLINKBUTTON