]> git.saurik.com Git - wxWidgets.git/blame - src/generic/commandlinkbuttong.cpp
missing commit
[wxWidgets.git] / src / generic / commandlinkbuttong.cpp
CommitLineData
3571e1ad
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/generic/commandlinkbuttong.cpp
3// Purpose: wxGenericCommandLinkButton
4// Author: Rickard Westerlund
5// Created: 2010-06-23
6// RCS-ID: $Id$
7// Copyright: (c) 2010 wxWidgets team
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11// ----------------------------------------------------------------------------
12// headers
13// ----------------------------------------------------------------------------
14
15// For compilers that support precompilation, includes "wx.h".
16#include "wx/wxprec.h"
17
18#ifdef __BORLANDC__
19 #pragma hdrstop
20#endif
21
22#if wxUSE_COMMANDLINKBUTTON
23
24#include "wx/commandlinkbutton.h"
25#include "wx/artprov.h"
26
28953245 27wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCommandLinkButton, wxButton, "wx/commandlinkbutton.h")
3571e1ad 28
8d6eed5f
SC
29wxDEFINE_FLAGS( wxCommandLinkButtonStyle )
30wxBEGIN_FLAGS( wxCommandLinkButtonStyle )
31// new style border flags, we put them first to
32// use them for streaming out
33wxFLAGS_MEMBER(wxBORDER_SIMPLE)
34wxFLAGS_MEMBER(wxBORDER_SUNKEN)
35wxFLAGS_MEMBER(wxBORDER_DOUBLE)
36wxFLAGS_MEMBER(wxBORDER_RAISED)
37wxFLAGS_MEMBER(wxBORDER_STATIC)
38wxFLAGS_MEMBER(wxBORDER_NONE)
39
40// old style border flags
41wxFLAGS_MEMBER(wxSIMPLE_BORDER)
42wxFLAGS_MEMBER(wxSUNKEN_BORDER)
43wxFLAGS_MEMBER(wxDOUBLE_BORDER)
44wxFLAGS_MEMBER(wxRAISED_BORDER)
45wxFLAGS_MEMBER(wxSTATIC_BORDER)
46wxFLAGS_MEMBER(wxBORDER)
47
48// standard window styles
49wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
50wxFLAGS_MEMBER(wxCLIP_CHILDREN)
51wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
52wxFLAGS_MEMBER(wxWANTS_CHARS)
53wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
54wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
55wxFLAGS_MEMBER(wxVSCROLL)
56wxFLAGS_MEMBER(wxHSCROLL)
57
58wxFLAGS_MEMBER(wxBU_AUTODRAW)
59wxFLAGS_MEMBER(wxBU_LEFT)
60wxFLAGS_MEMBER(wxBU_RIGHT)
61wxFLAGS_MEMBER(wxBU_TOP)
62wxFLAGS_MEMBER(wxBU_BOTTOM)
63wxEND_FLAGS( wxCommandLinkButtonStyle )
64
65wxBEGIN_PROPERTIES_TABLE(wxCommandLinkButton)
66wxPROPERTY( MainLabel, wxString, SetMainLabel, GetMainLabel, wxString(), \
67 0 /*flags*/, wxT("The main label"), wxT("group") )
68
69wxPROPERTY( Note, wxString, SetNote, GetNote, wxString(), \
70 0 /*flags*/, wxT("The link URL"), wxT("group") )
71wxPROPERTY_FLAGS( WindowStyle, wxCommandLinkButtonStyle, long, SetWindowStyleFlag, \
72 GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
73 wxT("The link style"), wxT("group")) // style
74wxEND_PROPERTIES_TABLE()
75
76wxEMPTY_HANDLERS_TABLE(wxCommandLinkButton)
77
78wxCONSTRUCTOR_7( wxCommandLinkButton, wxWindow*, Parent, wxWindowID, Id, wxString, \
79 MainLabel, wxString, Note, wxPoint, Position, wxSize, Size, long, WindowStyle )
80
3571e1ad
VZ
81// ----------------------------------------------------------------------------
82// Generic command link button
83// ----------------------------------------------------------------------------
84
85bool wxGenericCommandLinkButton::Create(wxWindow *parent,
86 wxWindowID id,
87 const wxString& mainLabel,
88 const wxString& note,
89 const wxPoint& pos,
90 const wxSize& size,
91 long style,
92 const wxValidator& validator,
93 const wxString& name)
94{
95 if ( !wxButton::Create(parent,
96 id,
97 mainLabel + '\n' + note,
98 pos,
99 size,
100 style,
101 validator,
102 name) )
103 return false;
104
105 if ( !HasNativeBitmap() )
106 SetDefaultBitmap();
107
108 return true;
109
110}
111
112void wxGenericCommandLinkButton::SetDefaultBitmap()
113{
114 SetBitmap(wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_BUTTON));
115}
116
117#endif // wxUSE_COMMANDLINKBUTTON