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