Source cleaning for new features.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-05-29 07:31:24 +00:00
parent 2858324691
commit 98159dd8b6
3 changed files with 22 additions and 14 deletions

View File

@@ -65,7 +65,7 @@ Constructor. See \helpref{Create}{wxhyperlinkctrlcreate} for more info.
\membersection{wxHyperLinkCtrl::Create}\label{wxhyperlinkctrlcreate} \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. Creates the hyperlink control.
@@ -73,7 +73,7 @@ Creates the hyperlink control.
\docparam{parent}{Parent window. Must not be \NULL.} \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.} \docparam{label}{The label of the hyperlink.}
@@ -81,7 +81,7 @@ Creates the hyperlink control.
\docparam{pos}{Window position.} \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.} appropriately.}
\docparam{style}{Window style. See \helpref{wxHyperlinkCtrl}{wxhyperlinkctrl}.} \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}} \func{void}{SetURL}{\param{const wxString \&}{ url}}
Sets the URL associated with the event. Sets the URL associated with the event.

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: hyperlink.h // Name: wx/hyperlink.h
// Purpose: Hyperlink control // Purpose: Hyperlink control
// Author: David Norris <danorris@gmail.com>, Otto Wyss // Author: David Norris <danorris@gmail.com>, Otto Wyss
// Modified by: Ryan Norton, Francesco Montorsi // Modified by: Ryan Norton, Francesco Montorsi
@@ -207,4 +207,3 @@ typedef void (wxEvtHandler::*wxHyperlinkEventFunction)(wxHyperlinkEvent&);
#endif // wxUSE_HYPERLINKCTRL #endif // wxUSE_HYPERLINKCTRL
#endif // _WX_HYPERLINK_H__ #endif // _WX_HYPERLINK_H__

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: hyperlink.cpp // Name: src/generic/hyperlink.cpp
// Purpose: Hyperlink control // Purpose: Hyperlink control
// Author: David Norris <danorris@gmail.com>, Otto Wyss // Author: David Norris <danorris@gmail.com>, Otto Wyss
// Modified by: Ryan Norton, Francesco Montorsi // Modified by: Ryan Norton, Francesco Montorsi
@@ -28,17 +28,20 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_HYPERLINKCTRL
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Includes // Includes
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#include "wx/hyperlink.h" #include "wx/hyperlink.h"
#include "wx/utils.h" // for wxLaunchDefaultBrowser
#ifndef WX_PRECOMP
#include "wx/utils.h" // for wxLaunchDefaultBrowser
#endif
#include "wx/clipbrd.h" #include "wx/clipbrd.h"
#if wxUSE_HYPERLINKCTRL
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@@ -69,15 +72,22 @@ bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id,
const wxString& label, const wxString& url, const wxPoint& pos, const wxString& label, const wxString& url, const wxPoint& pos,
const wxSize& size, long style, const wxString& name) 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 ?")); wxT("Both URL and label are empty ?"));
if (!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name)) if (!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name))
return false; return false;
// set to non empty strings both the url and the label // set to non empty strings both the url and the label
SetURL(url.IsEmpty() ? label : url); if(url.empty())
SetLabel(label.IsEmpty() ? url : label); 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 // by default the cursor to use in this window is wxCURSOR_HAND
SetCursor(wxCursor(wxCURSOR_HAND)); SetCursor(wxCursor(wxCURSOR_HAND));