#include <Wt/WAnchor>
Public Member Functions | |
WAnchor (WContainerWidget *parent=0) | |
Create an anchor. | |
WAnchor (const std::string &url, WContainerWidget *parent=0) | |
Create an anchor referring to a URL. | |
WAnchor (WResource *resource, WContainerWidget *parent=0) | |
Create an anchor referring to a resource. | |
WAnchor (const std::string &url, const WString &text, WContainerWidget *parent=0) | |
Create an anchor referring to a URL, using a text message. | |
WAnchor (WResource *resource, const WString &text, WContainerWidget *parent=0) | |
Create an anchor reffering to a resource, using a text message. | |
WAnchor (const std::string &ref, WImage *image, WContainerWidget *parent=0) | |
Create an anchor reffering to a URL, using an image. | |
WAnchor (WResource *resource, WImage *image, WContainerWidget *parent=0) | |
Create an anchor reffering to a resource, using an image. | |
void | setRef (const std::string &url) |
Set the destination URL. | |
const std::string & | ref () const |
Returns the destination URL. | |
void | setResource (WResource *resource) |
Set a destination resource. | |
WResource * | resource () const |
Returns the destination resource. | |
void | setText (const WString &text) |
Sets a text label. | |
const WString & | text () const |
Returns the label text. | |
void | setImage (WImage *image) |
Set an image. | |
WImage * | image () const |
Returns the image. | |
void | setTarget (AnchorTarget target) |
Set the location where the referred content should be displayed. | |
AnchorTarget | target () const |
Returns the location where the referred content should be displayed. |
WAnchor is an inline widget.
Use an anchor to link to another web page, document or resource. The anchor may contain text, image, or any other widget (since it inherits from WContainerWidget). A click will activate the target link.
Wt::WAnchor::WAnchor | ( | WResource * | resource, | |
WContainerWidget * | parent = 0 | |||
) |
Create an anchor referring to a resource.
A resource specifies application-dependent content, which may be generated by your application on demand.
The anchor does not assume ownership of the resource.
Wt::WAnchor::WAnchor | ( | WResource * | resource, | |
const WString & | text, | |||
WContainerWidget * | parent = 0 | |||
) |
Create an anchor reffering to a resource, using a text message.
A resource specifies application-dependent content, which may be generated by your application on demand.
The anchor does not assume ownership of the resource.
Wt::WAnchor::WAnchor | ( | const std::string & | ref, | |
WImage * | image, | |||
WContainerWidget * | parent = 0 | |||
) |
Create an anchor reffering to a URL, using an image.
Ownership of the image is transferred to the anchor.
Wt::WAnchor::WAnchor | ( | WResource * | resource, | |
WImage * | image, | |||
WContainerWidget * | parent = 0 | |||
) |
Create an anchor reffering to a resource, using an image.
A resource specifies application-dependent content, which may be generated by your application on demand.
The anchor does not assume ownership of the resource.
Ownership of the image is transferred to the anchor.
void Wt::WAnchor::setRef | ( | const std::string & | url | ) |
Set the destination URL.
This method should not be used when the anchor has been pointed to a dynamically generated resource using setResource().
const std::string& Wt::WAnchor::ref | ( | ) | const [inline] |
Returns the destination URL.
When the anchor refers to a resource, the current resource URL is returned.
void Wt::WAnchor::setResource | ( | WResource * | resource | ) |
Set a destination resource.
A resource specifies application-dependent content, which may be generated by your application on demand.
This sets the resource as the destination of the anchor, and is an alternative to setRef(). The resource may be cleared by passing resource = 0.
The anchor does not assume ownership of the resource.
WResource* Wt::WAnchor::resource | ( | ) | const [inline] |
void Wt::WAnchor::setText | ( | const WString & | text | ) |
Sets a text label.
If no text was previously set, a new WText widget is added using addWidget().
const WString & Wt::WAnchor::text | ( | ) | const |
void Wt::WAnchor::setImage | ( | WImage * | image | ) |
Set an image.
If an image was previously set, it is deleted. The image is added using addWidget().
Ownership of the image is transferred to the anchor.
WImage* Wt::WAnchor::image | ( | ) | const [inline] |
void Wt::WAnchor::setTarget | ( | AnchorTarget | target | ) |
Set the location where the referred content should be displayed.
By default, the referred content is displayed in the application (Wt::TargetSelf). When the destination is an HTML document, the application is replaced with the new document. When the reference is a document that cannot be displayed in the browser, it is offered for download or opened using an external program, depending on browser settings.
By setting target to Wt::TargetNewWindow, the destination is displayed in a new browser window or tab.
AnchorTarget Wt::WAnchor::target | ( | ) | const [inline] |