wx.Html.HtmlChoiceTagHandler Class Reference

Inheritance diagram for wx.Html.HtmlChoiceTagHandler:

wx.Html.HtmlTagHandler wx.Object

List of all members.

Public Types

enum  Style

Public Member Functions

void Append (string item, object clientdata)
void Append (string item, string hyperref)
void Append (string item, int cmd)
void Append (string item)
int FindCmd (int cmd)
int FindHyperref (string hyperref)
int FindItem (string item)
override string GetSupportedTags ()
override bool HandleTag (HtmlTag tag)
 HtmlChoiceTagHandler (Style style, string tag)
 HtmlChoiceTagHandler (Style style, string tag, int id)
 HtmlChoiceTagHandler (Style style, string tag, Size size, int id)

Properties

int Selection [get, set]
string SelectionString [get, set]


Detailed Description

This is a tag handler that offers you a choice among hyper links or actions. Choices may be specified by constructors or tags. Actions may be action events or hyper links. You may choose between the styles "Choice" and "List". Example:
     HtmlChoiceTagHandler tagHandler = new HtmlChoiceTagHandler(HtmlChoiceTagHandler.Style.List, "mychoice");
     tagHandler.Append("First choice: Command event", 23);
     tagHandler.Append("Second choice: Hyperlink", "http://testserver/page#section");
This handler will interpret tags like:
     <mychoice style="choice" id=24>
     <mychoice_choice cmd=24 name="Third choice"></mychoice>
     <mychoice_choice href="http://testserver/page#section2" name="Forth choice"></choice>
     <!-- the following three selections all have the same effect: Selection of item 0. !-->
     <mychoice_select cmd=23>
     <mychoice_select name="First choice: Command event">
     <mychoice_select pos=0>
     </mychoice>
     
Appending labels to the tag handler is useful for reusing a handler in several documents while specifying choices in HTML is appropriate if the choice is exclusively relevant to the current document.

Items may be identified in contained tags like ".._SELECT" by the attributes name="Name" by their name or the associated command: href="info.html" for an item representing a certain page to be loaded and cmd=24 for items issueing a command event of the provided ID. The third option is to identify items by their position on the list: pos=0.

Please note that method Append() shall run before processing the tag. So, this method can be considered as a part of the contructor.

This class relies on the fixes in the wx.NET implementation of wx.HtmlWidgetCell. So, analogously implementations will probably not work with the original wxWidgets system in C++.

Please note that because of a bug in wxWidgets this handler currently does not use wx.HtmlParser.PushTagHandler and wx.HtmlParser.PopTagHandler but implements tags with suffix "_CHOICE" and "_SELECT" as presented in the example.

Please note, that the type of the events caused by the control created by this tag handler depends on the style. This will raise EVT_LISTBOX if the style requires a list. The event will be processed by EVT_CHOICE in case of style "choice".


Member Enumeration Documentation

enum wx::Html::HtmlChoiceTagHandler::Style

Enumerator:
StaticNumberOfColumns  The number of columns os fixed and cannot be changed. This is the default.
DynamicNumberOfColumns  The number of columns can change. Models using this style shall add a handler of the ColumnPropertyCollection.OnChanging event.
StaticNumberOfRows  The number of rows os fixed and cannot be changed. This is the default.
DynamicNumberOfRows  The number of rows can change. Models using this style shall add a handler of the RowPropertyCollection.OnChanging event.
List 
Choice 
TOOLBAR 
CONTENTS 
INDEX 
SEARCH 
BOOKMARKS 
OPEN_FILES 
PRINT 
FLAT_TOOLBAR 
MERGE_BOOKS 
ICONS_BOOK 
ICONS_BOOK_CHAPTER 
ICONS_FOLDER  this is 0 since it is default
DEFAULT_STYLE 


Constructor & Destructor Documentation

wx.Html.HtmlChoiceTagHandler.HtmlChoiceTagHandler ( Style  style,
string  tag,
Size  size,
int  id 
)

Creates a handler.

Parameters:
style The style (appearance) of the switch/choice-control.
tag The HTML tag that this handler implements.
id The window id of the choice dialog. This may be overridden by attribute ID.
size The size of the control in pixel.

wx.Html.HtmlChoiceTagHandler.HtmlChoiceTagHandler ( Style  style,
string  tag,
int  id 
)

Creates a handler.

Parameters:
style The style (appearance) of the switch/choice-control.
tag The HTML tag that this handler implements.
id The window id of the choice dialog. This may be overridden by attribute ID.

wx.Html.HtmlChoiceTagHandler.HtmlChoiceTagHandler ( Style  style,
string  tag 
)

Creates a handler.

Parameters:
style The style (appearance) of the switch/choice-control.
tag The HTML tag that this handler implements.


Member Function Documentation

void wx.Html.HtmlChoiceTagHandler.Append ( string  item,
object  clientdata 
)

this creates a choice with attached client data.

Parameters:
item The name of the item.
clientdata The client data.

void wx.Html.HtmlChoiceTagHandler.Append ( string  item,
string  hyperref 
)

Add an item to the control loading a URL on selection.

void wx.Html.HtmlChoiceTagHandler.Append ( string  item,
int  cmd 
)

Add an item to the control. Selecting the item will cause a command event that may be processed in surrounding windows.

void wx.Html.HtmlChoiceTagHandler.Append ( string  item  ) 

Adds an item to the control without any command associated.

int wx.Html.HtmlChoiceTagHandler.FindCmd ( int  cmd  ) 

Find the first item of the provided command ID and return its index on success or -1 otherwise. Items are often subject of localization/translation. A neutral designator for selecting item is a representation of the action issued by the item. Therefore, this method enables a user to select an item issueing a certain command.

int wx.Html.HtmlChoiceTagHandler.FindHyperref ( string  hyperref  ) 

Find the first item of the provided hyperref and return its index on success or -1 otherwise. Items are often subject of localization/translation. A neutral designator for selecting item is a representation of the action issued by the item. Therefore, this method enables a user to select an item issueing a new page to be displayed.

int wx.Html.HtmlChoiceTagHandler.FindItem ( string  item  ) 

Find the provided item string and return its index on success or -1 otherwise.

override string wx.Html.HtmlChoiceTagHandler.GetSupportedTags (  )  [virtual]

Use this to define the tags that this handler implements. Return a comma-separated list of tag names like "I,B,FONT,P".

Please note, that in contrast to modern XML-compatible conventions wxWidgets uses upper case letters as standard form for tag names. For this reason, wx.NET will convert th result of this method automatically into upper case form. However, analogous code in C++ will probably not run with the original wxWidgets in C++ if this result contains lower case letters.

Implements wx.Html.HtmlTagHandler.

override bool wx.Html.HtmlChoiceTagHandler.HandleTag ( HtmlTag  tag  )  [virtual]

Implement the tags as defined by GetSupportedTags().

Implements wx.Html.HtmlTagHandler.


Property Documentation

int wx.Html.HtmlChoiceTagHandler.Selection [get, set]

string wx.Html.HtmlChoiceTagHandler.SelectionString [get, set]

Returns or sets the label of the selected item. This is an empty string if nothing is selected. Please refer to SelectCmd() and SelectHyperref() for alternative methods of selecting items.

Assignments trying to select an unknown item will be ignored silently. Refer to SelectItem() for an alternative method.


Manual of the wx.NET   (c) 2003-2011 the wx.NET project at   Get wx.NET at SourceForge.net. Fast, secure and Free Open Source software downloads