X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c105dda0810d927d8531e4949ada0b407a1cbebd..d642db66a5efc82d374b813022c72ba88bc50839:/include/wx/generic/hyperlink.h diff --git a/include/wx/generic/hyperlink.h b/include/wx/generic/hyperlink.h index 93a086f565..c148dba91b 100644 --- a/include/wx/generic/hyperlink.h +++ b/include/wx/generic/hyperlink.h @@ -9,12 +9,8 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef __GENERICHYPERLINKCTRLH__ -#define __GENERICHYPERLINKCTRLH__ - -#include "wx/defs.h" -#include "wx/control.h" - +#ifndef _WX_GENERICHYPERLINKCTRL_H_ +#define _WX_GENERICHYPERLINKCTRL_H_ // ---------------------------------------------------------------------------- // wxGenericHyperlinkCtrl @@ -24,7 +20,7 @@ class WXDLLIMPEXP_ADV wxGenericHyperlinkCtrl : public wxHyperlinkCtrlBase { public: // Default constructor (for two-step construction). - wxGenericHyperlinkCtrl() { } + wxGenericHyperlinkCtrl() { Init(); } // Constructor. wxGenericHyperlinkCtrl(wxWindow *parent, @@ -35,7 +31,8 @@ public: long style = wxHL_DEFAULT_STYLE, const wxString& name = wxHyperlinkCtrlNameStr) { - (void)Create(parent, id, label, url, pos, size, style, name); + Init(); + (void) Create(parent, id, label, url, pos, size, style, name); } // Creation function (for two-step construction). @@ -69,11 +66,21 @@ public: protected: + // Helper used by this class itself and native MSW implementation that + // connects OnRightUp() and OnPopUpCopy() handlers. + void ConnectMenuHandlers(); + // event handlers // Renders the hyperlink. void OnPaint(wxPaintEvent& event); + // Handle set/kill focus events (invalidate for painting focus rect) + void OnFocus(wxFocusEvent& event); + + // Fire a HyperlinkEvent on space + void OnChar(wxKeyEvent& event); + // Returns the wxRect of the label of this hyperlink. // This is different from the clientsize's rectangle when // clientsize != bestsize and this rectangle is influenced @@ -100,20 +107,19 @@ protected: // handles "Copy URL" menuitem void OnPopUpCopy(wxCommandEvent& event); - // Refreshes the control to update label's position if necessary - void OnSize(wxSizeEvent& event); - - // overridden base class virtuals // Returns the best size for the window, which is the size needed // to display the text label. - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestClientSize() const; // creates a context menu with "Copy URL" menuitem virtual void DoContextMenu(const wxPoint &); private: + // Common part of all ctors. + void Init(); + // URL associated with the link. This is transmitted inside // the HyperlinkEvent fired when the user clicks on the label. wxString m_url; @@ -134,9 +140,6 @@ private: // True if a click is in progress (left button down) and the click // originated inside the label's bounding box. bool m_clicking; - -private: - DECLARE_DYNAMIC_CLASS(wxGenericHyperlinkCtrl) }; -#endif // __GENERICHYPERLINKCTRLH__ +#endif // _WX_GENERICHYPERLINKCTRL_H_