2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: hyperlink.h
|
|
|
|
// Purpose: documentation for wxHyperlinkEvent class
|
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxHyperlinkEvent
|
|
|
|
@wxheader{hyperlink.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This event class is used for the events generated by
|
|
|
|
wxHyperlinkCtrl.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxadv}
|
|
|
|
@category{FIXME}
|
|
|
|
*/
|
|
|
|
class wxHyperlinkEvent : public wxCommandEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
The constructor is not normally used by the user code.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxHyperlinkEvent(wxObject* generator, int id,
|
|
|
|
const wxString& url);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the URL of the hyperlink where the user has just clicked.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxString GetURL();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the URL associated with the event.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetURL(const wxString& url);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxHyperlinkCtrl
|
|
|
|
@wxheader{hyperlink.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class shows a static text element which links to an URL.
|
|
|
|
Appearance and behaviour is completely customizable. In fact, when the user
|
|
|
|
clicks on the hyperlink, a wxHyperlinkEvent is
|
|
|
|
sent but if that event is not handled (or it's skipped; see
|
|
|
|
wxEvent::Skip), then a call to
|
|
|
|
wxLaunchDefaultBrowser is done with the
|
|
|
|
hyperlink's URL.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Note that standard wxWindow functions like wxWindow::SetBackgroundColour,
|
|
|
|
wxWindow::SetFont, wxWindow::SetCursor, wxWindow::SetLabel can be used to customize appearance of the hyperlink.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
|
|
|
@style{wxHL_ALIGN_LEFT}:
|
|
|
|
Align the text to the left.
|
|
|
|
@style{wxHL_ALIGN_RIGHT}:
|
|
|
|
Align the text to the right.
|
|
|
|
@style{wxHL_ALIGN_CENTRE}:
|
|
|
|
Center the text (horizontally).
|
|
|
|
@style{wxHL_CONTEXTMENU}:
|
|
|
|
Pop up a context menu when the hyperlink is right-clicked. The
|
|
|
|
context menu contains a "Copy URL" menu item which is automatically
|
|
|
|
handled by the hyperlink and which just copies in the clipboard the
|
|
|
|
URL (not the label) of the control.
|
|
|
|
@style{wxHL_DEFAULT_STYLE}:
|
|
|
|
The default style for wxHyperlinkCtrl:
|
|
|
|
wxBORDER_NONE|wxHL_CONTEXTMENU|wxHL_ALIGN_CENTRE.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxadv}
|
|
|
|
@category{ctrl}
|
|
|
|
@appearance{hyperlinkctrl.png}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@seealso
|
|
|
|
wxURL, wxHyperlinkEvent
|
|
|
|
*/
|
|
|
|
class wxHyperlinkCtrl : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Creates the hyperlink control.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window. Must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
Window identifier. A value of wxID_ANY indicates a default value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param label
|
2008-03-09 08:33:59 -04:00
|
|
|
The label of the hyperlink.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param url
|
2008-03-09 08:33:59 -04:00
|
|
|
The URL associated with the given label.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Window position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Window size. If the wxDefaultSize is specified then the window is sized
|
|
|
|
appropriately.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
Window style. See wxHyperlinkCtrl.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param validator
|
2008-03-09 08:33:59 -04:00
|
|
|
Window validator.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Window name.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
2008-03-09 08:33:59 -04:00
|
|
|
const wxString& label,
|
|
|
|
const wxString& url,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style,
|
|
|
|
const wxString& name = "hyperlink");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the colour used to print the label of the hyperlink when the mouse is
|
|
|
|
over the control.
|
|
|
|
*/
|
|
|
|
wxColour GetHoverColour();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the colour used to print the label when the link has never been clicked
|
|
|
|
before
|
|
|
|
(i.e. the link has not been @e visited) and the mouse is not over the control.
|
|
|
|
*/
|
|
|
|
wxColour GetNormalColour();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the URL associated with the hyperlink.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxString GetURL();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the hyperlink has already been clicked by the user at least
|
|
|
|
one time.
|
|
|
|
*/
|
|
|
|
bool GetVisited();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the colour used to print the label when the mouse is not over the
|
|
|
|
control
|
|
|
|
and the link has already been clicked before (i.e. the link has been @e
|
|
|
|
visited).
|
|
|
|
*/
|
|
|
|
wxColour GetVisitedColour();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the colour used to print the label of the hyperlink when the mouse is over
|
|
|
|
the control.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetHoverColour(const wxColour& colour);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the colour used to print the label when the link has never been clicked
|
|
|
|
before
|
|
|
|
(i.e. the link has not been @e visited) and the mouse is not over the control.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetNormalColour(const wxColour& colour);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the URL associated with the hyperlink.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetURL(const wxString& url);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Marks the hyperlink as visited (see wxHyperlinkCtrl::SetVisitedColour).
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetVisited(bool visited = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the colour used to print the label when the mouse is not over the control
|
|
|
|
and the link has already been clicked before (i.e. the link has been @e
|
|
|
|
visited).
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetVisitedColour(const wxColour& colour);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor. See Create() for more info.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxHyperLink(wxWindow* parent, wxWindowID id,
|
2008-03-09 08:33:59 -04:00
|
|
|
const wxString& label,
|
|
|
|
const wxString& url,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style,
|
|
|
|
const wxString& name = "hyperlink");
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|