IUP: Iclass_ Struct Reference

IUP - Portable User Interface

Iclass_ Struct Reference
[Base Class]


Detailed Description

Base Class Structure


Data Fields

char * name
char * format
int nativetype
int childtype
int interactive
int attrib_id
Iclassparent
Itable * attrib_func
void(* Release )(Iclass *ic)
int(* Create )(Ihandle *ih, void **params)
int(* Map )(Ihandle *ih)
void(* UnMap )(Ihandle *ih)
void(* Destroy )(Ihandle *ih)
Ihandle *(* GetInnerParent )(Ihandle *parent)
void(* LayoutUpdate )(Ihandle *ih)
void(* ComputeNaturalSize )(Ihandle *ih)
void(* SetCurrentSize )(Ihandle *ih, int w, int h, int shrink)
void(* SetPosition )(Ihandle *ih, int x, int y)
int(* DlgPopup )(Ihandle *ih, int x, int y)

Field Documentation

char* Iclass_::name
 

class name. No default, must be initialized.

char* Iclass_::format
 

Creation parameters format of the class when specified.
It can have none, one or more of the following.

  • "b" = (unsigned char) - byte
  • "c" = (unsigned char*) - array of byte
  • "i" = (int) - integer
  • "j" = (int*) - array of integer
  • "f" = (float) - real
  • "s" = (char*) - string
  • "a" = (char*) - name of an action
  • "h" = (Ihandle*) - element handle
  • "g" = (Ihandle**) - array of element handle If upper case then it is optional. Default is no parameters.

int Iclass_::nativetype
 

native type enum. Default is IUP_TYPEVOID.

int Iclass_::childtype
 

children count enum: none, one, or many. Default is IUP_CHILDNONE.

int Iclass_::interactive
 

keyboard interactive boolean, true if the class can have the keyboard input focus. Default is false.

int Iclass_::attrib_id
 

boolean to indicate if any attribute is numbered. Default is false.

Iclass* Iclass_::parent
 

class parent to implement inheritance. Class name must be different. Creation parameters should be the same or repace the parents creation function. Native type should be the same. Child type should be a more restrictive or equal type (many->one->none). Attribute functions will have only one common table. All methods can be changed, set to NULL, switched, etc.

Itable* Iclass_::attrib_func
 

table of functions to handle attributes

void(* Iclass_::Release)(Iclass *ic)
 

Method that release the memory allocated by the class. Called only once at iupClassRelease.

int(* Iclass_::Create)(Ihandle *ih, void **params)
 

Method that creates the element and process the creation parameters.
Called only from IupCreate.
The parameters can be NULL for all the controls.
The control should also depend on attributes set before IupMap.
Must return IUP_NOERROR or IUP_ERROR.
Can be NULL, like all methods.

int(* Iclass_::Map)(Ihandle *ih)
 

Method that map (create) the control to the native system.
Called only from IupMap.
Must return IUP_NOERROR or IUP_ERROR.

void(* Iclass_::UnMap)(Ihandle *ih)
 

Method that unmap (destroy) the control from the native system.
Called only from IupDestroy if the control is mapped.
Must return IUP_NOERROR or IUP_ERROR.

void(* Iclass_::Destroy)(Ihandle *ih)
 

Method that destroys the element.
Called only from IupDestroy. Always called even if the control is not mapped.

Ihandle*(* Iclass_::GetInnerParent)(Ihandle *parent)
 

Returns the actual parent to add a child. The default implementation returns itself.
Called only from IupAppend and IupReparent.

void(* Iclass_::LayoutUpdate)(Ihandle *ih)
 

Method that update size and position of the native control.
Called only from iupLayoutUpdateDialog and if the element is mapped.

void(* Iclass_::ComputeNaturalSize)(Ihandle *ih)
 

Method that computes the natural size.
Should update expand and call the same method for each children.
Does not depends on the element to be mapped. First call done at iupLayoutComputeDialog for the dialog.

void(* Iclass_::SetCurrentSize)(Ihandle *ih, int w, int h, int shrink)
 

Method that calculates and updates the current size based on the given size.
shrink is the dialog attribute passed here for optimization.
Does not depends on the element to be mapped. Called only from iupLayoutComputeDialog and itself on each child.

void(* Iclass_::SetPosition)(Ihandle *ih, int x, int y)
 

Method that calculates and updates the position relative to the parent.
Does not depends on the element to be mapped. Called only from iupLayoutComputeDialog and itself on each child.

int(* Iclass_::DlgPopup)(Ihandle *ih, int x, int y)
 

Method that shows a popup dialog. Called only for native pre-defined dialogs.
The element is not mapped.
Must return IUP_ERROR or IUP_NOERROR.
Called only from iupDialogPopup.