From 98159dd8b62759836ee48049e581e4c2be542cf0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Mon, 29 May 2006 07:31:24 +0000 Subject: [PATCH] Source cleaning for new features. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/hyperlink.tex | 7 +++---- include/wx/hyperlink.h | 3 +-- src/generic/hyperlink.cpp | 24 +++++++++++++++++------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/docs/latex/wx/hyperlink.tex b/docs/latex/wx/hyperlink.tex index 3068b8ebcf..f7c04c11a7 100644 --- a/docs/latex/wx/hyperlink.tex +++ b/docs/latex/wx/hyperlink.tex @@ -65,7 +65,7 @@ Constructor. See \helpref{Create}{wxhyperlinkctrlcreate} for more info. \membersection{wxHyperLinkCtrl::Create}\label{wxhyperlinkctrlcreate} -\func{}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id = -1} \param{const wxString \&}{ label}, \param{const wxString \&}{ url}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\param{long}{ style}, \param{const wxString\& }{name = ``hyperlink"}} +\func{}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id = wxID\_ANY} \param{const wxString \&}{ label}, \param{const wxString \&}{ url}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\param{long}{ style}, \param{const wxString\& }{name = ``hyperlink"}} Creates the hyperlink control. @@ -73,7 +73,7 @@ Creates the hyperlink control. \docparam{parent}{Parent window. Must not be \NULL.} -\docparam{id}{Window identifier. A value of -1 indicates a default value.} +\docparam{id}{Window identifier. A value of wxID\_ANY indicates a default value.} \docparam{label}{The label of the hyperlink.} @@ -81,7 +81,7 @@ Creates the hyperlink control. \docparam{pos}{Window position.} -\docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized +\docparam{size}{Window size. If the wxDefaultSize is specified then the window is sized appropriately.} \docparam{style}{Window style. See \helpref{wxHyperlinkCtrl}{wxhyperlinkctrl}.} @@ -217,4 +217,3 @@ Returns the URL of the hyperlink where the user has just clicked. \func{void}{SetURL}{\param{const wxString \&}{ url}} Sets the URL associated with the event. - diff --git a/include/wx/hyperlink.h b/include/wx/hyperlink.h index 474951d97c..dc4e2fcac3 100644 --- a/include/wx/hyperlink.h +++ b/include/wx/hyperlink.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: hyperlink.h +// Name: wx/hyperlink.h // Purpose: Hyperlink control // Author: David Norris , Otto Wyss // Modified by: Ryan Norton, Francesco Montorsi @@ -207,4 +207,3 @@ typedef void (wxEvtHandler::*wxHyperlinkEventFunction)(wxHyperlinkEvent&); #endif // wxUSE_HYPERLINKCTRL #endif // _WX_HYPERLINK_H__ - diff --git a/src/generic/hyperlink.cpp b/src/generic/hyperlink.cpp index 6f078ca9fe..54c6a9a092 100644 --- a/src/generic/hyperlink.cpp +++ b/src/generic/hyperlink.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: hyperlink.cpp +// Name: src/generic/hyperlink.cpp // Purpose: Hyperlink control // Author: David Norris , Otto Wyss // Modified by: Ryan Norton, Francesco Montorsi @@ -28,16 +28,19 @@ #pragma hdrstop #endif +#if wxUSE_HYPERLINKCTRL + //--------------------------------------------------------------------------- // Includes //--------------------------------------------------------------------------- #include "wx/hyperlink.h" -#include "wx/utils.h" // for wxLaunchDefaultBrowser -#include "wx/clipbrd.h" +#ifndef WX_PRECOMP + #include "wx/utils.h" // for wxLaunchDefaultBrowser +#endif -#if wxUSE_HYPERLINKCTRL +#include "wx/clipbrd.h" // ============================================================================ // implementation @@ -69,15 +72,22 @@ bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxString& url, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { - wxASSERT_MSG(!url.IsEmpty() || !label.IsEmpty(), + wxASSERT_MSG(!url.empty() || !label.empty(), wxT("Both URL and label are empty ?")); if (!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name)) return false; // set to non empty strings both the url and the label - SetURL(url.IsEmpty() ? label : url); - SetLabel(label.IsEmpty() ? url : label); + if(url.empty()) + SetURL(label); + else + SetUrl(url); + + if(label.empty()) + SetLabel(url); + else + SetLabel(label); // by default the cursor to use in this window is wxCURSOR_HAND SetCursor(wxCursor(wxCURSOR_HAND)); -- 2.47.2