summaryrefslogtreecommitdiff
path: root/iup/src/iup_register.c
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-11-04 11:56:41 -0800
committerPixel <pixel@nobis-crew.org>2009-11-04 11:59:33 -0800
commitd577d991b97ae2b5ee1af23641bcffc3f83af5b2 (patch)
tree590639d50205d1bcfaff2a7d2dc6ebf3f373c7ed /iup/src/iup_register.c
Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux.
Diffstat (limited to 'iup/src/iup_register.c')
-rwxr-xr-xiup/src/iup_register.c123
1 files changed, 123 insertions, 0 deletions
diff --git a/iup/src/iup_register.c b/iup/src/iup_register.c
new file mode 100755
index 0000000..4c58038
--- /dev/null
+++ b/iup/src/iup_register.c
@@ -0,0 +1,123 @@
+/** \file
+* \brief Register the Internal Controls
+*
+* See Copyright Notice in "iup.h"
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <memory.h>
+#include <stdarg.h>
+
+#include "iup.h"
+
+#include "iup_object.h"
+#include "iup_register.h"
+#include "iup_stdcontrols.h"
+
+
+static Itable *iregister_table = NULL; /* table indexed by name containing Iclass* address */
+
+void iupRegisterInit(void)
+{
+ iregister_table = iupTableCreate(IUPTABLE_STRINGINDEXED);
+}
+
+void iupRegisterFinish(void)
+{
+ char* name = iupTableFirst(iregister_table);
+ while (name)
+ {
+ Iclass* ic = (Iclass*)iupTableGetCurr(iregister_table);
+ iupClassRelease(ic);
+ name = iupTableNext(iregister_table);
+ }
+
+ iupTableDestroy(iregister_table);
+ iregister_table = NULL;
+}
+
+int iupRegisterGetClasses(char *list[], int n)
+{
+ int i = 0;
+ char* name = iupTableFirst(iregister_table);
+
+ if (!list || !n)
+ return iupTableCount(iregister_table);
+
+ while (name)
+ {
+ list[i] = name;
+ i++;
+ if (i == n)
+ break;
+
+ name = iupTableNext(iregister_table);
+ }
+
+ return i;
+}
+
+Iclass* iupRegisterFindClass(const char* name)
+{
+ return (Iclass*)iupTableGet(iregister_table, name);
+}
+
+void iupRegisterClass(Iclass* ic)
+{
+ Iclass* old_ic = (Iclass*)iupTableGet(iregister_table, ic->name);
+ if (old_ic)
+ iupClassRelease(old_ic);
+
+ iupTableSet(iregister_table, ic->name, (void*)ic, IUPTABLE_POINTER);
+}
+
+
+/***************************************************************/
+
+void iupRegisterInternalClasses(void)
+{
+ iupRegisterClass(iupDialogGetClass());
+ iupRegisterClass(iupMessageDlgGetClass());
+ iupRegisterClass(iupColorDlgGetClass());
+ iupRegisterClass(iupFontDlgGetClass());
+ iupRegisterClass(iupFileDlgGetClass());
+
+ iupRegisterClass(iupTimerGetClass());
+ iupRegisterClass(iupImageGetClass());
+ iupRegisterClass(iupImageRGBGetClass());
+ iupRegisterClass(iupImageRGBAGetClass());
+ iupRegisterClass(iupUserGetClass());
+ iupRegisterClass(iupClipboardGetClass());
+
+ iupRegisterClass(iupRadioGetClass());
+ iupRegisterClass(iupFillGetClass());
+ iupRegisterClass(iupHboxGetClass());
+ iupRegisterClass(iupVboxGetClass());
+ iupRegisterClass(iupZboxGetClass());
+ iupRegisterClass(iupCboxGetClass());
+ iupRegisterClass(iupSboxGetClass());
+ iupRegisterClass(iupNormalizerGetClass());
+
+ iupRegisterClass(iupMenuGetClass());
+ iupRegisterClass(iupItemGetClass());
+ iupRegisterClass(iupSeparatorGetClass());
+ iupRegisterClass(iupSubmenuGetClass());
+
+ iupRegisterClass(iupLabelGetClass());
+ iupRegisterClass(iupButtonGetClass());
+ iupRegisterClass(iupToggleGetClass());
+ iupRegisterClass(iupCanvasGetClass());
+ iupRegisterClass(iupFrameGetClass());
+ iupRegisterClass(iupTextGetClass());
+ iupRegisterClass(iupMultilineGetClass());
+ iupRegisterClass(iupListGetClass());
+
+ iupRegisterClass(iupProgressBarGetClass());
+ iupRegisterClass(iupValGetClass());
+ iupRegisterClass(iupTabsGetClass());
+ iupRegisterClass(iupSpinGetClass());
+ iupRegisterClass(iupSpinboxGetClass());
+ iupRegisterClass(iupTreeGetClass());
+}