Widget: ArgEdit
use class::ArgEdit;
The file ArgEdit.pm is located in the subdirectory './class'
This is a widget derived from Tk::Frame that gets connected with one argument of a tag and allows to display/modify the value of the argument.
Later it will also check the arguments types and display different widgets
for entries (Entry or List or Optionmenu or Text or Checkbox). Possible
argument types: TEXT, NUMBER, MULTILINE, OPTION([item1,
item2,
...]), REFERENCE([$stylegroup1.$stlye1.tag_name,
$stylegroup1.$stlye1.property_value(property_name)], ...), BOOL It should
also check possible ranges by number entries or the maximum length of text
entries.
If the argument is a reference to another tag, this should be modifyd using a special List-derived widget that shows all (possible) tags that could be referenced.
This object is coded as an Perl/Tk widget, so it has no Constructor new, it
has the standard Tk functions to initialise itself (Populate,ClassInit,...)
The function Populate()
is used like an constructor here.
Coding: 80% done
Documentation: up-to-date
NOTE: Here all objects get correctly destroyed after closing the window --> !NO CIRCULAR REFERENCES!
Do not set/read them directly, use the Get/Set methods instead.
$self->{'foreground'} #The foreground color definition
$self->{'background'} #The background color definition
$self->{'font'} #The font definition
$self->{'relief'} #The relief definition
$self->{'tagman'} #A reference to the associated TagMan object
$self->{'tag_name'} #The name of the tag the displayed argument belogs to (=this ArgEdit object is connected to)
$self->{'is_object'} #Flag, weather the ArgEdit 'belongs' to an EmbObj object
$self->{'ref_object'} #Reference to that EmbObj.
$self->{'is_doc_style'} #Flag, weather the ArgEdit 'belongs' to the document itself (Document arguments)
$self->{$arg_index}->{'_arg_name'} #the argument name of one entry (indexed by {$arg_index} ) This attribute has no Get/Set method, use it directly.
NOTE: The following attributes are used for the Tk widgets building the GUI and are accessed directly (no get/set methods):
$self->{$arg_index}->{'_frame'} #the base frame of one argument enty (indexed by {$arg_index} )
$self->{$arg_index}->{'_entry'} #the entry of one
argument(indexed
by {$arg_index} )
$self->{$arg_index}->{'_label'} #the label of one argument
entry(indexed
by {$arg_index} )
! Not called directly !
This ``constructor'' initialises a new object of the class ComObj and calls
ClassInit()
of the Superclass.
$object
= ArgEdit(%options);
This ``constructor'' sets the options of the new object of the class ArgEdit.
The binding of events and the creation of the associated Baloonhelp is done here too.
The keys/values in %options:
(+) '-foreground' => The foreground color
(+) '-background' => The background color
(+) '-relief' => The relief style ('flat', 'raised', 'sunken', 'ridged')
(+) '-font' => The font definition
(+) '-tagman' => A reference to the associated TagMan object
(+) '-tag_name' => The name of the tag which arguments should be edited by this ArgEdit object
(+) '-is_object' => Flag is set to 1, if argument is stored in an object, else it is 0
(+) '-ref_object' => Reference to the associated object (if any) or undef
(+) '-is_doc_style' => Flag is set to 1, if argument belongs to the whole document
The standard automatically called PERL destructor for objects.
$object->do_detsroy();
This ``destructor'' method is binded to the ``<DESTROY>'' event and should be performed whenever the element is destroyed. It should not be called directly.
$ref_tagman
= $object->tagman(); #gets a reference to the
TagMan object
$object->tagman($ref_tagman); #sets a reference to the Tagman object
$tag_name
= $object->tag_name(); #gets the tags name which
has the arguments to be edited
$object->tag_name($tag_name); #sets the tags name which has the arguments to be edited
$color_def
= $object->foreground(); #gets the foreground
color definition
$object->foreground($color_def); #sets the foreground color definition
$color_def
= $object->background(); #gets the background
color definition
$object->background($color_def); #sets the background color definition
$font_def
= $object->font(); #gets the font definition
$object->font($font_def); #sets the font definition
$relief_def
= $object->relief(); #gets the relief
definition
$object->relief($relief_def); #sets the relief definition
$is_object
= $object->is_object(); #gets the is_object flag
$object->is_object($is_object); #sets the is_object flag
$ref_object
= $object->ref_object(); #gets the reference to
the associated object
$object->ref_object($ref_object); #sets the reference to the associated object
$is_doc_style
= $object->is_doc_style(); #gets the
is_doc_style flag
$object->is_doc_style($is_doc_style); #sets the is_doc_style flag
no other public methods so far.
$object->_value_changed();
This is the callback binded to the ``<Key>'' event of the entry. It calls automatically the method ``set_content_changed()'' of the DocForm object the managed TagMan object belongs to. This means that when you change one argument entry, the whole document is set to CHANGED.
my $widget
= $object->_create_type_list($arg_index);
This function creates a BrowsEntry for displaying a 'LIST' argument.
The function returns a reference to the created widget.
Parameters:
(+) $arg_index: The index (number) of the argument that gets processed.
(+) The base of the hash-branch that holds all argument information (in the TagMan or in the EmbObj or in the Document itself)
my $widget
= $object->_create_type_tag_list($arg_index);
This function creates a BrowsEntry for displaying a 'TAG_LIST' argument.
The function returns a reference to the created widget.
Parameters:
(+) $arg_index: The index (number) of the argument that gets processed.
(+) The base of the hash-branch that holds all argument information (in the TagMan or in the EmbObj or in the Document itself)
my $widget
= $object->_create_type_text($arg_index);
This function creates an Entry widget for displaying a 'TEXT' argument.
The function returns a reference to the created widget.
Parameters:
(+) $arg_index: The index (number) of the argument that gets processed.
(+) The base of the hash-branch that holds all argument information (in the TagMan or in the EmbObj or in the Document itself)
my $widget
= $object->_create_type_multiline($arg_index);
This function creates a Text widget for displaying a 'MULTILINE' argument.
The function returns a reference to the created widget.
Parameters:
(+) $arg_index: The index (number) of the argument that gets processed.
(+) The base of the hash-branch that holds all argument information (in the TagMan or in the EmbObj or in the Document itself)
uiDocForm::multiline_arg_changed($arg_base_branch, $arg_index);
Updates the value of the argument.
Parameters:
(+) $arg_base_branch: Base of the 'args'-branch
(+) $arg_index: The index number of the argument