Ewl_Model: A data model
Detailed Description
Defines communication callbacks for views and controllers. Query row/column data, indicate expansion points, notify views and controllers of changes, trigger sorting on a row/column combination.
Data Structures | |
struct | Ewl_Model |
Holds the callbacks needed to define a model. More... | |
Defines | |
#define | EWL_MODEL(model) ((Ewl_Model *)model) |
#define | EWL_MODEL_COLUMN_SORTABLE(f) ((Ewl_Model_Column_Sortable)f) |
#define | EWL_MODEL_DATA_COUNT(f) ((Ewl_Model_Data_Count)f) |
#define | EWL_MODEL_DATA_EXPANDABLE(f) ((Ewl_Model_Data_Expandable)f) |
#define | EWL_MODEL_DATA_FETCH(f) ((Ewl_Model_Data_Fetch)f) |
#define | EWL_MODEL_DATA_HEADER_FETCH(f) ((Ewl_Model_Data_Header_Fetch)f) |
#define | EWL_MODEL_DATA_HIGHLIGHT(f) ((Ewl_Model_Data_Highlight)f) |
#define | EWL_MODEL_DATA_SORT(f) ((Ewl_Model_Data_Sort)f) |
#define | EWL_MODEL_DATA_UNREF(f) ((Ewl_Model_Data_Unref)f) |
#define | EWL_MODEL_EXPANSION_DATA_FETCH(f) ((Ewl_Model_Expansion_Data_Fetch)f) |
#define | EWL_MODEL_EXPANSION_MODEL_FETCH(f) ((Ewl_Model_Expansion_Model_Fetch)(f) |
#define | EWL_MODEL_FREE(f) ((Ewl_Model_Data_Free)f) |
Typedefs | |
typedef Ewl_Model | Ewl_Model |
typedef int(*) | Ewl_Model_Column_Sortable (void *data, unsigned int col) |
typedef unsigned int(*) | Ewl_Model_Data_Count (void *data) |
typedef int(*) | Ewl_Model_Data_Expandable (void *data, unsigned int row) |
typedef void *(*) | Ewl_Model_Data_Fetch (void *data, unsigned int row, unsigned int column) |
typedef void(*) | Ewl_Model_Data_Free (void *data) |
typedef void *(*) | Ewl_Model_Data_Header_Fetch (void *data, unsigned int col) |
typedef unsigned int(*) | Ewl_Model_Data_Highlight (void *data, unsigned int row) |
typedef void(*) | Ewl_Model_Data_Sort (void *data, unsigned int column, Ewl_Sort_Direction sort) |
typedef unsigned int(*) | Ewl_Model_Data_Unref (void *data) |
typedef void *(*) | Ewl_Model_Expansion_Data_Fetch (void *data, unsigned int row) |
typedef Ewl_Model *(*) | Ewl_Model_Expansion_Model_Fetch (void *data, unsigned int row) |
Functions | |
unsigned int | ewl_model_cb_ecore_list_count (void *data) |
This will return the number of elements in the ecore_list. | |
void * | ewl_model_cb_ecore_list_fetch (void *data, unsigned int row, unsigned int col) |
This will return the row data element from the list. | |
Ewl_Model_Column_Sortable | ewl_model_column_sortable_get (const Ewl_Model *m) |
Retrieves the sortable callback on the model. | |
void | ewl_model_column_sortable_set (Ewl_Model *m, Ewl_Model_Column_Sortable sortable) |
Sets the sortable callback. | |
Ewl_Model_Data_Count | ewl_model_data_count_get (const Ewl_Model *m) |
Gets the count callback from the model. | |
void | ewl_model_data_count_set (Ewl_Model *m, Ewl_Model_Data_Count count) |
Sets the count callback into the model. | |
Ewl_Model_Data_Expandable | ewl_model_data_expandable_get (const Ewl_Model *m) |
Retrieves the expandable callback set on the model. | |
void | ewl_model_data_expandable_set (Ewl_Model *m, Ewl_Model_Data_Expandable exp) |
Sets the expandable callback on the given model. | |
Ewl_Model_Data_Fetch | ewl_model_data_fetch_get (const Ewl_Model *m) |
Gets the fetch callback from the model. | |
void | ewl_model_data_fetch_set (Ewl_Model *m, Ewl_Model_Data_Fetch get) |
Sets the fetch callback in the model. | |
Ewl_Model_Data_Free | ewl_model_data_free_get (const Ewl_Model *m) |
Get the data free pointer set on this model. | |
void | ewl_model_data_free_set (Ewl_Model *m, Ewl_Model_Data_Free assign) |
Set the data free pointer on this view. | |
Ewl_Model_Data_Header_Fetch | ewl_model_data_header_fetch_get (const Ewl_Model *m) |
Retrieves the header fetch function. | |
void | ewl_model_data_header_fetch_set (Ewl_Model *m, Ewl_Model_Data_Header_Fetch get) |
Sets the fetch callback into the model. | |
Ewl_Model_Data_Highlight | ewl_model_data_highlight_get (const Ewl_Model *m) |
Retrieves the highlight model set in m. | |
void | ewl_model_data_highlight_set (Ewl_Model *m, Ewl_Model_Data_Highlight highlight) |
Sets the highlight callback into the model m. | |
Ewl_Model_Data_Sort | ewl_model_data_sort_get (const Ewl_Model *m) |
Gets the sort callback from the model. | |
void | ewl_model_data_sort_set (Ewl_Model *m, Ewl_Model_Data_Sort sort) |
Sets the sort callback into the model. | |
Ewl_Model_Data_Unref | ewl_model_data_unref_get (const Ewl_Model *m) |
Gets the unref callback from the model. | |
void | ewl_model_data_unref_set (Ewl_Model *m, Ewl_Model_Data_Unref unref) |
Sets the unref callback into the model. | |
void | ewl_model_destroy (Ewl_Model *m) |
Destroys the model, so its memory is returned to the system. | |
Ewl_Model * | ewl_model_ecore_list_instance (void) |
Retrieves a model pre-initialized to work with an ecore list. This will setup the fetch and count methods for you. | |
Ewl_Model_Expansion_Data_Fetch | ewl_model_expansion_data_fetch_get (const Ewl_Model *m) |
Gets the expansion_data callback from the model. | |
void | ewl_model_expansion_data_fetch_set (Ewl_Model *m, Ewl_Model_Expansion_Data_Fetch get) |
Sets the subfetch callback into the model. | |
Ewl_Model_Expansion_Model_Fetch | ewl_model_expansion_model_fetch_get (const Ewl_Model *m) |
Retrieves the model expansion model fetch function. | |
void | ewl_model_expansion_model_fetch_set (Ewl_Model *m, Ewl_Model_Expansion_Model_Fetch f) |
Sets the model expansion model fetch callback to f. | |
int | ewl_model_init (Ewl_Model *model) |
Set the model to the default values. | |
Ewl_Model * | ewl_model_new (void) |
Creates a new Ewl_Model object. |
Define Documentation
#define EWL_MODEL_COLUMN_SORTABLE | ( | f | ) | ((Ewl_Model_Column_Sortable)f) |
Model callback to check if a columns data is sortable
#define EWL_MODEL_DATA_COUNT | ( | f | ) | ((Ewl_Model_Data_Count)f) |
Model callback to have the program return the number of rows in its data
#define EWL_MODEL_DATA_EXPANDABLE | ( | f | ) | ((Ewl_Model_Data_Expandable)f) |
Model callback to handle fetching the expandable flag for a given row of the tree
#define EWL_MODEL_DATA_FETCH | ( | f | ) | ((Ewl_Model_Data_Fetch)f) |
Model callback to handle fetching the data at the given row/column
#define EWL_MODEL_DATA_HEADER_FETCH | ( | f | ) | ((Ewl_Model_Data_Header_Fetch)f) |
Model callback to get the header data for a specific column
#define EWL_MODEL_DATA_HIGHLIGHT | ( | f | ) | ((Ewl_Model_Data_Highlight)f) |
Model callback to check if a cell is to be highlighted
#define EWL_MODEL_DATA_SORT | ( | f | ) | ((Ewl_Model_Data_Sort)f) |
Model callback to inform the program to sort it's data in the given column
#define EWL_MODEL_DATA_UNREF | ( | f | ) | ((Ewl_Model_Data_Unref)f) |
Model callback to unreference the data used by the model. This signalize that the data is not used later from the model nor the controller
#define EWL_MODEL_EXPANSION_DATA_FETCH | ( | f | ) | ((Ewl_Model_Expansion_Data_Fetch)f) |
Model callback to get the expansion data for a specific row
#define EWL_MODEL_EXPANSION_MODEL_FETCH | ( | f | ) | ((Ewl_Model_Expansion_Model_Fetch)(f) |
Model callback to get the model to use for the expansion point
#define EWL_MODEL_FREE | ( | f | ) | ((Ewl_Model_Data_Free)f) |
Model callback to free data after passing it to be assigned in the view.
Typedef Documentation
typedef int(*) Ewl_Model_Column_Sortable(void *data, unsigned int col) |
A typedef to shorten the definition of the model_column_sortable callbacks.
typedef unsigned int(*) Ewl_Model_Data_Count(void *data) |
A typedef to shorten the definition of the model_count callbacks.
typedef int(*) Ewl_Model_Data_Expandable(void *data, unsigned int row) |
A typedef to shorten the definition of the model_expandable callback
typedef void*(*) Ewl_Model_Data_Fetch(void *data, unsigned int row, unsigned int column) |
A typedef to shorten the definition of the model_fetch callbacks.
typedef void(*) Ewl_Model_Data_Free(void *data) |
A typedef to shorten the definition of the model_data_free callbacks.
typedef void*(*) Ewl_Model_Data_Header_Fetch(void *data, unsigned int col) |
A typedef to shorten the definition of the model_data_header_fetch callback
typedef unsigned int(*) Ewl_Model_Data_Highlight(void *data, unsigned int row) |
A typedef to shorten the definition of the data_highlight callbacks.
typedef void(*) Ewl_Model_Data_Sort(void *data, unsigned int column, Ewl_Sort_Direction sort) |
A typedef to shorten the definition of the model_sort callbacks.
typedef unsigned int(*) Ewl_Model_Data_Unref(void *data) |
A typedef to shorten the definition of the model_data_unref callbacks.
typedef void*(*) Ewl_Model_Expansion_Data_Fetch(void *data, unsigned int row) |
A typedef to shorten the definition of the model_expansion_data callback
typedef Ewl_Model*(*) Ewl_Model_Expansion_Model_Fetch(void *data, unsigned int row) |
A typedef to shorten the definition of the model_expansion_model_fetch callback
Function Documentation
unsigned int ewl_model_cb_ecore_list_count | ( | void * | data | ) |
This will return the number of elements in the ecore_list.
- Parameters:
-
data,: The ecore_list to get the count from
- Returns:
- Returns the number of elements in the list
void* ewl_model_cb_ecore_list_fetch | ( | void * | data, | |
unsigned int | row, | |||
unsigned int | col | |||
) |
This will return the row data element from the list.
- Parameters:
-
data,: The ecore_list to get the data from row,: The row to get the data from col,: UNUSED
- Returns:
- Returns the data at the given row
Ewl_Model_Column_Sortable ewl_model_column_sortable_get | ( | const Ewl_Model * | m | ) |
Retrieves the sortable callback on the model.
- Parameters:
-
m,: the model to work with
- Returns:
- Returns the sortable callback on the model
void ewl_model_column_sortable_set | ( | Ewl_Model * | m, | |
Ewl_Model_Column_Sortable | sortable | |||
) |
Sets the sortable callback.
- Parameters:
-
m,: the model to work with sortable,: the sortable callback to set
- Returns:
- Returns no value
Ewl_Model_Data_Count ewl_model_data_count_get | ( | const Ewl_Model * | m | ) |
Gets the count callback from the model.
- Parameters:
-
m,: The Ewl_Model to get the count callback from
- Returns:
- Returns the Ewl_Model_Count callback set on the model or NULL if none set.
void ewl_model_data_count_set | ( | Ewl_Model * | m, | |
Ewl_Model_Data_Count | count | |||
) |
Sets the count callback into the model.
- Parameters:
-
m,: The Ewl_Model to set the count callback on count,: The count callback to set on the model
- Returns:
- Returns no value.
Ewl_Model_Data_Expandable ewl_model_data_expandable_get | ( | const Ewl_Model * | m | ) |
Retrieves the expandable callback set on the model.
- Parameters:
-
m,: The model to get the expandable callback from
- Returns:
- Returns the expandable callback set on the model
void ewl_model_data_expandable_set | ( | Ewl_Model * | m, | |
Ewl_Model_Data_Expandable | exp | |||
) |
Sets the expandable callback on the given model.
- Parameters:
-
m,: The model to set the callback on exp,: The expandable callback
- Returns:
- Returns no value
Ewl_Model_Data_Fetch ewl_model_data_fetch_get | ( | const Ewl_Model * | m | ) |
Gets the fetch callback from the model.
- Parameters:
-
m,: The Ewl_Model to get the fetch callback from
- Returns:
- Returns the Ewl_Model_Fetch callback or NULL if none set
void ewl_model_data_fetch_set | ( | Ewl_Model * | m, | |
Ewl_Model_Data_Fetch | get | |||
) |
Sets the fetch callback in the model.
- Parameters:
-
m,: The Ewl_Model to set the fetch callback into get,: The Ewl_Model_Fetch callback to set
- Returns:
- Returns no value.
Ewl_Model_Data_Free ewl_model_data_free_get | ( | const Ewl_Model * | m | ) |
void ewl_model_data_free_set | ( | Ewl_Model * | m, | |
Ewl_Model_Data_Free | data_free | |||
) |
Set the data free pointer on this view.
- Parameters:
-
m,: The Ewl_Model to set the data free function into data_free,: The Ewl_Model_Data_Free function to set
- Returns:
- Returns no value.
Ewl_Model_Data_Header_Fetch ewl_model_data_header_fetch_get | ( | const Ewl_Model * | m | ) |
Retrieves the header fetch function.
- Parameters:
-
m,: The model to work with
- Returns:
- Returns the header fetch function
void ewl_model_data_header_fetch_set | ( | Ewl_Model * | m, | |
Ewl_Model_Data_Header_Fetch | get | |||
) |
Sets the fetch callback into the model.
- Parameters:
-
m,: The model to work with get,: The fetch callback to set
- Returns:
- Returns no value
Ewl_Model_Data_Highlight ewl_model_data_highlight_get | ( | const Ewl_Model * | m | ) |
Retrieves the highlight model set in m.
- Parameters:
-
m,: The model to work with
- Returns:
- Returns the highlight model set in the model
void ewl_model_data_highlight_set | ( | Ewl_Model * | m, | |
Ewl_Model_Data_Highlight | highlight | |||
) |
Sets the highlight callback into the model m.
- Parameters:
-
m,: The Ewl_Model to set the callback on highlight,: The highlight callback to set on the model
- Returns:
- Returns no value
Ewl_Model_Data_Sort ewl_model_data_sort_get | ( | const Ewl_Model * | m | ) |
Gets the sort callback from the model.
- Parameters:
-
m,: The Ewl_Model to get the sort callback from
- Returns:
- Returns the Ewl_Model_Sort set on the model or NULL if none set
void ewl_model_data_sort_set | ( | Ewl_Model * | m, | |
Ewl_Model_Data_Sort | sort | |||
) |
Sets the sort callback into the model.
- Parameters:
-
m,: The Ewl_Model to set the sort callback on sort,: The sort callback to set
- Returns:
- Returns no value.
Ewl_Model_Data_Unref ewl_model_data_unref_get | ( | const Ewl_Model * | m | ) |
Gets the unref callback from the model.
- Parameters:
-
m,: The Ewl_Model to get the unref callback from
- Returns:
- Returns the Ewl_Model_Data_Unref callback set on the model or NULL if none set.
void ewl_model_data_unref_set | ( | Ewl_Model * | m, | |
Ewl_Model_Data_Unref | unref | |||
) |
Sets the unref callback into the model.
- Parameters:
-
m,: The Ewl_Model to set the unref callback on unref,: The unref callback to set on the model
- Returns:
- Returns no value.
void ewl_model_destroy | ( | Ewl_Model * | m | ) |
Destroys the model, so its memory is returned to the system.
- Parameters:
-
m,: Model that will be destroyed
- Returns:
- Returns no value
Ewl_Model* ewl_model_ecore_list_instance | ( | void | ) |
Retrieves a model pre-initialized to work with an ecore list. This will setup the fetch and count methods for you.
- Returns:
- Returns a model that is setup to work with an ecore_list
Ewl_Model_Expansion_Data_Fetch ewl_model_expansion_data_fetch_get | ( | const Ewl_Model * | m | ) |
Gets the expansion_data callback from the model.
- Parameters:
-
m,: The Ewl_Model to get the expansion_data callback from
- Returns:
- Returns the Ewl_Model_Expansion_Data_Fetch for the model
void ewl_model_expansion_data_fetch_set | ( | Ewl_Model * | m, | |
Ewl_Model_Expansion_Data_Fetch | get | |||
) |
Sets the subfetch callback into the model.
- Parameters:
-
m,: The Ewl_Model to set the expansion_data callback into get,: The Ewl_Model_Expansion_Data_Fetch callback for subrows
- Returns:
- Returns no value.
Ewl_Model_Expansion_Model_Fetch ewl_model_expansion_model_fetch_get | ( | const Ewl_Model * | m | ) |
Retrieves the model expansion model fetch function.
- Parameters:
-
m,: The model to work with
- Returns:
- Returns the model expansion model fetch function
void ewl_model_expansion_model_fetch_set | ( | Ewl_Model * | m, | |
Ewl_Model_Expansion_Model_Fetch | f | |||
) |
Sets the model expansion model fetch callback to f.
- Parameters:
-
m,: The model to work with f,: The model expansion model fetch callback
- Returns:
- Returns no value
int ewl_model_init | ( | Ewl_Model * | model | ) |
Set the model to the default values.
- Parameters:
-
model,: The Ewl_Model to initialize
- Returns:
- Returns TRUE on success or FALSE on failure
Ewl_Model* ewl_model_new | ( | void | ) |