cross-platform-generator
Public Member Functions | Events | Private Member Functions | Private Attributes
cpg.ListEditor Class Reference

Back end of the list editor. More...

Inheritance diagram for cpg.ListEditor:

Public Member Functions

 ListEditor ()
 List editor contstructor. by default the editor is empty untill an list is given to edit.
 
void SetList (ObservableCollection< string > source)
 Sets the list to edit with the editor. More...
 
int GetListCount ()
 Retrieves the current number of elements in the list. More...
 

Events

ListItemChanged OnListItemChanged
 Event triggered when the value of a list item was changed.
 

Private Member Functions

ObservableCollection< string > GetList ()
 Helper function to retrieve the current list we're modifying. More...
 
void AddItem_Click (object sender, RoutedEventArgs e)
 Adds a new item to the list with a generated value. Called when the Add button is clicked. More...
 
void RemoveItem_Click (object sender, RoutedEventArgs e)
 removes an item from the list. Called when the Remove button is clicked. More...
 
void List_content_MouseDoubleClick (object sender, MouseButtonEventArgs e)
 Allows an item in the list to modify its value through an adorner. More...
 
void DisableAdorner (bool update_value)
 Disables the currently active adorner and updates the item with the new value if required. More...
 
void AdornerKeyDown (object sender, KeyEventArgs e)
 Callback for when a key is pressed when the adorner is active and has keyboard focus. More...
 
void AdornerLostKeyboardFocus (object sender, KeyboardFocusChangedEventArgs e)
 Callback for when an adorner is active and loses keyboard focus. More...
 

Private Attributes

AdornerLayer active_layer_
 The current active adornlayer if any.
 
ListItemAdorner active_adorner_
 The current active adorner used to edit an item in the list.
 

Detailed Description

Back end of the list editor.

Author
Stan Pepels

Member Function Documentation

◆ AddItem_Click()

void cpg.ListEditor.AddItem_Click ( object  sender,
RoutedEventArgs  e 
)
inlineprivate

Adds a new item to the list with a generated value. Called when the Add button is clicked.

Parameters
[in]sender(object) The sender of the event.
[in]e(RoutedEventArgs) Arguments send with the event

◆ AdornerKeyDown()

void cpg.ListEditor.AdornerKeyDown ( object  sender,
KeyEventArgs  e 
)
inlineprivate

Callback for when a key is pressed when the adorner is active and has keyboard focus.

Parameters
[in]sender(object) The sender of the event.
[in]e(KeyEventArgs) Arguments send with the event detailing the current keyboard state.
Remarks
if enter is pressed the adorner will be disabled and the value updated.
See also
spg.ListEditor.DisableAdorner

◆ AdornerLostKeyboardFocus()

void cpg.ListEditor.AdornerLostKeyboardFocus ( object  sender,
KeyboardFocusChangedEventArgs  e 
)
inlineprivate

Callback for when an adorner is active and loses keyboard focus.

Parameters
[in]sender(object) The sender of the event.
[in]e(KeyboardFocusChangedEventArgs) Arguments send with the event detailing the old and new focus state.
Remarks
this will disable the adorner but the item adorned will not be updated.
See also
spg.ListEditor.DisableAdorner

◆ DisableAdorner()

void cpg.ListEditor.DisableAdorner ( bool  update_value)
inlineprivate

Disables the currently active adorner and updates the item with the new value if required.

Parameters
[in]update_value(bool) If set the list item value that was adorned will be updated to the text currently in the adorner
See also
cpg.ListItemAdorner
Remarks
If no adorner is active when this method is called nothing will happen.

◆ GetList()

ObservableCollection<string> cpg.ListEditor.GetList ( )
inlineprivate

Helper function to retrieve the current list we're modifying.

Returns
The current list that serves as the source for the xaml bindings.

◆ GetListCount()

int cpg.ListEditor.GetListCount ( )
inline

Retrieves the current number of elements in the list.

Returns
(int) The number of lements in the list.

◆ List_content_MouseDoubleClick()

void cpg.ListEditor.List_content_MouseDoubleClick ( object  sender,
MouseButtonEventArgs  e 
)
inlineprivate

Allows an item in the list to modify its value through an adorner.

Parameters
[in]sender(object) The sender of the event.
[in]e(RoutedEventArgs) Arguments send with the event
See also
cpg.ListItemAdorner

◆ RemoveItem_Click()

void cpg.ListEditor.RemoveItem_Click ( object  sender,
RoutedEventArgs  e 
)
inlineprivate

removes an item from the list. Called when the Remove button is clicked.

Parameters
[in]sender(object) The sender of the event.
[in]e(RoutedEventArgs) Arguments send with the event

◆ SetList()

void cpg.ListEditor.SetList ( ObservableCollection< string >  source)
inline

Sets the list to edit with the editor.

Parameters
[in]source(ObservableCollection<string>) The list to be modified.
Remarks
If the passed source is null the editor will set itself to the disabled state.

The documentation for this class was generated from the following file: