]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/hyperlink.h
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     interface of wxHyperlinkEvent 
   4 // Author:      wxWidgets team 
   6 // Licence:     wxWindows license 
   7 ///////////////////////////////////////////////////////////////////////////// 
  10     @class wxHyperlinkEvent 
  12     This event class is used for the events generated by wxHyperlinkCtrl. 
  14     @beginEventTable{wxHyperlinkEvent} 
  15     @event{EVT_HYPERLINK(id, func)} 
  16         User clicked on an hyperlink. 
  22 class wxHyperlinkEvent 
: public wxCommandEvent
 
  26         The constructor is not normally used by the user code. 
  28     wxHyperlinkEvent(wxObject
* generator
, int id
, const wxString
& url
); 
  31         Returns the URL of the hyperlink where the user has just clicked. 
  33     wxString 
GetURL() const; 
  36         Sets the URL associated with the event. 
  38     void SetURL(const wxString
& url
); 
  44     @class wxHyperlinkCtrl 
  46     This class shows a static text element which links to an URL. 
  47     Appearance and behaviour is completely customizable. 
  49     In fact, when the user clicks on the hyperlink, a wxHyperlinkEvent is 
  50     sent but if that event is not handled (or it's skipped; see wxEvent::Skip), 
  51     then a call to wxLaunchDefaultBrowser() is done with the hyperlink's URL. 
  53     Note that standard wxWindow functions like wxWindow::SetBackgroundColour, 
  54     wxWindow::SetFont, wxWindow::SetCursor, wxWindow::SetLabel can be used to 
  55     customize appearance of the hyperlink. 
  58     @style{wxHL_ALIGN_LEFT} 
  59            Align the text to the left. 
  60     @style{wxHL_ALIGN_RIGHT} 
  61            Align the text to the right. 
  62     @style{wxHL_ALIGN_CENTRE} 
  63            Center the text (horizontally). 
  64     @style{wxHL_CONTEXTMENU} 
  65            Pop up a context menu when the hyperlink is right-clicked. The 
  66            context menu contains a "Copy URL" menu item which is automatically 
  67            handled by the hyperlink and which just copies in the clipboard the 
  68            URL (not the label) of the control. 
  69     @style{wxHL_DEFAULT_STYLE} 
  70            The default style for wxHyperlinkCtrl: 
  71            wxBORDER_NONE|wxHL_CONTEXTMENU|wxHL_ALIGN_CENTRE. 
  74     @beginEventTable{wxHyperlinkEvent} 
  75     @event{EVT_HYPERLINK(id, func)} 
  76         The hyperlink was (left) clicked. If this event is not handled in user's 
  77         code (or it's skipped; see wxEvent::Skip), then a call to wxLaunchDefaultBrowser 
  78         is done with the hyperlink's URL. 
  84     @appearance{hyperlinkctrl.png} 
  86     @see wxURL, wxHyperlinkEvent 
  88 class wxHyperlinkCtrl 
: public wxControl
 
  92         Constructor. See Create() for more info. 
  94     wxHyperLink(wxWindow
* parent
, wxWindowID id
, 
  95                 const wxString
& label
, 
  97                 const wxPoint
& pos 
= wxDefaultPosition
, 
  98                 const wxSize
& size 
= wxDefaultSize
, 
  99                 long style 
= wxHL_DEFAULT_STYLE
, 
 100                 const wxString
& name 
= "hyperlink"); 
 103         Creates the hyperlink control. 
 106             Parent window. Must not be @NULL. 
 108             Window identifier. A value of wxID_ANY indicates a default value. 
 110             The label of the hyperlink. 
 112             The URL associated with the given label. 
 117             If the wxDefaultSize is specified then the window is sized appropriately. 
 119             Window style. See wxHyperlinkCtrl. 
 123     bool Create(wxWindow
* parent
, wxWindowID id
, const wxString
& label
, 
 124                 const wxString
& url
, const wxPoint
& pos 
= wxDefaultPosition
, 
 125                 const wxSize
& size 
= wxDefaultSize
, 
 126                 long style 
= wxHL_DEFAULT_STYLE
, 
 127                 const wxString
& name 
= wxHyperlinkCtrlNameStr
); 
 130         Returns the colour used to print the label of the hyperlink when the mouse is 
 133     virtual wxColour 
GetHoverColour() const; 
 136         Returns the colour used to print the label when the link has never been clicked 
 137         before (i.e. the link has not been @e visited) and the mouse is not over the control. 
 139     virtual wxColour 
GetNormalColour() const; 
 142         Returns the URL associated with the hyperlink. 
 144     virtual wxString 
GetURL() const; 
 147         Returns @true if the hyperlink has already been clicked by the user at least 
 150     virtual bool GetVisited() const = 0; 
 153         Returns the colour used to print the label when the mouse is not over the 
 154         control and the link has already been clicked before (i.e. the link has 
 157     virtual wxColour 
GetVisitedColour() const; 
 160         Sets the colour used to print the label of the hyperlink when the mouse is over 
 163     virtual void SetHoverColour(const wxColour
& colour
); 
 166         Sets the colour used to print the label when the link has never been clicked before 
 167         (i.e. the link has not been @e visited) and the mouse is not over the control. 
 169     virtual void SetNormalColour(const wxColour
& colour
); 
 172         Sets the URL associated with the hyperlink. 
 174     virtual void SetURL(const wxString
& url
); 
 177         Marks the hyperlink as visited (see wxHyperlinkCtrl::SetVisitedColour). 
 179     virtual void SetVisited(bool visited 
= true) = 0; 
 182         Sets the colour used to print the label when the mouse is not over the control 
 183         and the link has already been clicked before (i.e. the link has been @e visited). 
 185     virtual void SetVisitedColour(const wxColour
& colour
);