Data Structures | Modules | Typedefs | Enumerations | Functions

Ihandle Class
[Control SDK]

Collaboration diagram for Ihandle Class:

Data Structures

struct  Iclass_

Modules

 Class Object Functions
 Base Class

Typedefs

typedef enum _InativeType InativeType
typedef enum _IchildType IchildType
typedef char *(* IattribGetFunc )(Ihandle *ih)
typedef char *(* IattribGetIdFunc )(Ihandle *ih, int id)
typedef char *(* IattribGetId2Func )(Ihandle *ih, int id1, int id2)
typedef int(* IattribSetFunc )(Ihandle *ih, const char *value)
typedef int(* IattribSetIdFunc )(Ihandle *ih, int id, const char *value)
typedef int(* IattribSetId2Func )(Ihandle *ih, int id1, int id2, const char *value)
typedef enum _IattribFlags IattribFlags

Enumerations

enum  _InativeType {
  IUP_TYPEVOID, IUP_TYPECONTROL, IUP_TYPECANVAS, IUP_TYPEDIALOG,
  IUP_TYPEIMAGE, IUP_TYPEMENU, IUP_TYPEOTHER
}
enum  _IchildType { IUP_CHILDNONE, IUP_CHILDMANY }
enum  _IattribFlags {
  IUPAF_DEFAULT = 0, IUPAF_NO_INHERIT = 1, IUPAF_NO_DEFAULTVALUE = 2, IUPAF_NO_STRING = 4,
  IUPAF_NOT_MAPPED = 8, IUPAF_HAS_ID = 16, IUPAF_READONLY = 32, IUPAF_WRITEONLY = 64,
  IUPAF_HAS_ID2 = 128, IUPAF_CALLBACK = 256, IUPAF_NO_SAVE = 512, IUPAF_NOT_SUPPORTED = 1024,
  IUPAF_IHANDLENAME = 2048, IUPAF_IHANDLE = 4096
}

Functions

IUP_SDK_API IclassiupClassNew (Iclass *ic_parent)
IUP_SDK_API void iupClassRelease (Iclass *ic)
IUP_SDK_API int iupClassMatch (Iclass *ic, const char *classname)
IUP_SDK_API void iupClassRegisterAttribute (Iclass *ic, const char *name, IattribGetFunc get, IattribSetFunc set, const char *default_value, const char *system_default, int flags)
IUP_SDK_API void iupClassRegisterAttributeId (Iclass *ic, const char *name, IattribGetIdFunc get, IattribSetIdFunc set, int flags)
IUP_SDK_API void iupClassRegisterAttributeId2 (Iclass *ic, const char *name, IattribGetId2Func get, IattribSetId2Func set, int flags)
IUP_SDK_API void iupClassRegisterGetAttribute (Iclass *ic, const char *name, IattribGetFunc *get, IattribSetFunc *set, const char **default_value, const char **system_default, int *flags)
IUP_SDK_API void iupClassRegisterReplaceAttribFunc (Iclass *ic, const char *name, IattribGetFunc _get, IattribSetFunc _set)
IUP_SDK_API void iupClassRegisterReplaceAttribDef (Iclass *ic, const char *name, const char *_default_value, const char *_system_default)
IUP_SDK_API void iupClassRegisterReplaceAttribFlags (Iclass *ic, const char *name, int _flags)
IUP_SDK_API void iupClassRegisterCallback (Iclass *ic, const char *name, const char *format)
IUP_SDK_API char * iupClassCallbackGetFormat (Iclass *ic, const char *name)

Detailed Description

See iup_class.h

Typedef Documentation

typedef enum _InativeType InativeType

Known native types.

typedef enum _IchildType IchildType

Possible number of children.

typedef char*(* IattribGetFunc)(Ihandle *ih)

GetAttribute called for a specific attribute. Used by iupClassRegisterAttribute.

typedef char*(* IattribGetIdFunc)(Ihandle *ih, int id)

GetAttribute called for a specific attribute when has_attrib_id is 1.
Same as IattribGetFunc but handle attribute names with number ids at the end.
When calling iupClassRegisterAttribute just use a typecast.
-1 is used for invalid ids.
Pure numbers are translated into IDVALUEid. Used by iupClassRegisterAttribute.

typedef char*(* IattribGetId2Func)(Ihandle *ih, int id1, int id2)

GetAttribute called for a specific attribute when has_attrib_id is 1.
Same as IattribGetFunc but handle attribute names with number ids at the end.
When calling iupClassRegisterAttribute just use a typecast.
-1 is used for invalid ids.
Pure numbers are translated into IDVALUEid. Used by iupClassRegisterAttribute.

typedef int(* IattribSetFunc)(Ihandle *ih, const char *value)

SetAttribute called for a specific attribute.
If returns 0, the attribute will not be stored in the hash table (except inheritble attributes that are always stored in the hash table).
When IupSetAttribute is called using value=NULL, the default_value is passed to this function. Used by iupClassRegisterAttribute.

typedef int(* IattribSetIdFunc)(Ihandle *ih, int id, const char *value)

SetAttribute called for a specific attribute when has_attrib_id is 1.
Same as IattribSetFunc but handle attribute names with number ids at the end.
When calling iupClassRegisterAttribute just use a typecast.
-1 is used for invalid ids.
Pure numbers are translated into IDVALUEid, ex: "1" = "IDVALUE1". Used by iupClassRegisterAttribute.

typedef int(* IattribSetId2Func)(Ihandle *ih, int id1, int id2, const char *value)

SetAttribute called for a specific attribute when has_attrib_id is 2.
Same as IattribSetFunc but handle attribute names with number ids at the end.
When calling iupClassRegisterAttribute just use a typecast.
-1 is used for invalid ids.
Pure numbers are translated into IDVALUEid, ex: "1" = "IDVALUE1". Used by iupClassRegisterAttribute.

Attribute flags. Used by iupClassRegisterAttribute.


Enumeration Type Documentation

Known native types.

Enumerator:
IUP_TYPEVOID 

No native representation - HBOX, VBOX, ZBOX, FILL, RADIO (handle==(void*)-1 always)

IUP_TYPECONTROL 

Native controls - BUTTON, LABEL, TOGGLE, LIST, TEXT, MULTILINE, FRAME, others

IUP_TYPECANVAS 

Drawing canvas, also used as a base control for custom controls.

IUP_TYPEDIALOG 

DIALOG

IUP_TYPEIMAGE 

IMAGE

IUP_TYPEMENU 

MENU, SUBMENU, ITEM, SEPARATOR

IUP_TYPEOTHER 

Other resources - TIMER, CLIPBOARD, USER, etc

Possible number of children.

Enumerator:
IUP_CHILDNONE 

can not add children using Append/Insert

IUP_CHILDMANY 

can add any number of children. /n IUP_CHILDMANY+n can add n children.

Attribute flags. Used by iupClassRegisterAttribute.

Enumerator:
IUPAF_DEFAULT 

inheritable, can has a default value, is a string, can call the set/get functions only if mapped, no ID

IUPAF_NO_INHERIT 

is not inheritable

IUPAF_NO_DEFAULTVALUE 

can not has a default value

IUPAF_NO_STRING 

is not a string

IUPAF_NOT_MAPPED 

will call the set/get functions also when not mapped

IUPAF_HAS_ID 

can has an ID at the end of the name, automatically set by iupClassRegisterAttributeId

IUPAF_READONLY 

is read-only, can not be changed

IUPAF_WRITEONLY 

is write-only, usually an action

IUPAF_HAS_ID2 

can has two IDs at the end of the name, automatically set by iupClassRegisterAttributeId2

IUPAF_CALLBACK 

is a callback, not an attribute

IUPAF_NO_SAVE 

can NOT be directly saved, should have at least manual processing

IUPAF_NOT_SUPPORTED 

not supported in that driver

IUPAF_IHANDLENAME 

is an Ihandle* name, associated with IupSetHandle

IUPAF_IHANDLE 

is an Ihandle*


Function Documentation

IUP_SDK_API Iclass* iupClassNew ( Iclass ic_parent  ) 

Allocates memory for the Iclass structure and initializes the attribute handling functions table.
If parent is specified then a new instance of the parent class is created and set as the actual parent class.

IUP_SDK_API void iupClassRelease ( Iclass ic  ) 

Release the memory allocated by the class. Calls the Iclass::Release method.
Called from iupRegisterFinish.

IUP_SDK_API int iupClassMatch ( Iclass ic,
const char *  classname 
)

Check if the class name match the given name.
Parent classes are also checked.

IUP_SDK_API void iupClassRegisterAttribute ( Iclass ic,
const char *  name,
IattribGetFunc  get,
IattribSetFunc  set,
const char *  default_value,
const char *  system_default,
int  flags 
)

Register attribute handling functions, defaults and flags. get, set and default_value can be NULL. default_value should point to a constant string, it will not be duplicated internally.
Notice that when an attribute is not defined then default_value=NULL, is inheritable can has a default value and is a string.
Since there is only one attribute function table per class tree, if you register the same attribute in a child class, then it will replace the parent registration.
If an attribute is not inheritable or not a string then it MUST be registered. Internal attributes (starting with "_IUP") can never be registered.

IUP_SDK_API void iupClassRegisterAttributeId ( Iclass ic,
const char *  name,
IattribGetIdFunc  get,
IattribSetIdFunc  set,
int  flags 
)

Same as iupClassRegisterAttribute for attributes with Ids.

IUP_SDK_API void iupClassRegisterAttributeId2 ( Iclass ic,
const char *  name,
IattribGetId2Func  get,
IattribSetId2Func  set,
int  flags 
)

Same as iupClassRegisterAttribute for attributes with two Ids.

IUP_SDK_API void iupClassRegisterGetAttribute ( Iclass ic,
const char *  name,
IattribGetFunc get,
IattribSetFunc set,
const char **  default_value,
const char **  system_default,
int *  flags 
)

Returns the attribute handling functions, defaults and flags.

IUP_SDK_API void iupClassRegisterReplaceAttribFunc ( Iclass ic,
const char *  name,
IattribGetFunc  _get,
IattribSetFunc  _set 
)

Replaces the attribute handling functions of an already registered attribute.

IUP_SDK_API void iupClassRegisterReplaceAttribDef ( Iclass ic,
const char *  name,
const char *  _default_value,
const char *  _system_default 
)

Replaces the attribute handling default of an already registered attribute.

IUP_SDK_API void iupClassRegisterReplaceAttribFlags ( Iclass ic,
const char *  name,
int  _flags 
)

Replaces the attribute handling functions of an already registered attribute.

IUP_SDK_API void iupClassRegisterCallback ( Iclass ic,
const char *  name,
const char *  format 
)

Register the parameters of a callback.
Format follows the iupcbs::h header definitions.
Notice that these definitions are similar to the class registration but have several differences and conflicts, for backward compatibility reasons.
It can have none, one or more of the following.

  • "c" = (unsigned char) - byte
  • "i" = (int) - integer
  • "I" = (int*) - array of integers or pointer to integer
  • "f" = (float) - real
  • "d" = (double) - real
  • "s" = (char*) - string
  • "V" = (void*) - generic pointer
  • "C" = (struct _cdCanvas*) - cdCanvas* structure, used along with the CD library
  • "n" = (Ihandle*) - element handle The default return value for all callbacks is "i" (int), but a different return value can be specified using one of the above parameters, after all parameters using "=" to separate it from them.
IUP_SDK_API char* iupClassCallbackGetFormat ( Iclass ic,
const char *  name 
)

Returns the format of the parameters of a registered callback. If NULL then the default callback definition is assumed.