├── Makefile ├── README.md ├── include ├── iup │ ├── iup.h │ ├── iup_class_cbs.hpp │ ├── iup_config.h │ ├── iup_mglplot.h │ ├── iup_plot.h │ ├── iup_plus.h │ ├── iup_scintilla.h │ ├── iup_varg.h │ ├── iupcbs.h │ ├── iupcontrols.h │ ├── iupdef.h │ ├── iupdraw.h │ ├── iupdraw_cd.h │ ├── iupgl.h │ ├── iupglcontrols.h │ ├── iupim.h │ ├── iupkey.h │ ├── iuplua.h │ ├── iuplua_mglplot.h │ ├── iuplua_plot.h │ ├── iuplua_scintilla.h │ ├── iupluacontrols.h │ ├── iupluagl.h │ ├── iupluaglcontrols.h │ ├── iupluaim.h │ ├── iupluaole.h │ ├── iupluascripterdlg.h │ ├── iupluatuio.h │ ├── iupluaweb.h │ ├── iupole.h │ ├── iuptuio.h │ └── iupweb.h ├── libusb.h ├── stlink.h └── stlink │ ├── backend.h │ ├── chipid.h │ ├── commands.h │ ├── flash_loader.h │ ├── logging.h │ ├── mmap.h │ ├── reg.h │ ├── sg.h │ ├── usb.h │ ├── version.h │ └── version.h.in ├── lib ├── linux_64 │ ├── libiup.a │ ├── libstlink.a │ └── libusb-1.0.a └── win_32 │ ├── libiup.a │ ├── libstlink.a │ └── libusb-1.0.a └── rtt_stlink.c /Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(OS),Windows_NT) 2 | TARGET = rtt_stlink.exe 3 | CC = i686-w64-mingw32-gcc 4 | LINKER = i686-w64-mingw32-g++ 5 | RM=del 6 | INC_IUP = ./include/iup 7 | LD_LIB = ./lib/win_32 8 | else 9 | TARGET = rtt_stlink 10 | CC = gcc 11 | LINKER = g++ 12 | RM=rm 13 | LBITS := $(shell getconf LONG_BIT) 14 | ifeq ($(LBITS),64) 15 | INC_IUP = ./include/iup 16 | LD_LIB = ./lib/linux_64 17 | else 18 | INC_IUP = ./include/iup 19 | LD_LIB = ./lib/linux_86 20 | endif 21 | endif 22 | C_FLAG = -I. -I./include -I$(INC_IUP) -c -std=c99 23 | L_FLAG = $(LD_LIB)/libiup.a $(LD_LIB)/libstlink.a $(LD_LIB)/libusb-1.0.a 24 | ifeq ($(OS),Windows_NT) 25 | L_FLAG += -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lsetupapi -mwindows -static 26 | else 27 | ifeq ($(LBITS),64) 28 | L_FLAG += $(shell pkg-config --libs gtk+-3.0 gdk-3.0) 29 | else 30 | L_FLAG += $(shell pkg-config --libs gtk+-2.0 gdk-2.0) 31 | endif 32 | L_FLAG += -lX11 -lpthread -ludev 33 | endif 34 | 35 | $(TARGET):rtt_stlink.o 36 | $(LINKER) $^ $(L_FLAG) -o $(TARGET) 37 | 38 | rtt_stlink.o:rtt_stlink.c 39 | $(CC) $^ $(C_FLAG) 40 | 41 | clean: 42 | $(RM) -f *.o 43 | $(RM) -f $(TARGET) 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rtt_stlink 2 | Simple SEGGER RTT client for ST-Link 3 | -------------------------------------------------------------------------------- /include/iup/iup.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief User API 3 | * IUP - A Portable User Interface Toolkit 4 | * Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil 5 | * http://www.tecgraf.puc-rio.br/iup mailto:iup@tecgraf.puc-rio.br 6 | * 7 | * See Copyright Notice at the end of this file 8 | */ 9 | 10 | #ifndef __IUP_H 11 | #define __IUP_H 12 | 13 | #include "iupkey.h" 14 | #include "iupdef.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | #define IUP_NAME "IUP - Portable User Interface" 22 | #define IUP_DESCRIPTION "Multi-platform Toolkit for Building Graphical User Interfaces" 23 | #define IUP_COPYRIGHT "Copyright (C) 1994-2018 Tecgraf/PUC-Rio" 24 | #define IUP_VERSION "3.25" /* bug fixes are reported only by IupVersion functions */ 25 | #define IUP_VERSION_NUMBER 325000 26 | #define IUP_VERSION_DATE "2018/05/28" /* does not include bug fix releases */ 27 | 28 | typedef struct Ihandle_ Ihandle; 29 | typedef int (*Icallback)(Ihandle*); 30 | 31 | /************************************************************************/ 32 | /* Main API */ 33 | /************************************************************************/ 34 | 35 | int IupOpen (int *argc, char ***argv); 36 | void IupClose (void); 37 | void IupImageLibOpen (void); 38 | 39 | int IupMainLoop (void); 40 | int IupLoopStep (void); 41 | int IupLoopStepWait (void); 42 | int IupMainLoopLevel (void); 43 | void IupFlush (void); 44 | void IupExitLoop (void); 45 | 46 | int IupRecordInput(const char* filename, int mode); 47 | int IupPlayInput(const char* filename); 48 | 49 | void IupUpdate (Ihandle* ih); 50 | void IupUpdateChildren(Ihandle* ih); 51 | void IupRedraw (Ihandle* ih, int children); 52 | void IupRefresh (Ihandle* ih); 53 | void IupRefreshChildren(Ihandle* ih); 54 | 55 | int IupExecute(const char *filename, const char* parameters); 56 | int IupExecuteWait(const char *filename, const char* parameters); 57 | int IupHelp(const char* url); 58 | void IupLog(const char* type, const char* format, ...); 59 | 60 | char* IupLoad (const char *filename); 61 | char* IupLoadBuffer (const char *buffer); 62 | 63 | char* IupVersion (void); 64 | char* IupVersionDate (void); 65 | int IupVersionNumber (void); 66 | 67 | void IupSetLanguage (const char *lng); 68 | char* IupGetLanguage (void); 69 | void IupSetLanguageString(const char* name, const char* str); 70 | void IupStoreLanguageString(const char* name, const char* str); 71 | char* IupGetLanguageString(const char* name); 72 | void IupSetLanguagePack(Ihandle* ih); 73 | 74 | void IupDestroy (Ihandle* ih); 75 | void IupDetach (Ihandle* child); 76 | Ihandle* IupAppend (Ihandle* ih, Ihandle* child); 77 | Ihandle* IupInsert (Ihandle* ih, Ihandle* ref_child, Ihandle* child); 78 | Ihandle* IupGetChild (Ihandle* ih, int pos); 79 | int IupGetChildPos (Ihandle* ih, Ihandle* child); 80 | int IupGetChildCount(Ihandle* ih); 81 | Ihandle* IupGetNextChild (Ihandle* ih, Ihandle* child); 82 | Ihandle* IupGetBrother (Ihandle* ih); 83 | Ihandle* IupGetParent (Ihandle* ih); 84 | Ihandle* IupGetDialog (Ihandle* ih); 85 | Ihandle* IupGetDialogChild(Ihandle* ih, const char* name); 86 | int IupReparent (Ihandle* ih, Ihandle* new_parent, Ihandle* ref_child); 87 | 88 | int IupPopup (Ihandle* ih, int x, int y); 89 | int IupShow (Ihandle* ih); 90 | int IupShowXY (Ihandle* ih, int x, int y); 91 | int IupHide (Ihandle* ih); 92 | int IupMap (Ihandle* ih); 93 | void IupUnmap (Ihandle* ih); 94 | 95 | void IupResetAttribute(Ihandle* ih, const char* name); 96 | int IupGetAllAttributes(Ihandle* ih, char** names, int n); 97 | Ihandle* IupSetAtt(const char* handle_name, Ihandle* ih, const char* name, ...); 98 | Ihandle* IupSetAttributes (Ihandle* ih, const char *str); 99 | char* IupGetAttributes (Ihandle* ih); 100 | 101 | void IupSetAttribute (Ihandle* ih, const char* name, const char* value); 102 | void IupSetStrAttribute(Ihandle* ih, const char* name, const char* value); 103 | void IupSetStrf (Ihandle* ih, const char* name, const char* format, ...); 104 | void IupSetInt (Ihandle* ih, const char* name, int value); 105 | void IupSetFloat (Ihandle* ih, const char* name, float value); 106 | void IupSetDouble (Ihandle* ih, const char* name, double value); 107 | void IupSetRGB (Ihandle* ih, const char* name, unsigned char r, unsigned char g, unsigned char b); 108 | 109 | char* IupGetAttribute(Ihandle* ih, const char* name); 110 | int IupGetInt (Ihandle* ih, const char* name); 111 | int IupGetInt2 (Ihandle* ih, const char* name); 112 | int IupGetIntInt (Ihandle* ih, const char* name, int *i1, int *i2); 113 | float IupGetFloat (Ihandle* ih, const char* name); 114 | double IupGetDouble(Ihandle* ih, const char* name); 115 | void IupGetRGB (Ihandle* ih, const char* name, unsigned char *r, unsigned char *g, unsigned char *b); 116 | 117 | void IupSetAttributeId(Ihandle* ih, const char* name, int id, const char *value); 118 | void IupSetStrAttributeId(Ihandle* ih, const char* name, int id, const char *value); 119 | void IupSetStrfId(Ihandle* ih, const char* name, int id, const char* format, ...); 120 | void IupSetIntId(Ihandle* ih, const char* name, int id, int value); 121 | void IupSetFloatId(Ihandle* ih, const char* name, int id, float value); 122 | void IupSetDoubleId(Ihandle* ih, const char* name, int id, double value); 123 | void IupSetRGBId(Ihandle* ih, const char* name, int id, unsigned char r, unsigned char g, unsigned char b); 124 | 125 | char* IupGetAttributeId(Ihandle* ih, const char* name, int id); 126 | int IupGetIntId(Ihandle* ih, const char* name, int id); 127 | float IupGetFloatId(Ihandle* ih, const char* name, int id); 128 | double IupGetDoubleId(Ihandle* ih, const char* name, int id); 129 | void IupGetRGBId(Ihandle* ih, const char* name, int id, unsigned char *r, unsigned char *g, unsigned char *b); 130 | 131 | void IupSetAttributeId2(Ihandle* ih, const char* name, int lin, int col, const char* value); 132 | void IupSetStrAttributeId2(Ihandle* ih, const char* name, int lin, int col, const char* value); 133 | void IupSetStrfId2(Ihandle* ih, const char* name, int lin, int col, const char* format, ...); 134 | void IupSetIntId2(Ihandle* ih, const char* name, int lin, int col, int value); 135 | void IupSetFloatId2(Ihandle* ih, const char* name, int lin, int col, float value); 136 | void IupSetDoubleId2(Ihandle* ih, const char* name, int lin, int col, double value); 137 | void IupSetRGBId2(Ihandle* ih, const char* name, int lin, int col, unsigned char r, unsigned char g, unsigned char b); 138 | 139 | char* IupGetAttributeId2(Ihandle* ih, const char* name, int lin, int col); 140 | int IupGetIntId2(Ihandle* ih, const char* name, int lin, int col); 141 | float IupGetFloatId2(Ihandle* ih, const char* name, int lin, int col); 142 | double IupGetDoubleId2(Ihandle* ih, const char* name, int lin, int col); 143 | void IupGetRGBId2(Ihandle* ih, const char* name, int lin, int col, unsigned char *r, unsigned char *g, unsigned char *b); 144 | 145 | void IupSetGlobal (const char* name, const char* value); 146 | void IupSetStrGlobal(const char* name, const char* value); 147 | char* IupGetGlobal (const char* name); 148 | 149 | Ihandle* IupSetFocus (Ihandle* ih); 150 | Ihandle* IupGetFocus (void); 151 | Ihandle* IupPreviousField(Ihandle* ih); 152 | Ihandle* IupNextField (Ihandle* ih); 153 | 154 | Icallback IupGetCallback (Ihandle* ih, const char *name); 155 | Icallback IupSetCallback (Ihandle* ih, const char *name, Icallback func); 156 | Ihandle* IupSetCallbacks(Ihandle* ih, const char *name, Icallback func, ...); 157 | 158 | Icallback IupGetFunction(const char *name); 159 | Icallback IupSetFunction(const char *name, Icallback func); 160 | 161 | Ihandle* IupGetHandle (const char *name); 162 | Ihandle* IupSetHandle (const char *name, Ihandle* ih); 163 | int IupGetAllNames (char** names, int n); 164 | int IupGetAllDialogs(char** names, int n); 165 | char* IupGetName (Ihandle* ih); 166 | 167 | void IupSetAttributeHandle(Ihandle* ih, const char* name, Ihandle* ih_named); 168 | Ihandle* IupGetAttributeHandle(Ihandle* ih, const char* name); 169 | void IupSetAttributeHandleId(Ihandle* ih, const char* name, int id, Ihandle* ih_named); 170 | Ihandle* IupGetAttributeHandleId(Ihandle* ih, const char* name, int id); 171 | void IupSetAttributeHandleId2(Ihandle* ih, const char* name, int lin, int col, Ihandle* ih_named); 172 | Ihandle* IupGetAttributeHandleId2(Ihandle* ih, const char* name, int lin, int col); 173 | 174 | char* IupGetClassName(Ihandle* ih); 175 | char* IupGetClassType(Ihandle* ih); 176 | int IupGetAllClasses(char** names, int n); 177 | int IupGetClassAttributes(const char* classname, char** names, int n); 178 | int IupGetClassCallbacks(const char* classname, char** names, int n); 179 | void IupSaveClassAttributes(Ihandle* ih); 180 | void IupCopyClassAttributes(Ihandle* src_ih, Ihandle* dst_ih); 181 | void IupSetClassDefaultAttribute(const char* classname, const char *name, const char* value); 182 | int IupClassMatch(Ihandle* ih, const char* classname); 183 | 184 | Ihandle* IupCreate (const char *classname); 185 | Ihandle* IupCreatev(const char *classname, void* *params); 186 | Ihandle* IupCreatep(const char *classname, void* first, ...); 187 | 188 | /************************************************************************/ 189 | /* Elements */ 190 | /************************************************************************/ 191 | 192 | Ihandle* IupFill (void); 193 | Ihandle* IupSpace(void); 194 | 195 | Ihandle* IupRadio (Ihandle* child); 196 | Ihandle* IupVbox (Ihandle* child, ...); 197 | Ihandle* IupVboxv (Ihandle* *children); 198 | Ihandle* IupZbox (Ihandle* child, ...); 199 | Ihandle* IupZboxv (Ihandle* *children); 200 | Ihandle* IupHbox (Ihandle* child, ...); 201 | Ihandle* IupHboxv (Ihandle* *children); 202 | 203 | Ihandle* IupNormalizer (Ihandle* ih_first, ...); 204 | Ihandle* IupNormalizerv(Ihandle* *ih_list); 205 | 206 | Ihandle* IupCbox (Ihandle* child, ...); 207 | Ihandle* IupCboxv (Ihandle* *children); 208 | Ihandle* IupSbox (Ihandle* child); 209 | Ihandle* IupSplit (Ihandle* child1, Ihandle* child2); 210 | Ihandle* IupScrollBox (Ihandle* child); 211 | Ihandle* IupFlatScrollBox(Ihandle* child); 212 | Ihandle* IupGridBox (Ihandle* child, ...); 213 | Ihandle* IupGridBoxv (Ihandle* *children); 214 | Ihandle* IupExpander (Ihandle* child); 215 | Ihandle* IupDetachBox (Ihandle* child); 216 | Ihandle* IupBackgroundBox(Ihandle* child); 217 | 218 | Ihandle* IupFrame (Ihandle* child); 219 | Ihandle* IupFlatFrame (Ihandle* child); 220 | 221 | Ihandle* IupImage (int width, int height, const unsigned char *pixmap); 222 | Ihandle* IupImageRGB (int width, int height, const unsigned char *pixmap); 223 | Ihandle* IupImageRGBA (int width, int height, const unsigned char *pixmap); 224 | 225 | Ihandle* IupItem (const char* title, const char* action); 226 | Ihandle* IupSubmenu (const char* title, Ihandle* child); 227 | Ihandle* IupSeparator (void); 228 | Ihandle* IupMenu (Ihandle* child, ...); 229 | Ihandle* IupMenuv (Ihandle* *children); 230 | 231 | Ihandle* IupButton (const char* title, const char* action); 232 | Ihandle* IupFlatButton (const char* title); 233 | Ihandle* IupFlatToggle (const char* title); 234 | Ihandle* IupDropButton (Ihandle* dropchild); 235 | Ihandle* IupFlatLabel (const char* title); 236 | Ihandle* IupFlatSeparator(void); 237 | Ihandle* IupCanvas(const char* action); 238 | Ihandle* IupDialog (Ihandle* child); 239 | Ihandle* IupUser (void); 240 | Ihandle* IupLabel (const char* title); 241 | Ihandle* IupList (const char* action); 242 | Ihandle* IupText (const char* action); 243 | Ihandle* IupMultiLine (const char* action); 244 | Ihandle* IupToggle (const char* title, const char* action); 245 | Ihandle* IupTimer (void); 246 | Ihandle* IupClipboard (void); 247 | Ihandle* IupProgressBar(void); 248 | Ihandle* IupVal (const char *type); 249 | Ihandle* IupTabs (Ihandle* child, ...); 250 | Ihandle* IupTabsv (Ihandle* *children); 251 | Ihandle* IupFlatTabs (Ihandle* first, ...); 252 | Ihandle* IupFlatTabsv (Ihandle* *children); 253 | Ihandle* IupTree (void); 254 | Ihandle* IupLink (const char* url, const char* title); 255 | Ihandle* IupAnimatedLabel(Ihandle* animation); 256 | Ihandle* IupDatePick (void); 257 | Ihandle* IupCalendar (void); 258 | Ihandle* IupColorbar (void); 259 | Ihandle* IupGauge (void); 260 | Ihandle* IupDial (const char* type); 261 | Ihandle* IupColorBrowser(void); 262 | 263 | /* Old controls, use SPIN attribute of IupText */ 264 | Ihandle* IupSpin (void); 265 | Ihandle* IupSpinbox (Ihandle* child); 266 | 267 | 268 | /************************************************************************/ 269 | /* Utilities */ 270 | /************************************************************************/ 271 | 272 | /* String compare utility */ 273 | int IupStringCompare(const char* str1, const char* str2, int casesensitive, int lexicographic); 274 | 275 | /* IupImage utility */ 276 | int IupSaveImageAsText(Ihandle* ih, const char* file_name, const char* format, const char* name); 277 | 278 | /* IupText and IupScintilla utilities */ 279 | void IupTextConvertLinColToPos(Ihandle* ih, int lin, int col, int *pos); 280 | void IupTextConvertPosToLinCol(Ihandle* ih, int pos, int *lin, int *col); 281 | 282 | /* IupText, IupList, IupTree, IupMatrix and IupScintilla utility */ 283 | int IupConvertXYToPos(Ihandle* ih, int x, int y); 284 | 285 | /* OLD names, kept for backward compatibility, will never be removed. */ 286 | void IupStoreGlobal(const char* name, const char* value); 287 | void IupStoreAttribute(Ihandle* ih, const char* name, const char* value); 288 | void IupSetfAttribute(Ihandle* ih, const char* name, const char* format, ...); 289 | void IupStoreAttributeId(Ihandle* ih, const char* name, int id, const char *value); 290 | void IupSetfAttributeId(Ihandle* ih, const char* name, int id, const char* f, ...); 291 | void IupStoreAttributeId2(Ihandle* ih, const char* name, int lin, int col, const char* value); 292 | void IupSetfAttributeId2(Ihandle* ih, const char* name, int lin, int col, const char* format, ...); 293 | 294 | /* IupTree utilities */ 295 | int IupTreeSetUserId(Ihandle* ih, int id, void* userid); 296 | void* IupTreeGetUserId(Ihandle* ih, int id); 297 | int IupTreeGetId(Ihandle* ih, void *userid); 298 | void IupTreeSetAttributeHandle(Ihandle* ih, const char* name, int id, Ihandle* ih_named); /* deprecated, use IupSetAttributeHandleId */ 299 | 300 | 301 | /************************************************************************/ 302 | /* Pre-defined dialogs */ 303 | /************************************************************************/ 304 | 305 | Ihandle* IupFileDlg(void); 306 | Ihandle* IupMessageDlg(void); 307 | Ihandle* IupColorDlg(void); 308 | Ihandle* IupFontDlg(void); 309 | Ihandle* IupProgressDlg(void); 310 | 311 | int IupGetFile(char *arq); 312 | void IupMessage(const char *title, const char *msg); 313 | void IupMessagef(const char *title, const char *format, ...); 314 | void IupMessageError(Ihandle* parent, const char* message); 315 | int IupMessageAlarm(Ihandle* parent, const char* title, const char *message, const char *buttons); 316 | int IupAlarm(const char *title, const char *msg, const char *b1, const char *b2, const char *b3); 317 | int IupScanf(const char *format, ...); 318 | int IupListDialog(int type, const char *title, int size, const char** list, 319 | int op, int max_col, int max_lin, int* marks); 320 | int IupGetText(const char* title, char* text, int maxsize); 321 | int IupGetColor(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b); 322 | 323 | typedef int (*Iparamcb)(Ihandle* dialog, int param_index, void* user_data); 324 | int IupGetParam(const char* title, Iparamcb action, void* user_data, const char* format, ...); 325 | int IupGetParamv(const char* title, Iparamcb action, void* user_data, const char* format, int param_count, int param_extra, void** param_data); 326 | Ihandle* IupParam(const char* format); 327 | Ihandle* IupParamBox(Ihandle* param, ...); 328 | Ihandle* IupParamBoxv(Ihandle* *param_array); 329 | 330 | Ihandle* IupLayoutDialog(Ihandle* dialog); 331 | Ihandle* IupElementPropertiesDialog(Ihandle* elem); 332 | 333 | 334 | #ifdef __cplusplus 335 | } 336 | #endif 337 | 338 | /************************************************************************/ 339 | /* Common Flags and Return Values */ 340 | /************************************************************************/ 341 | #define IUP_ERROR 1 342 | #define IUP_NOERROR 0 343 | #define IUP_OPENED -1 344 | #define IUP_INVALID -1 345 | #define IUP_INVALID_ID -10 346 | 347 | 348 | /************************************************************************/ 349 | /* Callback Return Values */ 350 | /************************************************************************/ 351 | #define IUP_IGNORE -1 352 | #define IUP_DEFAULT -2 353 | #define IUP_CLOSE -3 354 | #define IUP_CONTINUE -4 355 | 356 | /************************************************************************/ 357 | /* IupPopup and IupShowXY Parameter Values */ 358 | /************************************************************************/ 359 | #define IUP_CENTER 0xFFFF /* 65535 */ 360 | #define IUP_LEFT 0xFFFE /* 65534 */ 361 | #define IUP_RIGHT 0xFFFD /* 65533 */ 362 | #define IUP_MOUSEPOS 0xFFFC /* 65532 */ 363 | #define IUP_CURRENT 0xFFFB /* 65531 */ 364 | #define IUP_CENTERPARENT 0xFFFA /* 65530 */ 365 | #define IUP_TOP IUP_LEFT 366 | #define IUP_BOTTOM IUP_RIGHT 367 | 368 | /************************************************************************/ 369 | /* SHOW_CB Callback Values */ 370 | /************************************************************************/ 371 | enum{IUP_SHOW, IUP_RESTORE, IUP_MINIMIZE, IUP_MAXIMIZE, IUP_HIDE}; 372 | 373 | /************************************************************************/ 374 | /* SCROLL_CB Callback Values */ 375 | /************************************************************************/ 376 | enum{IUP_SBUP, IUP_SBDN, IUP_SBPGUP, IUP_SBPGDN, IUP_SBPOSV, IUP_SBDRAGV, 377 | IUP_SBLEFT, IUP_SBRIGHT, IUP_SBPGLEFT, IUP_SBPGRIGHT, IUP_SBPOSH, IUP_SBDRAGH}; 378 | 379 | /************************************************************************/ 380 | /* Mouse Button Values and Macros */ 381 | /************************************************************************/ 382 | #define IUP_BUTTON1 '1' 383 | #define IUP_BUTTON2 '2' 384 | #define IUP_BUTTON3 '3' 385 | #define IUP_BUTTON4 '4' 386 | #define IUP_BUTTON5 '5' 387 | 388 | #define iup_isshift(_s) (_s[0]=='S') 389 | #define iup_iscontrol(_s) (_s[1]=='C') 390 | #define iup_isbutton1(_s) (_s[2]=='1') 391 | #define iup_isbutton2(_s) (_s[3]=='2') 392 | #define iup_isbutton3(_s) (_s[4]=='3') 393 | #define iup_isdouble(_s) (_s[5]=='D') 394 | #define iup_isalt(_s) (_s[6]=='A') 395 | #define iup_issys(_s) (_s[7]=='Y') 396 | #define iup_isbutton4(_s) (_s[8]=='4') 397 | #define iup_isbutton5(_s) (_s[9]=='5') 398 | 399 | /* Old definitions for backward compatibility */ 400 | #define isshift iup_isshift 401 | #define iscontrol iup_iscontrol 402 | #define isbutton1 iup_isbutton1 403 | #define isbutton2 iup_isbutton2 404 | #define isbutton3 iup_isbutton3 405 | #define isdouble iup_isdouble 406 | #define isalt iup_isalt 407 | #define issys iup_issys 408 | #define isbutton4 iup_isbutton4 409 | #define isbutton5 iup_isbutton5 410 | 411 | 412 | /************************************************************************/ 413 | /* Pre-Defined Masks */ 414 | /************************************************************************/ 415 | #define IUP_MASK_FLOAT "[+/-]?(/d+/.?/d*|/./d+)" 416 | #define IUP_MASK_UFLOAT "(/d+/.?/d*|/./d+)" 417 | #define IUP_MASK_EFLOAT "[+/-]?(/d+/.?/d*|/./d+)([eE][+/-]?/d+)?" 418 | #define IUP_MASK_UEFLOAT "(/d+/.?/d*|/./d+)([eE][+/-]?/d+)?" 419 | #define IUP_MASK_FLOATCOMMA "[+/-]?(/d+/,?/d*|/,/d+)" 420 | #define IUP_MASK_UFLOATCOMMA "(/d+/,?/d*|/,/d+)" 421 | #define IUP_MASK_INT "[+/-]?/d+" 422 | #define IUP_MASK_UINT "/d+" 423 | 424 | /* Old definitions for backward compatibility */ 425 | #define IUPMASK_FLOAT IUP_MASK_FLOAT 426 | #define IUPMASK_UFLOAT IUP_MASK_UFLOAT 427 | #define IUPMASK_EFLOAT IUP_MASK_EFLOAT 428 | #define IUPMASK_INT IUP_MASK_INT 429 | #define IUPMASK_UINT IUP_MASK_UINT 430 | 431 | 432 | /************************************************************************/ 433 | /* IupGetParam Callback situations */ 434 | /************************************************************************/ 435 | #define IUP_GETPARAM_BUTTON1 -1 436 | #define IUP_GETPARAM_INIT -2 437 | #define IUP_GETPARAM_BUTTON2 -3 438 | #define IUP_GETPARAM_BUTTON3 -4 439 | #define IUP_GETPARAM_CLOSE -5 440 | #define IUP_GETPARAM_MAP -6 441 | #define IUP_GETPARAM_OK IUP_GETPARAM_BUTTON1 442 | #define IUP_GETPARAM_CANCEL IUP_GETPARAM_BUTTON2 443 | #define IUP_GETPARAM_HELP IUP_GETPARAM_BUTTON3 444 | 445 | /************************************************************************/ 446 | /* Used by IupColorbar */ 447 | /************************************************************************/ 448 | #define IUP_PRIMARY -1 449 | #define IUP_SECONDARY -2 450 | 451 | /************************************************************************/ 452 | /* Record Input Modes */ 453 | /************************************************************************/ 454 | enum {IUP_RECBINARY, IUP_RECTEXT}; 455 | 456 | 457 | /************************************************************************/ 458 | /* Replacement for the WinMain in Windows, */ 459 | /* this allows the application to start from "main". */ 460 | /* Used only for Watcom. */ 461 | /************************************************************************/ 462 | #if defined (__WATCOMC__) 463 | #ifdef __cplusplus 464 | extern "C" { 465 | int IupMain (int argc, char** argv); /* In C++ we have to declare the prototype */ 466 | } 467 | #endif 468 | #define main IupMain /* this is the trick for Watcom and MetroWerks */ 469 | #endif 470 | 471 | /****************************************************************************** 472 | * Copyright (C) 1994-2018 Tecgraf/PUC-Rio. 473 | * 474 | * Permission is hereby granted, free of charge, to any person obtaining 475 | * a copy of this software and associated documentation files (the 476 | * "Software"), to deal in the Software without restriction, including 477 | * without limitation the rights to use, copy, modify, merge, publish, 478 | * distribute, sublicense, and/or sell copies of the Software, and to 479 | * permit persons to whom the Software is furnished to do so, subject to 480 | * the following conditions: 481 | * 482 | * The above copyright notice and this permission notice shall be 483 | * included in all copies or substantial portions of the Software. 484 | * 485 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 486 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 487 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 488 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 489 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 490 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 491 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 492 | ******************************************************************************/ 493 | 494 | #endif 495 | -------------------------------------------------------------------------------- /include/iup/iup_class_cbs.hpp: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Class Callback Utilities. 3 | */ 4 | 5 | #ifndef __IUP_CLASS_CBS_HPP 6 | #define __IUP_CLASS_CBS_HPP 7 | 8 | 9 | #define IUP_CLASS_GET_OBJECT(__ih, __class) dynamic_cast<__class*>((__class*)IupGetAttribute(__ih, #__class "->this")) 10 | 11 | 12 | #define IUP_CLASS_INITCALLBACK(__ih, __class) \ 13 | IupSetAttribute(__ih, #__class "->this", (char*)this) 14 | 15 | #define IUP_CLASS_SETCALLBACK(__ih, __name, __cb) \ 16 | IupSetCallback(__ih, __name, (Icallback)CB_##__cb) 17 | 18 | 19 | 20 | #ifdef __IUP_PLUS_H 21 | 22 | #define IUP_PLUS_GET_OBJECT(__elem, __class) dynamic_cast<__class*>((__class*)IupGetAttribute(__elem.GetHandle(), #__class "->this")) 23 | 24 | #define IUP_PLUS_INITCALLBACK(__elem, __class) \ 25 | IupSetAttribute(__elem.GetHandle(), #__class "->this", (char*)this) 26 | 27 | #define IUP_PLUS_SETCALLBACK(__elem, __name, __cb) \ 28 | IupSetCallback(__elem.GetHandle(), __name, (Icallback)CB_##__cb) 29 | 30 | #endif 31 | 32 | 33 | 34 | #define IUP_CLASS_DECLARECALLBACK_IFn(__class, __cb) \ 35 | int __cb(Ihandle* ih); \ 36 | static int CB_##__cb(Ihandle* ih) \ 37 | { \ 38 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 39 | return obj->__cb(ih); \ 40 | } 41 | 42 | #define IUP_CLASS_DECLARECALLBACK_IFni(__class, __cb) \ 43 | int __cb(Ihandle* ih, int i1); \ 44 | static int CB_##__cb(Ihandle* ih, int i1) \ 45 | { \ 46 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 47 | return obj->__cb(ih, i1); \ 48 | } 49 | 50 | #define IUP_CLASS_DECLARECALLBACK_IFnii(__class, __cb) \ 51 | int __cb(Ihandle* ih, int i1, int i2); \ 52 | static int CB_##__cb(Ihandle* ih, int i1, int i2) \ 53 | { \ 54 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 55 | return obj->__cb(ih, i1, i2); \ 56 | } 57 | 58 | #define IUP_CLASS_DECLARECALLBACK_IFniii(__class, __cb) \ 59 | int __cb(Ihandle* ih, int i1, int i2, int i3); \ 60 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int i3) \ 61 | { \ 62 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 63 | return obj->__cb(ih, i1, i2, i3); \ 64 | } 65 | 66 | #define IUP_CLASS_DECLARECALLBACK_IFniiii(__class, __cb) \ 67 | int __cb(Ihandle* ih, int i1, int i2, int i3, int i4); \ 68 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int i3, int i4) \ 69 | { \ 70 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 71 | return obj->__cb(ih, i1, i2, i3, i4); \ 72 | } 73 | 74 | #define IUP_CLASS_DECLARECALLBACK_IFniiiii(__class, __cb) \ 75 | int __cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5); \ 76 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5) \ 77 | { \ 78 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 79 | return obj->__cb(ih, i1, i2, i3, i4, i5); \ 80 | } 81 | 82 | #define IUP_CLASS_DECLARECALLBACK_IFniiiiii(__class, __cb) \ 83 | int __cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5, int i6); \ 84 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5, int i6) \ 85 | { \ 86 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 87 | return obj->__cb(ih, i1, i2, i3, i4, i5, i6); \ 88 | } 89 | 90 | #define IUP_CLASS_DECLARECALLBACK_IFniiiiiiC(__class, __cb) \ 91 | int __cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5, int i6, struct _cdCanvas* canvas); \ 92 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5, int i6, struct _cdCanvas* canvas) \ 93 | { \ 94 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 95 | return obj->__cb(ih, i1, i2, i3, i4, i5, i6, canvas); \ 96 | } 97 | 98 | #define IUP_CLASS_DECLARECALLBACK_IFnC(__class, __cb) \ 99 | int __cb(Ihandle* ih, struct _cdCanvas* canvas); \ 100 | static int CB_##__cb(Ihandle* ih, struct _cdCanvas* canvas) \ 101 | { \ 102 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 103 | return obj->__cb(ih, canvas); \ 104 | } 105 | 106 | #define IUP_CLASS_DECLARECALLBACK_dIFnii(__class, __cb) \ 107 | double __cb(Ihandle* ih, int i1, int i2); \ 108 | static double CB_##__cb(Ihandle* ih, int i1, int i2) \ 109 | { \ 110 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 111 | return obj->__cb(ih, i1, i2); \ 112 | } 113 | 114 | #define IUP_CLASS_DECLARECALLBACK_sIFni(__class, __cb) \ 115 | char* __cb(Ihandle* ih, int i1); \ 116 | static char* CB_##__cb(Ihandle* ih, int i1) \ 117 | { \ 118 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 119 | return obj->__cb(ih, i1); \ 120 | } 121 | 122 | #define IUP_CLASS_DECLARECALLBACK_sIFnii(__class, __cb) \ 123 | char* __cb(Ihandle* ih, int i1, int i2); \ 124 | static char* CB_##__cb(Ihandle* ih, int i1, int i2) \ 125 | { \ 126 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 127 | return obj->__cb(ih, i1, i2); \ 128 | } 129 | 130 | #define IUP_CLASS_DECLARECALLBACK_sIFniis(__class, __cb) \ 131 | char* __cb(Ihandle* ih, int i1, int i2, char* s); \ 132 | static char* CB_##__cb(Ihandle* ih, int i1, int i2, char* s) \ 133 | { \ 134 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 135 | return obj->__cb(ih, i1, i2, s); \ 136 | } 137 | 138 | #define IUP_CLASS_DECLARECALLBACK_IFnff(__class, __cb) \ 139 | int __cb(Ihandle* ih, float f1, float f2); \ 140 | static int CB_##__cb(Ihandle* ih, float f1, float f2) \ 141 | { \ 142 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 143 | return obj->__cb(ih, f1, f2); \ 144 | } 145 | 146 | #define IUP_CLASS_DECLARECALLBACK_IFniff(__class, __cb) \ 147 | int __cb(Ihandle* ih, int i1, float f1, float f2); \ 148 | static int CB_##__cb(Ihandle* ih, int i1, float f1, float f2) \ 149 | { \ 150 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 151 | return obj->__cb(ih, i1, f1, f2); \ 152 | } 153 | 154 | #define IUP_CLASS_DECLARECALLBACK_IFnfiis(__class, __cb) \ 155 | int __cb(Ihandle* ih, float f1, int i1, int i2, char* s); \ 156 | static int CB_##__cb(Ihandle* ih, float f1, int i1, int i2, char* s) \ 157 | { \ 158 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 159 | return obj->__cb(ih, f1, i1, i2, s); \ 160 | } 161 | 162 | #define IUP_CLASS_DECLARECALLBACK_IFniiff(__class, __cb) \ 163 | int __cb(Ihandle* ih, int i1, int i2, float f1, float f2); \ 164 | static int CB_##__cb(Ihandle* ih, int i1, int i2, float f1, float f2) \ 165 | { \ 166 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 167 | return obj->__cb(ih, i1, i2, f1, f2); \ 168 | } 169 | 170 | #define IUP_CLASS_DECLARECALLBACK_IFniiffi(__class, __cb) \ 171 | int __cb(Ihandle* ih, int i1, int i2, float f1, float f2, int i3); \ 172 | static int CB_##__cb(Ihandle* ih, int i1, int i2, float f1, float f2, int i3) \ 173 | { \ 174 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 175 | return obj->__cb(ih, i1, i2, f1, f2, i3); \ 176 | } 177 | 178 | #define IUP_CLASS_DECLARECALLBACK_IFniiffFF(__class, __cb) \ 179 | int __cb(Ihandle* ih, int i1, int i2, float f1, float f2, float *f3, float *f4); \ 180 | static int CB_##__cb(Ihandle* ih, int i1, int i2, float f1, float f2, float *f3, float *f4) \ 181 | { \ 182 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 183 | return obj->__cb(ih, i1, i2, f1, f2, f3, f4); \ 184 | } 185 | 186 | #define IUP_CLASS_DECLARECALLBACK_IFniiffs(__class, __cb) \ 187 | int __cb(Ihandle* ih, int i1, int i2, float f1, float f2, char* s); \ 188 | static int CB_##__cb(Ihandle* ih, int i1, int i2, float f1, float f2, char* s) \ 189 | { \ 190 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 191 | return obj->__cb(ih, i1, i2, f1, f2, s); \ 192 | } 193 | 194 | #define IUP_CLASS_DECLARECALLBACK_IFnd(__class, __cb) \ 195 | int __cb(Ihandle* ih, double d1); \ 196 | static int CB_##__cb(Ihandle* ih, double d1) \ 197 | { \ 198 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 199 | return obj->__cb(ih, d1); \ 200 | } 201 | 202 | #define IUP_CLASS_DECLARECALLBACK_IFndds(__class, __cb) \ 203 | int __cb(Ihandle* ih, double d1, double d2, char* s); \ 204 | static int CB_##__cb(Ihandle* ih, double d1, double d2, char* s) \ 205 | { \ 206 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 207 | return obj->__cb(ih, d1, d2, s); \ 208 | } 209 | 210 | #define IUP_CLASS_DECLARECALLBACK_IFniid(__class, __cb) \ 211 | int __cb(Ihandle* ih, int i1, int i2, double d1); \ 212 | static int CB_##__cb(Ihandle* ih, int i1, int i2, double d1) \ 213 | { \ 214 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 215 | return obj->__cb(ih, i1, i2, d1); \ 216 | } 217 | 218 | #define IUP_CLASS_DECLARECALLBACK_IFniidd(__class, __cb) \ 219 | int __cb(Ihandle* ih, int i1, int i2, double d1, double d2); \ 220 | static int CB_##__cb(Ihandle* ih, int i1, int i2, double d1, double d2) \ 221 | { \ 222 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 223 | return obj->__cb(ih, i1, i2, d1, d2); \ 224 | } 225 | 226 | #define IUP_CLASS_DECLARECALLBACK_IFniiddi(__class, __cb) \ 227 | int __cb(Ihandle* ih, int i1, int i2, double d1, double d2, int i3); \ 228 | static int CB_##__cb(Ihandle* ih, int i1, int i2, double d1, double d2, int i3) \ 229 | { \ 230 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 231 | return obj->__cb(ih, i1, i2, d1, d2, i3); \ 232 | } 233 | 234 | #define IUP_CLASS_DECLARECALLBACK_IFniidds(__class, __cb) \ 235 | int __cb(Ihandle* ih, int i1, int i2, double d1, double d2, char* s); \ 236 | static int CB_##__cb(Ihandle* ih, int i1, int i2, double d1, double d2, char* s) \ 237 | { \ 238 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 239 | return obj->__cb(ih, i1, i2, d1, d2, s); \ 240 | } 241 | 242 | #define IUP_CLASS_DECLARECALLBACK_IFniiIII(__class, __cb) \ 243 | int __cb(Ihandle* ih, int i1, int i2, int *I1, int *I2, int *I3); \ 244 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int *I1, int *I2, int *I3) \ 245 | { \ 246 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 247 | return obj->__cb(ih, i1, i2, I1, I2, I3); \ 248 | } 249 | 250 | #define IUP_CLASS_DECLARECALLBACK_IFniIIII(__class, __cb) \ 251 | int __cb(Ihandle* ih, int i1, int *I1, int *I2, int *I3, int *I4); \ 252 | static int CB_##__cb(Ihandle* ih, int i1, int *I1, int *I2, int *I3, int *I4) \ 253 | { \ 254 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 255 | return obj->__cb(ih, i1, I1, I2, I3, I4); \ 256 | } 257 | 258 | #define IUP_CLASS_DECLARECALLBACK_IFnIi(__class, __cb) \ 259 | int __cb(Ihandle* ih, int *I1, int i1); \ 260 | static int CB_##__cb(Ihandle* ih, int *I1, int i1) \ 261 | { \ 262 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 263 | return obj->__cb(ih, I1, i1); \ 264 | } 265 | 266 | #define IUP_CLASS_DECLARECALLBACK_IFnccc(__class, __cb) \ 267 | int __cb(Ihandle* ih, char c1, char c2, char c3); \ 268 | static int CB_##__cb(Ihandle* ih, char c1, char c2, char c3) \ 269 | { \ 270 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 271 | return obj->__cb(ih, c1, c2, c3); \ 272 | } 273 | 274 | #define IUP_CLASS_DECLARECALLBACK_IFnis(__class, __cb) \ 275 | int __cb(Ihandle* ih, int i1, char* s); \ 276 | static int CB_##__cb(Ihandle* ih, int i1, char* s) \ 277 | { \ 278 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 279 | return obj->__cb(ih, i1, s); \ 280 | } 281 | 282 | #define IUP_CLASS_DECLARECALLBACK_IFniis(__class, __cb) \ 283 | int __cb(Ihandle* ih, int i1, int i2, char* s); \ 284 | static int CB_##__cb(Ihandle* ih, int i1, int i2, char* s) \ 285 | { \ 286 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 287 | return obj->__cb(ih, i1, i2, s); \ 288 | } 289 | 290 | #define IUP_CLASS_DECLARECALLBACK_IFniiis(__class, __cb) \ 291 | int __cb(Ihandle* ih, int i1, int i2, int i3, char* s); \ 292 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int i3, char* s) \ 293 | { \ 294 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 295 | return obj->__cb(ih, i1, i2, i3, s); \ 296 | } 297 | 298 | #define IUP_CLASS_DECLARECALLBACK_IFniiiis(__class, __cb) \ 299 | int __cb(Ihandle* ih, int i1, int i2, int i3, int i4, char* s); \ 300 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int i3, int i4, char* s) \ 301 | { \ 302 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 303 | return obj->__cb(ih, i1, i2, i3, i4, s); \ 304 | } 305 | 306 | #define IUP_CLASS_DECLARECALLBACK_IFniiiiis(__class, __cb) \ 307 | int __cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5, char* s); \ 308 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5, char* s) \ 309 | { \ 310 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 311 | return obj->__cb(ih, i1, i2, i3, i4, i5, s); \ 312 | } 313 | 314 | #define IUP_CLASS_DECLARECALLBACK_IFniiiiiis(__class, __cb) \ 315 | int __cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5, int i6, char* s); \ 316 | static int CB_##__cb(Ihandle* ih, int i1, int i2, int i3, int i4, int i5, int i6, char* s) \ 317 | { \ 318 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 319 | return obj->__cb(ih, i1, i2, i3, i4, i5, i6, s); \ 320 | } 321 | 322 | #define IUP_CLASS_DECLARECALLBACK_IFnss(__class, __cb) \ 323 | int __cb(Ihandle* ih, char* s1, char* s2); \ 324 | static int CB_##__cb(Ihandle* ih, char* s1, char* s2) \ 325 | { \ 326 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 327 | return obj->__cb(ih, s1, s2); \ 328 | } 329 | 330 | #define IUP_CLASS_DECLARECALLBACK_IFns(__class, __cb) \ 331 | int __cb(Ihandle* ih, char* s1); \ 332 | static int CB_##__cb(Ihandle* ih, char* s1) \ 333 | { \ 334 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 335 | return obj->__cb(ih, s1); \ 336 | } 337 | 338 | #define IUP_CLASS_DECLARECALLBACK_IFnsi(__class, __cb) \ 339 | int __cb(Ihandle* ih, char* s1, int i1); \ 340 | static int CB_##__cb(Ihandle* ih, char* s1, int i1) \ 341 | { \ 342 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 343 | return obj->__cb(ih, s1, i1); \ 344 | } 345 | 346 | #define IUP_CLASS_DECLARECALLBACK_IFnsii(__class, __cb) \ 347 | int __cb(Ihandle* ih, char* s1, int i1, int i2); \ 348 | static int CB_##__cb(Ihandle* ih, char* s1, int i1, int i2) \ 349 | { \ 350 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 351 | return obj->__cb(ih, s1, i1, i2); \ 352 | } 353 | 354 | #define IUP_CLASS_DECLARECALLBACK_IFnsiii(__class, __cb) \ 355 | int __cb(Ihandle* ih, char* s1, int i1, int i2, int i3); \ 356 | static int CB_##__cb(Ihandle* ih, char* s1, int i1, int i2, int i3) \ 357 | { \ 358 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 359 | return obj->__cb(ih, s1, i1, i2, i3); \ 360 | } 361 | 362 | #define IUP_CLASS_DECLARECALLBACK_IFnnii(__class, __cb) \ 363 | int __cb(Ihandle* ih, Ihandle* ih1, int i1, int i2); \ 364 | static int CB_##__cb(Ihandle* ih, Ihandle* ih1, int i1, int i2) \ 365 | { \ 366 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 367 | return obj->__cb(ih, ih1, i1, i2); \ 368 | } 369 | 370 | #define IUP_CLASS_DECLARECALLBACK_IFnnn(__class, __cb) \ 371 | int __cb(Ihandle* ih, Ihandle* ih1, Ihandle *ih2); \ 372 | static int CB_##__cb(Ihandle* ih, Ihandle* ih1, Ihandle *ih2) \ 373 | { \ 374 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 375 | return obj->__cb(ih, ih1, ih2); \ 376 | } 377 | 378 | #define IUP_CLASS_DECLARECALLBACK_IFniinsii(__class, __cb) \ 379 | int __cb(Ihandle* ih, int i1, int i2, Ihandle* ih1, char* s, int i3, int i4); \ 380 | static int CB_##__cb(Ihandle* ih, int i1, int i2, Ihandle* ih1, char* s, int i3, int i4) \ 381 | { \ 382 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 383 | return obj->__cb(ih, i1, i2, ih1, s, i3, i4); \ 384 | } 385 | 386 | #define IUP_CLASS_DECLARECALLBACK_IFnsVi(__class, __cb) \ 387 | int __cb(Ihandle* ih, char* s1, void* V1, int i1); \ 388 | static int CB_##__cb(Ihandle* ih, char* s1, void* V1, int i1) \ 389 | { \ 390 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 391 | return obj->__cb(ih, s1, V1, i1); \ 392 | } 393 | 394 | #define IUP_CLASS_DECLARECALLBACK_IFnsViii(__class, __cb) \ 395 | int __cb(Ihandle* ih, char* s1, void* V1, int i1, int i2, int i3); \ 396 | static int CB_##__cb(Ihandle* ih, char* s1, void* V1, int i1, int i2, int i3) \ 397 | { \ 398 | __class* obj = IUP_CLASS_GET_OBJECT(ih, __class); \ 399 | return obj->__cb(ih, s1, V1, i1, i2, i3); \ 400 | } 401 | 402 | 403 | 404 | /* #define IUP_CLASS_DEBUG */ 405 | #ifdef IUP_CLASS_DEBUG 406 | class IUP_CLASS_DUMMY 407 | { 408 | // Used to check for errors in the definitions 409 | IUP_CLASS_DECLARECALLBACK_IFn(IUP_CLASS_DUMMY, IFn); 410 | IUP_CLASS_DECLARECALLBACK_IFni(IUP_CLASS_DUMMY, IFni); 411 | IUP_CLASS_DECLARECALLBACK_IFnii(IUP_CLASS_DUMMY, IFnii); 412 | IUP_CLASS_DECLARECALLBACK_IFniii(IUP_CLASS_DUMMY, IFniii); 413 | IUP_CLASS_DECLARECALLBACK_IFniiii(IUP_CLASS_DUMMY, IFniiii); 414 | IUP_CLASS_DECLARECALLBACK_IFniiiii(IUP_CLASS_DUMMY, IFniiiii); 415 | IUP_CLASS_DECLARECALLBACK_IFniiiiii(IUP_CLASS_DUMMY, IFniiiiii); 416 | IUP_CLASS_DECLARECALLBACK_IFniiiiiiC(IUP_CLASS_DUMMY, IFniiiiiiC); 417 | IUP_CLASS_DECLARECALLBACK_IFnC(IUP_CLASS_DUMMY, IFnC); 418 | IUP_CLASS_DECLARECALLBACK_dIFnii(IUP_CLASS_DUMMY, dIFnii); 419 | IUP_CLASS_DECLARECALLBACK_sIFni(IUP_CLASS_DUMMY, sIFni); 420 | IUP_CLASS_DECLARECALLBACK_sIFnii(IUP_CLASS_DUMMY, sIFnii); 421 | IUP_CLASS_DECLARECALLBACK_sIFniis(IUP_CLASS_DUMMY, sIFniis); 422 | IUP_CLASS_DECLARECALLBACK_IFnff(IUP_CLASS_DUMMY, IFnff); 423 | IUP_CLASS_DECLARECALLBACK_IFniff(IUP_CLASS_DUMMY, IFniff); 424 | IUP_CLASS_DECLARECALLBACK_IFnfiis(IUP_CLASS_DUMMY, IFnfiis); 425 | IUP_CLASS_DECLARECALLBACK_IFniiff(IUP_CLASS_DUMMY, IFniiff); 426 | IUP_CLASS_DECLARECALLBACK_IFniiffi(IUP_CLASS_DUMMY, IFniiffi); 427 | IUP_CLASS_DECLARECALLBACK_IFniiffFF(IUP_CLASS_DUMMY, IFniiffFF); 428 | IUP_CLASS_DECLARECALLBACK_IFniiffs(IUP_CLASS_DUMMY, IFniiffs); 429 | IUP_CLASS_DECLARECALLBACK_IFnd(IUP_CLASS_DUMMY, IFnd); 430 | IUP_CLASS_DECLARECALLBACK_IFndds(IUP_CLASS_DUMMY, IFndds); 431 | IUP_CLASS_DECLARECALLBACK_IFniid(IUP_CLASS_DUMMY, IFniid); 432 | IUP_CLASS_DECLARECALLBACK_IFniidd(IUP_CLASS_DUMMY, IFniidd); 433 | IUP_CLASS_DECLARECALLBACK_IFniiddi(IUP_CLASS_DUMMY, IFniiddi); 434 | IUP_CLASS_DECLARECALLBACK_IFniidds(IUP_CLASS_DUMMY, IFniidds); 435 | IUP_CLASS_DECLARECALLBACK_IFniiIII(IUP_CLASS_DUMMY, IFniiIII); 436 | IUP_CLASS_DECLARECALLBACK_IFniIIII(IUP_CLASS_DUMMY, IFniIIII); 437 | IUP_CLASS_DECLARECALLBACK_IFnIi(IUP_CLASS_DUMMY, IFnIi); 438 | IUP_CLASS_DECLARECALLBACK_IFnccc(IUP_CLASS_DUMMY, IFnccc); 439 | IUP_CLASS_DECLARECALLBACK_IFnis(IUP_CLASS_DUMMY, IFnis); 440 | IUP_CLASS_DECLARECALLBACK_IFniis(IUP_CLASS_DUMMY, IFniis); 441 | IUP_CLASS_DECLARECALLBACK_IFniiis(IUP_CLASS_DUMMY, IFniiis); 442 | IUP_CLASS_DECLARECALLBACK_IFniiiis(IUP_CLASS_DUMMY, IFniiiis); 443 | IUP_CLASS_DECLARECALLBACK_IFniiiiis(IUP_CLASS_DUMMY, IFniiiiis); 444 | IUP_CLASS_DECLARECALLBACK_IFniiiiiis(IUP_CLASS_DUMMY, IFniiiiiis); 445 | IUP_CLASS_DECLARECALLBACK_IFnss(IUP_CLASS_DUMMY, IFnss); 446 | IUP_CLASS_DECLARECALLBACK_IFns(IUP_CLASS_DUMMY, IFns); 447 | IUP_CLASS_DECLARECALLBACK_IFnsi(IUP_CLASS_DUMMY, IFnsi); 448 | IUP_CLASS_DECLARECALLBACK_IFnsii(IUP_CLASS_DUMMY, IFnsii); 449 | IUP_CLASS_DECLARECALLBACK_IFnsiii(IUP_CLASS_DUMMY, IFnsiii); 450 | IUP_CLASS_DECLARECALLBACK_IFnnii(IUP_CLASS_DUMMY, IFnnii); 451 | IUP_CLASS_DECLARECALLBACK_IFnnn(IUP_CLASS_DUMMY, IFnnn); 452 | IUP_CLASS_DECLARECALLBACK_IFniinsii(IUP_CLASS_DUMMY, IFniinsii); 453 | IUP_CLASS_DECLARECALLBACK_IFnsVi(IUP_CLASS_DUMMY, IFnsVi); 454 | IUP_CLASS_DECLARECALLBACK_IFnsViii(IUP_CLASS_DUMMY, IFnsViii); 455 | }; 456 | 457 | class SampleClass 458 | { 459 | int sample_count; 460 | 461 | public: 462 | SampleClass() 463 | { 464 | sample_count = 0; 465 | 466 | Ihandle* button1 = IupButton("Inc", NULL); 467 | Ihandle* button2 = IupButton("Dec", NULL); 468 | Ihandle* dialog = IupDialog(IupHbox(button1, button2, NULL)); 469 | 470 | // 1) Register "this" object as a callback receiver (need only once) 471 | IUP_CLASS_INITCALLBACK(dialog, SampleClass); 472 | 473 | // 2) Associate the callback with the button 474 | IUP_CLASS_SETCALLBACK(button1, "ACTION", ButtonAction1); 475 | IUP_CLASS_SETCALLBACK(button2, "ACTION", ButtonAction2); 476 | 477 | IupShow(dialog); 478 | }; 479 | 480 | protected: 481 | // 3) Declare the callback as a member function 482 | IUP_CLASS_DECLARECALLBACK_IFn(SampleClass, ButtonAction1); 483 | IUP_CLASS_DECLARECALLBACK_IFn(SampleClass, ButtonAction2); 484 | }; 485 | 486 | // 4) Define the callback as a member function 487 | int SampleClass::ButtonAction1(Ihandle*) 488 | { 489 | sample_count++; 490 | return IUP_DEFAULT; 491 | } 492 | int SampleClass::ButtonAction2(Ihandle*) 493 | { 494 | sample_count--; 495 | return IUP_DEFAULT; 496 | } 497 | 498 | #endif // IUP_CLASS_DEBUG 499 | 500 | #endif 501 | -------------------------------------------------------------------------------- /include/iup/iup_config.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Configuration file Utilities 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef IUP_CONFIG_H 8 | #define IUP_CONFIG_H 9 | 10 | #if defined(__cplusplus) 11 | extern "C" { 12 | #endif 13 | 14 | Ihandle* IupConfig(void); 15 | 16 | int IupConfigLoad(Ihandle* ih); 17 | int IupConfigSave(Ihandle* ih); 18 | 19 | /****************************************************************/ 20 | 21 | void IupConfigSetVariableStr(Ihandle* ih, const char* group, const char* key, const char* value); 22 | void IupConfigSetVariableStrId(Ihandle* ih, const char* group, const char* key, int id, const char* value); 23 | void IupConfigSetVariableInt(Ihandle* ih, const char* group, const char* key, int value); 24 | void IupConfigSetVariableIntId(Ihandle* ih, const char* group, const char* key, int id, int value); 25 | void IupConfigSetVariableDouble(Ihandle* ih, const char* group, const char* key, double value); 26 | void IupConfigSetVariableDoubleId(Ihandle* ih, const char* group, const char* key, int id, double value); 27 | 28 | const char* IupConfigGetVariableStr(Ihandle* ih, const char* group, const char* key); 29 | const char* IupConfigGetVariableStrId(Ihandle* ih, const char* group, const char* key, int id); 30 | int IupConfigGetVariableInt(Ihandle* ih, const char* group, const char* key); 31 | int IupConfigGetVariableIntId(Ihandle* ih, const char* group, const char* key, int id); 32 | double IupConfigGetVariableDouble(Ihandle* ih, const char* group, const char* key); 33 | double IupConfigGetVariableDoubleId(Ihandle* ih, const char* group, const char* key, int id); 34 | 35 | const char* IupConfigGetVariableStrDef(Ihandle* ih, const char* group, const char* key, const char* def); 36 | const char* IupConfigGetVariableStrIdDef(Ihandle* ih, const char* group, const char* key, int id, const char* def); 37 | int IupConfigGetVariableIntDef(Ihandle* ih, const char* group, const char* key, int def); 38 | int IupConfigGetVariableIntIdDef(Ihandle* ih, const char* group, const char* key, int id, int def); 39 | double IupConfigGetVariableDoubleDef(Ihandle* ih, const char* group, const char* key, double def); 40 | double IupConfigGetVariableDoubleIdDef(Ihandle* ih, const char* group, const char* key, int id, double def); 41 | 42 | void IupConfigCopy(Ihandle* ih1, Ihandle* ih2, const char* exclude_prefix); 43 | 44 | /****************************************************************/ 45 | 46 | void IupConfigSetListVariable(Ihandle* ih, const char *group, const char* key, const char* value, int add); 47 | 48 | void IupConfigRecentInit(Ihandle* ih, Ihandle* menu, Icallback recent_cb, int max_recent); 49 | void IupConfigRecentUpdate(Ihandle* ih, const char* filename); 50 | 51 | void IupConfigDialogShow(Ihandle* ih, Ihandle* dialog, const char* name); 52 | void IupConfigDialogClosed(Ihandle* ih, Ihandle* dialog, const char* name); 53 | 54 | 55 | #if defined(__cplusplus) 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /include/iup/iup_mglplot.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Plot component for Iup. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUP_MGLPLOT_H 8 | #define __IUP_MGLPLOT_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* Initialize IupMglPlot widget class */ 15 | void IupMglPlotOpen(void); 16 | 17 | /* Create an IupMglPlot widget instance */ 18 | Ihandle* IupMglPlot(void); 19 | 20 | /***********************************************/ 21 | /* Additional API */ 22 | 23 | /* Linear Data Only */ 24 | void IupMglPlotBegin(Ihandle *ih, int dim); 25 | void IupMglPlotAdd1D(Ihandle *ih, const char* name, double y); 26 | void IupMglPlotAdd2D(Ihandle *ih, double x, double y); 27 | void IupMglPlotAdd3D(Ihandle *ih, double x, double y, double z); 28 | int IupMglPlotEnd(Ihandle *ih); 29 | 30 | /* Linear (dim=1,2,3), Planar (dim=1), Volumetric (dim=1) */ 31 | int IupMglPlotNewDataSet(Ihandle *ih, int dim); 32 | 33 | /* Linear Data Only */ 34 | void IupMglPlotInsert1D(Ihandle* ih, int ds_index, int sample_index, const char** names, const double* y, int count); 35 | void IupMglPlotInsert2D(Ihandle* ih, int ds_index, int sample_index, const double* x, const double* y, int count); 36 | void IupMglPlotInsert3D(Ihandle* ih, int ds_index, int sample_index, const double* x, const double* y, const double* z, int count); 37 | 38 | /* Linear Data Only */ 39 | void IupMglPlotSet1D(Ihandle* ih, int ds_index, const char** names, const double* y, int count); 40 | void IupMglPlotSet2D(Ihandle* ih, int ds_index, const double* x, const double* y, int count); 41 | void IupMglPlotSet3D(Ihandle* ih, int ds_index, const double* x, const double* y, const double* z, int count); 42 | void IupMglPlotSetFormula(Ihandle* ih, int ds_index, const char* formulaX, const char* formulaY, const char* formulaZ, int count); 43 | 44 | /* Linear (dim=1), Planar (dim=1), Volumetric (dim=1) */ 45 | void IupMglPlotSetData(Ihandle* ih, int ds_index, const double* data, int count_x, int count_y, int count_z); 46 | void IupMglPlotLoadData(Ihandle* ih, int ds_index, const char* filename, int count_x, int count_y, int count_z); 47 | void IupMglPlotSetFromFormula(Ihandle* ih, int ds_index, const char* formula, int count_x, int count_y, int count_z); 48 | 49 | /* Only inside callbacks */ 50 | void IupMglPlotTransform(Ihandle* ih, double x, double y, double z, int *ix, int *iy); 51 | void IupMglPlotTransformTo(Ihandle* ih, int ix, int iy, double *x, double *y, double *z); 52 | 53 | /* Only inside callbacks */ 54 | void IupMglPlotDrawMark(Ihandle* ih, double x, double y, double z); 55 | void IupMglPlotDrawLine(Ihandle* ih, double x1, double y1, double z1, double x2, double y2, double z2); 56 | void IupMglPlotDrawText(Ihandle* ih, const char* text, double x, double y, double z); 57 | 58 | void IupMglPlotPaintTo(Ihandle *ih, const char* format, int w, int h, double dpi, void *data); 59 | 60 | /***********************************************/ 61 | 62 | /* Utility label for showing TeX labels */ 63 | Ihandle* IupMglLabel(const char* title); 64 | 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/iup/iup_plot.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Plot component for Iup. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUP_PLOT_H 8 | #define __IUP_PLOT_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* Initialize IupPlot widget class */ 15 | void IupPlotOpen(void); 16 | 17 | /* Create an IupPlot widget instance */ 18 | Ihandle* IupPlot(void); 19 | 20 | /***********************************************/ 21 | /* Additional API */ 22 | 23 | void IupPlotBegin(Ihandle *ih, int strXdata); 24 | void IupPlotAdd(Ihandle *ih, double x, double y); 25 | void IupPlotAddStr(Ihandle *ih, const char* x, double y); 26 | void IupPlotAddSegment(Ihandle *ih, double x, double y); 27 | int IupPlotEnd(Ihandle *ih); 28 | 29 | int IupPlotLoadData(Ihandle* ih, const char* filename, int strXdata); 30 | 31 | /* available only when linking with "iupluaplot" */ 32 | int IupPlotSetFormula(Ihandle* ih, int sample_count, const char* formula, const char* init); 33 | 34 | void IupPlotInsert(Ihandle *ih, int ds_index, int sample_index, double x, double y); 35 | void IupPlotInsertStr(Ihandle *ih, int ds_index, int sample_index, const char* x, double y); 36 | void IupPlotInsertSegment(Ihandle *ih, int ds_index, int sample_index, double x, double y); 37 | 38 | void IupPlotInsertStrSamples(Ihandle* ih, int ds_index, int sample_index, const char** x, double* y, int count); 39 | void IupPlotInsertSamples(Ihandle* ih, int ds_index, int sample_index, double *x, double *y, int count); 40 | 41 | void IupPlotAddSamples(Ihandle* ih, int ds_index, double *x, double *y, int count); 42 | void IupPlotAddStrSamples(Ihandle* ih, int ds_index, const char** x, double* y, int count); 43 | 44 | void IupPlotGetSample(Ihandle* ih, int ds_index, int sample_index, double *x, double *y); 45 | void IupPlotGetSampleStr(Ihandle* ih, int ds_index, int sample_index, const char* *x, double *y); 46 | int IupPlotGetSampleSelection(Ihandle* ih, int ds_index, int sample_index); 47 | double IupPlotGetSampleExtra(Ihandle* ih, int ds_index, int sample_index); 48 | void IupPlotSetSample(Ihandle* ih, int ds_index, int sample_index, double x, double y); 49 | void IupPlotSetSampleStr(Ihandle* ih, int ds_index, int sample_index, const char* x, double y); 50 | void IupPlotSetSampleSelection(Ihandle* ih, int ds_index, int sample_index, int selected); 51 | void IupPlotSetSampleExtra(Ihandle* ih, int ds_index, int sample_index, double extra); 52 | 53 | void IupPlotTransform(Ihandle* ih, double x, double y, double *cnv_x, double *cnv_y); 54 | void IupPlotTransformTo(Ihandle* ih, double cnv_x, double cnv_y, double *x, double *y); 55 | 56 | int IupPlotFindSample(Ihandle* ih, double cnv_x, double cnv_y, int *ds_index, int *sample_index); 57 | int IupPlotFindSegment(Ihandle* ih, double cnv_x, double cnv_y, int *ds_index, int *sample_index1, int *sample_index2); 58 | 59 | struct _cdCanvas; 60 | 61 | void IupPlotPaintTo(Ihandle *ih, struct _cdCanvas* cnv); 62 | 63 | /***********************************************/ 64 | 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/iup/iup_plus.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Name space for C++ high level API 3 | * 4 | * See Copyright Notice in iup.h 5 | */ 6 | 7 | #ifndef __IUP_PLUS_H 8 | #define __IUP_PLUS_H 9 | 10 | 11 | #include "iup.h" 12 | #include "iupkey.h" 13 | #include "iupdraw.h" 14 | #include "iup_class_cbs.hpp" 15 | #include "iupcontrols.h" 16 | #include "iupgl.h" 17 | #include "iupglcontrols.h" 18 | #include "iupim.h" 19 | #include "iup_config.h" 20 | #include "iup_mglplot.h" 21 | #include "iup_plot.h" 22 | #include "iupole.h" 23 | #include "iupweb.h" 24 | #include "iup_scintilla.h" 25 | #include "iuptuio.h" 26 | 27 | 28 | 29 | /** \brief Name space for C++ high level API 30 | * 31 | * \par 32 | * Defines wrapper classes for all C structures. 33 | * 34 | * See \ref iup_plus.h 35 | */ 36 | namespace Iup 37 | { 38 | inline char* Version() { return IupVersion(); } 39 | inline char* VersionDate() { return IupVersionDate(); } 40 | inline int VersionNumber() { return IupVersionNumber(); } 41 | 42 | inline int Open(int &argc, char **&argv) { return IupOpen(&argc, &argv); } 43 | inline void Close() { IupClose(); } 44 | inline void ImageLibOpen() { IupImageLibOpen(); } 45 | 46 | inline int MainLoop() { return IupMainLoop(); } 47 | inline int LoopStep() { return IupLoopStep(); } 48 | inline int LoopStepWait() { return IupLoopStepWait(); } 49 | inline int MainLoopLevel() { return IupMainLoopLevel(); } 50 | inline void Flush() { IupFlush(); } 51 | inline void ExitLoop() { IupExitLoop(); } 52 | 53 | inline int RecordInput(const char* filename, int mode) { return IupRecordInput(filename, mode); } 54 | inline int PlayInput(const char* filename) { return IupPlayInput(filename); } 55 | 56 | inline int Help(const char* url) { return IupHelp(url); } 57 | inline void Log(const char* type, const char* str) { IupLog(type, "%s", str); } 58 | inline const char* Load(const char *filename) { return IupLoad(filename); } 59 | inline const char* LoadBuffer(const char *buffer) { return IupLoadBuffer(buffer); } 60 | 61 | inline void SetLanguage(const char *lng) { IupSetLanguage(lng); } 62 | inline const char* GetLanguage() { return IupGetLanguage(); } 63 | inline void SetLanguageString(const char* name, const char* str) { IupSetLanguageString(name, str); } 64 | inline void StoreLanguageString(const char* name, const char* str) { IupStoreLanguageString(name, str); } 65 | inline const char* GetLanguageString(const char* name) { return IupGetLanguageString(name); } 66 | 67 | inline int GetAllClasses(char** names, int n) { return IupGetAllClasses(names, n); } 68 | inline int GetClassAttributes(const char* classname, char** names, int n) { return IupGetClassAttributes(classname, names, n); } 69 | inline int GetClassCallbacks(const char* classname, char** names, int n) { return IupGetClassCallbacks(classname, names, n); } 70 | inline void SetClassDefaultAttribute(const char* classname, const char *name, const char* value) { IupSetClassDefaultAttribute(classname, name, value); } 71 | 72 | inline void SetGlobal(const char* name, const char* value) { IupSetGlobal(name, value); } 73 | inline void SetStringGlobal(const char* name, const char* value) { IupSetStrGlobal(name, value); } 74 | inline char* GetGlobal(const char* name) { return IupGetGlobal(name); } 75 | 76 | inline int GetFile(char* filename) { return IupGetFile(filename); } 77 | inline void Message(const char *title, const char *msg) { IupMessage(title, msg); } 78 | inline int Alarm(const char *title, const char *msg, const char *b1, const char *b2, const char *b3) { return IupAlarm(title, msg, b1, b2, b3); } 79 | inline int ListDialog(int type, const char *title, int size, const char** list, int op, int max_col, int max_lin, int* marks) { return IupListDialog(type, title, size, list, op, max_col, max_lin, marks); } 80 | inline int GetText(const char* title, char* text, int maxsize = 10240) { return IupGetText(title, text, maxsize); } 81 | inline int GetColor(int x, int y, unsigned char &r, unsigned char &g, unsigned char &b) { return IupGetColor(x, y, &r, &g, &b); } 82 | inline int GetParamv(const char* title, Iparamcb action, void* user_data, const char* format, int param_count, int param_extra, void** param_data) 83 | { return IupGetParamv(title, action, user_data, format, param_count, param_extra, param_data); } 84 | 85 | inline int GetAllNames(char** names, int n) { return IupGetAllNames(names, n); } 86 | inline int GetAllDialogs(char** names, int n) { return IupGetAllDialogs(names, n); } 87 | 88 | 89 | class Element 90 | { 91 | protected: 92 | Ihandle* ih; 93 | 94 | /* forbidden */ 95 | Element() { ih = 0; }; 96 | 97 | public: 98 | Element(Ihandle* ref_ih) { ih = ref_ih; } 99 | Element(const Element& elem) : Element(elem.ih) {} 100 | 101 | virtual ~Element() 102 | { 103 | // The destructor does not destroy the element because all Iup::Element are just a reference to the Ihandle*, 104 | // since several IUP elements are automatically destroyed when the dialog is destroyed. 105 | // So to force an element to be destroyed explicitly call the Destroy method. 106 | } 107 | 108 | Ihandle* GetHandle() const { return ih; } 109 | 110 | bool Failed() const { 111 | return ih == 0; 112 | } 113 | 114 | void SetAttribute(const char* name, const char* value) { IupSetAttribute(ih, name, value); } 115 | char* GetAttribute(const char* name) { return IupGetAttribute(ih, name); } 116 | void SetUserData(const char* name, void* data) { IupSetAttribute(ih, name, (char*)data); } 117 | void* GetUserData(const char* name) { return (void*)IupGetAttribute(ih, name); } 118 | void SetString(const char* name, const char* value) { IupSetStrAttribute(ih, name, value); } 119 | const char* GetString(const char* name) { return IupGetAttribute(ih, name); } 120 | void SetInteger(const char* name, int value) { IupSetInt(ih, name, value); } 121 | int GetInteger(const char* name) { return IupGetInt(ih, name); } 122 | void GetIntegerInteger(const char* name, int &i1, int &i2) { IupGetIntInt(ih, name, &i1, &i2); } 123 | void SetNumber(const char* name, double value) { IupSetDouble(ih, name, value); } 124 | double GetNumber(const char* name) { return IupGetDouble(ih, name); } 125 | void SetRGB(const char* name, unsigned char r, unsigned char g, unsigned char b) { IupSetRGB(ih, name, r, g, b); } 126 | void GetRGB(const char* name, unsigned char &r, unsigned char &g, unsigned char &b) { IupGetRGB(ih, name, &r, &g, &b); } 127 | 128 | void SetAttributeId(const char* name, int id, const char* value) { IupSetAttributeId(ih, name, id, value); } 129 | char* GetAttributeId(const char* name, int id) { return IupGetAttributeId(ih, name, id); } 130 | void SetUserDataId(const char* name, int id, void* data) { IupSetAttributeId(ih, name, id, (char*)data); } 131 | void* GetUserDataId(const char* name, int id) { return (void*)IupGetAttributeId(ih, name, id); } 132 | void SetStringId(const char* name, int id, const char* value) { IupSetStrAttributeId(ih, name, id, value); } 133 | const char* GetStringId(const char* name, int id) { return IupGetAttributeId(ih, name, id); } 134 | void SetIntegerId(const char* name, int id, int value) { IupSetIntId(ih, name, id, value); } 135 | int GetIntegerId(const char* name, int id) { return IupGetIntId(ih, name, id); } 136 | void SetNumberId(const char* name, int id, double value) { IupSetDoubleId(ih, name, id, value); } 137 | double GetNumberId(const char* name, int id) { return IupGetDoubleId(ih, name, id); } 138 | void SetRGBId(const char* name, int id, unsigned char r, unsigned char g, unsigned char b) { IupSetRGBId(ih, name, id, r, g, b); } 139 | void GetRGBId(const char* name, int id, unsigned char &r, unsigned char &g, unsigned char &b) { IupGetRGBId(ih, name, id, &r, &g, &b); } 140 | 141 | void SetAttributeId2(const char* name, int lin, int col, const char* value) { IupSetAttributeId2(ih, name, lin, col, value); } 142 | char* GetAttributeId2(const char* name, int lin, int col) { return IupGetAttributeId2(ih, name, lin, col); } 143 | void SetUserDataId2(const char* name, int lin, int col, void* data) { IupSetAttributeId2(ih, name, lin, col, (char*)data); } 144 | void* GetUserDataId2(const char* name, int lin, int col) { return (void*)IupGetAttributeId2(ih, name, lin, col); } 145 | void SetStringId2(const char* name, int lin, int col, const char* value) { IupSetStrAttributeId2(ih, name, lin, col, value); } 146 | const char* GetStringId2(const char* name, int lin, int col) { return IupGetAttributeId2(ih, name, lin, col); } 147 | void SetIntegerId2(const char* name, int lin, int col, int value) { IupSetIntId2(ih, name, lin, col, value); } 148 | int GetIntegerId2(const char* name, int lin, int col) { return IupGetIntId2(ih, name, lin, col); } 149 | void SetNumberId2(const char* name, int lin, int col, double value) { IupSetDoubleId2(ih, name, lin, col, value); } 150 | double GetNumberId2(const char* name, int lin, int col) { return IupGetDoubleId2(ih, name, lin, col); } 151 | void SetRGBId2(const char* name, int lin, int col, unsigned char r, unsigned char g, unsigned char b) { IupSetRGBId2(ih, name, lin, col, r, g, b); } 152 | void GetRGBId2(const char* name, int lin, int col, unsigned char &r, unsigned char &g, unsigned char &b) { IupGetRGBId2(ih, name, lin, col, &r, &g, &b); } 153 | 154 | Element SetAttributes(const char* str) { return IupSetAttributes(ih, str); } 155 | void ResetAttribute(const char* name) { IupResetAttribute(ih, name); } 156 | int GetAllAttributes(char** names, int n) { return IupGetAllAttributes(ih, names, n); } 157 | void SetAttributeHandle(const char* name, const Element& elem) { IupSetAttributeHandle(ih, name, elem.GetHandle()); } 158 | Element GetAttributeHandle(const char* name) { return IupGetAttributeHandle(ih, name); } 159 | void SetAttributeHandleId(const char* name, int id, const Element& elem) { IupSetAttributeHandleId(ih, name, id, elem.GetHandle()); } 160 | Element GetAttributeHandleId(const char* name, int id) { return IupGetAttributeHandleId(ih, name, id); } 161 | void SetAttributeHandleId2(const char* name, int lin, int col, const Element& elem) { IupSetAttributeHandleId2(ih, name, lin, col, elem.GetHandle()); } 162 | Element GetAttributeHandleId2(const char* name, int lin, int col) { return IupGetAttributeHandleId2(ih, name, lin, col); } 163 | 164 | Icallback GetCallback(const char *name) { return IupGetCallback(ih, name); } 165 | Icallback SetCallback(const char *name, Icallback func) { return IupSetCallback(ih, name, func); } 166 | 167 | void Destroy() { IupDestroy(ih); } 168 | 169 | int Map() { return IupMap(ih); } 170 | void Unmap() { IupUnmap(ih); } 171 | 172 | char* GetName() { return IupGetName(ih); } 173 | 174 | char* GetClassName() { return IupGetClassName(ih); } 175 | char* GetClassType() { return IupGetClassType(ih); } 176 | void SaveClassAttributes() { IupSaveClassAttributes(ih); } 177 | void CopyClassAttributesTo(const Element& dst) { IupCopyClassAttributes(ih, dst.ih); } 178 | int ClassMatch(const char* classname) { return IupClassMatch(ih, classname); } 179 | 180 | }; 181 | 182 | inline Icallback GetFunction(const char *name) { return IupGetFunction(name); } 183 | inline Icallback SetFunction(const char *name, Icallback func) { return IupSetFunction(name, func); } 184 | inline Element GetHandle(const char *name) { return Element(IupGetHandle(name)); } 185 | inline Element SetHandle(const char *name, const Element& elem) { return Element(IupSetHandle(name, elem.GetHandle())); } 186 | inline void SetLanguagePack(const Element& elem) { IupSetLanguagePack(elem.GetHandle()); } 187 | 188 | class Dialog; 189 | class Container; 190 | 191 | class Control : public Element 192 | { 193 | public: 194 | Control(Ihandle* _ih) : Element(_ih) {} 195 | Control(const Control& control) : Element(control.ih) {} 196 | Control(const Element& elem) : Element(elem.GetHandle()) {} 197 | 198 | Control SetAttributes(const char* str) { IupSetAttributes(ih, str); return *this; } 199 | 200 | void Update() { IupUpdate(ih); } 201 | void Redraw() { IupRedraw(ih, 0); } 202 | void Refresh() { IupRefresh(ih); } 203 | 204 | void Detach(const Control& child) { IupDetach(child.ih); } 205 | 206 | Control GetBrother() { return Control(IupGetBrother(ih)); } 207 | Container GetParent(); 208 | Dialog GetDialog(); 209 | Control GetDialogChild(const char* name) { return Control(IupGetDialogChild(ih, name)); } 210 | int Reparent(const Container& new_parent, const Control& ref_child); 211 | 212 | Control SetFocus() { return Control(IupSetFocus(ih)); } 213 | Control PreviousField() { return Control(IupPreviousField(ih)); } 214 | Control NextField() { return Control(IupNextField(ih)); } 215 | 216 | void ConvertLinColToPos(int lin, int col, int &pos) { IupTextConvertLinColToPos(ih, lin, col, &pos); } 217 | void ConvertPosToLinCol(int pos, int &lin, int &col) { IupTextConvertPosToLinCol(ih, pos, &lin, &col); } 218 | int ConvertXYToPos(int x, int y) { return IupConvertXYToPos(ih, x, y); } 219 | }; 220 | 221 | inline Control GetFocus() { return Control(IupGetFocus()); } 222 | 223 | class Container : public Control 224 | { 225 | public: 226 | Container(Ihandle* _ih) : Control(_ih) {} 227 | Container(const Container& container) : Control(container.ih) {} 228 | Container(const Control& control) : Control(control.GetHandle()) {} 229 | Container(const Element& elem) : Control(elem.GetHandle()) {} 230 | 231 | Container(Ihandle* _ih, const Control* child_array, int count) : Control(_ih) { 232 | for (int i = 0; i < count; i++) 233 | IupAppend(ih, child_array[i].GetHandle()); 234 | } 235 | Container(Ihandle* _ih, Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 236 | : Control(_ih) { 237 | if (!child0.Failed()) IupAppend(ih, child0.GetHandle()); 238 | if (!child1.Failed()) IupAppend(ih, child1.GetHandle()); 239 | if (!child2.Failed()) IupAppend(ih, child2.GetHandle()); 240 | if (!child3.Failed()) IupAppend(ih, child3.GetHandle()); 241 | if (!child4.Failed()) IupAppend(ih, child4.GetHandle()); 242 | if (!child5.Failed()) IupAppend(ih, child5.GetHandle()); 243 | if (!child6.Failed()) IupAppend(ih, child6.GetHandle()); 244 | if (!child7.Failed()) IupAppend(ih, child7.GetHandle()); 245 | if (!child8.Failed()) IupAppend(ih, child8.GetHandle()); 246 | if (!child9.Failed()) IupAppend(ih, child9.GetHandle()); 247 | } 248 | 249 | Control Append(const Control& child) { return IupAppend(ih, child.GetHandle()); } 250 | Control Insert(const Control& ref_child, const Control& child) { return IupInsert(ih, ref_child.GetHandle(), child.GetHandle()); } 251 | Control GetChild(int pos) { return IupGetChild(ih, pos); } 252 | int GetChildPos(const Control& child) { return IupGetChildPos(ih, child.GetHandle()); } 253 | int GetChildCount() { return IupGetChildCount(ih); } 254 | 255 | Control GetFirstChild() { return Control(IupGetNextChild(ih, 0)); } 256 | Control GetNextChild(const Control& ref_child) { return Control(IupGetNextChild(ih, ref_child.GetHandle())); } 257 | 258 | void UpdateChildren() { IupUpdateChildren(ih); } 259 | void RedrawChildren() { IupRedraw(ih, 1); } 260 | void RefreshChildren() { IupRefreshChildren(ih); } 261 | }; 262 | 263 | class Dialog : public Container 264 | { 265 | public: 266 | Dialog(const Dialog& dialog) : Container(dialog.GetHandle()) {} 267 | Dialog(const Element& elem) : Container(elem.GetHandle()) {} 268 | Dialog(Control child) : Container(IupDialog(child.GetHandle())) { } 269 | Dialog(Container child) : Container(IupDialog(child.GetHandle())) { } 270 | Dialog(Ihandle* _ih) : Container(_ih) {} 271 | 272 | int Popup(int x, int y) { return IupPopup(ih, x, y); } 273 | int Show() { return IupShow(ih); } 274 | int ShowXY(int x, int y) { return IupShowXY(ih, x, y); } 275 | int Hide() { return IupHide(ih); } 276 | }; 277 | 278 | inline Dialog Control::GetDialog() { return Dialog(IupGetDialog(ih)); } 279 | inline Dialog LayoutDialog(const Dialog& dialog) { return Dialog(IupLayoutDialog(dialog.GetHandle())); } 280 | inline Dialog ElementPropertiesDialog(const Control& control) { return Dialog(IupElementPropertiesDialog(control.GetHandle())); } 281 | inline Container Control::GetParent() { return Container(IupGetParent(ih)); } 282 | inline int Control::Reparent(const Container& new_parent, const Control& ref_child) { return IupReparent(ih, new_parent.GetHandle(), ref_child.GetHandle()); } 283 | 284 | void MessageError(const Dialog& parent, const char* message) 285 | { IupMessageError(parent.GetHandle(), message); } 286 | int MessageAlarm(const Dialog& parent, const char* title, const char* message, const char* buttons) 287 | { return IupMessageAlarm(parent.GetHandle(), title, message, buttons); } 288 | 289 | class Menu : public Container 290 | { 291 | public: 292 | Menu() : Container(IupMenu(0)) {} 293 | Menu(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 294 | : Container(IupMenu(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 295 | Menu(const Control *child_array, int count) : Container(IupMenu(0), child_array, count) {} 296 | Menu(const Menu& menu) : Container(menu.GetHandle()) {} 297 | Menu(Ihandle* _ih) : Container(_ih) {} 298 | 299 | int Popup(int x, int y) { return IupPopup(ih, x, y); } 300 | }; 301 | 302 | #ifdef __IM_PLUS_H 303 | class Image : public Element 304 | { 305 | public: 306 | Image(const char* filename) : Element(IupLoadImage(filename)) {} 307 | Image(const im::Image& image) : Element(IupImageFromImImage(image.GetHandle())) {} 308 | Image(Ihandle* _ih) : Element(_ih) {} 309 | Image(const Element& elem) : Element(elem.GetHandle()) {} 310 | 311 | int Save(const char* filename, const char* im_format) { return IupSaveImage(ih, filename, im_format); } 312 | int SaveAsText(const char* filename, const char* iup_format, const char* name) { return IupSaveImageAsText(ih, filename, iup_format, name); } 313 | }; 314 | class Clipboard : public Element 315 | { 316 | public: 317 | Clipboard() : Element(IupClipboard()) {} 318 | Clipboard(Ihandle* _ih) : Element(_ih) {} 319 | Clipboard(const Element& elem) : Element(elem.GetHandle()) {} 320 | 321 | void SetImage(const im::Image& image) { SetUserData("NATIVEIMAGE", IupGetImageNativeHandle(image.GetHandle())); } 322 | 323 | im::Image GetImage(void) { return im::Image(IupGetNativeHandleImage(GetUserData("NATIVEIMAGE"))); } 324 | }; 325 | //TODO imImage* IupImageToImImage(Ihandle* iup_image) 326 | #endif 327 | class User : public Element 328 | { 329 | public: 330 | User() : Element(IupUser()) {} 331 | User(Ihandle* _ih) : Element(_ih) {} 332 | User(const Element& elem) : Element(elem.GetHandle()) {} 333 | }; 334 | class Param : public Element 335 | { 336 | public: 337 | Param(const char* format) : Element(IupParam(format)) {} 338 | Param(Ihandle* _ih) : Element(_ih) {} 339 | Param(const Element& elem) : Element(elem.GetHandle()) {} 340 | }; 341 | class Timer : public Element 342 | { 343 | public: 344 | Timer() : Element(IupTimer()) {} 345 | Timer(Ihandle* _ih) : Element(_ih) {} 346 | Timer(const Element& elem) : Element(elem.GetHandle()) {} 347 | }; 348 | class Separator : public Control 349 | { 350 | public: 351 | Separator() : Control(IupSeparator()) {} 352 | Separator(Ihandle* _ih) : Control(_ih) {} 353 | Separator(const Element& elem) : Control(elem.GetHandle()) {} 354 | }; 355 | class Item : public Control 356 | { 357 | public: 358 | Item(const char* title = 0) : Control(IupItem(title, 0)) {} 359 | Item(Ihandle* _ih) : Control(_ih) {} 360 | Item(const Element& elem) : Control(elem.GetHandle()) {} 361 | }; 362 | class Canvas : public Control 363 | { 364 | public: 365 | Canvas() : Control(IupCanvas(0)) {} 366 | Canvas(Ihandle* _ih) : Control(_ih) {} 367 | Canvas(const Element& elem) : Control(elem.GetHandle()) {} 368 | 369 | void DrawBegin() { IupDrawBegin(ih); } 370 | void DrawEnd() { IupDrawEnd(ih); } 371 | void DrawSetClipRect(int x1, int y1, int x2, int y2) { IupDrawSetClipRect(ih, x1, y1, x2, y2); } 372 | void DrawGetClipRect(int *x1, int *y1, int *x2, int *y2) { IupDrawGetClipRect(ih, x1, y1, x2, y2); } 373 | void DrawResetClip() { IupDrawResetClip(ih); } 374 | void DrawParentBackground() { IupDrawParentBackground(ih); } 375 | void DrawLine(int x1, int y1, int x2, int y2) { IupDrawLine(ih, x1, y1, x2, y2); } 376 | void DrawRectangle(int x1, int y1, int x2, int y2) { IupDrawRectangle(ih, x1, y1, x2, y2); } 377 | void DrawArc(int x1, int y1, int x2, int y2, double a1, double a2) { IupDrawArc(ih, x1, y1, x2, y2, a1, a2); } 378 | void DrawPolygon(int* points, int count) { IupDrawPolygon(ih, points, count); } 379 | void DrawText(const char* text, int len, int x, int y, int w, int h) { IupDrawText(ih, text, len, x, y, w, h); } 380 | void DrawImage(const char* name, int x, int y, int w, int h) { IupDrawImage(ih, name, x, y, h, h); } 381 | void DrawSelectRect(int x1, int y1, int x2, int y2) { IupDrawSelectRect(ih, x1, y1, x2, y2); } 382 | void DrawFocusRect(int x1, int y1, int x2, int y2) { IupDrawFocusRect(ih, x1, y1, x2, y2); } 383 | void DrawGetSize(int &w, int &h) { IupDrawGetSize(ih, &w, &h); } 384 | void DrawGetTextSize(const char* str, int len, int &w, int &h) { IupDrawGetTextSize(ih, str, len, &w, &h); } 385 | void DrawGetImageInfo(const char* name, int &w, int &h, int &bpp) { IupDrawGetImageInfo(name, &w, &h, &bpp); } 386 | }; 387 | class Link : public Control 388 | { 389 | public: 390 | Link(const char* url = 0, const char* title = 0) : Control(IupLink(url, title)) {} 391 | Link(Ihandle* _ih) : Control(_ih) {} 392 | Link(const Element& elem) : Control(elem.GetHandle()) {} 393 | }; 394 | class Label : public Control 395 | { 396 | public: 397 | Label(const char* title = 0) : Control(IupLabel(title)) {} 398 | Label(Ihandle* _ih) : Control(_ih) {} 399 | Label(const Element& elem) : Control(elem.GetHandle()) {} 400 | }; 401 | 402 | class Button : public Control 403 | { 404 | public: 405 | Button(const char* title = 0) : Control(IupButton(title, 0)) {} 406 | Button(Ihandle* _ih) : Control(_ih) {} 407 | Button(const Element& elem) : Control(elem.GetHandle()) {} 408 | }; 409 | class FlatButton : public Control 410 | { 411 | public: 412 | FlatButton(const char* title = 0) : Control(IupFlatButton(title)) {} 413 | FlatButton(Ihandle* _ih) : Control(_ih) {} 414 | FlatButton(const Element& elem) : Control(elem.GetHandle()) {} 415 | }; 416 | class FlatToggle : public Control 417 | { 418 | public: 419 | FlatToggle(const char* title = 0) : Control(IupFlatToggle(title)) {} 420 | FlatToggle(Ihandle* _ih) : Control(_ih) {} 421 | FlatToggle(const Element& elem) : Control(elem.GetHandle()) {} 422 | }; 423 | class FlatSeparator : public Control 424 | { 425 | public: 426 | FlatSeparator() : Control(IupFlatSeparator()) {} 427 | FlatSeparator(Ihandle* _ih) : Control(_ih) {} 428 | FlatSeparator(const Element& elem) : Control(elem.GetHandle()) {} 429 | }; 430 | class Space : public Control 431 | { 432 | public: 433 | Space() : Control(IupSpace()) {} 434 | Space(Ihandle* _ih) : Control(_ih) {} 435 | Space(const Element& elem) : Control(elem.GetHandle()) {} 436 | }; 437 | class DropButton : public Control 438 | { 439 | public: 440 | DropButton() : Control(IupDropButton(0)) {} 441 | DropButton(Control child) : Control(IupDropButton(child.GetHandle())) {} 442 | DropButton(Ihandle* _ih) : Control(_ih) {} 443 | DropButton(const Element& elem) : Control(elem.GetHandle()) {} 444 | }; 445 | class FlatLabel : public Control 446 | { 447 | public: 448 | FlatLabel(const char* title = 0) : Control(IupFlatLabel(title)) {} 449 | FlatLabel(Ihandle* _ih) : Control(_ih) {} 450 | FlatLabel(const Element& elem) : Control(elem.GetHandle()) {} 451 | }; 452 | class AnimatedLabel : public Control 453 | { 454 | public: 455 | AnimatedLabel(Element animation = (Ihandle*)0) : Control(IupAnimatedLabel(animation.GetHandle())) {} 456 | AnimatedLabel(Ihandle* _ih) : Control(_ih) {} 457 | AnimatedLabel(const Element& elem) : Control(elem.GetHandle()) {} 458 | }; 459 | class Toggle : public Control 460 | { 461 | public: 462 | Toggle(const char* title = 0) : Control(IupToggle(title, 0)) {} 463 | Toggle(Ihandle* _ih) : Control(_ih) {} 464 | Toggle(const Element& elem) : Control(elem.GetHandle()) {} 465 | }; 466 | class Fill: public Control 467 | { 468 | public: 469 | Fill() : Control(IupFill()) {} 470 | Fill(Ihandle* _ih) : Control(_ih) {} 471 | Fill(const Element& elem) : Control(elem.GetHandle()) {} 472 | }; 473 | class Spin: public Control 474 | { 475 | public: 476 | Spin() : Control(IupSpin()) {} 477 | Spin(Ihandle* _ih) : Control(_ih) {} 478 | Spin(const Element& elem) : Control(elem.GetHandle()) {} 479 | }; 480 | class Tree: public Control 481 | { 482 | public: 483 | Tree() : Control(IupTree()) {} 484 | Tree(Ihandle* _ih) : Control(_ih) {} 485 | Tree(const Element& elem) : Control(elem.GetHandle()) {} 486 | 487 | int SetUserId(int id, void* userid) { return IupTreeSetUserId(ih, id, userid); } 488 | void* GetUserId(int id) { return IupTreeGetUserId(ih, id); } 489 | int GetId(void *userid) { return IupTreeGetId(ih, userid); } 490 | }; 491 | class Val : public Control 492 | { 493 | public: 494 | Val(const char* orientation = 0) : Control(IupVal(orientation)) {} 495 | Val(Ihandle* _ih) : Control(_ih) {} 496 | Val(const Element& elem) : Control(elem.GetHandle()) {} 497 | }; 498 | class ProgressBar: public Control 499 | { 500 | public: 501 | ProgressBar() : Control(IupProgressBar()) {} 502 | ProgressBar(Ihandle* _ih) : Control(_ih) {} 503 | ProgressBar(const Element& elem) : Control(elem.GetHandle()) {} 504 | }; 505 | class List: public Control 506 | { 507 | public: 508 | List() : Control(IupList(0)) {} 509 | List(Ihandle* _ih) : Control(_ih) {} 510 | List(const Element& elem) : Control(elem.GetHandle()) {} 511 | }; 512 | class Text : public Control 513 | { 514 | public: 515 | Text() : Control(IupText(0)) {} 516 | Text(Ihandle* _ih) : Control(_ih) {} 517 | Text(const Element& elem) : Control(elem.GetHandle()) {} 518 | }; 519 | 520 | class Split : public Container 521 | { 522 | public: 523 | Split() : Container(IupSplit(0, 0)) {} 524 | Split(Control child) : Container(IupSplit(child.GetHandle(), 0)) {} 525 | Split(Control child1, Control child2) : Container(IupSplit(child1.GetHandle(), child2.GetHandle())) {} 526 | Split(const Split& split) : Container(split.GetHandle()) {} 527 | Split(Ihandle* _ih) : Container(_ih) {} 528 | }; 529 | class Submenu : public Container 530 | { 531 | public: 532 | Submenu(const char* title = 0) : Container(IupSubmenu(title, 0)) {} 533 | Submenu(const char* title, Control child) : Container(IupSubmenu(title, child.GetHandle())) {} 534 | Submenu(const Submenu& container) : Container(container.GetHandle()) {} 535 | Submenu(Ihandle* _ih) : Container(_ih) {} 536 | }; 537 | class Radio : public Container 538 | { 539 | public: 540 | Radio() : Container(IupRadio(0)) {} 541 | Radio(Control child) : Container(IupRadio(child.GetHandle())) {} 542 | Radio(const Radio& container) : Container(container.GetHandle()) {} 543 | Radio(Ihandle* _ih) : Container(_ih) {} 544 | }; 545 | class Sbox : public Container 546 | { 547 | public: 548 | Sbox() : Container(IupSbox(0)) {} 549 | Sbox(Control child) : Container(IupSbox(child.GetHandle())) {} 550 | Sbox(const Sbox& container) : Container(container.GetHandle()) {} 551 | Sbox(Ihandle* _ih) : Container(_ih) {} 552 | }; 553 | class ScrollBox : public Container 554 | { 555 | public: 556 | ScrollBox() : Container(IupScrollBox(0)) {} 557 | ScrollBox(Control child) : Container(IupScrollBox(child.GetHandle())) {} 558 | ScrollBox(const ScrollBox& container) : Container(container.GetHandle()) {} 559 | ScrollBox(Ihandle* _ih) : Container(_ih) {} 560 | }; 561 | class FlatScrollBox : public Container 562 | { 563 | public: 564 | FlatScrollBox() : Container(IupFlatScrollBox(0)) {} 565 | FlatScrollBox(Control child) : Container(IupFlatScrollBox(child.GetHandle())) {} 566 | FlatScrollBox(const FlatScrollBox& container) : Container(container.GetHandle()) {} 567 | FlatScrollBox(Ihandle* _ih) : Container(_ih) {} 568 | }; 569 | class Expander : public Container 570 | { 571 | public: 572 | Expander(const Expander& container) : Container(container.GetHandle()) {} 573 | Expander() : Container(IupExpander(0)) {} 574 | Expander(Control child) : Container(IupExpander(child.GetHandle())) {} 575 | Expander(Ihandle* _ih) : Container(_ih) {} 576 | }; 577 | class DetachBox : public Container 578 | { 579 | public: 580 | DetachBox(const DetachBox& container) : Container(container.GetHandle()) {} 581 | DetachBox() : Container(IupDetachBox(0)) {} 582 | DetachBox(Control child) : Container(IupDetachBox(child.GetHandle())) {} 583 | DetachBox(Ihandle* _ih) : Container(_ih) {} 584 | }; 585 | class BackgroundBox : public Container 586 | { 587 | public: 588 | BackgroundBox() : Container(IupBackgroundBox(0)) {} 589 | BackgroundBox(Control child) : Container(IupBackgroundBox(child.GetHandle())) {} 590 | BackgroundBox(const BackgroundBox& container) : Container(container.GetHandle()) {} 591 | BackgroundBox(Ihandle* _ih) : Container(_ih) {} 592 | 593 | void DrawBegin() { IupDrawBegin(ih); } 594 | void DrawEnd() { IupDrawEnd(ih); } 595 | void DrawSetClipRect(int x1, int y1, int x2, int y2) { IupDrawSetClipRect(ih, x1, y1, x2, y2); } 596 | void DrawGetClipRect(int *x1, int *y1, int *x2, int *y2) { IupDrawGetClipRect(ih, x1, y1, x2, y2); } 597 | void DrawResetClip() { IupDrawResetClip(ih); } 598 | void DrawParentBackground() { IupDrawParentBackground(ih); } 599 | void DrawLine(int x1, int y1, int x2, int y2) { IupDrawLine(ih, x1, y1, x2, y2); } 600 | void DrawRectangle(int x1, int y1, int x2, int y2) { IupDrawRectangle(ih, x1, y1, x2, y2); } 601 | void DrawArc(int x1, int y1, int x2, int y2, double a1, double a2) { IupDrawArc(ih, x1, y1, x2, y2, a1, a2); } 602 | void DrawPolygon(int* points, int count) { IupDrawPolygon(ih, points, count); } 603 | void DrawText(const char* text, int len, int x, int y, int w, int h) { IupDrawText(ih, text, len, x, y, w, h); } 604 | void DrawImage(const char* name, int x, int y, int w, int h) { IupDrawImage(ih, name, x, y, h, h); } 605 | void DrawSelectRect(int x1, int y1, int x2, int y2) { IupDrawSelectRect(ih, x1, y1, x2, y2); } 606 | void DrawFocusRect(int x1, int y1, int x2, int y2) { IupDrawFocusRect(ih, x1, y1, x2, y2); } 607 | void DrawGetSize(int &w, int &h) { IupDrawGetSize(ih, &w, &h); } 608 | void DrawGetTextSize(const char* str, int len, int &w, int &h) { IupDrawGetTextSize(ih, str, len, &w, &h); } 609 | void DrawGetImageInfo(const char* name, int &w, int &h, int &bpp) { IupDrawGetImageInfo(name, &w, &h, &bpp); } 610 | }; 611 | 612 | class Frame : public Container 613 | { 614 | public: 615 | Frame() : Container(IupFrame(0)) {} 616 | Frame(Control child) : Container(IupFrame(child.GetHandle())) {} 617 | Frame(const Frame& container) : Container(container.GetHandle()) {} 618 | Frame(Ihandle* _ih) : Container(_ih) {} 619 | }; 620 | class FlatFrame : public Container 621 | { 622 | public: 623 | FlatFrame() : Container(IupFlatFrame(0)) {} 624 | FlatFrame(Control child) : Container(IupFlatFrame(child.GetHandle())) {} 625 | FlatFrame(const FlatFrame& container) : Container(container.GetHandle()) {} 626 | FlatFrame(Ihandle* _ih) : Container(_ih) {} 627 | }; 628 | class Spinbox : public Container 629 | { 630 | public: 631 | Spinbox() : Container(IupSpinbox(0)) {} 632 | Spinbox(Control child) : Container(IupSpinbox(child.GetHandle())) {} 633 | Spinbox(const Spinbox& container) : Container(container.GetHandle()) {} 634 | Spinbox(Ihandle* _ih) : Container(_ih) {} 635 | }; 636 | 637 | class Vbox : public Container 638 | { 639 | Vbox(const Vbox& box) : Container(box.GetHandle()) {} /* to avoid hierarchy construction problems */ 640 | public: 641 | Vbox() : Container(IupVbox(0)) {} 642 | Vbox(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 643 | : Container(IupVbox(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 644 | Vbox(const Control *child_array, int count) : Container(IupVbox(0), child_array, count) {} 645 | Vbox(Ihandle* _ih) : Container(_ih) {} 646 | }; 647 | class Hbox : public Container 648 | { 649 | Hbox(const Hbox& box) : Container(box.GetHandle()) {} /* to avoid hierarchy construction problems */ 650 | public: 651 | Hbox() : Container(IupHbox(0)) {} 652 | Hbox(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 653 | : Container(IupHbox(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 654 | Hbox(const Control *child_array, int count) : Container(IupHbox(0), child_array, count) {} 655 | Hbox(Ihandle* _ih) : Container(_ih) {} 656 | }; 657 | class Zbox : public Container 658 | { 659 | public: 660 | Zbox() : Container(IupZbox(0)) {} 661 | Zbox(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 662 | : Container(IupZbox(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 663 | Zbox(const Control *child_array, int count) : Container(IupZbox(0), child_array, count) {} 664 | Zbox(const Zbox& box) : Container(box.GetHandle()) {} 665 | Zbox(Ihandle* _ih) : Container(_ih) {} 666 | }; 667 | class Cbox : public Container 668 | { 669 | public: 670 | Cbox() : Container(IupCbox(0)) {} 671 | Cbox(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 672 | : Container(IupCbox(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 673 | Cbox(const Control *child_array, int count) : Container(IupCbox(0), child_array, count) {} 674 | Cbox(const Cbox& box) : Container(box.GetHandle()) {} 675 | Cbox(Ihandle* _ih) : Container(_ih) {} 676 | }; 677 | class Tabs : public Container 678 | { 679 | public: 680 | Tabs() : Container(IupTabs(0)) {} 681 | Tabs(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 682 | : Container(IupTabs(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 683 | Tabs(const Control *child_array, int count) : Container(IupTabs(0), child_array, count) {} 684 | Tabs(const Tabs& tabs) : Container(tabs.GetHandle()) {} 685 | Tabs(Ihandle* _ih) : Container(_ih) {} 686 | }; 687 | class FlatTabs : public Container 688 | { 689 | public: 690 | FlatTabs() : Container(IupFlatTabs(0)) {} 691 | FlatTabs(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 692 | : Container(IupFlatTabs(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 693 | FlatTabs(const Control *child_array, int count) : Container(IupFlatTabs(0), child_array, count) {} 694 | FlatTabs(const FlatTabs& tabs) : Container(tabs.GetHandle()) {} 695 | FlatTabs(Ihandle* _ih) : Container(_ih) {} 696 | }; 697 | class GridBox : public Container 698 | { 699 | public: 700 | GridBox() : Container(IupGridBox(0)) {} 701 | GridBox(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 702 | : Container(IupGridBox(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 703 | GridBox(const Control *child_array, int count) : Container(IupGridBox(0), child_array, count) {} 704 | GridBox(const GridBox& box) : Container(box.GetHandle()) {} 705 | GridBox(Ihandle* _ih) : Container(_ih) {} 706 | }; 707 | class ParamBox : public Container 708 | { 709 | public: 710 | ParamBox() : Container(IupParamBox(0)) {} 711 | ParamBox(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 712 | : Container(IupParamBox(child0.GetHandle(), child1.GetHandle(), child2.GetHandle(), child3.GetHandle(), child4.GetHandle(), child5.GetHandle(), child6.GetHandle(), child7.GetHandle(), child8.GetHandle(), child9.GetHandle(), 0)) {} 713 | ParamBox(const Control *child_array, int count) : Container(IupParamBox(0), child_array, count) {} 714 | ParamBox(const ParamBox& box) : Container(box.GetHandle()) {} 715 | ParamBox(Ihandle* _ih) : Container(_ih) {} 716 | }; 717 | class Normalizer : public Container 718 | { 719 | public: 720 | Normalizer() : Container(IupNormalizer(0)) {} 721 | Normalizer(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 722 | : Container(IupNormalizer(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 723 | Normalizer(const Control *child_array, int count) : Container(IupNormalizer(0), child_array, count) {} 724 | Normalizer(const Normalizer& elem) : Container(elem.GetHandle()) {} 725 | Normalizer(Ihandle* _ih) : Container(_ih) {} 726 | }; 727 | 728 | 729 | class FileDlg : public Dialog 730 | { 731 | public: 732 | FileDlg() : Dialog(IupFileDlg()) {} 733 | }; 734 | class MessageDlg : public Dialog 735 | { 736 | public: 737 | MessageDlg() : Dialog(IupMessageDlg()) {} 738 | }; 739 | class ColorDlg : public Dialog 740 | { 741 | public: 742 | ColorDlg() : Dialog(IupColorDlg()) {} 743 | }; 744 | class FontDlg : public Dialog 745 | { 746 | public: 747 | FontDlg() : Dialog(IupFontDlg()) {} 748 | }; 749 | class ProgressDlg : public Dialog 750 | { 751 | public: 752 | ProgressDlg() : Dialog(IupProgressDlg()) {} 753 | }; 754 | class ScintillaDlg : public Dialog 755 | { 756 | public: 757 | ScintillaDlg() : Dialog(IupScintillaDlg()) {} 758 | }; 759 | #ifdef LUA_VERSION 760 | public: 761 | LuaScripterDlg(lua_State *L) : Dialog(IupLuaScripterDlg(L)) {} 762 | }; 763 | #endif 764 | 765 | class GLCanvas : public Control 766 | { 767 | public: 768 | GLCanvas() : Control(IupGLCanvas(0)) {} 769 | GLCanvas(Ihandle* _ih) : Control(_ih) {} 770 | GLCanvas(const Element& elem) : Control(elem.GetHandle()) {} 771 | 772 | static void Open() { IupGLCanvasOpen(); } 773 | 774 | void MakeCurrent() { IupGLMakeCurrent(ih); } 775 | int IsCurrent() { return IupGLIsCurrent(ih); } 776 | void SwapBuffers() { IupGLSwapBuffers(ih); } 777 | void Palette(int index, float r, float g, float b) { IupGLPalette(ih, index, r, g, b); } 778 | void UseFont(int first, int count, int list_base) { IupGLUseFont(ih, first, count, list_base); } 779 | 780 | static void Wait(int gl) { IupGLWait(gl); } 781 | }; 782 | class GLBackgroundBox : public Container 783 | { 784 | public: 785 | GLBackgroundBox() : Container(IupGLBackgroundBox(0)) {} 786 | GLBackgroundBox(Control child) : Container(IupGLBackgroundBox(child.GetHandle())) {} 787 | GLBackgroundBox(const GLBackgroundBox& container) : Container(container.GetHandle()) {} 788 | GLBackgroundBox(Ihandle* _ih) : Container(_ih) {} 789 | }; 790 | 791 | class Controls 792 | { 793 | public: 794 | static void Open() { IupControlsOpen(); } 795 | }; 796 | class Dial : public Control 797 | { 798 | public: 799 | Dial(const char* orientation = 0) : Control(IupDial(orientation)) {} 800 | Dial(Ihandle* _ih) : Control(_ih) {} 801 | Dial(const Element& elem) : Control(elem.GetHandle()) {} 802 | }; 803 | class Gauge : public Control 804 | { 805 | public: 806 | Gauge() : Control(IupGauge()) {} 807 | Gauge(Ihandle* _ih) : Control(_ih) {} 808 | Gauge(const Element& elem) : Control(elem.GetHandle()) {} 809 | }; 810 | class ColorBrowser : public Control 811 | { 812 | public: 813 | ColorBrowser() : Control(IupColorBrowser()) {} 814 | ColorBrowser(Ihandle* _ih) : Control(_ih) {} 815 | ColorBrowser(const Element& elem) : Control(elem.GetHandle()) {} 816 | }; 817 | class Cells : public Control 818 | { 819 | public: 820 | Cells() : Control(IupCells()) {} 821 | Cells(Ihandle* _ih) : Control(_ih) {} 822 | Cells(const Element& elem) : Control(elem.GetHandle()) {} 823 | }; 824 | class Colorbar : public Control 825 | { 826 | public: 827 | Colorbar() : Control(IupColorbar()) {} 828 | Colorbar(Ihandle* _ih) : Control(_ih) {} 829 | Colorbar(const Element& elem) : Control(elem.GetHandle()) {} 830 | }; 831 | class Matrix : public Control 832 | { 833 | public: 834 | Matrix() : Control(IupMatrix(0)) {} 835 | Matrix(Ihandle* _ih) : Control(_ih) {} 836 | Matrix(const Element& elem) : Control(elem.GetHandle()) {} 837 | 838 | void SetFormula(int col, const char* formula, const char* init = 0) { IupMatrixSetFormula(ih, col, formula, init); } 839 | void SetDynamic(const char* init = 0) { IupMatrixSetDynamic(ih, init); } 840 | }; 841 | class MatrixList : public Control 842 | { 843 | public: 844 | MatrixList() : Control(IupMatrixList()) {} 845 | MatrixList(Ihandle* _ih) : Control(_ih) {} 846 | MatrixList(const Element& elem) : Control(elem.GetHandle()) {} 847 | }; 848 | class MatrixEx : public Control 849 | { 850 | public: 851 | MatrixEx() : Control(IupMatrixEx()) {} 852 | MatrixEx(Ihandle* _ih) : Control(_ih) {} 853 | MatrixEx(const Element& elem) : Control(elem.GetHandle()) {} 854 | }; 855 | class GLControls 856 | { 857 | public: 858 | static void Open() { IupGLControlsOpen(); } 859 | }; 860 | class GLSubCanvas : public Control 861 | { 862 | public: 863 | GLSubCanvas() : Control(IupGLSubCanvas()) {} 864 | GLSubCanvas(Ihandle* _ih) : Control(_ih) {} 865 | GLSubCanvas(const Element& elem) : Control(elem.GetHandle()) {} 866 | }; 867 | class GLSeparator : public Control 868 | { 869 | public: 870 | GLSeparator() : Control(IupGLSeparator()) {} 871 | GLSeparator(Ihandle* _ih) : Control(_ih) {} 872 | GLSeparator(const Element& elem) : Control(elem.GetHandle()) {} 873 | }; 874 | class GLProgressBar : public Control 875 | { 876 | public: 877 | GLProgressBar() : Control(IupGLProgressBar()) {} 878 | GLProgressBar(Ihandle* _ih) : Control(_ih) {} 879 | GLProgressBar(const Element& elem) : Control(elem.GetHandle()) {} 880 | }; 881 | class GLVal : public Control 882 | { 883 | public: 884 | GLVal() : Control(IupGLVal()) {} 885 | GLVal(Ihandle* _ih) : Control(_ih) {} 886 | GLVal(const Element& elem) : Control(elem.GetHandle()) {} 887 | }; 888 | class GLLabel : public Control 889 | { 890 | public: 891 | GLLabel(const char* title = 0) : Control(IupGLLabel(title)) {} 892 | GLLabel(Ihandle* _ih) : Control(_ih) {} 893 | GLLabel(const Element& elem) : Control(elem.GetHandle()) {} 894 | }; 895 | class GLButton : public Control 896 | { 897 | public: 898 | GLButton(const char* title = 0) : Control(IupGLButton(title)) {} 899 | GLButton(Ihandle* _ih) : Control(_ih) {} 900 | GLButton(const Element& elem) : Control(elem.GetHandle()) {} 901 | }; 902 | class GLToggle : public Control 903 | { 904 | public: 905 | GLToggle(const char* title = 0) : Control(IupGLToggle(title)) {} 906 | GLToggle(Ihandle* _ih) : Control(_ih) {} 907 | GLToggle(const Element& elem) : Control(elem.GetHandle()) {} 908 | }; 909 | class GLLink : public Control 910 | { 911 | public: 912 | GLLink(const char *url = 0, const char* title = 0) : Control(IupGLLink(url, title)) {} 913 | GLLink(Ihandle* _ih) : Control(_ih) {} 914 | GLLink(const Element& elem) : Control(elem.GetHandle()) {} 915 | }; 916 | class GLFrame : public Container 917 | { 918 | public: 919 | GLFrame(Control child) : Container(IupGLFrame(child.GetHandle())) {} 920 | GLFrame() : Container(IupGLFrame(0)) {} 921 | GLFrame(const GLFrame& container) : Container(container.GetHandle()) {} 922 | GLFrame(Ihandle* _ih) : Container(_ih) {} 923 | }; 924 | class GLExpander : public Container 925 | { 926 | public: 927 | GLExpander(Control child) : Container(IupGLExpander(child.GetHandle())) {} 928 | GLExpander() : Container(IupGLExpander(0)) {} 929 | GLExpander(const GLExpander& container) : Container(container.GetHandle()) {} 930 | GLExpander(Ihandle* _ih) : Container(_ih) {} 931 | }; 932 | class GLScrollBox : public Container 933 | { 934 | public: 935 | GLScrollBox(Control child) : Container(IupGLScrollBox(child.GetHandle())) {} 936 | GLScrollBox() : Container(IupGLScrollBox(0)) {} 937 | GLScrollBox(const GLScrollBox& container) : Container(container.GetHandle()) {} 938 | GLScrollBox(Ihandle* _ih) : Container(_ih) {} 939 | }; 940 | class GLSizeBox : public Container 941 | { 942 | public: 943 | GLSizeBox(Control child) : Container(IupGLSizeBox(child.GetHandle())) {} 944 | GLSizeBox() : Container(IupGLSizeBox(0)) {} 945 | GLSizeBox(const GLSizeBox& container) : Container(container.GetHandle()) {} 946 | GLSizeBox(Ihandle* _ih) : Container(_ih) {} 947 | }; 948 | class GLCanvasBox : public Container 949 | { 950 | public: 951 | GLCanvasBox() : Container(IupGLCanvasBox(0)) {} 952 | GLCanvasBox(Control child0, Control child1 = (Ihandle*)0, Control child2 = (Ihandle*)0, Control child3 = (Ihandle*)0, Control child4 = (Ihandle*)0, Control child5 = (Ihandle*)0, Control child6 = (Ihandle*)0, Control child7 = (Ihandle*)0, Control child8 = (Ihandle*)0, Control child9 = (Ihandle*)0) 953 | : Container(IupGLCanvasBox(0), child0, child1, child2, child3, child4, child5, child6, child7, child8, child9) {} 954 | GLCanvasBox(const Control *child_array, int count) : Container(IupGLCanvasBox(0), child_array, count) {} 955 | GLCanvasBox(const GLCanvasBox& container) : Container(container.GetHandle()) {} 956 | GLCanvasBox(Ihandle* _ih) : Container(_ih) {} 957 | }; 958 | class Plot : public Control 959 | { 960 | public: 961 | Plot() : Control(IupPlot()) {} 962 | Plot(Ihandle* _ih) : Control(_ih) {} 963 | Plot(const Element& elem) : Control(elem.GetHandle()) {} 964 | 965 | static void Open() { IupPlotOpen(); } 966 | 967 | void Begin(int strXdata) { IupPlotBegin(ih, strXdata); } 968 | void Add(double x, double y) { IupPlotAdd(ih, x, y); } 969 | void AddStr(const char* x, double y) { IupPlotAddStr(ih, x, y); } 970 | void AddSegment(double x, double y) { IupPlotAddSegment(ih, x, y); } 971 | int End() { return IupPlotEnd(ih); } 972 | 973 | int LoadData(const char* filename, int strXdata) { return IupPlotLoadData(ih, filename, strXdata); } 974 | 975 | int SetFormula(int sample_count, const char* formula, const char* init) { return IupPlotSetFormula(ih, sample_count, formula, init); } 976 | 977 | void Insert(int ds_index, int sample_index, double x, double y) { IupPlotInsert(ih, ds_index, sample_index, x, y); } 978 | void InsertStr(int ds_index, int sample_index, const char* x, double y) { IupPlotInsertStr(ih, ds_index, sample_index, x, y); } 979 | void InsertSegment(int ds_index, int sample_index, double x, double y) { IupPlotInsertSegment(ih, ds_index, sample_index, x, y); } 980 | 981 | void InsertStrSamples(int ds_index, int sample_index, const char** x, double* y, int count) { IupPlotInsertStrSamples(ih, ds_index, sample_index, x, y, count); } 982 | void InsertSamples(int ds_index, int sample_index, double *x, double *y, int count) { IupPlotInsertSamples(ih, ds_index, sample_index, x, y, count); } 983 | 984 | void AddSamples(int ds_index, double *x, double *y, int count) { IupPlotAddSamples(ih, ds_index, x, y, count); } 985 | void AddStrSamples(int ds_index, const char** x, double* y, int count) { IupPlotAddStrSamples(ih, ds_index, x, y, count); } 986 | 987 | void GetSample(int ds_index, int sample_index, double &x, double &y) { IupPlotGetSample(ih, ds_index, sample_index, &x, &y); } 988 | void GetSampleStr(int ds_index, int sample_index, const char* &x, double &y) { IupPlotGetSampleStr(ih, ds_index, sample_index, &x, &y); } 989 | int GetSampleSelection(int ds_index, int sample_index) { return IupPlotGetSampleSelection(ih, ds_index, sample_index); } 990 | double GetSampleExtra(int ds_index, int sample_index) { return IupPlotGetSampleExtra(ih, ds_index, sample_index); } 991 | void SetSample(int ds_index, int sample_index, double x, double y) { IupPlotSetSample(ih, ds_index, sample_index, x, y); } 992 | void SetSampleStr(int ds_index, int sample_index, const char* x, double y) { IupPlotSetSampleStr(ih, ds_index, sample_index, x, y); } 993 | void SetSampleSelection(int ds_index, int sample_index, int selected) { IupPlotSetSampleSelection(ih, ds_index, sample_index, selected); } 994 | void SetSampleExtra(int ds_index, int sample_index, double extra) { IupPlotSetSampleExtra(ih, ds_index, sample_index, extra); } 995 | 996 | void Transform(double x, double y, double &cnv_x, double &cnv_y) { IupPlotTransform(ih, x, y, &cnv_x, &cnv_y); } 997 | void TransformTo(double cnv_x, double cnv_y, double &x, double &y) { IupPlotTransformTo(ih, cnv_x, cnv_y, &x, &y); } 998 | 999 | int FindSample(double cnv_x, double cnv_y, int &ds_index, int &sample_index) { return IupPlotFindSample(ih, cnv_x, cnv_y, &ds_index, &sample_index); } 1000 | 1001 | #ifdef __CD_PLUS_H 1002 | void PaintTo(cd::Canvas& cd_canvas) { IupPlotPaintTo(ih, cd_canvas.GetHandle()); } 1003 | #endif 1004 | }; 1005 | class MglPlot : public Control 1006 | { 1007 | public: 1008 | MglPlot() : Control(IupMglPlot()) {} 1009 | MglPlot(Ihandle* _ih) : Control(_ih) {} 1010 | MglPlot(const Element& elem) : Control(elem.GetHandle()) {} 1011 | 1012 | static void Open() { IupMglPlotOpen(); } 1013 | 1014 | void Begin(int dim) { IupMglPlotBegin(ih, dim); } 1015 | void Add1D(const char* name, double y) { IupMglPlotAdd1D(ih, name, y); } 1016 | void Add2D(double x, double y) { IupMglPlotAdd2D(ih, x, y); } 1017 | void Add3D(double x, double y, double z) { IupMglPlotAdd3D(ih, x, y, z); } 1018 | int End() { return IupMglPlotEnd(ih); } 1019 | 1020 | int NewDataSet(int dim) { return IupMglPlotNewDataSet(ih, dim); } 1021 | 1022 | void Insert1D(int ds_index, int sample_index, const char** names, const double* y, int count) { IupMglPlotInsert1D(ih, ds_index, sample_index, names, y, count); } 1023 | void Insert2D(int ds_index, int sample_index, const double* x, const double* y, int count) { IupMglPlotInsert2D(ih, ds_index, sample_index, x, y, count); } 1024 | void Insert3D(int ds_index, int sample_index, const double* x, const double* y, const double* z, int count) { IupMglPlotInsert3D(ih, ds_index, sample_index, x, y, z, count); } 1025 | 1026 | void Set1D(int ds_index, const char** names, const double* y, int count) { IupMglPlotSet1D(ih, ds_index, names, y, count); } 1027 | void Set2D(int ds_index, const double* x, const double* y, int count) { IupMglPlotSet2D(ih, ds_index, x, y, count); } 1028 | void Set3D(int ds_index, const double* x, const double* y, const double* z, int count) { IupMglPlotSet3D(ih, ds_index, x, y, z, count); } 1029 | void SetFormula(int ds_index, const char* formulaX, const char* formulaY, const char* formulaZ, int count) { IupMglPlotSetFormula(ih, ds_index, formulaX, formulaY, formulaZ, count); } 1030 | 1031 | void SetData(int ds_index, const double* data, int count_x, int count_y, int count_z) { IupMglPlotSetData(ih, ds_index, data, count_x, count_y, count_z); } 1032 | void LoadData(int ds_index, const char* filename, int count_x, int count_y, int count_z) { IupMglPlotLoadData(ih, ds_index, filename, count_x, count_y, count_z); } 1033 | void SetFromFormula(int ds_index, const char* formula, int count_x, int count_y, int count_z) { IupMglPlotSetFromFormula(ih, ds_index, formula, count_x, count_y, count_z); } 1034 | 1035 | void Transform(double x, double y, double z, int &ix, int &iy) { IupMglPlotTransform(ih, x, y, z, &ix, &iy); } 1036 | void TransformTo(int ix, int iy, double &x, double &y, double &z) { IupMglPlotTransformTo(ih, ix, iy, &x, &y, &z); } 1037 | 1038 | void DrawMark(double x, double y, double z) { IupMglPlotDrawMark(ih, x, y, z); } 1039 | void DrawLine(double x1, double y1, double z1, double x2, double y2, double z2) { IupMglPlotDrawLine(ih, x1, y1, z1, x2, y2, z2); } 1040 | void DrawText(const char* text, double x, double y, double z) { IupMglPlotDrawText(ih, text, x, y, z); } 1041 | 1042 | void PaintTo(const char* format, int w, int h, double dpi, unsigned char* data) { IupMglPlotPaintTo(ih, format, w, h, dpi, (void*)data); } 1043 | void PaintTo(const char* format, int w, int h, double dpi, const char* filename) { IupMglPlotPaintTo(ih, format, w, h, dpi, (void*)filename); } 1044 | 1045 | }; 1046 | class MglLabel : public Control 1047 | { 1048 | public: 1049 | MglLabel(const char* title) : Control(IupMglLabel(title)) {} 1050 | MglLabel(Ihandle* _ih) : Control(_ih) {} 1051 | MglLabel(const Element& elem) : Control(elem.GetHandle()) {} 1052 | }; 1053 | class OleControl : public Control 1054 | { 1055 | public: 1056 | OleControl(const char* progid) : Control(IupOleControl(progid)) {} 1057 | OleControl(Ihandle* _ih) : Control(_ih) {} 1058 | OleControl(const Element& elem) : Control(elem.GetHandle()) {} 1059 | 1060 | static void Open() { IupOleControlOpen(); } 1061 | }; 1062 | class WebBrowser : public Control 1063 | { 1064 | public: 1065 | WebBrowser() : Control(IupWebBrowser()) {} 1066 | WebBrowser(Ihandle* _ih) : Control(_ih) {} 1067 | WebBrowser(const Element& elem) : Control(elem.GetHandle()) {} 1068 | 1069 | static void Open() { IupWebBrowserOpen(); } 1070 | }; 1071 | class Scintilla : public Control 1072 | { 1073 | public: 1074 | Scintilla(): Control(IupScintilla()) {} 1075 | Scintilla(Ihandle* _ih) : Control(_ih) {} 1076 | Scintilla(const Element& elem) : Control(elem.GetHandle()) {} 1077 | 1078 | static void Open() { IupScintillaOpen(); } 1079 | }; 1080 | class TuioClient : public Element 1081 | { 1082 | public: 1083 | TuioClient(int port) : Element(IupTuioClient(port)) {} 1084 | TuioClient(Ihandle* _ih) : Element(_ih) {} 1085 | TuioClient(const Element& elem) : Element(elem.GetHandle()) {} 1086 | 1087 | static void Open() { IupTuioOpen(); } 1088 | }; 1089 | 1090 | class Config: public Element 1091 | { 1092 | public: 1093 | Config(): Element(IupConfig()) { } 1094 | Config(Ihandle* _ih) : Element(_ih) {} 1095 | Config(const Element& elem) : Element(elem.GetHandle()) {} 1096 | 1097 | int LoadConfig() { return IupConfigLoad(ih); } 1098 | int SaveConfig() { return IupConfigSave(ih); } 1099 | 1100 | void SetVariableStrId(const char* group, const char* key, int id, const char* value) { IupConfigSetVariableStrId(ih, group, key, id, value); } 1101 | void SetVariableIntId(const char* group, const char* key, int id, int value) { IupConfigSetVariableIntId(ih, group, key, id, value); } 1102 | void SetVariableDoubleId(const char* group, const char* key, int id, double value) { IupConfigSetVariableDoubleId(ih, group, key, id, value); } 1103 | void SetVariableStr(const char* group, const char* key, const char* value) { IupConfigSetVariableStr(ih, group, key, value); } 1104 | void SetVariableInt(const char* group, const char* key, int value) { IupConfigSetVariableInt(ih, group, key, value); } 1105 | void SetVariableDouble(const char* group, const char* key, double value) { IupConfigSetVariableDouble(ih, group, key, value); } 1106 | 1107 | char* GetVariableStr(const char* group, const char* key) { return (char*)IupConfigGetVariableStr(ih, group, key); } 1108 | int GetVariableInt(const char* group, const char* key) { return IupConfigGetVariableInt(ih, group, key); } 1109 | double GetVariableDouble(const char* group, const char* key) { return IupConfigGetVariableDouble(ih, group, key); } 1110 | char* GetVariableStrId(const char* group, const char* key, int id) { return (char*)IupConfigGetVariableStrId(ih, group, key, id); } 1111 | int GetVariableIntId(const char* group, const char* key, int id) { return IupConfigGetVariableIntId(ih, group, key, id); } 1112 | double GetVariableDoubleId(const char* group, const char* key, int id) { return IupConfigGetVariableDoubleId(ih, group, key, id); } 1113 | 1114 | char* GetVariableStrDef(const char* group, const char* key, const char* def) { return (char*)IupConfigGetVariableStrDef(ih, group, key, def); } 1115 | int GetVariableIntDef(const char* group, const char* key, int def) { return IupConfigGetVariableIntDef(ih, group, key, def); } 1116 | double GetVariableDoubleDef(const char* group, const char* key, double def) { return IupConfigGetVariableDoubleDef(ih, group, key, def); } 1117 | char* GetVariableStrIdDef(const char* group, const char* key, int id, const char* def) { return (char*)IupConfigGetVariableStrIdDef(ih, group, key, id, def); } 1118 | int GetVariableIntIdDef(const char* group, const char* key, int id, int def) { return IupConfigGetVariableIntIdDef(ih, group, key, id, def); } 1119 | double GetVariableDoubleIdDef(const char* group, const char* key, int id, double def) { return IupConfigGetVariableDoubleIdDef(ih, group, key, id, def); } 1120 | 1121 | void Copy(const Config& config2, const char* exclude_prefix) { IupConfigCopy(ih, config2.GetHandle(), exclude_prefix); } 1122 | 1123 | void SetListVariable(const char *group, const char* key, const char* value, int add) { IupConfigSetListVariable(ih, group, key, value, add); } 1124 | 1125 | void RecentInit(Menu menu, Icallback recent_cb, int max_recent) { IupConfigRecentInit(ih, menu.GetHandle(), recent_cb, max_recent); } 1126 | void RecentUpdate(const char* filename) { IupConfigRecentUpdate(ih, filename); } 1127 | 1128 | void DialogShow(Dialog dialog, const char* name) { IupConfigDialogShow(ih, dialog.GetHandle(), name); } 1129 | void DialogClosed(Dialog dialog, const char* name) { IupConfigDialogClosed(ih, dialog.GetHandle(), name); } 1130 | }; 1131 | } 1132 | 1133 | #ifdef __CD_PLUS_H 1134 | namespace cd 1135 | { 1136 | class CanvasIup : public Canvas 1137 | { 1138 | public: 1139 | CanvasIup(Iup::Canvas& iup_canvas) 1140 | : Canvas() { canvas = cdCreateCanvas(CD_IUP, iup_canvas.GetHandle()); } 1141 | }; 1142 | class CanvasIupDoubleBuffer : public Canvas 1143 | { 1144 | public: 1145 | CanvasIupDoubleBuffer(Iup::Canvas& iup_canvas) 1146 | : Canvas() { canvas = cdCreateCanvas(CD_IUPDBUFFER, iup_canvas.GetHandle()); } 1147 | }; 1148 | class CanvasIupDoubleBufferRGB : public Canvas 1149 | { 1150 | public: 1151 | CanvasIupDoubleBufferRGB(Iup::Canvas& iup_canvas) 1152 | : Canvas() { canvas = cdCreateCanvas(CD_IUPDBUFFERRGB, iup_canvas.GetHandle()); } 1153 | }; 1154 | } 1155 | #endif 1156 | 1157 | #endif 1158 | -------------------------------------------------------------------------------- /include/iup/iup_scintilla.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Scintilla control. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUP_SCINTILLA_H 8 | #define __IUP_SCINTILLA_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | 15 | void IupScintillaOpen(void); 16 | 17 | Ihandle *IupScintilla(void); 18 | Ihandle *IupScintillaDlg(void); 19 | 20 | #ifdef SCINTILLA_H 21 | sptr_t IupScintillaSendMessage(Ihandle* ih, unsigned int iMessage, uptr_t wParam, sptr_t lParam); 22 | #endif 23 | 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /include/iup/iup_varg.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief IUP API with explicit variable argument parameters. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUP_VARG_H 8 | #define __IUP_VARG_H 9 | 10 | #include 11 | #include "iup.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | void IupLogV(const char* type, const char* format, va_list arglist); 18 | 19 | Ihandle* IupSetAttV(const char* handle_name, Ihandle* ih, const char* name, va_list arglist); 20 | 21 | void IupSetStrfV(Ihandle* ih, const char* name, const char* format, va_list arglist); 22 | void IupSetStrfIdV(Ihandle* ih, const char* name, int id, const char* format, va_list arglist); 23 | void IupSetStrfId2V(Ihandle* ih, const char* name, int lin, int col, const char* format, va_list arglist); 24 | 25 | Ihandle* IupSetCallbacksV(Ihandle* ih, const char *name, Icallback func, va_list arglist); 26 | 27 | Ihandle* IupCreateV(const char *classname, void* first, va_list arglist); 28 | Ihandle* IupVboxV(Ihandle* child, va_list arglist); 29 | Ihandle* IupZboxV(Ihandle* child, va_list arglist); 30 | Ihandle* IupHboxV(Ihandle* child,va_list arglist); 31 | Ihandle* IupNormalizerV(Ihandle* ih_first, va_list arglist); 32 | Ihandle* IupCboxV(Ihandle* child, va_list arglist); 33 | Ihandle* IupGridBoxV(Ihandle* child, va_list arglist); 34 | Ihandle* IupMenuV(Ihandle* child,va_list arglist); 35 | Ihandle* IupTabsV(Ihandle* child, va_list arglist); 36 | Ihandle* IupFlatTabsV(Ihandle* child, va_list arglist); 37 | 38 | void IupMessageV(const char *title, const char *format, va_list arglist); 39 | Ihandle* IupParamBoxV(Ihandle* param, va_list arglist); 40 | int IupGetParamV(const char* title, Iparamcb action, void* user_data, const char* format, va_list arglist); 41 | 42 | Ihandle* IupGLCanvasBoxV(Ihandle* child, va_list arglist); 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /include/iup/iupcbs.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Contains all function pointer typedefs. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPCBS_H 8 | #define __IUPCBS_H 9 | 10 | struct _cdCanvas; 11 | 12 | typedef int (*IFidle)(void); /* idle */ 13 | 14 | typedef void(*IFi)(int); /* globalentermodal_cb, globalleavemodal_cb, */ 15 | typedef void(*IFii)(int, int); /* globalkeypress_cb */ 16 | typedef void (*IFiis)(int, int, char*); /* globalmotion_cb */ 17 | typedef void (*IFiiiis)(int, int, int, int, char*); /* globalbutton_cb */ 18 | typedef void (*IFfiis)(float,int,int,char*); /* globalwheel_cb */ 19 | 20 | typedef int (*IFn)(Ihandle*); /* default definition, same as Icallback */ 21 | typedef int (*IFni)(Ihandle*, int); /* k_any, show_cb, toggle_action, spin_cb, branchopen_cb, branchclose_cb, executeleaf_cb, showrename_cb, rightclick_cb, extended_cb, height_cb, width_cb */ 22 | typedef int (*IFnii)(Ihandle*, int, int); /* resize_cb, caret_cb, matrix_mousemove_cb, enteritem_cb, leaveitem_cb, scrolltop_cb, dropcheck_cb, selection_cb, select_cb, switch_cb, scrolling_cb, vspan_cb, hspan_cb */ 23 | typedef int (*IFniii)(Ihandle*, int, int, int); /* trayclick_cb, edition_cb */ 24 | typedef int (*IFniiii)(Ihandle*, int, int, int, int); /* dragdrop_cb */ 25 | typedef int(*IFniiiiiiC)(Ihandle*, int, int, int, int, int, int, struct _cdCanvas*); /* draw_cb */ 26 | typedef int (*IFniiiiii)(Ihandle*, int, int, int, int, int, int); /* OLD draw_cb */ 27 | 28 | typedef int (*IFnff)(Ihandle*, float, float); /* canvas_action, plotmotion_cb (pplot) */ 29 | typedef int (*IFniff)(Ihandle*,int,float,float); /* scroll_cb */ 30 | typedef int (*IFnfiis)(Ihandle*,float,int,int,char*); /* wheel_cb */ 31 | 32 | typedef int (*IFnsVi)(Ihandle*, char*, void*, int); /* dragdata_cb */ 33 | typedef int (*IFnsViii)(Ihandle*, char*, void*, int, int, int); /* dropdata_cb */ 34 | typedef int (*IFnsiii)(Ihandle*, char*, int, int, int); /* dropfiles_cb */ 35 | 36 | typedef int (*IFnnii)(Ihandle*, Ihandle*, int, int); /* drop_cb */ 37 | typedef int (*IFnn)(Ihandle*, Ihandle*); /* savemarkers_cb, restoremarkers_cb */ 38 | typedef int (*IFnnn)(Ihandle*, Ihandle*, Ihandle*); /* tabchange_cb */ 39 | typedef int (*IFnss)(Ihandle*, char *, char *); /* file_cb */ 40 | typedef int (*IFns)(Ihandle*, char *); /* multiselect_cb */ 41 | typedef int (*IFnsi)(Ihandle*, char *, int); /* copydata_cb */ 42 | typedef int (*IFnis)(Ihandle*, int, char *); /* text_action, multiline_action, edit_cb, rename_cb */ 43 | typedef int (*IFnsii)(Ihandle*, char*, int, int); /* list_action */ 44 | typedef int (*IFniis)(Ihandle*, int, int, char*); /* motion_cb, click_cb, value_edit_cb */ 45 | typedef int (*IFniiis)(Ihandle*, int, int, int, char*); /* touch_cb, dblclick_cb */ 46 | typedef int (*IFniiiis)(Ihandle*, int, int, int, int, char*); /* button_cb, matrix_action, mousemotion_cb */ 47 | typedef int (*IFniiiiiis)(Ihandle*, int, int, int, int, int, int, char*); /* mouseclick_cb */ 48 | 49 | typedef int (*IFnIi)(Ihandle*, int*, int); /* multiselection_cb, multiunselection_cb */ 50 | typedef int (*IFnd)(Ihandle*, double); /* mousemove_cb, button_press_cb, button_release_cb */ 51 | typedef int (*IFniiIII)(Ihandle*, int, int, int*, int*, int*); /* fgcolor_cb, bgcolor_cb */ 52 | typedef int (*IFniinsii)(Ihandle*, int, int, Ihandle*, char*, int, int); /* dropselect_cb */ 53 | typedef int (*IFnccc)(Ihandle*, unsigned char, unsigned char, unsigned char); /* drag_cb, change_cb */ 54 | typedef int (*IFniIIII)(Ihandle*, int, int*, int*, int*, int*); /* multitouch_cb */ 55 | 56 | typedef int (*IFnC)(Ihandle*, struct _cdCanvas*); /* postdraw_cb, predraw_cb */ 57 | typedef int (*IFniiff)(Ihandle*, int, int, float, float); /* delete_cb (pplot) */ 58 | typedef int (*IFniiffi)(Ihandle*, int, int, float, float, int); /* select_cb (pplot) */ 59 | typedef int (*IFniidd)(Ihandle*, int, int, double, double); /* delete_cb */ 60 | typedef int (*IFniiddi)(Ihandle*, int, int, double, double, int); /* select_cb */ 61 | typedef int (*IFniiddiddi)(Ihandle*, int, int, double, double, int, double, double, int); /* clicksegment_cb */ 62 | typedef int (*IFniiffFF)(Ihandle*, int, int, float, float, float*, float*); /* edit_cb */ 63 | typedef int (*IFniiffs)(Ihandle*, int, int, float, float, char*); /* plotbutton_cb (pplot) */ 64 | typedef int (*IFniidds)(Ihandle*, int, int, double, double, char*); /* plotbutton_cb */ 65 | typedef int (*IFndds)(Ihandle*, double, double, char*); /* plotmotion_cb */ 66 | 67 | typedef char* (*sIFnii)(Ihandle*, int, int); /* value_cb, font_cb */ 68 | typedef char* (*sIFni)(Ihandle*, int); /* cell_cb */ 69 | typedef char* (*sIFniis)(Ihandle*, int, int, char*); /* translatevalue_cb */ 70 | 71 | typedef double (*dIFnii)(Ihandle*, int, int); /* numericgetvalue_cb */ 72 | typedef int (*IFniid)(Ihandle*, int, int, double); /* numericsetvalue_cb */ 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /include/iup/iupcontrols.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief initializes dial, gauge, colorbrowser, colorbar controls. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPCONTROLS_H 8 | #define __IUPCONTROLS_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | 15 | int IupControlsOpen(void); 16 | 17 | Ihandle* IupCells(void); 18 | Ihandle* IupMatrix(const char *action); 19 | Ihandle* IupMatrixList(void); 20 | Ihandle* IupMatrixEx(void); 21 | 22 | /* available only when linking with "iupluamatrix" */ 23 | void IupMatrixSetFormula(Ihandle* ih, int col, const char* formula, const char* init); 24 | void IupMatrixSetDynamic(Ihandle* ih, const char* init); 25 | 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/iup/iupdef.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Callbacks, Attributes and Attribute Values definitions. 3 | * Avoid using these definitions. Use the strings instead. 4 | * 5 | * See Copyright Notice in iup.h 6 | */ 7 | 8 | #ifndef __IUPDEF_H 9 | #define __IUPDEF_H 10 | 11 | /* ATTENTION: these are OLD definitions and they are NOT updated anymore since IUP 3.0 */ 12 | /* Avoid using them, directly use the strings instead. */ 13 | /* Define __IUPDEF_H to avoid the inclusion of this header */ 14 | 15 | #define IUP_RUN "RUN" 16 | #define IUP_ENGLISH "ENGLISH" 17 | #define IUP_PORTUGUESE "PORTUGUESE" 18 | #define IUP_SBH "SBH" 19 | #define IUP_SBV "SBV" 20 | 21 | /************************************************************************/ 22 | /* Callbacks */ 23 | /************************************************************************/ 24 | 25 | #define IUP_IDLE_ACTION "IDLE_ACTION" 26 | 27 | #define IUP_ACTION "ACTION" 28 | #define IUP_GETFOCUS_CB "GETFOCUS_CB" 29 | #define IUP_KILLFOCUS_CB "KILLFOCUS_CB" 30 | #define IUP_K_ANY "K_ANY" 31 | #define IUP_KEYPRESS_CB "KEYPRESS_CB" 32 | #define IUP_HELP_CB "HELP_CB" 33 | 34 | #define IUP_SCROLL_CB "SCROLL_CB" 35 | #define IUP_RESIZE_CB "RESIZE_CB" 36 | #define IUP_MOTION_CB "MOTION_CB" 37 | #define IUP_BUTTON_CB "BUTTON_CB" 38 | #define IUP_ENTERWINDOW_CB "ENTERWINDOW_CB" 39 | #define IUP_LEAVEWINDOW_CB "LEAVEWINDOW_CB" 40 | #define IUP_WHEEL_CB "WHEEL_CB" 41 | 42 | #define IUP_MASK_CB "MASK_CB" 43 | #define IUP_OPEN_CB "OPEN_CB" 44 | #define IUP_HIGHLIGHT_CB "HIGHLIGHT_CB" 45 | #define IUP_MENUCLOSE_CB "MENUCLOSE_CB" 46 | 47 | #define IUP_MAP_CB "MAP_CB" 48 | #define IUP_CLOSE_CB "CLOSE_CB" 49 | #define IUP_SHOW_CB "SHOW_CB" 50 | 51 | #define IUP_DROPFILES_CB "DROPFILES_CB" 52 | #define IUP_WOM_CB "WOM_CB" 53 | 54 | /************************************************************************/ 55 | /* Attributes */ 56 | /************************************************************************/ 57 | 58 | #define IUP_DIRECTION "DIRECTION" 59 | #define IUP_ACTIVE "ACTIVE" 60 | #define IUP_BGCOLOR "BGCOLOR" 61 | #define IUP_FRAMECOLOR "FRAMECOLOR" 62 | #define IUP_FGCOLOR "FGCOLOR" 63 | #define IUP_COLOR "COLOR" 64 | #define IUP_WID "WID" 65 | #define IUP_SIZE "SIZE" 66 | #define IUP_RASTERSIZE "RASTERSIZE" 67 | #define IUP_TITLE "TITLE" 68 | #define IUP_VALUE "VALUE" 69 | #define IUP_VISIBLE "VISIBLE" 70 | #define IUP_FONT "FONT" 71 | #define IUP_TIP "TIP" 72 | #define IUP_EXPAND "EXPAND" 73 | #define IUP_SEPARATOR "SEPARATOR" 74 | 75 | #define IUP_HOTSPOT "HOTSPOT" 76 | #define IUP_HEIGHT "HEIGHT" 77 | #define IUP_WIDTH "WIDTH" 78 | 79 | #define IUP_KEY "KEY" 80 | 81 | #define IUP_MULTIPLE "MULTIPLE" 82 | #define IUP_DROPDOWN "DROPDOWN" 83 | #define IUP_VISIBLE_ITEMS "VISIBLE_ITEMS" 84 | 85 | #define IUP_MARGIN "MARGIN" 86 | #define IUP_GAP "GAP" 87 | #define IUP_ALIGNMENT "ALIGNMENT" 88 | 89 | #define IUP_IMAGE "IMAGE" 90 | #define IUP_IMINACTIVE "IMINACTIVE" 91 | #define IUP_IMPRESS "IMPRESS" 92 | #define IUP_WIN_SAVEBITS "WIN_SAVEBITS" 93 | 94 | #define IUP_NC "NC" 95 | #define IUP_MASK "MASK" 96 | 97 | #define IUP_APPEND "APPEND" 98 | #define IUP_BORDER "BORDER" 99 | 100 | #define IUP_CARET "CARET" 101 | #define IUP_SELECTION "SELECTION" 102 | #define IUP_SELECTEDTEXT "SELECTEDTEXT" 103 | #define IUP_INSERT "INSERT" 104 | 105 | #define IUP_CONID "CONID" 106 | #define IUP_CURSOR "CURSOR" 107 | 108 | #define IUP_ICON "ICON" 109 | #define IUP_MENUBOX "MENUBOX" 110 | #define IUP_MINBOX "MINBOX" 111 | #define IUP_MAXBOX "MAXBOX" 112 | #define IUP_RESIZE "RESIZE" 113 | #define IUP_MENU "MENU" 114 | #define IUP_STARTFOCUS "STARTFOCUS" 115 | #define IUP_PARENTDIALOG "PARENTDIALOG" 116 | #define IUP_SHRINK "SHRINK" 117 | #define IUP_DEFAULTENTER "DEFAULTENTER" 118 | #define IUP_DEFAULTESC "DEFAULTESC" 119 | #define IUP_X "X" 120 | #define IUP_Y "Y" 121 | #define IUP_TOOLBOX "TOOLBOX" 122 | #define IUP_CONTROL "CONTROL" 123 | #define IUP_READONLY "READONLY" 124 | 125 | #define IUP_SCROLLBAR "SCROLLBAR" 126 | #define IUP_POSY "POSY" 127 | #define IUP_POSX "POSX" 128 | #define IUP_DX "DX" 129 | #define IUP_DY "DY" 130 | #define IUP_XMAX "XMAX" 131 | #define IUP_XMIN "XMIN" 132 | #define IUP_YMAX "YMAX" 133 | #define IUP_YMIN "YMIN" 134 | 135 | #define IUP_RED "255 0 0" 136 | #define IUP_GREEN "0 255 0" 137 | #define IUP_BLUE "0 0 255" 138 | 139 | #define IUP_MIN "MIN" 140 | #define IUP_MAX "MAX" 141 | 142 | #define IUP_TIME "TIME" 143 | #define IUP_DRAG "DRAG" 144 | #define IUP_DROP "DROP" 145 | #define IUP_REPAINT "REPAINT" 146 | #define IUP_TOPMOST "TOPMOST" 147 | #define IUP_CLIPCHILDREN "CLIPCHILDREN" 148 | 149 | #define IUP_DIALOGTYPE "DIALOGTYPE" 150 | #define IUP_FILE "FILE" 151 | #define IUP_MULTIPLEFILES "MULTIPLEFILES" 152 | #define IUP_FILTER "FILTER" 153 | #define IUP_FILTERUSED "FILTERUSED" 154 | #define IUP_FILTERINFO "FILTERINFO" 155 | #define IUP_EXTFILTER "EXTFILTER" 156 | #define IUP_DIRECTORY "DIRECTORY" 157 | #define IUP_ALLOWNEW "ALLOWNEW" 158 | #define IUP_NOOVERWRITEPROMPT "NOOVERWRITEPROMPT" 159 | #define IUP_NOCHANGEDIR "NOCHANGEDIR" 160 | #define IUP_FILEEXIST "FILEEXIST" 161 | #define IUP_STATUS "STATUS" 162 | 163 | #define IUP_LOCKLOOP "LOCKLOOP" 164 | #define IUP_SYSTEM "SYSTEM" 165 | #define IUP_DRIVER "DRIVER" 166 | #define IUP_SCREENSIZE "SCREENSIZE" 167 | #define IUP_SYSTEMLANGUAGE "SYSTEMLANGUAGE" 168 | #define IUP_COMPUTERNAME "COMPUTERNAME" 169 | #define IUP_USERNAME "USERNAME" 170 | 171 | #define IUP_OPEN "OPEN" 172 | #define IUP_SAVE "SAVE" 173 | #define IUP_DIR "DIR" 174 | 175 | #define IUP_HORIZONTAL "HORIZONTAL" 176 | #define IUP_VERTICAL "VERTICAL" 177 | 178 | /************************************************************************/ 179 | /* Attribute Values */ 180 | /************************************************************************/ 181 | 182 | #define IUP_YES "YES" 183 | #define IUP_NO "NO" 184 | #define IUP_ON "ON" 185 | #define IUP_OFF "OFF" 186 | 187 | #define IUP_ACENTER "ACENTER" 188 | #define IUP_ALEFT "ALEFT" 189 | #define IUP_ARIGHT "ARIGHT" 190 | #define IUP_ATOP "ATOP" 191 | #define IUP_ABOTTOM "ABOTTOM" 192 | 193 | #define IUP_NORTH "NORTH" 194 | #define IUP_SOUTH "SOUTH" 195 | #define IUP_WEST "WEST" 196 | #define IUP_EAST "EAST" 197 | #define IUP_NE "NE" 198 | #define IUP_SE "SE" 199 | #define IUP_NW "NW" 200 | #define IUP_SW "SW" 201 | 202 | #define IUP_FULLSCREEN "FULLSCREEN" 203 | #define IUP_FULL "FULL" 204 | #define IUP_HALF "HALF" 205 | #define IUP_THIRD "THIRD" 206 | #define IUP_QUARTER "QUARTER" 207 | #define IUP_EIGHTH "EIGHTH" 208 | 209 | #define IUP_ARROW "ARROW" 210 | #define IUP_BUSY "BUSY" 211 | #define IUP_RESIZE_N "RESIZE_N" 212 | #define IUP_RESIZE_S "RESIZE_S" 213 | #define IUP_RESIZE_E "RESIZE_E" 214 | #define IUP_RESIZE_W "RESIZE_W" 215 | #define IUP_RESIZE_NE "RESIZE_NE" 216 | #define IUP_RESIZE_NW "RESIZE_NW" 217 | #define IUP_RESIZE_SE "RESIZE_SE" 218 | #define IUP_RESIZE_SW "RESIZE_SW" 219 | #define IUP_MOVE "MOVE" 220 | #define IUP_HAND "HAND" 221 | #define IUP_NONE "NONE" 222 | #define IUP_IUP "IUP" 223 | #define IUP_CROSS "CROSS" 224 | #define IUP_PEN "PEN" 225 | #define IUP_TEXT "TEXT" 226 | #define IUP_RESIZE_C "RESIZE_C" 227 | #define IUP_OPENHAND "OPENHAND" 228 | 229 | /************************************************************************/ 230 | /* Keys */ 231 | /************************************************************************/ 232 | 233 | #define IUP_K_exclam "K_exclam" 234 | #define IUP_K_quotedbl "K_quotedbl" 235 | #define IUP_K_numbersign "K_numbersign" 236 | #define IUP_K_dollar "K_dollar" 237 | #define IUP_K_percent "K_percent" 238 | #define IUP_K_ampersand "K_ampersand" 239 | #define IUP_K_quoteright "K_quoteright" 240 | #define IUP_K_parentleft "K_parentleft" 241 | #define IUP_K_parentright "K_parentright" 242 | #define IUP_K_asterisk "K_asterisk" 243 | #define IUP_K_plus "K_plus" 244 | #define IUP_K_comma "K_comma" 245 | #define IUP_K_minus "K_minus" 246 | #define IUP_K_period "K_period" 247 | #define IUP_K_slash "K_slash" 248 | #define IUP_K_0 "K_0" 249 | #define IUP_K_1 "K_1" 250 | #define IUP_K_2 "K_2" 251 | #define IUP_K_3 "K_3" 252 | #define IUP_K_4 "K_4" 253 | #define IUP_K_5 "K_5" 254 | #define IUP_K_6 "K_6" 255 | #define IUP_K_7 "K_7" 256 | #define IUP_K_8 "K_8" 257 | #define IUP_K_9 "K_9" 258 | #define IUP_K_colon "K_colon" 259 | #define IUP_K_semicolon "K_semicolon " 260 | #define IUP_K_less "K_less" 261 | #define IUP_K_equal "K_equal" 262 | #define IUP_K_greater "K_greater" 263 | #define IUP_K_question "K_question" 264 | #define IUP_K_at "K_at" 265 | #define IUP_K_A "K_A" 266 | #define IUP_K_B "K_B" 267 | #define IUP_K_C "K_C" 268 | #define IUP_K_D "K_D" 269 | #define IUP_K_E "K_E" 270 | #define IUP_K_F "K_F" 271 | #define IUP_K_G "K_G" 272 | #define IUP_K_H "K_H" 273 | #define IUP_K_I "K_I" 274 | #define IUP_K_J "K_J" 275 | #define IUP_K_K "K_K" 276 | #define IUP_K_L "K_L" 277 | #define IUP_K_M "K_M" 278 | #define IUP_K_N "K_N" 279 | #define IUP_K_O "K_O" 280 | #define IUP_K_P "K_P" 281 | #define IUP_K_Q "K_Q" 282 | #define IUP_K_R "K_R" 283 | #define IUP_K_S "K_S" 284 | #define IUP_K_T "K_T" 285 | #define IUP_K_U "K_U" 286 | #define IUP_K_V "K_V" 287 | #define IUP_K_W "K_W" 288 | #define IUP_K_X "K_X" 289 | #define IUP_K_Y "K_Y" 290 | #define IUP_K_Z "K_Z" 291 | #define IUP_K_bracketleft "K_bracketleft" 292 | #define IUP_K_backslash "K_backslash" 293 | #define IUP_K_bracketright "K_bracketright" 294 | #define IUP_K_circum "K_circum" 295 | #define IUP_K_underscore "K_underscore" 296 | #define IUP_K_quoteleft "K_quoteleft" 297 | #define IUP_K_a "K_a" 298 | #define IUP_K_b "K_b" 299 | #define IUP_K_c "K_c" 300 | #define IUP_K_d "K_d" 301 | #define IUP_K_e "K_e" 302 | #define IUP_K_f "K_f" 303 | #define IUP_K_g "K_g" 304 | #define IUP_K_h "K_h" 305 | #define IUP_K_i "K_i" 306 | #define IUP_K_j "K_j" 307 | #define IUP_K_k "K_k" 308 | #define IUP_K_l "K_l" 309 | #define IUP_K_m "K_m" 310 | #define IUP_K_n "K_n" 311 | #define IUP_K_o "K_o" 312 | #define IUP_K_p "K_p" 313 | #define IUP_K_q "K_q" 314 | #define IUP_K_r "K_r" 315 | #define IUP_K_s "K_s" 316 | #define IUP_K_t "K_t" 317 | #define IUP_K_u "K_u" 318 | #define IUP_K_v "K_v" 319 | #define IUP_K_w "K_w" 320 | #define IUP_K_x "K_x" 321 | #define IUP_K_y "K_y" 322 | #define IUP_K_z "K_z" 323 | #define IUP_K_braceleft "K_braceleft" 324 | #define IUP_K_bar "K_bar" 325 | #define IUP_K_braceright "K_braceright" 326 | #define IUP_K_tilde "K_tilde" 327 | 328 | #define IUP_K_cA "K_cA" 329 | #define IUP_K_cB "K_cB" 330 | #define IUP_K_cC "K_cC" 331 | #define IUP_K_cD "K_cD" 332 | #define IUP_K_cE "K_cE" 333 | #define IUP_K_cF "K_cF" 334 | #define IUP_K_cG "K_cG" 335 | #define IUP_K_cJ "K_cJ" 336 | #define IUP_K_cK "K_cK" 337 | #define IUP_K_cL "K_cL" 338 | #define IUP_K_cN "K_cN" 339 | #define IUP_K_cO "K_cO" 340 | #define IUP_K_cP "K_cP" 341 | #define IUP_K_cQ "K_cQ" 342 | #define IUP_K_cR "K_cR" 343 | #define IUP_K_cS "K_cS" 344 | #define IUP_K_cT "K_cT" 345 | #define IUP_K_cU "K_cU" 346 | #define IUP_K_cV "K_cV" 347 | #define IUP_K_cW "K_cW" 348 | #define IUP_K_cX "K_cX" 349 | #define IUP_K_cY "K_cY" 350 | #define IUP_K_cZ "K_cZ" 351 | #define IUP_K_mA "K_mA" 352 | #define IUP_K_mB "K_mB" 353 | #define IUP_K_mC "K_mC" 354 | #define IUP_K_mD "K_mD" 355 | #define IUP_K_mE "K_mE" 356 | #define IUP_K_mF "K_mF" 357 | #define IUP_K_mG "K_mG" 358 | #define IUP_K_mH "K_mH" 359 | #define IUP_K_mI "K_mI" 360 | #define IUP_K_mJ "K_mJ" 361 | #define IUP_K_mK "K_mK" 362 | #define IUP_K_mL "K_mL" 363 | #define IUP_K_mM "K_mM" 364 | #define IUP_K_mN "K_mN" 365 | #define IUP_K_mO "K_mO" 366 | #define IUP_K_mP "K_mP" 367 | #define IUP_K_mQ "K_mQ" 368 | #define IUP_K_mR "K_mR" 369 | #define IUP_K_mS "K_mS" 370 | #define IUP_K_mT "K_mT" 371 | #define IUP_K_mU "K_mU" 372 | #define IUP_K_mV "K_mV" 373 | #define IUP_K_mW "K_mW" 374 | #define IUP_K_mX "K_mX" 375 | #define IUP_K_mY "K_mY" 376 | #define IUP_K_mZ "K_mZ" 377 | #define IUP_K_BS "K_BS" 378 | #define IUP_K_TAB "K_TAB" 379 | #define IUP_K_CR "K_CR" 380 | #define IUP_K_SP "K_SP" 381 | #define IUP_K_ESC "K_ESC" 382 | #define IUP_K_sCR "K_sCR" 383 | #define IUP_K_sTAB "K_sTAB" 384 | #define IUP_K_cTAB "K_cTAB" 385 | #define IUP_K_mTAB "K_mTAB" 386 | #define IUP_K_HOME "K_HOME" 387 | #define IUP_K_UP "K_UP" 388 | #define IUP_K_PGUP "K_PGUP" 389 | #define IUP_K_LEFT "K_LEFT" 390 | #define IUP_K_RIGHT "K_RIGHT" 391 | #define IUP_K_END "K_END" 392 | #define IUP_K_DOWN "K_DOWN" 393 | #define IUP_K_PGDN "K_PGDN" 394 | #define IUP_K_MIDDLE "K_MIDDLE" 395 | #define IUP_K_INS "K_INS" 396 | #define IUP_K_DEL "K_DEL" 397 | #define IUP_K_sHOME "K_sHOME" 398 | #define IUP_K_sUP "K_sUP" 399 | #define IUP_K_sPGUP "K_sPGUP" 400 | #define IUP_K_sLEFT "K_sLEFT" 401 | #define IUP_K_sRIGHT "K_sRIGHT" 402 | #define IUP_K_sEND "K_sEND" 403 | #define IUP_K_sDOWN "K_sDOWN" 404 | #define IUP_K_sPGDN "K_sPGDN" 405 | #define IUP_K_cHOME "K_cHOME" 406 | #define IUP_K_cPGUP "K_cPGUP" 407 | #define IUP_K_cLEFT "K_cLEFT" 408 | #define IUP_K_cRIGHT "K_cRIGHT" 409 | #define IUP_K_cEND "K_cEND" 410 | #define IUP_K_cPGDN "K_cPGDN" 411 | #define IUP_K_cUP "K_cUP" 412 | #define IUP_K_cDOWN "K_cDOWN" 413 | #define IUP_K_cMIDDLE "K_cMIDDLE" 414 | #define IUP_K_cINS "K_cINS" 415 | #define IUP_K_cDEL "K_cDEL" 416 | #define IUP_K_mHOME "K_mHOME" 417 | #define IUP_K_mPGUP "K_mPGUP" 418 | #define IUP_K_mLEFT "K_mLEFT" 419 | #define IUP_K_mRIGHT "K_mRIGHT" 420 | #define IUP_K_mEND "K_mEND" 421 | #define IUP_K_mPGDN "K_mPGDN" 422 | #define IUP_K_mUP "K_mUP" 423 | #define IUP_K_mDOWN "K_mDOWN" 424 | #define IUP_K_mINS "K_mINS" 425 | #define IUP_K_mDEL "K_mDEL" 426 | #define IUP_K_F1 "K_F1" 427 | #define IUP_K_F2 "K_F2" 428 | #define IUP_K_F3 "K_F3" 429 | #define IUP_K_F4 "K_F4" 430 | #define IUP_K_F5 "K_F5" 431 | #define IUP_K_F6 "K_F6" 432 | #define IUP_K_F7 "K_F7" 433 | #define IUP_K_F8 "K_F8" 434 | #define IUP_K_F9 "K_F9" 435 | #define IUP_K_F10 "K_F10" 436 | #define IUP_K_F11 "K_F11" 437 | #define IUP_K_F12 "K_F12" 438 | #define IUP_K_sF1 "K_sF1" 439 | #define IUP_K_sF2 "K_sF2" 440 | #define IUP_K_sF3 "K_sF3" 441 | #define IUP_K_sF4 "K_sF4" 442 | #define IUP_K_sF5 "K_sF5" 443 | #define IUP_K_sF6 "K_sF6" 444 | #define IUP_K_sF7 "K_sF7" 445 | #define IUP_K_sF8 "K_sF8" 446 | #define IUP_K_sF9 "K_sF9" 447 | #define IUP_K_sF10 "K_sF10" 448 | #define IUP_K_sF11 "K_sF11" 449 | #define IUP_K_sF12 "K_sF12" 450 | #define IUP_K_cF1 "K_cF1" 451 | #define IUP_K_cF2 "K_cF2" 452 | #define IUP_K_cF3 "K_cF3" 453 | #define IUP_K_cF4 "K_cF4" 454 | #define IUP_K_cF5 "K_cF5" 455 | #define IUP_K_cF6 "K_cF6" 456 | #define IUP_K_cF7 "K_cF7" 457 | #define IUP_K_cF8 "K_cF8" 458 | #define IUP_K_cF9 "K_cF9" 459 | #define IUP_K_cF10 "K_cF10" 460 | #define IUP_K_cF11 "K_cF11" 461 | #define IUP_K_cF12 "K_cF12" 462 | #define IUP_K_mF1 "K_mF1" 463 | #define IUP_K_mF2 "K_mF2" 464 | #define IUP_K_mF3 "K_mF3" 465 | #define IUP_K_mF4 "K_mF4" 466 | #define IUP_K_mF5 "K_mF5" 467 | #define IUP_K_mF6 "K_mF6" 468 | #define IUP_K_mF7 "K_mF7" 469 | #define IUP_K_mF8 "K_mF8" 470 | #define IUP_K_mF9 "K_mF9" 471 | #define IUP_K_mF10 "K_mF10" 472 | #define IUP_K_m1 "K_m1" 473 | #define IUP_K_m2 "K_m2" 474 | #define IUP_K_m3 "K_m3" 475 | #define IUP_K_m4 "K_m4" 476 | #define IUP_K_m5 "K_m5" 477 | #define IUP_K_m6 "K_m6" 478 | #define IUP_K_m7 "K_m7" 479 | #define IUP_K_m8 "K_m8" 480 | #define IUP_K_m9 "K_m9" 481 | #define IUP_K_m0 "K_m0" 482 | 483 | /************/ 484 | /* Colorbar */ 485 | /************/ 486 | 487 | #define IUP_NUM_PARTS "NUM_PARTS" 488 | #define IUP_NUM_CELLS "NUM_CELLS" 489 | #define IUP_CELL "CELL" 490 | #define IUP_PREVIEW_SIZE "PREVIEW_SIZE" 491 | #define IUP_SHOW_PREVIEW "SHOW_PREVIEW" 492 | #define IUP_SHOW_SECONDARY "SHOW_SECONDARY" 493 | #define IUP_PRIMARY_CELL "PRIMARY_CELL" 494 | #define IUP_SECONDARY_CELL "SECONDARY_CELL" 495 | #define IUP_ORIENTATION "ORIENTATION" 496 | #define IUP_SQUARED "SQUARED" 497 | #define IUP_SHADOWED "SHADOWED" 498 | #define IUP_BUFFERIZE "BUFFERIZE" 499 | #define IUP_TRANSPARENCY "TRANSPARENCY" 500 | #define IUP_CELL_CB "CELL_CB" 501 | #define IUP_EXTENDED_CB "EXTENDED_CB" 502 | #define IUP_SELECT_CB "SELECT_CB" 503 | #define IUP_SWITCH_CB "SWITCH_CB" 504 | #define IUP_VERTICAL "VERTICAL" 505 | #define IUP_HORIZONTAL "HORIZONTAL" 506 | 507 | /************/ 508 | /* Cells */ 509 | /************/ 510 | 511 | #define IUP_ALL "ALL" 512 | #define IUP_BOXED "BOXED" 513 | #define IUP_CLIPPED "CLIPPED" 514 | #define IUP_TRANSPARENT "TRANSPARENT" 515 | #define IUP_NON_SCROLLABLE_LINES "NON_SCROLLABLE_LINES" 516 | #define IUP_NON_SCROLLABLE_COLS "NON_SCROLLABLE_COLS" 517 | #define IUP_ORIGIN "ORIGIN" 518 | #define IUP_NO_COLOR "NO_COLOR" 519 | #define IUP_FIRST_LINE "FIRST_LINE" 520 | #define IUP_FIRST_COL "FIRST_COL" 521 | #define IUP_DOUBLE_BUFFER "DOUBLE_BUFFER" 522 | #define IUP_LIMITS "LIMITS" 523 | #define IUP_CANVAS "CANVAS" 524 | #define IUP_IMAGE_CANVAS "IMAGE_CANVAS" 525 | #define IUP_FULL_VISIBLE "FULL_VISIBLE" 526 | #define IUP_MOUSECLICK_CB "MOUSECLICK_CB" 527 | #define IUP_MOUSEMOTION_CB "MOUSEMOTION_CB" 528 | #define IUP_DRAW_CB "DRAW_CB" 529 | #define IUP_WIDTH_CB "WIDTH_CB" 530 | #define IUP_HEIGHT_CB "HEIGHT_CB" 531 | #define IUP_NLINES_CB "NLINES_CB" 532 | #define IUP_NCOLS_CB "NCOLS_CB" 533 | #define IUP_HSPAN_CB "HSPAN_CB" 534 | #define IUP_VSPAN_CB "VSPAN_CB" 535 | #define IUP_SCROLLING_CB "SCROLLING_CB" 536 | 537 | /*****************/ 538 | /* ColorBrowser */ 539 | /*****************/ 540 | 541 | #define IUP_RGB "RGB" 542 | #define IUP_CHANGE_CB "CHANGE_CB" 543 | #define IUP_DRAG_CB "DRAG_CB" 544 | 545 | /*****************/ 546 | /* Val */ 547 | /*****************/ 548 | 549 | #define ICTL_MOUSEMOVE_CB "MOUSEMOVE_CB" 550 | #define ICTL_BUTTON_PRESS_CB "BUTTON_PRESS_CB" 551 | #define ICTL_BUTTON_RELEASE_CB "BUTTON_RELEASE_CB" 552 | #define ICTL_HORIZONTAL "HORIZONTAL" 553 | #define ICTL_VERTICAL "VERTICAL" 554 | #define ICTL_SHOWTICKS "SHOWTICKS" 555 | 556 | /*****************/ 557 | /* Tabs */ 558 | /*****************/ 559 | 560 | #define ICTL_TOP "TOP" 561 | #define ICTL_BOTTOM "BOTTOM" 562 | #define ICTL_LEFT "LEFT" 563 | #define ICTL_RIGHT "RIGHT" 564 | #define ICTL_TABTYPE "TABTYPE" 565 | #define ICTL_TABTITLE "TABTITLE" 566 | #define ICTL_TABSIZE "TABSIZE" 567 | #define ICTL_TABCHANGE_CB "TABCHANGE_CB" 568 | #define ICTL_FONT "FONT" 569 | #define ICTL_FONT_ACTIVE "FONT_ACTIVE" 570 | #define ICTL_FONT_INACTIVE "FONT_INACTIVE" 571 | 572 | /*****************/ 573 | /* Gauge */ 574 | /*****************/ 575 | 576 | #define ICTL_SHOW_TEXT "SHOW_TEXT" 577 | #define ICTL_DASHED "DASHED" 578 | #define ICTL_MARGIN "MARGIN" 579 | #define ICTL_TEXT "TEXT" 580 | 581 | /*****************/ 582 | /* Dial */ 583 | /*****************/ 584 | 585 | #define ICTL_DENSITY "DENSITY" 586 | #define ICTL_HORIZONTAL "HORIZONTAL" 587 | #define ICTL_VERTICAL "VERTICAL" 588 | #define ICTL_CIRCULAR "CIRCULAR" 589 | #define ICTL_UNIT "UNIT" 590 | 591 | /*****************/ 592 | /* Matrix */ 593 | /*****************/ 594 | 595 | #define IUP_ENTERITEM_CB "ENTERITEM_CB" 596 | #define IUP_LEAVEITEM_CB "LEAVEITEM_CB" 597 | #define IUP_EDITION_CB "EDITION_CB" 598 | #define IUP_CLICK_CB "CLICK_CB" 599 | #define IUP_DROP_CB "DROP_CB" 600 | #define IUP_DROPSELECT_CB "DROPSELECT_CB" 601 | #define IUP_DROPCHECK_CB "DROPCHECK_CB" 602 | #define IUP_SCROLL_CB "SCROLL_CB" 603 | #define IUP_VALUE_CB "VALUE_CB" 604 | #define IUP_VALUE_EDIT_CB "VALUE_EDIT_CB" 605 | #define IUP_FIELD_CB "FIELD_CB" 606 | #define IUP_RESIZEMATRIX "RESIZEMATRIX" 607 | #define IUP_ADDLIN "ADDLIN" 608 | #define IUP_ADDCOL "ADDCOL" 609 | #define IUP_DELLIN "DELLIN" 610 | #define IUP_DELCOL "DELCOL" 611 | #define IUP_NUMLIN "NUMLIN" 612 | #define IUP_NUMCOL "NUMCOL" 613 | #define IUP_NUMLIN_VISIBLE "NUMLIN_VISIBLE" 614 | #define IUP_NUMCOL_VISIBLE "NUMCOL_VISIBLE" 615 | #define IUP_MARKED "MARKED" 616 | #define IUP_WIDTHDEF "WIDTHDEF" 617 | #define IUP_HEIGHTDEF "HEIGHTDEF" 618 | #define IUP_AREA "AREA" 619 | #define IUP_MARK_MODE "MARK_MODE" 620 | #define IUP_LIN "LIN" 621 | #define IUP_COL "COL" 622 | #define IUP_LINCOL "LINCOL" 623 | #define IUP_CELL "CELL" 624 | #define IUP_EDIT_MODE "EDIT_MODE" 625 | #define IUP_FOCUS_CELL "FOCUS_CELL" 626 | #define IUP_ORIGIN "ORIGIN" 627 | #define IUP_REDRAW "REDRAW" 628 | #define IUP_PREVIOUSVALUE "PREVIOUSVALUE" 629 | #define IUP_MOUSEMOVE_CB "MOUSEMOVE_CB" 630 | 631 | /*****************/ 632 | /* Tree */ 633 | /*****************/ 634 | 635 | #define IUP_ADDLEAF "ADDLEAF" 636 | #define IUP_ADDBRANCH "ADDBRANCH" 637 | #define IUP_DELNODE "DELNODE" 638 | #define IUP_IMAGELEAF "IMAGELEAF" 639 | #define IUP_IMAGEBRANCHCOLLAPSED "IMAGEBRANCHCOLLAPSED" 640 | #define IUP_IMAGEBRANCHEXPANDED "IMAGEBRANCHEXPANDED" 641 | #define IUP_IMAGEEXPANDED "IMAGEEXPANDED" 642 | #define IUP_KIND "KIND" 643 | #define IUP_PARENT "PARENT" 644 | #define IUP_DEPTH "DEPTH" 645 | #define IUP_MARKED "MARKED" 646 | #define IUP_ADDEXPANDED "ADDEXPANDED" 647 | #define IUP_CTRL "CTRL" 648 | #define IUP_SHIFT "SHIFT" 649 | #define IUP_STATE "STATE" 650 | #define IUP_STARTING "STARTING" 651 | #define IUP_LEAF "LEAF" 652 | #define IUP_BRANCH "BRANCH" 653 | #define IUP_SELECTED "SELECTED" 654 | #define IUP_CHILDREN "CHILDREN" 655 | #define IUP_MARKED "MARKED" 656 | #define IUP_ROOT "ROOT" 657 | #define IUP_LAST "LAST" 658 | #define IUP_PGUP "PGUP" 659 | #define IUP_PGDN "PGDN" 660 | #define IUP_NEXT "NEXT" 661 | #define IUP_PREVIOUS "PREVIOUS" 662 | #define IUP_INVERT "INVERT" 663 | #define IUP_BLOCK "BLOCK" 664 | #define IUP_CLEARALL "CLEARALL" 665 | #define IUP_MARKALL "MARKALL" 666 | #define IUP_INVERTALL "INVERTALL" 667 | #define IUP_REDRAW "REDRAW" 668 | #define IUP_COLLAPSED "COLLAPSED" 669 | #define IUP_EXPANDED "EXPANDED" 670 | #define IUP_SELECTION_CB "SELECTION_CB" 671 | #define IUP_BRANCHOPEN_CB "BRANCHOPEN_CB" 672 | #define IUP_BRANCHCLOSE_CB "BRANCHCLOSE_CB" 673 | #define IUP_RIGHTCLICK_CB "RIGHTCLICK_CB" 674 | #define IUP_EXECUTELEAF_CB "EXECUTELEAF_CB" 675 | #define IUP_RENAMENODE_CB "RENAMENODE_CB" 676 | #define IUP_IMGLEAF "IMGLEAF" 677 | #define IUP_IMGCOLLAPSED "IMGCOLLAPSED" 678 | #define IUP_IMGEXPANDED "IMGEXPANDED" 679 | #define IUP_IMGBLANK "IMGBLANK" 680 | #define IUP_IMGPAPER "IMGPAPER" 681 | 682 | #endif 683 | 684 | -------------------------------------------------------------------------------- /include/iup/iupdraw.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Canvas Draw API 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPDRAW_H 8 | #define __IUPDRAW_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* all functions can be used only in IUP canvas and inside the ACTION callback */ 15 | 16 | void IupDrawBegin(Ihandle* ih); 17 | void IupDrawEnd(Ihandle* ih); 18 | 19 | /* all functions can be called only between calls to Begin and End */ 20 | 21 | void IupDrawSetClipRect(Ihandle* ih, int x1, int y1, int x2, int y2); 22 | void IupDrawGetClipRect(Ihandle* ih, int *x1, int *y1, int *x2, int *y2); 23 | void IupDrawResetClip(Ihandle* ih); 24 | 25 | /* color controlled by the attribute DRAWCOLOR */ 26 | /* line style or fill controlled by the attribute DRAWSTYLE */ 27 | 28 | void IupDrawParentBackground(Ihandle* ih); 29 | void IupDrawLine(Ihandle* ih, int x1, int y1, int x2, int y2); 30 | void IupDrawRectangle(Ihandle* ih, int x1, int y1, int x2, int y2); 31 | void IupDrawArc(Ihandle* ih, int x1, int y1, int x2, int y2, double a1, double a2); 32 | void IupDrawPolygon(Ihandle* ih, int* points, int count); 33 | void IupDrawText(Ihandle* ih, const char* text, int len, int x, int y, int w, int h); 34 | void IupDrawImage(Ihandle* ih, const char* name, int x, int y, int w, int h); 35 | void IupDrawSelectRect(Ihandle* ih, int x1, int y1, int x2, int y2); 36 | void IupDrawFocusRect(Ihandle* ih, int x1, int y1, int x2, int y2); 37 | 38 | void IupDrawGetSize(Ihandle* ih, int *w, int *h); 39 | void IupDrawGetTextSize(Ihandle* ih, const char* text, int len, int *w, int *h); 40 | void IupDrawGetImageInfo(const char* name, int *w, int *h, int *bpp); 41 | 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/iup/iupdraw_cd.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief IupDraw CD driver 3 | * 4 | * See Copyright Notice in iup.h 5 | */ 6 | 7 | #ifndef __CD_IUPDRAW_H 8 | #define __CD_IUPDRAW_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | cdContext* cdContextIupDraw(void); 15 | #define CD_IUPDRAW cdContextIupDraw() 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | #endif /* ifndef __CD_IUPDRAW_ */ 22 | -------------------------------------------------------------------------------- /include/iup/iupgl.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief OpenGL canvas for Iup. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPGL_H 8 | #define __IUPGL_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* Attributes 15 | ** To set the appropriate visual (pixel format) the following 16 | ** attributes may be specified. Their values should be set 17 | ** before the canvas is mapped to the scrren. 18 | ** After mapping, changing their values has no effect. 19 | */ 20 | #ifndef IUP_BUFFER /* IUP_SINGLE (defaut) or IUP_DOUBLE */ 21 | #define IUP_BUFFER "BUFFER" 22 | #endif 23 | #ifndef IUP_STEREO /* IUP_NO (defaut) or IUP_YES */ 24 | #define IUP_STEREO "STEREO" 25 | #endif 26 | #ifndef IUP_BUFFER_SIZE /* Number of bits if index mode */ 27 | #define IUP_BUFFER_SIZE "BUFFER_SIZE" 28 | #endif 29 | #ifndef IUP_RED_SIZE /* Number of red bits */ 30 | #define IUP_RED_SIZE "RED_SIZE" 31 | #endif 32 | #ifndef IUP_GREEN_SIZE /* Number of green bits */ 33 | #define IUP_GREEN_SIZE "GREEN_SIZE" 34 | #endif 35 | #ifndef IUP_BLUE_SIZE /* Number of blue bits */ 36 | #define IUP_BLUE_SIZE "BLUE_SIZE" 37 | #endif 38 | #ifndef IUP_ALPHA_SIZE /* Number of alpha bits */ 39 | #define IUP_ALPHA_SIZE "ALPHA_SIZE" 40 | #endif 41 | #ifndef IUP_DEPTH_SIZE /* Number of bits in depth buffer */ 42 | #define IUP_DEPTH_SIZE "DEPTH_SIZE" 43 | #endif 44 | #ifndef IUP_STENCIL_SIZE /* Number of bits in stencil buffer */ 45 | #define IUP_STENCIL_SIZE "STENCIL_SIZE" 46 | #endif 47 | #ifndef IUP_ACCUM_RED_SIZE /* Number of red bits in accum. buffer */ 48 | #define IUP_ACCUM_RED_SIZE "ACCUM_RED_SIZE" 49 | #endif 50 | #ifndef IUP_ACCUM_GREEN_SIZE /* Number of green bits in accum. buffer */ 51 | #define IUP_ACCUM_GREEN_SIZE "ACCUM_GREEN_SIZE" 52 | #endif 53 | #ifndef IUP_ACCUM_BLUE_SIZE /* Number of blue bits in accum. buffer */ 54 | #define IUP_ACCUM_BLUE_SIZE "ACCUM_BLUE_SIZE" 55 | #endif 56 | #ifndef IUP_ACCUM_ALPHA_SIZE /* Number of alpha bits in accum. buffer */ 57 | #define IUP_ACCUM_ALPHA_SIZE "ACCUM_ALPHA_SIZE" 58 | #endif 59 | 60 | 61 | /* Attribute values */ 62 | #ifndef IUP_DOUBLE 63 | #define IUP_DOUBLE "DOUBLE" 64 | #endif 65 | #ifndef IUP_SINGLE 66 | #define IUP_SINGLE "SINGLE" 67 | #endif 68 | #ifndef IUP_INDEX 69 | #define IUP_INDEX "INDEX" 70 | #endif 71 | #ifndef IUP_RGBA 72 | #define IUP_RGBA "RGBA" 73 | #endif 74 | #ifndef IUP_YES 75 | #define IUP_YES "YES" 76 | #endif 77 | #ifndef IUP_NO 78 | #define IUP_NO "NO" 79 | #endif 80 | 81 | void IupGLCanvasOpen(void); 82 | 83 | Ihandle *IupGLCanvas(const char *action); 84 | Ihandle* IupGLBackgroundBox(Ihandle* child); 85 | 86 | void IupGLMakeCurrent(Ihandle* ih); 87 | int IupGLIsCurrent(Ihandle* ih); 88 | void IupGLSwapBuffers(Ihandle* ih); 89 | void IupGLPalette(Ihandle* ih, int index, float r, float g, float b); 90 | void IupGLUseFont(Ihandle* ih, int first, int count, int list_base); 91 | void IupGLWait(int gl); 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /include/iup/iupglcontrols.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief GL Controls. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPGLCONTROLS_H 8 | #define __IUPGLCONTROLS_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | 15 | int IupGLControlsOpen(void); 16 | 17 | Ihandle* IupGLCanvasBoxv(Ihandle** children); 18 | Ihandle* IupGLCanvasBox(Ihandle* child, ...); 19 | 20 | Ihandle* IupGLSubCanvas(void); 21 | 22 | Ihandle* IupGLLabel(const char* title); 23 | Ihandle* IupGLSeparator(void); 24 | Ihandle* IupGLButton(const char* title); 25 | Ihandle* IupGLToggle(const char* title); 26 | Ihandle* IupGLLink(const char *url, const char * title); 27 | Ihandle* IupGLProgressBar(void); 28 | Ihandle* IupGLVal(void); 29 | Ihandle* IupGLFrame(Ihandle* child); 30 | Ihandle* IupGLExpander(Ihandle* child); 31 | Ihandle* IupGLScrollBox(Ihandle* child); 32 | Ihandle* IupGLSizeBox(Ihandle* child); 33 | Ihandle* IupGLText(void); 34 | 35 | 36 | /* Utilities */ 37 | void IupGLDrawImage(Ihandle* ih, const char* name, int x, int y, int active); 38 | void IupGLDrawText(Ihandle* ih, const char* str, int len, int x, int y); 39 | void IupGLDrawGetTextSize(Ihandle* ih, const char* str, int *w, int *h); 40 | void IupGLDrawGetImageInfo(const char* name, int *w, int *h, int *bpp); 41 | 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/iup/iupim.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Utilities using IM 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPIM_H 8 | #define __IUPIM_H 9 | 10 | #if defined(__cplusplus) 11 | extern "C" { 12 | #endif 13 | 14 | 15 | Ihandle* IupLoadImage(const char* file_name); 16 | int IupSaveImage(Ihandle* ih, const char* file_name, const char* format); 17 | 18 | Ihandle* IupLoadAnimation(const char* file_name); 19 | Ihandle* IupLoadAnimationFrames(const char** file_name_list, int file_count); 20 | 21 | #ifdef __IM_IMAGE_H 22 | imImage* IupGetNativeHandleImage(void* handle); 23 | void* IupGetImageNativeHandle(const imImage* image); 24 | 25 | Ihandle* IupImageFromImImage(const imImage* image); 26 | imImage* IupImageToImImage(Ihandle* iup_image); 27 | #endif 28 | 29 | 30 | #if defined(__cplusplus) 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/iup/iupkey.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Keyboard Keys definitions. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPKEY_H 8 | #define __IUPKEY_H 9 | 10 | /* from 32 to 126, all character sets are equal, 11 | the key code is the same as the ASCii character code. */ 12 | 13 | #define K_SP ' ' /* 32 (0x20) */ 14 | #define K_exclam '!' /* 33 */ 15 | #define K_quotedbl '\"' /* 34 */ 16 | #define K_numbersign '#' /* 35 */ 17 | #define K_dollar '$' /* 36 */ 18 | #define K_percent '%' /* 37 */ 19 | #define K_ampersand '&' /* 38 */ 20 | #define K_apostrophe '\'' /* 39 */ 21 | #define K_parentleft '(' /* 40 */ 22 | #define K_parentright ')' /* 41 */ 23 | #define K_asterisk '*' /* 42 */ 24 | #define K_plus '+' /* 43 */ 25 | #define K_comma ',' /* 44 */ 26 | #define K_minus '-' /* 45 */ 27 | #define K_period '.' /* 46 */ 28 | #define K_slash '/' /* 47 */ 29 | #define K_0 '0' /* 48 (0x30) */ 30 | #define K_1 '1' /* 49 */ 31 | #define K_2 '2' /* 50 */ 32 | #define K_3 '3' /* 51 */ 33 | #define K_4 '4' /* 52 */ 34 | #define K_5 '5' /* 53 */ 35 | #define K_6 '6' /* 54 */ 36 | #define K_7 '7' /* 55 */ 37 | #define K_8 '8' /* 56 */ 38 | #define K_9 '9' /* 57 */ 39 | #define K_colon ':' /* 58 */ 40 | #define K_semicolon ';' /* 59 */ 41 | #define K_less '<' /* 60 */ 42 | #define K_equal '=' /* 61 */ 43 | #define K_greater '>' /* 62 */ 44 | #define K_question '?' /* 63 */ 45 | #define K_at '@' /* 64 */ 46 | #define K_A 'A' /* 65 (0x41) */ 47 | #define K_B 'B' /* 66 */ 48 | #define K_C 'C' /* 67 */ 49 | #define K_D 'D' /* 68 */ 50 | #define K_E 'E' /* 69 */ 51 | #define K_F 'F' /* 70 */ 52 | #define K_G 'G' /* 71 */ 53 | #define K_H 'H' /* 72 */ 54 | #define K_I 'I' /* 73 */ 55 | #define K_J 'J' /* 74 */ 56 | #define K_K 'K' /* 75 */ 57 | #define K_L 'L' /* 76 */ 58 | #define K_M 'M' /* 77 */ 59 | #define K_N 'N' /* 78 */ 60 | #define K_O 'O' /* 79 */ 61 | #define K_P 'P' /* 80 */ 62 | #define K_Q 'Q' /* 81 */ 63 | #define K_R 'R' /* 82 */ 64 | #define K_S 'S' /* 83 */ 65 | #define K_T 'T' /* 84 */ 66 | #define K_U 'U' /* 85 */ 67 | #define K_V 'V' /* 86 */ 68 | #define K_W 'W' /* 87 */ 69 | #define K_X 'X' /* 88 */ 70 | #define K_Y 'Y' /* 89 */ 71 | #define K_Z 'Z' /* 90 */ 72 | #define K_bracketleft '[' /* 91 */ 73 | #define K_backslash '\\' /* 92 */ 74 | #define K_bracketright ']' /* 93 */ 75 | #define K_circum '^' /* 94 */ 76 | #define K_underscore '_' /* 95 */ 77 | #define K_grave '`' /* 96 */ 78 | #define K_a 'a' /* 97 (0x61) */ 79 | #define K_b 'b' /* 98 */ 80 | #define K_c 'c' /* 99 */ 81 | #define K_d 'd' /* 100 */ 82 | #define K_e 'e' /* 101 */ 83 | #define K_f 'f' /* 102 */ 84 | #define K_g 'g' /* 103 */ 85 | #define K_h 'h' /* 104 */ 86 | #define K_i 'i' /* 105 */ 87 | #define K_j 'j' /* 106 */ 88 | #define K_k 'k' /* 107 */ 89 | #define K_l 'l' /* 108 */ 90 | #define K_m 'm' /* 109 */ 91 | #define K_n 'n' /* 110 */ 92 | #define K_o 'o' /* 111 */ 93 | #define K_p 'p' /* 112 */ 94 | #define K_q 'q' /* 113 */ 95 | #define K_r 'r' /* 114 */ 96 | #define K_s 's' /* 115 */ 97 | #define K_t 't' /* 116 */ 98 | #define K_u 'u' /* 117 */ 99 | #define K_v 'v' /* 118 */ 100 | #define K_w 'w' /* 119 */ 101 | #define K_x 'x' /* 120 */ 102 | #define K_y 'y' /* 121 */ 103 | #define K_z 'z' /* 122 */ 104 | #define K_braceleft '{' /* 123 */ 105 | #define K_bar '|' /* 124 */ 106 | #define K_braceright '}' /* 125 */ 107 | #define K_tilde '~' /* 126 (0x7E) */ 108 | 109 | /* Printable ASCii keys */ 110 | 111 | #define iup_isprint(_c) ((_c) > 31 && (_c) < 127) 112 | 113 | /* also define the escape sequences that have keys associated */ 114 | 115 | #define K_BS '\b' /* 8 */ 116 | #define K_TAB '\t' /* 9 */ 117 | #define K_LF '\n' /* 10 (0x0A) not a real key, is a combination of CR with a modifier, just to document */ 118 | #define K_CR '\r' /* 13 (0x0D) */ 119 | 120 | /* backward compatible definitions */ 121 | 122 | #define K_quoteleft K_grave 123 | #define K_quoteright K_apostrophe 124 | #define isxkey iup_isXkey 125 | 126 | /* IUP Extended Key Codes, range start at 128 */ 127 | 128 | #define iup_isXkey(_c) ((_c) >= 128) 129 | 130 | /* These use the same definition as X11 and GDK. 131 | This also means that any X11 or GDK definition can also be used. */ 132 | 133 | #define K_PAUSE 0xFF13 134 | #define K_ESC 0xFF1B 135 | #define K_HOME 0xFF50 136 | #define K_LEFT 0xFF51 137 | #define K_UP 0xFF52 138 | #define K_RIGHT 0xFF53 139 | #define K_DOWN 0xFF54 140 | #define K_PGUP 0xFF55 141 | #define K_PGDN 0xFF56 142 | #define K_END 0xFF57 143 | #define K_MIDDLE 0xFF0B 144 | #define K_Print 0xFF61 145 | #define K_INS 0xFF63 146 | #define K_Menu 0xFF67 147 | #define K_DEL 0xFFFF 148 | #define K_F1 0xFFBE 149 | #define K_F2 0xFFBF 150 | #define K_F3 0xFFC0 151 | #define K_F4 0xFFC1 152 | #define K_F5 0xFFC2 153 | #define K_F6 0xFFC3 154 | #define K_F7 0xFFC4 155 | #define K_F8 0xFFC5 156 | #define K_F9 0xFFC6 157 | #define K_F10 0xFFC7 158 | #define K_F11 0xFFC8 159 | #define K_F12 0xFFC9 160 | 161 | /* no Shift/Ctrl/Alt */ 162 | #define K_LSHIFT 0xFFE1 163 | #define K_RSHIFT 0xFFE2 164 | #define K_LCTRL 0xFFE3 165 | #define K_RCTRL 0xFFE4 166 | #define K_LALT 0xFFE9 167 | #define K_RALT 0xFFEA 168 | 169 | #define K_NUM 0xFF7F 170 | #define K_SCROLL 0xFF14 171 | #define K_CAPS 0xFFE5 172 | 173 | /* Also, these are the same as the Latin-1 definition */ 174 | 175 | #define K_ccedilla 0x00E7 176 | #define K_Ccedilla 0x00C7 177 | #define K_acute 0x00B4 /* no Shift/Ctrl/Alt */ 178 | #define K_diaeresis 0x00A8 179 | 180 | /******************************************************/ 181 | /* Modifiers use last 4 bits. Since IUP 3.9 */ 182 | /* These modifiers definitions are specific to IUP */ 183 | /******************************************************/ 184 | 185 | #define iup_isShiftXkey(_c) ((_c) & 0x10000000) 186 | #define iup_isCtrlXkey(_c) ((_c) & 0x20000000) 187 | #define iup_isAltXkey(_c) ((_c) & 0x40000000) 188 | #define iup_isSysXkey(_c) ((_c) & 0x80000000) 189 | 190 | #define iup_XkeyBase(_c) ((_c) & 0x0FFFFFFF) 191 | #define iup_XkeyShift(_c) ((_c) | 0x10000000) /* Shift */ 192 | #define iup_XkeyCtrl(_c) ((_c) | 0x20000000) /* Ctrl */ 193 | #define iup_XkeyAlt(_c) ((_c) | 0x40000000) /* Alt */ 194 | #define iup_XkeySys(_c) ((_c) | 0x80000000) /* Sys (Win or Apple) */ 195 | 196 | /* These definitions are here for backward compatibility 197 | and to simplify some key combination usage. 198 | But since IUP 3.9, modifiers can be combined with any key 199 | and they can be mixed together. */ 200 | 201 | #define K_sHOME iup_XkeyShift(K_HOME ) 202 | #define K_sUP iup_XkeyShift(K_UP ) 203 | #define K_sPGUP iup_XkeyShift(K_PGUP ) 204 | #define K_sLEFT iup_XkeyShift(K_LEFT ) 205 | #define K_sMIDDLE iup_XkeyShift(K_MIDDLE ) 206 | #define K_sRIGHT iup_XkeyShift(K_RIGHT ) 207 | #define K_sEND iup_XkeyShift(K_END ) 208 | #define K_sDOWN iup_XkeyShift(K_DOWN ) 209 | #define K_sPGDN iup_XkeyShift(K_PGDN ) 210 | #define K_sINS iup_XkeyShift(K_INS ) 211 | #define K_sDEL iup_XkeyShift(K_DEL ) 212 | #define K_sSP iup_XkeyShift(K_SP ) 213 | #define K_sTAB iup_XkeyShift(K_TAB ) 214 | #define K_sCR iup_XkeyShift(K_CR ) 215 | #define K_sBS iup_XkeyShift(K_BS ) 216 | #define K_sPAUSE iup_XkeyShift(K_PAUSE ) 217 | #define K_sESC iup_XkeyShift(K_ESC ) 218 | #define K_sF1 iup_XkeyShift(K_F1 ) 219 | #define K_sF2 iup_XkeyShift(K_F2 ) 220 | #define K_sF3 iup_XkeyShift(K_F3 ) 221 | #define K_sF4 iup_XkeyShift(K_F4 ) 222 | #define K_sF5 iup_XkeyShift(K_F5 ) 223 | #define K_sF6 iup_XkeyShift(K_F6 ) 224 | #define K_sF7 iup_XkeyShift(K_F7 ) 225 | #define K_sF8 iup_XkeyShift(K_F8 ) 226 | #define K_sF9 iup_XkeyShift(K_F9 ) 227 | #define K_sF10 iup_XkeyShift(K_F10 ) 228 | #define K_sF11 iup_XkeyShift(K_F11 ) 229 | #define K_sF12 iup_XkeyShift(K_F12 ) 230 | #define K_sPrint iup_XkeyShift(K_Print ) 231 | #define K_sMenu iup_XkeyShift(K_Menu ) 232 | 233 | #define K_cHOME iup_XkeyCtrl(K_HOME ) 234 | #define K_cUP iup_XkeyCtrl(K_UP ) 235 | #define K_cPGUP iup_XkeyCtrl(K_PGUP ) 236 | #define K_cLEFT iup_XkeyCtrl(K_LEFT ) 237 | #define K_cMIDDLE iup_XkeyCtrl(K_MIDDLE ) 238 | #define K_cRIGHT iup_XkeyCtrl(K_RIGHT ) 239 | #define K_cEND iup_XkeyCtrl(K_END ) 240 | #define K_cDOWN iup_XkeyCtrl(K_DOWN ) 241 | #define K_cPGDN iup_XkeyCtrl(K_PGDN ) 242 | #define K_cINS iup_XkeyCtrl(K_INS ) 243 | #define K_cDEL iup_XkeyCtrl(K_DEL ) 244 | #define K_cSP iup_XkeyCtrl(K_SP ) 245 | #define K_cTAB iup_XkeyCtrl(K_TAB ) 246 | #define K_cCR iup_XkeyCtrl(K_CR ) 247 | #define K_cBS iup_XkeyCtrl(K_BS ) 248 | #define K_cPAUSE iup_XkeyCtrl(K_PAUSE ) 249 | #define K_cESC iup_XkeyCtrl(K_ESC ) 250 | #define K_cCcedilla iup_XkeyCtrl(K_Ccedilla) 251 | #define K_cF1 iup_XkeyCtrl(K_F1 ) 252 | #define K_cF2 iup_XkeyCtrl(K_F2 ) 253 | #define K_cF3 iup_XkeyCtrl(K_F3 ) 254 | #define K_cF4 iup_XkeyCtrl(K_F4 ) 255 | #define K_cF5 iup_XkeyCtrl(K_F5 ) 256 | #define K_cF6 iup_XkeyCtrl(K_F6 ) 257 | #define K_cF7 iup_XkeyCtrl(K_F7 ) 258 | #define K_cF8 iup_XkeyCtrl(K_F8 ) 259 | #define K_cF9 iup_XkeyCtrl(K_F9 ) 260 | #define K_cF10 iup_XkeyCtrl(K_F10 ) 261 | #define K_cF11 iup_XkeyCtrl(K_F11 ) 262 | #define K_cF12 iup_XkeyCtrl(K_F12 ) 263 | #define K_cPrint iup_XkeyCtrl(K_Print ) 264 | #define K_cMenu iup_XkeyCtrl(K_Menu ) 265 | 266 | #define K_mHOME iup_XkeyAlt(K_HOME ) 267 | #define K_mUP iup_XkeyAlt(K_UP ) 268 | #define K_mPGUP iup_XkeyAlt(K_PGUP ) 269 | #define K_mLEFT iup_XkeyAlt(K_LEFT ) 270 | #define K_mMIDDLE iup_XkeyAlt(K_MIDDLE ) 271 | #define K_mRIGHT iup_XkeyAlt(K_RIGHT ) 272 | #define K_mEND iup_XkeyAlt(K_END ) 273 | #define K_mDOWN iup_XkeyAlt(K_DOWN ) 274 | #define K_mPGDN iup_XkeyAlt(K_PGDN ) 275 | #define K_mINS iup_XkeyAlt(K_INS ) 276 | #define K_mDEL iup_XkeyAlt(K_DEL ) 277 | #define K_mSP iup_XkeyAlt(K_SP ) 278 | #define K_mTAB iup_XkeyAlt(K_TAB ) 279 | #define K_mCR iup_XkeyAlt(K_CR ) 280 | #define K_mBS iup_XkeyAlt(K_BS ) 281 | #define K_mPAUSE iup_XkeyAlt(K_PAUSE ) 282 | #define K_mESC iup_XkeyAlt(K_ESC ) 283 | #define K_mCcedilla iup_XkeyAlt(K_Ccedilla) 284 | #define K_mF1 iup_XkeyAlt(K_F1 ) 285 | #define K_mF2 iup_XkeyAlt(K_F2 ) 286 | #define K_mF3 iup_XkeyAlt(K_F3 ) 287 | #define K_mF4 iup_XkeyAlt(K_F4 ) 288 | #define K_mF5 iup_XkeyAlt(K_F5 ) 289 | #define K_mF6 iup_XkeyAlt(K_F6 ) 290 | #define K_mF7 iup_XkeyAlt(K_F7 ) 291 | #define K_mF8 iup_XkeyAlt(K_F8 ) 292 | #define K_mF9 iup_XkeyAlt(K_F9 ) 293 | #define K_mF10 iup_XkeyAlt(K_F10 ) 294 | #define K_mF11 iup_XkeyAlt(K_F11 ) 295 | #define K_mF12 iup_XkeyAlt(K_F12 ) 296 | #define K_mPrint iup_XkeyAlt(K_Print ) 297 | #define K_mMenu iup_XkeyAlt(K_Menu ) 298 | 299 | #define K_yHOME iup_XkeySys(K_HOME ) 300 | #define K_yUP iup_XkeySys(K_UP ) 301 | #define K_yPGUP iup_XkeySys(K_PGUP ) 302 | #define K_yLEFT iup_XkeySys(K_LEFT ) 303 | #define K_yMIDDLE iup_XkeySys(K_MIDDLE ) 304 | #define K_yRIGHT iup_XkeySys(K_RIGHT ) 305 | #define K_yEND iup_XkeySys(K_END ) 306 | #define K_yDOWN iup_XkeySys(K_DOWN ) 307 | #define K_yPGDN iup_XkeySys(K_PGDN ) 308 | #define K_yINS iup_XkeySys(K_INS ) 309 | #define K_yDEL iup_XkeySys(K_DEL ) 310 | #define K_ySP iup_XkeySys(K_SP ) 311 | #define K_yTAB iup_XkeySys(K_TAB ) 312 | #define K_yCR iup_XkeySys(K_CR ) 313 | #define K_yBS iup_XkeySys(K_BS ) 314 | #define K_yPAUSE iup_XkeySys(K_PAUSE ) 315 | #define K_yESC iup_XkeySys(K_ESC ) 316 | #define K_yCcedilla iup_XkeySys(K_Ccedilla) 317 | #define K_yF1 iup_XkeySys(K_F1 ) 318 | #define K_yF2 iup_XkeySys(K_F2 ) 319 | #define K_yF3 iup_XkeySys(K_F3 ) 320 | #define K_yF4 iup_XkeySys(K_F4 ) 321 | #define K_yF5 iup_XkeySys(K_F5 ) 322 | #define K_yF6 iup_XkeySys(K_F6 ) 323 | #define K_yF7 iup_XkeySys(K_F7 ) 324 | #define K_yF8 iup_XkeySys(K_F8 ) 325 | #define K_yF9 iup_XkeySys(K_F9 ) 326 | #define K_yF10 iup_XkeySys(K_F10 ) 327 | #define K_yF11 iup_XkeySys(K_F11 ) 328 | #define K_yF12 iup_XkeySys(K_F12 ) 329 | #define K_yPrint iup_XkeySys(K_Print ) 330 | #define K_yMenu iup_XkeySys(K_Menu ) 331 | 332 | #define K_sPlus iup_XkeyShift(K_plus ) 333 | #define K_sComma iup_XkeyShift(K_comma ) 334 | #define K_sMinus iup_XkeyShift(K_minus ) 335 | #define K_sPeriod iup_XkeyShift(K_period ) 336 | #define K_sSlash iup_XkeyShift(K_slash ) 337 | #define K_sAsterisk iup_XkeyShift(K_asterisk) 338 | 339 | #define K_cA iup_XkeyCtrl(K_A) 340 | #define K_cB iup_XkeyCtrl(K_B) 341 | #define K_cC iup_XkeyCtrl(K_C) 342 | #define K_cD iup_XkeyCtrl(K_D) 343 | #define K_cE iup_XkeyCtrl(K_E) 344 | #define K_cF iup_XkeyCtrl(K_F) 345 | #define K_cG iup_XkeyCtrl(K_G) 346 | #define K_cH iup_XkeyCtrl(K_H) 347 | #define K_cI iup_XkeyCtrl(K_I) 348 | #define K_cJ iup_XkeyCtrl(K_J) 349 | #define K_cK iup_XkeyCtrl(K_K) 350 | #define K_cL iup_XkeyCtrl(K_L) 351 | #define K_cM iup_XkeyCtrl(K_M) 352 | #define K_cN iup_XkeyCtrl(K_N) 353 | #define K_cO iup_XkeyCtrl(K_O) 354 | #define K_cP iup_XkeyCtrl(K_P) 355 | #define K_cQ iup_XkeyCtrl(K_Q) 356 | #define K_cR iup_XkeyCtrl(K_R) 357 | #define K_cS iup_XkeyCtrl(K_S) 358 | #define K_cT iup_XkeyCtrl(K_T) 359 | #define K_cU iup_XkeyCtrl(K_U) 360 | #define K_cV iup_XkeyCtrl(K_V) 361 | #define K_cW iup_XkeyCtrl(K_W) 362 | #define K_cX iup_XkeyCtrl(K_X) 363 | #define K_cY iup_XkeyCtrl(K_Y) 364 | #define K_cZ iup_XkeyCtrl(K_Z) 365 | #define K_c1 iup_XkeyCtrl(K_1) 366 | #define K_c2 iup_XkeyCtrl(K_2) 367 | #define K_c3 iup_XkeyCtrl(K_3) 368 | #define K_c4 iup_XkeyCtrl(K_4) 369 | #define K_c5 iup_XkeyCtrl(K_5) 370 | #define K_c6 iup_XkeyCtrl(K_6) 371 | #define K_c7 iup_XkeyCtrl(K_7) 372 | #define K_c8 iup_XkeyCtrl(K_8) 373 | #define K_c9 iup_XkeyCtrl(K_9) 374 | #define K_c0 iup_XkeyCtrl(K_0) 375 | #define K_cPlus iup_XkeyCtrl(K_plus ) 376 | #define K_cComma iup_XkeyCtrl(K_comma ) 377 | #define K_cMinus iup_XkeyCtrl(K_minus ) 378 | #define K_cPeriod iup_XkeyCtrl(K_period ) 379 | #define K_cSlash iup_XkeyCtrl(K_slash ) 380 | #define K_cSemicolon iup_XkeyCtrl(K_semicolon ) 381 | #define K_cEqual iup_XkeyCtrl(K_equal ) 382 | #define K_cBracketleft iup_XkeyCtrl(K_bracketleft ) 383 | #define K_cBracketright iup_XkeyCtrl(K_bracketright) 384 | #define K_cBackslash iup_XkeyCtrl(K_backslash ) 385 | #define K_cAsterisk iup_XkeyCtrl(K_asterisk ) 386 | 387 | #define K_mA iup_XkeyAlt(K_A) 388 | #define K_mB iup_XkeyAlt(K_B) 389 | #define K_mC iup_XkeyAlt(K_C) 390 | #define K_mD iup_XkeyAlt(K_D) 391 | #define K_mE iup_XkeyAlt(K_E) 392 | #define K_mF iup_XkeyAlt(K_F) 393 | #define K_mG iup_XkeyAlt(K_G) 394 | #define K_mH iup_XkeyAlt(K_H) 395 | #define K_mI iup_XkeyAlt(K_I) 396 | #define K_mJ iup_XkeyAlt(K_J) 397 | #define K_mK iup_XkeyAlt(K_K) 398 | #define K_mL iup_XkeyAlt(K_L) 399 | #define K_mM iup_XkeyAlt(K_M) 400 | #define K_mN iup_XkeyAlt(K_N) 401 | #define K_mO iup_XkeyAlt(K_O) 402 | #define K_mP iup_XkeyAlt(K_P) 403 | #define K_mQ iup_XkeyAlt(K_Q) 404 | #define K_mR iup_XkeyAlt(K_R) 405 | #define K_mS iup_XkeyAlt(K_S) 406 | #define K_mT iup_XkeyAlt(K_T) 407 | #define K_mU iup_XkeyAlt(K_U) 408 | #define K_mV iup_XkeyAlt(K_V) 409 | #define K_mW iup_XkeyAlt(K_W) 410 | #define K_mX iup_XkeyAlt(K_X) 411 | #define K_mY iup_XkeyAlt(K_Y) 412 | #define K_mZ iup_XkeyAlt(K_Z) 413 | #define K_m1 iup_XkeyAlt(K_1) 414 | #define K_m2 iup_XkeyAlt(K_2) 415 | #define K_m3 iup_XkeyAlt(K_3) 416 | #define K_m4 iup_XkeyAlt(K_4) 417 | #define K_m5 iup_XkeyAlt(K_5) 418 | #define K_m6 iup_XkeyAlt(K_6) 419 | #define K_m7 iup_XkeyAlt(K_7) 420 | #define K_m8 iup_XkeyAlt(K_8) 421 | #define K_m9 iup_XkeyAlt(K_9) 422 | #define K_m0 iup_XkeyAlt(K_0) 423 | #define K_mPlus iup_XkeyAlt(K_plus ) 424 | #define K_mComma iup_XkeyAlt(K_comma ) 425 | #define K_mMinus iup_XkeyAlt(K_minus ) 426 | #define K_mPeriod iup_XkeyAlt(K_period ) 427 | #define K_mSlash iup_XkeyAlt(K_slash ) 428 | #define K_mSemicolon iup_XkeyAlt(K_semicolon ) 429 | #define K_mEqual iup_XkeyAlt(K_equal ) 430 | #define K_mBracketleft iup_XkeyAlt(K_bracketleft ) 431 | #define K_mBracketright iup_XkeyAlt(K_bracketright) 432 | #define K_mBackslash iup_XkeyAlt(K_backslash ) 433 | #define K_mAsterisk iup_XkeyAlt(K_asterisk ) 434 | 435 | #define K_yA iup_XkeySys(K_A) 436 | #define K_yB iup_XkeySys(K_B) 437 | #define K_yC iup_XkeySys(K_C) 438 | #define K_yD iup_XkeySys(K_D) 439 | #define K_yE iup_XkeySys(K_E) 440 | #define K_yF iup_XkeySys(K_F) 441 | #define K_yG iup_XkeySys(K_G) 442 | #define K_yH iup_XkeySys(K_H) 443 | #define K_yI iup_XkeySys(K_I) 444 | #define K_yJ iup_XkeySys(K_J) 445 | #define K_yK iup_XkeySys(K_K) 446 | #define K_yL iup_XkeySys(K_L) 447 | #define K_yM iup_XkeySys(K_M) 448 | #define K_yN iup_XkeySys(K_N) 449 | #define K_yO iup_XkeySys(K_O) 450 | #define K_yP iup_XkeySys(K_P) 451 | #define K_yQ iup_XkeySys(K_Q) 452 | #define K_yR iup_XkeySys(K_R) 453 | #define K_yS iup_XkeySys(K_S) 454 | #define K_yT iup_XkeySys(K_T) 455 | #define K_yU iup_XkeySys(K_U) 456 | #define K_yV iup_XkeySys(K_V) 457 | #define K_yW iup_XkeySys(K_W) 458 | #define K_yX iup_XkeySys(K_X) 459 | #define K_yY iup_XkeySys(K_Y) 460 | #define K_yZ iup_XkeySys(K_Z) 461 | #define K_y1 iup_XkeySys(K_1) 462 | #define K_y2 iup_XkeySys(K_2) 463 | #define K_y3 iup_XkeySys(K_3) 464 | #define K_y4 iup_XkeySys(K_4) 465 | #define K_y5 iup_XkeySys(K_5) 466 | #define K_y6 iup_XkeySys(K_6) 467 | #define K_y7 iup_XkeySys(K_7) 468 | #define K_y8 iup_XkeySys(K_8) 469 | #define K_y9 iup_XkeySys(K_9) 470 | #define K_y0 iup_XkeySys(K_0) 471 | #define K_yPlus iup_XkeySys(K_plus ) 472 | #define K_yComma iup_XkeySys(K_comma ) 473 | #define K_yMinus iup_XkeySys(K_minus ) 474 | #define K_yPeriod iup_XkeySys(K_period ) 475 | #define K_ySlash iup_XkeySys(K_slash ) 476 | #define K_ySemicolon iup_XkeySys(K_semicolon ) 477 | #define K_yEqual iup_XkeySys(K_equal ) 478 | #define K_yBracketleft iup_XkeySys(K_bracketleft ) 479 | #define K_yBracketright iup_XkeySys(K_bracketright) 480 | #define K_yBackslash iup_XkeySys(K_backslash ) 481 | #define K_yAsterisk iup_XkeySys(K_asterisk ) 482 | 483 | 484 | #endif 485 | -------------------------------------------------------------------------------- /include/iup/iuplua.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief IUP Binding for Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUA_H 8 | #define __IUPLUA_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iuplua_open(lua_State *L); 15 | int iupkey_open(lua_State *L); /* does nothing, kept for backward compatibility */ 16 | int iuplua_close(lua_State * L); 17 | 18 | /* utilities */ 19 | int iuplua_isihandle(lua_State *L, int pos); 20 | Ihandle* iuplua_checkihandle(lua_State *L, int pos); 21 | void iuplua_pushihandle(lua_State *L, Ihandle *n); 22 | int iuplua_dofile(lua_State *L, const char *filename); 23 | int iuplua_dostring(lua_State *L, const char *string, const char *chunk_name); 24 | int iuplua_dobuffer(lua_State *L, const char *buffer, int len, const char *chunk_name); 25 | void iuplua_show_error_message(const char *pname, const char* msg); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/iup/iuplua_mglplot.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief IupMglPlot Binding for Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUA_MGLPLOT_H 8 | #define __IUPLUA_MGLPLOT_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iup_mglplotlua_open (lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iuplua_plot.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief iup_plot Binding for Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUA_PLOT_H 8 | #define __IUPLUA_PLOT_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iup_plotlua_open (lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iuplua_scintilla.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief IupScintilla Binding for Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUA_SCINTILLA_H 8 | #define __IUPLUA_SCINTILLA_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iup_scintillalua_open (lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iupluacontrols.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief iupcontrols Binding for Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUACONTROLS_H 8 | #define __IUPLUACONTROLS_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iupcontrolslua_open (lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iupluagl.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Binding of iupglcanvas to Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUAGL_H 8 | #define __IUPLUAGL_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iupgllua_open (lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iupluaglcontrols.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief iupglcontrols Binding for Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUAGLCONTROLS_H 8 | #define __IUPLUAGLCONTROLS_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iupglcontrolslua_open (lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iupluaim.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Bindig of iupim functions to Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUAIM_H 8 | #define __IUPLUAIM_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iupimlua_open(lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iupluaole.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Binding of iupolecontrol to Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUAOLE_H 8 | #define __IUPLUAOLE_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iupolelua_open (lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iupluascripterdlg.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief IupLuaScripterDlg dialog and Lua binding 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUASCRIPTERDLG_H 8 | #define __IUPLUASCRIPTERDLG_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | void IupLuaScripterDlgOpen(lua_State * L); 15 | 16 | Ihandle* IupLuaScripterDlg(void); 17 | 18 | /* Lua binding */ 19 | int iupluascripterdlglua_open(lua_State * L); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /include/iup/iupluatuio.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Binding of iuptuio to Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUATUIO_H 8 | #define __IUPLUATUIO_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iuptuiolua_open (lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iupluaweb.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Binding of iupwebbrowser to Lua. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPLUAWEB_H 8 | #define __IUPLUAWEB_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int iupweblua_open (lua_State * L); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/iup/iupole.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Ole control. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPOLE_H 8 | #define __IUPOLE_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | 15 | Ihandle *IupOleControl(const char* progid); 16 | 17 | int IupOleControlOpen(void); 18 | 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /include/iup/iuptuio.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief IupTuioClient control 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPTUIO_H 8 | #define __IUPTUIO_H 9 | 10 | #if defined(__cplusplus) 11 | extern "C" { 12 | #endif 13 | 14 | int IupTuioOpen(void); 15 | Ihandle* IupTuioClient(int port); 16 | 17 | #if defined(__cplusplus) 18 | } 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /include/iup/iupweb.h: -------------------------------------------------------------------------------- 1 | /** \file 2 | * \brief Web control. 3 | * 4 | * See Copyright Notice in "iup.h" 5 | */ 6 | 7 | #ifndef __IUPWEB_H 8 | #define __IUPWEB_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int IupWebBrowserOpen(void); 15 | 16 | Ihandle *IupWebBrowser(void); 17 | 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /include/stlink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: stlink.h 3 | * 4 | * This should contain all the common top level stlink interfaces, regardless 5 | * of how the backend does the work.... 6 | */ 7 | #ifndef STLINK_H 8 | #define STLINK_H 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #define STLINK_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) 19 | 20 | // Max data transfer size. 21 | // 6kB = max mem32_read block, 8kB sram 22 | //#define Q_BUF_LEN 96 23 | #define Q_BUF_LEN (1024 * 100) 24 | 25 | // STLINK_DEBUG_RESETSYS, etc: 26 | #define STLINK_CORE_RUNNING 0x80 27 | #define STLINK_CORE_HALTED 0x81 28 | #define STLINK_CORE_STAT_UNKNOWN -1 29 | 30 | #define STLINK_GET_VERSION 0xf1 31 | #define STLINK_GET_CURRENT_MODE 0xf5 32 | #define STLINK_GET_TARGET_VOLTAGE 0xF7 33 | 34 | #define STLINK_DEBUG_COMMAND 0xF2 35 | #define STLINK_DFU_COMMAND 0xF3 36 | #define STLINK_DFU_EXIT 0x07 37 | 38 | // STLINK_GET_CURRENT_MODE 39 | #define STLINK_DEV_DFU_MODE 0x00 40 | #define STLINK_DEV_MASS_MODE 0x01 41 | #define STLINK_DEV_DEBUG_MODE 0x02 42 | #define STLINK_DEV_UNKNOWN_MODE -1 43 | 44 | // TODO - possible poor names... 45 | #define STLINK_SWD_ENTER 0x30 46 | #define STLINK_SWD_READCOREID 0x32 // TBD 47 | #define STLINK_JTAG_WRITEDEBUG_32BIT 0x35 48 | #define STLINK_JTAG_READDEBUG_32BIT 0x36 49 | #define STLINK_JTAG_DRIVE_NRST 0x3c 50 | 51 | #define STLINK_DEBUG_APIV2_SWD_SET_FREQ 0x43 52 | 53 | /* cortex core ids */ 54 | // TODO clean this up... 55 | #define STM32VL_CORE_ID 0x1ba01477 56 | #define STM32F7_CORE_ID 0x5ba02477 57 | 58 | // Constant STM32 memory map figures 59 | #define STM32_FLASH_BASE 0x08000000 60 | #define STM32_SRAM_BASE 0x20000000 61 | 62 | // Baud rate divisors for SWDCLK 63 | #define STLINK_SWDCLK_4MHZ_DIVISOR 0 64 | #define STLINK_SWDCLK_1P8MHZ_DIVISOR 1 65 | #define STLINK_SWDCLK_1P2MHZ_DIVISOR 2 66 | #define STLINK_SWDCLK_950KHZ_DIVISOR 3 67 | #define STLINK_SWDCLK_480KHZ_DIVISOR 7 68 | #define STLINK_SWDCLK_240KHZ_DIVISOR 15 69 | #define STLINK_SWDCLK_125KHZ_DIVISOR 31 70 | #define STLINK_SWDCLK_100KHZ_DIVISOR 40 71 | #define STLINK_SWDCLK_50KHZ_DIVISOR 79 72 | #define STLINK_SWDCLK_25KHZ_DIVISOR 158 73 | #define STLINK_SWDCLK_15KHZ_DIVISOR 265 74 | #define STLINK_SWDCLK_5KHZ_DIVISOR 798 75 | 76 | 77 | 78 | /* Enough space to hold both a V2 command or a V1 command packaged as generic scsi*/ 79 | #define C_BUF_LEN 32 80 | 81 | enum stlink_flash_type { 82 | STLINK_FLASH_TYPE_UNKNOWN = 0, 83 | STLINK_FLASH_TYPE_F0, 84 | STLINK_FLASH_TYPE_L0, 85 | STLINK_FLASH_TYPE_F4, 86 | STLINK_FLASH_TYPE_L4, 87 | STLINK_FLASH_TYPE_F1_XL, 88 | }; 89 | 90 | struct stlink_reg { 91 | uint32_t r[16]; 92 | uint32_t s[32]; 93 | uint32_t xpsr; 94 | uint32_t main_sp; 95 | uint32_t process_sp; 96 | uint32_t rw; 97 | uint32_t rw2; 98 | uint8_t control; 99 | uint8_t faultmask; 100 | uint8_t basepri; 101 | uint8_t primask; 102 | uint32_t fpscr; 103 | }; 104 | 105 | typedef uint32_t stm32_addr_t; 106 | 107 | typedef struct flash_loader { 108 | stm32_addr_t loader_addr; /* loader sram adddr */ 109 | stm32_addr_t buf_addr; /* buffer sram address */ 110 | } flash_loader_t; 111 | 112 | typedef struct _cortex_m3_cpuid_ { 113 | uint16_t implementer_id; 114 | uint16_t variant; 115 | uint16_t part; 116 | uint8_t revision; 117 | } cortex_m3_cpuid_t; 118 | 119 | typedef struct stlink_version_ { 120 | uint32_t stlink_v; 121 | uint32_t jtag_v; 122 | uint32_t swim_v; 123 | uint32_t st_vid; 124 | uint32_t stlink_pid; 125 | } stlink_version_t; 126 | 127 | enum transport_type { 128 | TRANSPORT_TYPE_ZERO = 0, 129 | TRANSPORT_TYPE_LIBSG, 130 | TRANSPORT_TYPE_LIBUSB, 131 | TRANSPORT_TYPE_INVALID 132 | }; 133 | 134 | typedef struct _stlink stlink_t; 135 | 136 | #include "stlink/backend.h" 137 | 138 | struct _stlink { 139 | struct _stlink_backend *backend; 140 | void *backend_data; 141 | 142 | // Room for the command header 143 | unsigned char c_buf[C_BUF_LEN]; 144 | // Data transferred from or to device 145 | unsigned char q_buf[Q_BUF_LEN]; 146 | int q_len; 147 | 148 | // transport layer verboseness: 0 for no debug info, 10 for lots 149 | int verbose; 150 | uint32_t core_id; 151 | uint32_t chip_id; 152 | int core_stat; 153 | 154 | char serial[16]; 155 | int serial_size; 156 | 157 | enum stlink_flash_type flash_type; 158 | stm32_addr_t flash_base; 159 | size_t flash_size; 160 | size_t flash_pgsz; 161 | 162 | /* sram settings */ 163 | stm32_addr_t sram_base; 164 | size_t sram_size; 165 | 166 | // bootloader 167 | stm32_addr_t sys_base; 168 | size_t sys_size; 169 | 170 | struct stlink_version_ version; 171 | }; 172 | 173 | int stlink_enter_swd_mode(stlink_t *sl); 174 | int stlink_enter_jtag_mode(stlink_t *sl); 175 | int stlink_exit_debug_mode(stlink_t *sl); 176 | int stlink_exit_dfu_mode(stlink_t *sl); 177 | void stlink_close(stlink_t *sl); 178 | int stlink_core_id(stlink_t *sl); 179 | int stlink_reset(stlink_t *sl); 180 | int stlink_jtag_reset(stlink_t *sl, int value); 181 | int stlink_run(stlink_t *sl); 182 | int stlink_status(stlink_t *sl); 183 | int stlink_version(stlink_t *sl); 184 | int stlink_read_debug32(stlink_t *sl, uint32_t addr, uint32_t *data); 185 | int stlink_read_mem32(stlink_t *sl, uint32_t addr, uint16_t len); 186 | int stlink_write_debug32(stlink_t *sl, uint32_t addr, uint32_t data); 187 | int stlink_write_mem32(stlink_t *sl, uint32_t addr, uint16_t len); 188 | int stlink_write_mem8(stlink_t *sl, uint32_t addr, uint16_t len); 189 | int stlink_read_all_regs(stlink_t *sl, struct stlink_reg *regp); 190 | int stlink_read_all_unsupported_regs(stlink_t *sl, struct stlink_reg *regp); 191 | int stlink_read_reg(stlink_t *sl, int r_idx, struct stlink_reg *regp); 192 | int stlink_read_unsupported_reg(stlink_t *sl, int r_idx, struct stlink_reg *regp); 193 | int stlink_write_unsupported_reg(stlink_t *sl, uint32_t value, int r_idx, struct stlink_reg *regp); 194 | int stlink_write_reg(stlink_t *sl, uint32_t reg, int idx); 195 | int stlink_step(stlink_t *sl); 196 | int stlink_current_mode(stlink_t *sl); 197 | int stlink_force_debug(stlink_t *sl); 198 | int stlink_target_voltage(stlink_t *sl); 199 | int stlink_set_swdclk(stlink_t *sl, uint16_t divisor); 200 | 201 | int stlink_erase_flash_mass(stlink_t* sl); 202 | int stlink_write_flash(stlink_t* sl, stm32_addr_t address, uint8_t* data, uint32_t length, uint8_t eraseonly); 203 | int stlink_parse_ihex(const char* path, uint8_t erased_pattern, uint8_t * * mem, size_t * size, uint32_t * begin); 204 | uint8_t stlink_get_erased_pattern(stlink_t *sl); 205 | int stlink_mwrite_flash(stlink_t *sl, uint8_t* data, uint32_t length, stm32_addr_t addr); 206 | int stlink_fwrite_flash(stlink_t *sl, const char* path, stm32_addr_t addr); 207 | int stlink_mwrite_sram(stlink_t *sl, uint8_t* data, uint32_t length, stm32_addr_t addr); 208 | int stlink_fwrite_sram(stlink_t *sl, const char* path, stm32_addr_t addr); 209 | int stlink_verify_write_flash(stlink_t *sl, stm32_addr_t address, uint8_t *data, uint32_t length); 210 | 211 | int stlink_chip_id(stlink_t *sl, uint32_t *chip_id); 212 | int stlink_cpu_id(stlink_t *sl, cortex_m3_cpuid_t *cpuid); 213 | 214 | int stlink_erase_flash_page(stlink_t* sl, stm32_addr_t flashaddr); 215 | uint32_t stlink_calculate_pagesize(stlink_t *sl, uint32_t flashaddr); 216 | uint16_t read_uint16(const unsigned char *c, const int pt); 217 | void stlink_core_stat(stlink_t *sl); 218 | void stlink_print_data(stlink_t *sl); 219 | unsigned int is_bigendian(void); 220 | uint32_t read_uint32(const unsigned char *c, const int pt); 221 | void write_uint32(unsigned char* buf, uint32_t ui); 222 | void write_uint16(unsigned char* buf, uint16_t ui); 223 | bool stlink_is_core_halted(stlink_t *sl); 224 | int write_buffer_to_sram(stlink_t *sl, flash_loader_t* fl, const uint8_t* buf, size_t size); 225 | int write_loader_to_sram(stlink_t *sl, stm32_addr_t* addr, size_t* size); 226 | int stlink_fread(stlink_t* sl, const char* path, bool is_ihex, stm32_addr_t addr, size_t size); 227 | int stlink_load_device_params(stlink_t *sl); 228 | 229 | #include "stlink/sg.h" 230 | #include "stlink/usb.h" 231 | #include "stlink/reg.h" 232 | #include "stlink/commands.h" 233 | #include "stlink/chipid.h" 234 | #include "stlink/flash_loader.h" 235 | #include "stlink/version.h" 236 | 237 | #ifdef __cplusplus 238 | } 239 | #endif 240 | 241 | #endif /* STLINK_H */ 242 | -------------------------------------------------------------------------------- /include/stlink/backend.h: -------------------------------------------------------------------------------- 1 | #ifndef STLINK_BACKEND_H_ 2 | #define STLINK_BACKEND_H_ 3 | 4 | typedef struct _stlink_backend { 5 | void (*close) (stlink_t * sl); 6 | int (*exit_debug_mode) (stlink_t * sl); 7 | int (*enter_swd_mode) (stlink_t * sl); 8 | int (*enter_jtag_mode) (stlink_t * stl); 9 | int (*exit_dfu_mode) (stlink_t * stl); 10 | int (*core_id) (stlink_t * stl); 11 | int (*reset) (stlink_t * stl); 12 | int (*jtag_reset) (stlink_t * stl, int value); 13 | int (*run) (stlink_t * stl); 14 | int (*status) (stlink_t * stl); 15 | int (*version) (stlink_t *sl); 16 | int (*read_debug32) (stlink_t *sl, uint32_t addr, uint32_t *data); 17 | int (*read_mem32) (stlink_t *sl, uint32_t addr, uint16_t len); 18 | int (*write_debug32) (stlink_t *sl, uint32_t addr, uint32_t data); 19 | int (*write_mem32) (stlink_t *sl, uint32_t addr, uint16_t len); 20 | int (*write_mem8) (stlink_t *sl, uint32_t addr, uint16_t len); 21 | int (*read_all_regs) (stlink_t *sl, struct stlink_reg * regp); 22 | int (*read_reg) (stlink_t *sl, int r_idx, struct stlink_reg * regp); 23 | int (*read_all_unsupported_regs) (stlink_t *sl, struct stlink_reg *regp); 24 | int (*read_unsupported_reg) (stlink_t *sl, int r_idx, struct stlink_reg *regp); 25 | int (*write_unsupported_reg) (stlink_t *sl, uint32_t value, int idx, struct stlink_reg *regp); 26 | int (*write_reg) (stlink_t *sl, uint32_t reg, int idx); 27 | int (*step) (stlink_t * stl); 28 | int (*current_mode) (stlink_t * stl); 29 | int (*force_debug) (stlink_t *sl); 30 | int32_t (*target_voltage) (stlink_t *sl); 31 | int (*set_swdclk) (stlink_t * stl, uint16_t divisor); 32 | } stlink_backend_t; 33 | 34 | #endif /* STLINK_BACKEND_H_ */ 35 | -------------------------------------------------------------------------------- /include/stlink/chipid.h: -------------------------------------------------------------------------------- 1 | #ifndef STLINK_CHIPID_H_ 2 | #define STLINK_CHIPID_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /** 9 | * Chip IDs are explained in the appropriate programming manual for the 10 | * DBGMCU_IDCODE register (0xE0042000) 11 | * stm32 chipids, only lower 12 bits.. 12 | */ 13 | enum stlink_stm32_chipids { 14 | STLINK_CHIPID_UNKNOWN = 0x000, 15 | 16 | STLINK_CHIPID_STM32_F1_MEDIUM = 0x410, 17 | STLINK_CHIPID_STM32_F2 = 0x411, 18 | STLINK_CHIPID_STM32_F1_LOW = 0x412, 19 | STLINK_CHIPID_STM32_F4 = 0x413, 20 | STLINK_CHIPID_STM32_F1_HIGH = 0x414, 21 | STLINK_CHIPID_STM32_L4 = 0x415, 22 | STLINK_CHIPID_STM32_L1_MEDIUM = 0x416, 23 | STLINK_CHIPID_STM32_L0 = 0x417, 24 | STLINK_CHIPID_STM32_F1_CONN = 0x418, 25 | STLINK_CHIPID_STM32_F4_HD = 0x419, 26 | STLINK_CHIPID_STM32_F1_VL_MEDIUM_LOW = 0x420, 27 | STLINK_CHIPID_STM32_F446 = 0x421, 28 | STLINK_CHIPID_STM32_F3 = 0x422, 29 | STLINK_CHIPID_STM32_F4_LP = 0x423, 30 | STLINK_CHIPID_STM32_L0_CAT2 = 0x425, 31 | STLINK_CHIPID_STM32_L1_MEDIUM_PLUS = 0x427, 32 | STLINK_CHIPID_STM32_F1_VL_HIGH = 0x428, 33 | STLINK_CHIPID_STM32_L1_CAT2 = 0x429, 34 | STLINK_CHIPID_STM32_F1_XL = 0x430, 35 | STLINK_CHIPID_STM32_F411RE = 0x431, 36 | STLINK_CHIPID_STM32_F37x = 0x432, 37 | STLINK_CHIPID_STM32_F4_DE = 0x433, 38 | STLINK_CHIPID_STM32_F4_DSI = 0x434, 39 | /* 40 | * 0x435 covers STM32L43xxx and STM32L44xxx devices 41 | * 0x461 covers STM32L496xx and STM32L4A6xx devices 42 | * 0x462 covers STM32L45xxx and STM32L46xxx devices 43 | */ 44 | STLINK_CHIPID_STM32_L43X = 0x435, 45 | STLINK_CHIPID_STM32_L496X = 0x461, 46 | STLINK_CHIPID_STM32_L46X = 0x462, 47 | /* 48 | * 0x436 is actually assigned to some L1 chips that are called "Medium-Plus" 49 | * and some that are called "High". 0x427 is assigned to the other "Medium- 50 | * plus" chips. To make it a bit simpler we just call 427 MEDIUM_PLUS and 51 | * 0x436 HIGH. 52 | */ 53 | STLINK_CHIPID_STM32_L1_HIGH = 0x436, 54 | STLINK_CHIPID_STM32_L152_RE = 0x437, 55 | STLINK_CHIPID_STM32_F334 = 0x438, 56 | STLINK_CHIPID_STM32_F3_SMALL = 0x439, 57 | STLINK_CHIPID_STM32_F0 = 0x440, 58 | STLINK_CHIPID_STM32_F412 = 0x441, 59 | STLINK_CHIPID_STM32_F09X = 0x442, 60 | STLINK_CHIPID_STM32_F0_SMALL = 0x444, 61 | STLINK_CHIPID_STM32_F04 = 0x445, 62 | STLINK_CHIPID_STM32_F303_HIGH = 0x446, 63 | STLINK_CHIPID_STM32_L0_CAT5 = 0x447, 64 | STLINK_CHIPID_STM32_F0_CAN = 0x448, 65 | STLINK_CHIPID_STM32_F7 = 0x449, /* This ID is found on the NucleoF746ZG board */ 66 | STLINK_CHIPID_STM32_F7XXXX = 0x451, 67 | STLINK_CHIPID_STM32_F72XXX = 0x452, /* This ID is found on the NucleoF722ZE board */ 68 | STLINK_CHIPID_STM32_L011 = 0x457, 69 | STLINK_CHIPID_STM32_F410 = 0x458, 70 | STLINK_CHIPID_STM32_F413 = 0x463, 71 | STLINK_CHIPID_STM32_L4RX = 0x470 // taken from the STM32L4R9I-DISCO board 72 | }; 73 | 74 | /** 75 | * Chipid parameters 76 | */ 77 | struct stlink_chipid_params { 78 | uint32_t chip_id; 79 | char *description; 80 | enum stlink_flash_type flash_type; 81 | uint32_t flash_size_reg; 82 | uint32_t flash_pagesize; 83 | uint32_t sram_size; 84 | uint32_t bootrom_base; 85 | uint32_t bootrom_size; 86 | }; 87 | 88 | const struct stlink_chipid_params *stlink_chipid_get_params(uint32_t chipid); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* STLINK_CHIPID_H_ */ 95 | -------------------------------------------------------------------------------- /include/stlink/commands.h: -------------------------------------------------------------------------------- 1 | #ifndef STLINK_COMMANDS_H_ 2 | #define STLINK_COMMANDS_H_ 3 | 4 | enum stlink_debug_commands { 5 | STLINK_DEBUG_ENTER_JTAG = 0x00, 6 | STLINK_DEBUG_GETSTATUS = 0x01, 7 | STLINK_DEBUG_FORCEDEBUG = 0x02, 8 | STLINK_DEBUG_RESETSYS = 0x03, 9 | STLINK_DEBUG_READALLREGS = 0x04, 10 | STLINK_DEBUG_READREG = 0x05, 11 | STLINK_DEBUG_WRITEREG = 0x06, 12 | STLINK_DEBUG_READMEM_32BIT = 0x07, 13 | STLINK_DEBUG_WRITEMEM_32BIT = 0x08, 14 | STLINK_DEBUG_RUNCORE = 0x09, 15 | STLINK_DEBUG_STEPCORE = 0x0a, 16 | STLINK_DEBUG_SETFP = 0x0b, 17 | STLINK_DEBUG_WRITEMEM_8BIT = 0x0d, 18 | STLINK_DEBUG_CLEARFP = 0x0e, 19 | STLINK_DEBUG_WRITEDEBUGREG = 0x0f, 20 | STLINK_DEBUG_ENTER = 0x20, 21 | STLINK_DEBUG_EXIT = 0x21, 22 | STLINK_DEBUG_READCOREID = 0x22, 23 | STLINK_DEBUG_ENTER_SWD = 0xa3 24 | }; 25 | 26 | #endif /* STLINK_COMMANDS_H_ */ 27 | -------------------------------------------------------------------------------- /include/stlink/flash_loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: stlink.h 3 | * 4 | * This should contain all the common top level stlink interfaces, regardless 5 | * of how the backend does the work.... 6 | */ 7 | #ifndef STLINK_FLASH_LOADER_H_ 8 | #define STLINK_FLASH_LOADER_H_ 9 | 10 | #include 11 | #include 12 | 13 | #include "stlink.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | int stlink_flash_loader_init(stlink_t *sl, flash_loader_t* fl); 20 | int stlink_flash_loader_write_to_sram(stlink_t *sl, stm32_addr_t* addr, size_t* size); 21 | int stlink_flash_loader_run(stlink_t *sl, flash_loader_t* fl, stm32_addr_t target, const uint8_t* buf, size_t size); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif /* STLINK_FLASH_LOADER_H_ */ 28 | -------------------------------------------------------------------------------- /include/stlink/logging.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Ugly, low performance, configurable level, logging "framework" 3 | */ 4 | 5 | #ifndef UGLYLOGGING_H 6 | #define UGLYLOGGING_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | enum ugly_loglevel { 13 | UDEBUG = 90, 14 | UINFO = 50, 15 | UWARN = 30, 16 | UERROR = 20 17 | }; 18 | 19 | int ugly_init(int maximum_threshold); 20 | int ugly_log(int level, const char *tag, const char *format, ...); 21 | 22 | #define UGLY_LOG_FILE (strstr(__FILE__, "/") != NULL ? \ 23 | strrchr(__FILE__, '/') + 1 : strrchr(__FILE__, '\\') + 1) 24 | 25 | /** @todo we need to write this in a more generic way, for now this should compile 26 | on visual studio (See http://stackoverflow.com/a/8673872/1836746) */ 27 | #define DLOG_HELPER(format, ...) ugly_log(UDEBUG, UGLY_LOG_FILE, format, __VA_ARGS__) 28 | #define DLOG(...) DLOG_HELPER(__VA_ARGS__, "") 29 | #define ILOG_HELPER(format, ...) ugly_log(UINFO, UGLY_LOG_FILE, format, __VA_ARGS__) 30 | #define ILOG(...) ILOG_HELPER(__VA_ARGS__, "") 31 | #define WLOG_HELPER(format, ...) ugly_log(UWARN, UGLY_LOG_FILE, format, __VA_ARGS__) 32 | #define WLOG(...) WLOG_HELPER(__VA_ARGS__, "") 33 | #define ELOG_HELPER(format, ...) ugly_log(UERROR, UGLY_LOG_FILE, format, __VA_ARGS__) 34 | #define ELOG(...) ELOG_HELPER(__VA_ARGS__, "") 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /* UGLYLOGGING_H */ 41 | 42 | -------------------------------------------------------------------------------- /include/stlink/mmap.h: -------------------------------------------------------------------------------- 1 | #ifndef STLINK_MMAP_H 2 | #define STLINK_MMAP_H 3 | 4 | #ifdef STLINK_HAVE_SYS_MMAN_H 5 | #include 6 | #else 7 | 8 | #define PROT_READ (1<<0) 9 | #define PROT_WRITE (1<<1) 10 | 11 | #define MAP_SHARED (1<<0) 12 | #define MAP_PRIVATE (1<<1) 13 | 14 | #define MAP_ANONYMOUS (1<<5) 15 | 16 | #define MAP_FAILED ((void *)-1) 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | void *mmap(void *addr, size_t len, int prot, int flags, int fd, long long offset); 23 | int munmap(void *addr, size_t len); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif /* HAVE_SYS_MMAN_H */ 30 | 31 | #endif /* STLINK_MMAP_H */ 32 | -------------------------------------------------------------------------------- /include/stlink/reg.h: -------------------------------------------------------------------------------- 1 | #ifndef STLINK_REG_H_ 2 | #define STLINK_REG_H_ 3 | 4 | #define STLINK_REG_CM3_CPUID 0xE000ED00 5 | #define STLINK_REG_CM3_FP_CTRL 0xE0002000 6 | #define STLINK_REG_CM3_FP_COMP0 0xE0002008 7 | 8 | /* Cortex™-M3 Technical Reference Manual */ 9 | /* Debug Halting Control and Status Register */ 10 | #define STLINK_REG_DHCSR 0xe000edf0 11 | #define STLINK_REG_DHCSR_DBGKEY 0xa05f0000 12 | #define STLINK_REG_DCRSR 0xe000edf4 13 | #define STLINK_REG_DCRDR 0xe000edf8 14 | 15 | /* Application Interrupt and Reset Control Register */ 16 | #define STLINK_REG_AIRCR 0xe000ed0c 17 | #define STLINK_REG_AIRCR_VECTKEY 0x05fa0000 18 | #define STLINK_REG_AIRCR_SYSRESETREQ 0x00000004 19 | 20 | #endif /* STLINK_REG_H_ */ 21 | -------------------------------------------------------------------------------- /include/stlink/sg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: stlink/sg.h 3 | * Author: karl 4 | * 5 | * Created on October 1, 2011, 11:29 PM 6 | */ 7 | 8 | #ifndef STLINK_SG_H 9 | #define STLINK_SG_H 10 | 11 | #if defined(_MSC_VER) 12 | #pragma warning(push) 13 | #pragma warning(disable: 4200 4255 4668 4820) 14 | #include 15 | #pragma warning(pop) 16 | #else 17 | #include 18 | #endif 19 | 20 | #include "stlink.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | // device access 27 | #define RDWR 0 28 | #define RO 1 29 | #define SG_TIMEOUT_SEC 1 // actually 1 is about 2 sec 30 | #define SG_TIMEOUT_MSEC 3 * 1000 31 | // Each CDB can be a total of 6, 10, 12, or 16 bytes, later version 32 | // of the SCSI standard also allow for variable-length CDBs (min. CDB is 6). 33 | // the stlink needs max. 10 bytes. 34 | #define CDB_6 6 35 | #define CDB_10 10 36 | #define CDB_12 12 37 | #define CDB_16 16 38 | 39 | #define CDB_SL 10 40 | 41 | // Query data flow direction. 42 | #define Q_DATA_OUT 0 43 | #define Q_DATA_IN 1 44 | 45 | // The SCSI Request Sense command is used to obtain sense data 46 | // (error information) from a target device. 47 | // http://en.wikipedia.org/wiki/SCSI_Request_Sense_Command 48 | #define SENSE_BUF_LEN 32 49 | 50 | 51 | 52 | struct stlink_libsg { 53 | libusb_context* libusb_ctx; 54 | libusb_device_handle *usb_handle; 55 | unsigned ep_rep; 56 | unsigned ep_req; 57 | 58 | int sg_fd; 59 | int do_scsi_pt_err; 60 | 61 | unsigned char cdb_cmd_blk[CDB_SL]; 62 | 63 | int q_data_dir; // Q_DATA_IN, Q_DATA_OUT 64 | // the start of the query data in the device memory space 65 | uint32_t q_addr; 66 | 67 | // Sense (error information) data 68 | // obsolete, this was fed to the scsi tools 69 | unsigned char sense_buf[SENSE_BUF_LEN]; 70 | 71 | struct stlink_reg reg; 72 | }; 73 | 74 | stlink_t* stlink_v1_open(const int verbose, int reset); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* STLINK_SG_H */ 81 | 82 | -------------------------------------------------------------------------------- /include/stlink/usb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: stlink/usb.h 3 | * Author: karl 4 | * 5 | * Created on October 1, 2011, 11:29 PM 6 | */ 7 | 8 | #ifndef STLINK_USB_H 9 | #define STLINK_USB_H 10 | 11 | #include 12 | #include 13 | 14 | #include "stlink.h" 15 | #include "stlink/logging.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #define STLINK_USB_VID_ST 0x0483 22 | #define STLINK_USB_PID_STLINK 0x3744 23 | #define STLINK_USB_PID_STLINK_32L 0x3748 24 | #define STLINK_USB_PID_STLINK_NUCLEO 0x374b 25 | 26 | #define STLINK_SG_SIZE 31 27 | #define STLINK_CMD_SIZE 16 28 | 29 | struct stlink_libusb { 30 | libusb_context* libusb_ctx; 31 | libusb_device_handle* usb_handle; 32 | unsigned int ep_req; 33 | unsigned int ep_rep; 34 | int protocoll; 35 | unsigned int sg_transfer_idx; 36 | unsigned int cmd_len; 37 | }; 38 | 39 | /** 40 | * Open a stlink 41 | * @param verbose Verbosity loglevel 42 | * @param reset Reset stlink programmer 43 | * @param serial Serial number to search for, when NULL the first stlink found is opened (binary format) 44 | * @retval NULL Error while opening the stlink 45 | * @retval !NULL Stlink found and ready to use 46 | */ 47 | stlink_t *stlink_open_usb(enum ugly_loglevel verbose, bool reset, char serial[16]); 48 | size_t stlink_probe_usb(stlink_t **stdevs[]); 49 | void stlink_probe_usb_free(stlink_t **stdevs[], size_t size); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* STLINK_USB_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/stlink/version.h: -------------------------------------------------------------------------------- 1 | #ifndef STLINK_VERSION_H_ 2 | #define STLINK_VERSION_H_ 3 | 4 | #define STLINK_VERSION "@PROJECT_VERSION@" 5 | #define STLINK_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ 6 | #define STLINK_VERSION_MINOR @PROJECT_VERSION_MINOR@ 7 | #define STLINK_VERSION_PATCH @PROJECT_VERSION_PATCH@ 8 | 9 | #endif /* STLINK_VERSION_ */ 10 | -------------------------------------------------------------------------------- /include/stlink/version.h.in: -------------------------------------------------------------------------------- 1 | #ifndef STLINK_VERSION_H_ 2 | #define STLINK_VERSION_H_ 3 | 4 | #define STLINK_VERSION "@PROJECT_VERSION@" 5 | #define STLINK_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ 6 | #define STLINK_VERSION_MINOR @PROJECT_VERSION_MINOR@ 7 | #define STLINK_VERSION_PATCH @PROJECT_VERSION_PATCH@ 8 | 9 | #endif /* STLINK_VERSION_ */ 10 | -------------------------------------------------------------------------------- /lib/linux_64/libiup.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trlsmax/rtt_stlink/7b5ee1d41c0a5e392f7d22e70c8729495acdcaeb/lib/linux_64/libiup.a -------------------------------------------------------------------------------- /lib/linux_64/libstlink.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trlsmax/rtt_stlink/7b5ee1d41c0a5e392f7d22e70c8729495acdcaeb/lib/linux_64/libstlink.a -------------------------------------------------------------------------------- /lib/linux_64/libusb-1.0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trlsmax/rtt_stlink/7b5ee1d41c0a5e392f7d22e70c8729495acdcaeb/lib/linux_64/libusb-1.0.a -------------------------------------------------------------------------------- /lib/win_32/libiup.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trlsmax/rtt_stlink/7b5ee1d41c0a5e392f7d22e70c8729495acdcaeb/lib/win_32/libiup.a -------------------------------------------------------------------------------- /lib/win_32/libstlink.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trlsmax/rtt_stlink/7b5ee1d41c0a5e392f7d22e70c8729495acdcaeb/lib/win_32/libstlink.a -------------------------------------------------------------------------------- /lib/win_32/libusb-1.0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trlsmax/rtt_stlink/7b5ee1d41c0a5e392f7d22e70c8729495acdcaeb/lib/win_32/libusb-1.0.a -------------------------------------------------------------------------------- /rtt_stlink.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | typedef struct { 12 | uint32_t sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4" 13 | uint32_t pBuffer; // Pointer to start of buffer 14 | uint32_t SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty. 15 | uint32_t WrOff; // Position of next item to be written by either target. 16 | uint32_t RdOff; // Position of next item to be read by host. Must be volatile since it may be modified by host. 17 | uint32_t Flags; // Contains configuration flags 18 | } rtt_channel; 19 | 20 | typedef struct { 21 | int8_t acID[16]; // Initialized to "SEGGER RTT" 22 | int32_t MaxNumUpBuffers; // Initialized to SEGGER_RTT_MAX_NUM_UP_BUFFERS (type. 2) 23 | int32_t MaxNumDownBuffers; // Initialized to SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (type. 2) 24 | int32_t cb_size; 25 | int32_t cb_addr; 26 | rtt_channel *aUp; // Up buffers, transferring information up from target via debug probe to host 27 | rtt_channel *aDown; // Down buffers, transferring information down from host via debug probe to target 28 | } rtt_cb; 29 | 30 | Ihandle *timer; 31 | Ihandle *txt_message; 32 | stlink_t* sl = NULL; 33 | rtt_cb *rtt_cb_ptr; 34 | 35 | int read_mem(uint8_t *des, uint32_t addr, uint32_t len) 36 | { 37 | uint32_t offset_addr = 0, offset_len, read_len; 38 | 39 | // address and read len need to align to 4 40 | read_len = len; 41 | offset_addr = addr % 4; 42 | if (offset_addr > 0) { 43 | addr -= offset_addr; 44 | read_len += offset_addr; 45 | } 46 | offset_len = read_len % 4; 47 | if (offset_len > 0) 48 | read_len += (4 - offset_len); 49 | 50 | stlink_read_mem32(sl, addr, read_len); 51 | 52 | // read data we actually need 53 | for (uint32_t i = 0; i < len; i++) 54 | des[i] = (uint8_t)sl->q_buf[i + offset_addr]; 55 | 56 | return 0; 57 | } 58 | 59 | int write_mem(uint8_t *buf, uint32_t addr, uint32_t len) 60 | { 61 | for (uint32_t i = 0; i < len; i++) 62 | sl->q_buf[i] = buf[i]; 63 | 64 | stlink_write_mem8(sl, addr, len); 65 | 66 | return 0; 67 | } 68 | 69 | int get_channel_data(uint8_t *buf, rtt_channel *rtt_c, uint32_t rtt_channel_addr) 70 | { 71 | uint32_t len; 72 | 73 | if (rtt_c->WrOff > rtt_c->RdOff) { 74 | len = rtt_c->WrOff - rtt_c->RdOff; 75 | read_mem(buf, rtt_c->pBuffer + rtt_c->RdOff, len); 76 | rtt_c->RdOff += len; 77 | write_mem((uint8_t *)&(rtt_c->RdOff), rtt_channel_addr + 4 * 4, 4); 78 | return 1; 79 | } else if (rtt_c->WrOff < rtt_c->RdOff) { 80 | len = rtt_c->SizeOfBuffer - rtt_c->RdOff; 81 | read_mem(buf, rtt_c->pBuffer + rtt_c->RdOff, len); 82 | read_mem(buf + len, rtt_c->pBuffer, rtt_c->WrOff); 83 | rtt_c->RdOff = rtt_c->WrOff; 84 | write_mem((uint8_t *)&(rtt_c->RdOff), rtt_channel_addr + 4 * 4, 4); 85 | return 1; 86 | } else { 87 | return 0; 88 | } 89 | } 90 | 91 | int cb_timer(Ihandle *self) 92 | { 93 | uint8_t buf[1024]; 94 | char str_buf[1024]; 95 | int line_cnt; 96 | 97 | // update SEGGER_RTT_CB content 98 | read_mem(buf, rtt_cb_ptr->cb_addr + 24, rtt_cb_ptr->cb_size - 24); 99 | for (uint32_t j = 0; j < rtt_cb_ptr->MaxNumUpBuffers * sizeof(rtt_channel); j++) 100 | ((uint8_t *)rtt_cb_ptr->aUp)[j] = buf[j]; 101 | for (uint32_t j = 0; j < rtt_cb_ptr->MaxNumDownBuffers * sizeof(rtt_channel); j++) 102 | ((uint8_t *)rtt_cb_ptr->aDown)[j] = buf[rtt_cb_ptr->MaxNumUpBuffers * sizeof(rtt_channel) + j]; 103 | 104 | memset(buf, '\0', 1024); 105 | if (get_channel_data(buf, &rtt_cb_ptr->aUp[0], rtt_cb_ptr->cb_addr + 24) > 0) { 106 | if (strlen(buf) > 0) { 107 | strcpy(str_buf, buf); 108 | IupSetAttribute(txt_message, "APPEND", str_buf); 109 | line_cnt = IupGetInt(txt_message, "LINECOUNT"); 110 | IupSetStrf(txt_message, "SCROLLTO", "%d:1", line_cnt); 111 | } 112 | } 113 | 114 | return IUP_DEFAULT; 115 | } 116 | 117 | static stlink_t *stlink_open_first(void) 118 | { 119 | stlink_t* sl = NULL; 120 | sl = stlink_v1_open(0, 1); 121 | if (sl == NULL) 122 | sl = stlink_open_usb(0, 1, NULL); 123 | 124 | return sl; 125 | } 126 | 127 | int cb_btn_connect(Ihandle *self) 128 | { 129 | if (sl == NULL) { 130 | sl = stlink_open_first(); 131 | 132 | if (sl == NULL) { 133 | IupMessage("error","fail to open stlink"); 134 | return IUP_DEFAULT; 135 | } 136 | 137 | sl->verbose = 1; 138 | 139 | if (stlink_current_mode(sl) == STLINK_DEV_DFU_MODE) 140 | stlink_exit_dfu_mode(sl); 141 | 142 | if (stlink_current_mode(sl) != STLINK_DEV_DEBUG_MODE) 143 | stlink_enter_swd_mode(sl); 144 | 145 | // read the whole RAM 146 | uint8_t *buf = (uint8_t *)malloc(sl->sram_size); 147 | uint32_t r_cnt = sl->sram_size / 0x400; 148 | printf("target have %u k ram\n\r", r_cnt); 149 | for (uint32_t i = 0; i < r_cnt; i++) { 150 | stlink_read_mem32(sl, 0x20000000 + i * 0x400, 0x400); 151 | for (uint32_t k = 0; k < 0x400; k++) 152 | (buf + i * 0x400)[k] = (uint8_t)(sl->q_buf[k]); 153 | } 154 | 155 | rtt_cb_ptr = (rtt_cb *)malloc(sizeof(rtt_cb)); 156 | rtt_cb_ptr->cb_addr = 0; 157 | 158 | // find SEGGER_RTT_CB address 159 | uint32_t offset; 160 | for (offset = 0; offset < sl->sram_size - 16; offset++) { 161 | if (strncmp((char *)&buf[offset], "SEGGER RTT", 16) == 0) { 162 | rtt_cb_ptr->cb_addr = 0x20000000 + offset; 163 | printf("addr = 0x%x\n\r", rtt_cb_ptr->cb_addr); 164 | break; 165 | } 166 | } 167 | 168 | if (rtt_cb_ptr->cb_addr == 0) { 169 | IupMessage("ERROR", "NO SEGGER_RTT_CB found!"); 170 | free(buf); 171 | return IUP_DEFAULT; 172 | } 173 | 174 | // get SEGGER_RTT_CB content 175 | memcpy(rtt_cb_ptr->acID, ((rtt_cb *)(buf + offset))->acID, 16); 176 | rtt_cb_ptr->MaxNumUpBuffers = ((rtt_cb *)(buf + offset))->MaxNumUpBuffers; 177 | rtt_cb_ptr->MaxNumDownBuffers = ((rtt_cb *)(buf + offset))->MaxNumDownBuffers; 178 | rtt_cb_ptr->cb_size = 24 + (rtt_cb_ptr->MaxNumUpBuffers + rtt_cb_ptr->MaxNumDownBuffers) * sizeof(rtt_cb); 179 | rtt_cb_ptr->aUp = (rtt_channel *)malloc(rtt_cb_ptr->MaxNumUpBuffers * sizeof(rtt_channel)); 180 | rtt_cb_ptr->aDown = (rtt_channel *)malloc(rtt_cb_ptr->MaxNumDownBuffers * sizeof(rtt_channel)); 181 | memcpy(rtt_cb_ptr->aUp, buf + offset + 24, rtt_cb_ptr->MaxNumUpBuffers * sizeof(rtt_channel)); 182 | memcpy(rtt_cb_ptr->aDown, buf + offset + 24 + rtt_cb_ptr->MaxNumUpBuffers * sizeof(rtt_channel), 183 | rtt_cb_ptr->MaxNumDownBuffers * sizeof(rtt_channel)); 184 | 185 | free(buf); 186 | stlink_run(sl); 187 | 188 | IupSetAttribute(timer, "RUN", "YES"); 189 | IupSetAttribute(self, "TITLE", "DISCONNECT"); 190 | } else { 191 | stlink_exit_debug_mode(sl); 192 | stlink_close(sl); 193 | sl = NULL; 194 | IupSetAttribute(timer, "RUN", "NO"); 195 | IupSetAttribute(self, "TITLE", "CONNECT"); 196 | free(rtt_cb_ptr->aUp); 197 | free(rtt_cb_ptr->aDown); 198 | free(rtt_cb_ptr); 199 | } 200 | 201 | return IUP_DEFAULT; 202 | } 203 | 204 | void create_main_dialog(void) 205 | { 206 | Ihandle *dlg; 207 | Ihandle *btn_connect; 208 | 209 | timer = IupTimer(); 210 | IupSetInt(timer, "TIME", 100); 211 | IupSetCallback(timer, "ACTION_CB", (Icallback)cb_timer); 212 | 213 | btn_connect = IupButton("CONNECT", NULL); 214 | IupSetAttribute(btn_connect, "EXPAND", "HORIZONTALFREE"); 215 | IupSetCallback(btn_connect, "ACTION", (Icallback)cb_btn_connect); 216 | 217 | txt_message = IupText(NULL); 218 | IupSetAttribute(txt_message, "EXPAND", "YES"); 219 | IupSetAttribute(txt_message, "READONLY", "YES"); 220 | IupSetAttribute(txt_message, "MULTILINE", "YES"); 221 | IupSetAttribute(txt_message, "APPENDNEWLINE", "NO"); 222 | 223 | dlg = IupDialog( 224 | IupSetAttributes(IupVbox( 225 | txt_message, 226 | btn_connect, 227 | NULL), "NMARGIN=10x10,GAP=10") 228 | ); 229 | 230 | IupSetAttribute(dlg, "TITLE", "RTT STLINK"); 231 | IupSetAttribute(dlg, "RASTERSIZE", "800x600"); 232 | IupShowXY(dlg, IUP_CENTER, IUP_CENTER); 233 | } 234 | 235 | int main(int ac, char** av) 236 | { 237 | IupOpen(&ac, &av); 238 | 239 | create_main_dialog(); 240 | IupMainLoop(); 241 | 242 | IupClose(); 243 | if (sl) { 244 | stlink_exit_debug_mode(sl); 245 | stlink_close(sl); 246 | } 247 | if (rtt_cb_ptr->aUp != NULL) 248 | free(rtt_cb_ptr->aUp); 249 | if (rtt_cb_ptr->aDown != NULL) 250 | free(rtt_cb_ptr->aDown); 251 | if (rtt_cb_ptr != NULL) 252 | free(rtt_cb_ptr); 253 | 254 | return 0; 255 | } 256 | --------------------------------------------------------------------------------