int main(int argc, char **argv) { Ihandle *dlg; Ihandle *config; IupOpen(&argc, &argv); IupGLCanvasOpen(); IupImageLibOpen(); config = IupConfig(); IupSetAttribute(config, "APP_NAME", "simple_paint"); IupConfigLoad(config); dlg = create_main_dialog(config); /* show the dialog at the last position, with the last size */ IupConfigDialogShow(config, dlg, "MainWindow"); /* open a file from the command line (allow file association in Windows) */ if (argc > 1 && argv[1]) { const char* filename = argv[1]; open_file(dlg, filename); } /* initialize the current file, if not already loaded */ check_new_file(dlg); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
static int iupluaimglib_open (lua_State *L) { IupImageLibOpen(); iuplua_get_env(L); iuplua_register(L, imagelibopen, "ImageLibOpen"); return 0; /* nothing in stack */ }
int main(int argc, char* argv[]) { IupOpen(&argc, &argv); IupImageLibOpen(); ButtonTest(); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
int main(int argc, char* argv[]) { IupOpen(&argc, &argv); IupControlsOpen(); IupImageLibOpen(); MatrixCbsTest(); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
void MatrixCbsTest(void) { Ihandle *dlg, *bt; IupMatrixExOpen(); IupImageLibOpen(); IupSetFunction("removeline", (Icallback)removeline); IupSetFunction("addline", (Icallback)addline); IupSetFunction("removecol", (Icallback)removecol); IupSetFunction("addcol", (Icallback)addcol); IupSetFunction("redraw", (Icallback)redraw); createmenu(); bt = IupButton("Button", NULL); IupSetCallback(bt, "ACTION", bt_cb); dlg = IupDialog( // IupZbox( IupTabs( IupSetAttributes( IupVbox((create_mat(1)), bt, IupText(""), IupLabel("Label Text"), IupFrame(IupVal("HORIZONTAL")), NULL), "MARGIN=10x10, GAP=10, TABTITLE=Test1"), IupSetAttributes( IupVbox(IupFrame(create_mat(2)), IupText(""), IupLabel("Label Text"), IupVal("HORIZONTAL"), // NULL), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2,FONT=HELVETICA_ITALIC_14"), // NULL), "FONT=HELVETICA_NORMAL_12, BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"), NULL), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"), NULL)); IupSetAttribute(dlg,"TITLE", "IupMatrix"); IupSetAttribute(dlg,"MENU", "mymenu"); IupSetAttributeHandle(dlg,"DEFAULTENTER", bt); // IupSetAttribute(dlg,"BGCOLOR", "255 0 255"); //IupSetAttribute(dlg,"COMPOSITED", "YES"); //IupSetAttribute(dlg,"OPACITY", "192"); IupShowXY(dlg,IUP_CENTER,IUP_CENTER); }
int main(int argc, char **argv) { Ihandle *dlg, *vbox, *multitext, *menu; Ihandle *sub_menu_file, *file_menu, *item_exit, *item_new, *item_open, *item_save, *item_saveas, *item_revert; Ihandle *sub_menu_edit, *edit_menu, *item_find, *item_goto, *item_copy, *item_paste, *item_cut, *item_delete, *item_select_all; Ihandle *btn_cut, *btn_copy, *btn_paste, *btn_find, *btn_new, *btn_open, *btn_save; Ihandle *sub_menu_format, *format_menu, *item_font; Ihandle *sub_menu_help, *help_menu, *item_help, *item_about; Ihandle *sub_menu_view, *view_menu, *item_toolbar, *item_statusbar; Ihandle *lbl_statusbar, *toolbar_hb, *recent_menu; Ihandle *config; const char* font; IupOpen(&argc, &argv); IupImageLibOpen(); config = IupConfig(); IupSetAttribute(config, "APP_NAME", "simple_notepad"); IupConfigLoad(config); multitext = IupText(NULL); IupSetAttribute(multitext, "MULTILINE", "YES"); IupSetAttribute(multitext, "EXPAND", "YES"); IupSetAttribute(multitext, "NAME", "MULTITEXT"); IupSetAttribute(multitext, "DIRTY", "NO"); IupSetCallback(multitext, "CARET_CB", (Icallback)multitext_caret_cb); IupSetCallback(multitext, "VALUECHANGED_CB", (Icallback)multitext_valuechanged_cb); IupSetCallback(multitext, "DROPFILES_CB", (Icallback)dropfiles_cb); font = IupConfigGetVariableStr(config, "MainWindow", "Font"); if (font) IupSetStrAttribute(multitext, "FONT", font); lbl_statusbar = IupLabel("Lin 1, Col 1"); IupSetAttribute(lbl_statusbar, "NAME", "STATUSBAR"); IupSetAttribute(lbl_statusbar, "EXPAND", "HORIZONTAL"); IupSetAttribute(lbl_statusbar, "PADDING", "10x5"); item_new = IupItem("New\tCtrl+N", NULL); IupSetAttribute(item_new, "IMAGE", "IUP_FileNew"); IupSetCallback(item_new, "ACTION", (Icallback)item_new_action_cb); btn_new = IupButton(NULL, NULL); IupSetAttribute(btn_new, "IMAGE", "IUP_FileNew"); IupSetAttribute(btn_new, "FLAT", "Yes"); IupSetCallback(btn_new, "ACTION", (Icallback)item_new_action_cb); item_open = IupItem("&Open...\tCtrl+O", NULL); IupSetAttribute(item_open, "IMAGE", "IUP_FileOpen"); IupSetCallback(item_open, "ACTION", (Icallback)item_open_action_cb); btn_open = IupButton(NULL, NULL); IupSetAttribute(btn_open, "IMAGE", "IUP_FileOpen"); IupSetAttribute(btn_open, "FLAT", "Yes"); IupSetCallback(btn_open, "ACTION", (Icallback)item_open_action_cb); item_save = IupItem("Save\tCtrl+S", NULL); IupSetAttribute(item_save, "NAME", "ITEM_SAVE"); IupSetAttribute(item_save, "IMAGE", "IUP_FileSave"); IupSetCallback(item_save, "ACTION", (Icallback)item_save_action_cb); btn_save = IupButton(NULL, NULL); IupSetAttribute(btn_save, "IMAGE", "IUP_FileSave"); IupSetAttribute(btn_save, "FLAT", "Yes"); IupSetCallback(btn_save, "ACTION", (Icallback)item_save_action_cb); item_saveas = IupItem("Save &As...", NULL); IupSetAttribute(item_saveas, "NAME", "ITEM_SAVEAS"); IupSetCallback(item_saveas, "ACTION", (Icallback)item_saveas_action_cb); item_revert = IupItem("Revert", NULL); IupSetAttribute(item_revert, "NAME", "ITEM_REVERT"); IupSetCallback(item_revert, "ACTION", (Icallback)item_revert_action_cb); item_exit = IupItem("E&xit", NULL); IupSetCallback(item_exit, "ACTION", (Icallback)item_exit_action_cb); item_find = IupItem("&Find...\tCtrl+F", NULL); IupSetAttribute(item_find, "IMAGE", "IUP_EditFind"); IupSetCallback(item_find, "ACTION", (Icallback)item_find_action_cb); btn_find = IupButton(NULL, NULL); IupSetAttribute(btn_find, "IMAGE", "IUP_EditFind"); IupSetAttribute(btn_find, "FLAT", "Yes"); IupSetCallback(btn_find, "ACTION", (Icallback)item_find_action_cb); item_cut = IupItem("Cut\tCtrl+X", NULL); IupSetAttribute(item_cut, "NAME", "ITEM_CUT"); IupSetAttribute(item_cut, "IMAGE", "IUP_EditCut"); IupSetCallback(item_cut, "ACTION", (Icallback)item_cut_action_cb); item_copy = IupItem("Copy\tCtrl+C", NULL); IupSetAttribute(item_copy, "NAME", "ITEM_COPY"); IupSetAttribute(item_copy, "IMAGE", "IUP_EditCopy"); IupSetCallback(item_copy, "ACTION", (Icallback)item_copy_action_cb); item_paste = IupItem("Paste\tCtrl+V", NULL); IupSetAttribute(item_paste, "NAME", "ITEM_PASTE"); IupSetAttribute(item_paste, "IMAGE", "IUP_EditPaste"); IupSetCallback(item_paste, "ACTION", (Icallback)item_paste_action_cb); item_delete = IupItem("Delete\tDel", NULL); IupSetAttribute(item_delete, "IMAGE", "IUP_EditErase"); IupSetAttribute(item_delete, "NAME", "ITEM_DELETE"); IupSetCallback(item_delete, "ACTION", (Icallback)item_delete_action_cb); item_select_all = IupItem("Select All\tCtrl+A", NULL); IupSetCallback(item_select_all, "ACTION", (Icallback)item_select_all_action_cb); btn_cut = IupButton(NULL, NULL); IupSetAttribute(btn_cut, "IMAGE", "IUP_EditCut"); IupSetAttribute(btn_cut, "FLAT", "Yes"); IupSetCallback(btn_cut, "ACTION", (Icallback)item_cut_action_cb); btn_copy = IupButton(NULL, NULL); IupSetAttribute(btn_copy, "IMAGE", "IUP_EditCopy"); IupSetAttribute(btn_copy, "FLAT", "Yes"); IupSetCallback(btn_copy, "ACTION", (Icallback)item_copy_action_cb); btn_paste = IupButton(NULL, NULL); IupSetAttribute(btn_paste, "IMAGE", "IUP_EditPaste"); IupSetAttribute(btn_paste, "FLAT", "Yes"); IupSetCallback(btn_paste, "ACTION", (Icallback)item_paste_action_cb); toolbar_hb = IupHbox( btn_new, btn_open, btn_save, IupSetAttributes(IupLabel(NULL), "SEPARATOR=VERTICAL"), btn_cut, btn_copy, btn_paste, IupSetAttributes(IupLabel(NULL), "SEPARATOR=VERTICAL"), btn_find, NULL); IupSetAttribute(toolbar_hb, "MARGIN", "5x5"); IupSetAttribute(toolbar_hb, "GAP", "2"); item_toolbar = IupItem("&Toobar...", NULL); IupSetCallback(item_toolbar, "ACTION", (Icallback)item_toolbar_action_cb); IupSetAttribute(item_toolbar, "VALUE", "ON"); item_statusbar = IupItem("&Statusbar...", NULL); IupSetCallback(item_statusbar, "ACTION", (Icallback)item_statusbar_action_cb); IupSetAttribute(item_statusbar, "VALUE", "ON"); if (!IupConfigGetVariableIntDef(config, "MainWindow", "Toolbar", 1)) { IupSetAttribute(item_toolbar, "VALUE", "OFF"); IupSetAttribute(toolbar_hb, "FLOATING", "YES"); IupSetAttribute(toolbar_hb, "VISIBLE", "NO"); } if (!IupConfigGetVariableIntDef(config, "MainWindow", "Statusbar", 1)) { IupSetAttribute(item_statusbar, "VALUE", "OFF"); IupSetAttribute(lbl_statusbar, "FLOATING", "YES"); IupSetAttribute(lbl_statusbar, "VISIBLE", "NO"); } item_goto = IupItem("&Go To...\tCtrl+G", NULL); IupSetCallback(item_goto, "ACTION", (Icallback)item_goto_action_cb); item_font = IupItem("&Font...", NULL); IupSetCallback(item_font, "ACTION", (Icallback)item_font_action_cb); item_help = IupItem("&Help...", NULL); IupSetCallback(item_help, "ACTION", (Icallback)item_help_action_cb); item_about = IupItem("&About...", NULL); IupSetCallback(item_about, "ACTION", (Icallback)item_about_action_cb); recent_menu = IupMenu(NULL); file_menu = IupMenu( item_new, item_open, item_save, item_saveas, item_revert, IupSeparator(), IupSubmenu("Recent &Files", recent_menu), item_exit, NULL); edit_menu = IupMenu( item_cut, item_copy, item_paste, item_delete, IupSeparator(), item_find, item_goto, IupSeparator(), item_select_all, NULL); format_menu = IupMenu( item_font, NULL); view_menu = IupMenu( item_toolbar, item_statusbar, NULL); help_menu = IupMenu( item_help, item_about, NULL); IupSetCallback(file_menu, "OPEN_CB", (Icallback)file_menu_open_cb); IupSetCallback(edit_menu, "OPEN_CB", (Icallback)edit_menu_open_cb); sub_menu_file = IupSubmenu("&File", file_menu); sub_menu_edit = IupSubmenu("&Edit", edit_menu); sub_menu_format = IupSubmenu("F&ormat", format_menu); sub_menu_view = IupSubmenu("&View", view_menu); sub_menu_help = IupSubmenu("&Help", help_menu); menu = IupMenu( sub_menu_file, sub_menu_edit, sub_menu_format, sub_menu_view, sub_menu_help, NULL); vbox = IupVbox( toolbar_hb, multitext, lbl_statusbar, NULL); dlg = IupDialog(vbox); IupSetAttributeHandle(dlg, "MENU", menu); IupSetAttribute(dlg, "SIZE", "HALFxHALF"); IupSetCallback(dlg, "CLOSE_CB", (Icallback)item_exit_action_cb); IupSetCallback(dlg, "DROPFILES_CB", (Icallback)dropfiles_cb); IupSetAttribute(dlg, "CONFIG", (char*)config); /* parent for pre-defined dialogs in closed functions (IupMessage) */ IupSetAttributeHandle(NULL, "PARENTDIALOG", dlg); IupSetCallback(dlg, "K_cN", (Icallback)item_new_action_cb); IupSetCallback(dlg, "K_cO", (Icallback)item_open_action_cb); IupSetCallback(dlg, "K_cS", (Icallback)item_save_action_cb); IupSetCallback(dlg, "K_cF", (Icallback)item_find_action_cb); IupSetCallback(dlg, "K_cG", (Icallback)item_goto_action_cb); IupConfigRecentInit(config, recent_menu, item_recent_cb, 10); IupShowXY(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT); IupSetAttribute(dlg, "USERSIZE", NULL); /* remove minimum size restriction */ new_file(dlg); /* open a file from the command line (allow file association in Windows) */ if (argc > 1 && argv[1]) { const char* filename = argv[1]; open_file(dlg, filename); } IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
static int imagelibopen(lua_State *L) { (void)L; IupImageLibOpen(); return 0; }
// ------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------- int main (int argc, char** argv) { // Init //glutInit(&argc, argv); IupOpen(&argc, &argv); IupGLCanvasOpen(); IupImageLibOpen(); // Create dialog cMainDialog *main_dialog = new cMainDialog(); //glewExperimental = GL_TRUE; GLenum err = glewInit(); if(GLEW_OK != err) { fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err)); return EXIT_FAILURE; } printf("Glew Version: %s\n", glewGetString(GLEW_VERSION)); printf("GL Vendor: %s\n", glGetString(GL_VENDOR)); printf("GL Renderer: %s\n", glGetString(GL_RENDERER)); printf("\nGL Version: %s\n", glGetString(GL_VERSION)); //This is the new way for getting the GL version. //It returns integers. Much better than the old glGetString(GL_VERSION). int OpenGLVersion[2]; glGetIntegerv(GL_MAJOR_VERSION, &OpenGLVersion[0]); glGetIntegerv(GL_MINOR_VERSION, &OpenGLVersion[1]); printf("OpenGL major version = %d\n", OpenGLVersion[0]); printf("OpenGL minor version = %d\n", OpenGLVersion[1]); // For all versions of OpenGL 3.3 and above, // the corresponding GLSL version matches the OpenGL version. // So GL 4.1 uses GLSL 4.10. printf("Shader Version: %s\n\n", glGetString(GL_SHADING_LANGUAGE_VERSION)); int major, minor, rev; _glfwParseGLVersion(&major, &minor, &rev); cRender::m_new_render = major <= 2 ? false: true; g_model = new cModel(); if(!g_render_att) g_render_att = new cRenderAtt(); if(cRender::m_new_render) { if(!g_shader) { g_shader = new cShader(); if(!g_shader->create()) { delete g_shader; g_shader = NULL; } } if(!g_shader2) { g_shader2 = new cShader(); if(!g_shader2->create()) { delete g_shader2; g_shader2 = NULL; } } } init_opengl(); main_dialog->show_dialog(); IupMainLoop(); IupClose(); delete main_dialog; //delete obj_dialog; return EXIT_SUCCESS; }
int main(int argc, char ** argv) { setExecutablePath(argv[0]); lua_State *L = lua_open(); luaL_openlibs(L); #if USE_IUP iuplua_open(L); cdlua_open(L); cdluaiup_open(L); iupkey_open(L); iupimlua_open(L); IupImageLibOpen (); iupcontrolslua_open(L); imlua_open(L); imlua_open_process(L); #endif luaopen_pack(L); luaopen_lfs(L); luaopen_marshal(L); luaopen_mime_core(L); luaopen_socket_core(L); pdfdoc_register(L); pdfpage_register(L); clipboard_register(L); luaopen_system(L); luaopen_compare(L); #if _DEBUG lua_pushboolean(L, true); lua_setfield(L, LUA_GLOBALSINDEX, "_DEBUG"); #endif char luaFile[512] = ""; char playlistFile[512] = ""; int beginIndex = 1; if (argc > 1) { int strl = strlen(argv[1]); bool isLuaFile = strcmp(&argv[1][strl-4], ".lua") == 0; if (isLuaFile) { beginIndex = 2; strcpy_s(luaFile, sizeof(luaFile), argv[1]); } else if (strcmp(&argv[1][strl-5], ".sing") == 0 || strcmp(&argv[1][strl-4], ".m3u") == 0 || strcmp(&argv[1][strl-4], ".txt") == 0) { } } if (!luaFile[0]) { lua_pushboolean(L, true); lua_setfield(L, LUA_GLOBALSINDEX, "APPLOADED"); const char* execPath = getExecutablePath(); sprintf_s(luaFile, sizeof(luaFile), "%s\\%s", execPath, "main.lua"); } int temp_int = luaL_loadfile(L,luaFile); int returnval = 0; if (temp_int) { const char *error = lua_tostring(L, -1); printf("Error in file: \"%s\"\n", luaFile); printf("%s\n", error); returnval = 1; } else { const char *error; for (int i = beginIndex; i < argc; i++) lua_pushstring(L, argv[i]); if (docall(L,argc-beginIndex,0)) { error = lua_tostring(L, -1); if (error) std::cout << error; returnval = 1; } } close(L); return returnval; }
int main(int argc, char **argv) { Ihandle *dlg, *vbox, *multitext, *menu; Ihandle *sub_menu_file, *file_menu, *item_exit, *item_open, *item_saveas, *btn_open, *btn_save; Ihandle *sub_menu_edit, *edit_menu, *item_find, *item_goto, *btn_find; Ihandle *sub_menu_format, *format_menu, *item_font; Ihandle *sub_menu_help, *help_menu, *item_about; Ihandle *lbl_statusbar, *toolbar_hb; IupOpen(&argc, &argv); IupImageLibOpen(); multitext = IupText(NULL); IupSetAttribute(multitext, "MULTILINE", "YES"); IupSetAttribute(multitext, "EXPAND", "YES"); IupSetAttribute(multitext, "NAME", "MULTITEXT"); lbl_statusbar = IupLabel("Lin 1, Col 1"); IupSetAttribute(lbl_statusbar, "NAME", "STATUSBAR"); IupSetAttribute(lbl_statusbar, "EXPAND", "HORIZONTAL"); IupSetAttribute(lbl_statusbar, "PADDING", "10x5"); item_open = IupItem("&Open...\tCtrl+O", NULL); btn_open = IupButton(NULL, NULL); IupSetAttribute(btn_open, "IMAGE", "IUP_FileOpen"); IupSetAttribute(btn_open, "FLAT", "Yes"); item_saveas = IupItem("Save &As...\tCtrl+S", NULL); btn_save = IupButton(NULL, NULL); IupSetAttribute(btn_save, "IMAGE", "IUP_FileSave"); IupSetAttribute(btn_save, "FLAT", "Yes"); item_exit = IupItem("E&xit", NULL); item_find = IupItem("&Find...\tCtrl+F", NULL); btn_find = IupButton(NULL, NULL); IupSetAttribute(btn_find, "IMAGE", "IUP_EditFind"); IupSetAttribute(btn_find, "FLAT", "Yes"); toolbar_hb = IupHbox( btn_open, btn_save, IupSetAttributes(IupLabel(NULL), "SEPARATOR=VERTICAL"), btn_find, NULL); IupSetAttribute(toolbar_hb, "MARGIN", "5x5"); IupSetAttribute(toolbar_hb, "GAP", "2"); item_goto = IupItem("&Go To...\tCtrl+G", NULL); item_font = IupItem("&Font...", NULL); item_about = IupItem("&About...", NULL); IupSetCallback(item_open, "ACTION", (Icallback)item_open_action_cb); IupSetCallback(btn_open, "ACTION", (Icallback)item_open_action_cb); IupSetCallback(item_saveas, "ACTION", (Icallback)item_saveas_action_cb); IupSetCallback(btn_save, "ACTION", (Icallback)item_saveas_action_cb); IupSetCallback(item_exit, "ACTION", (Icallback)item_exit_action_cb); IupSetCallback(item_find, "ACTION", (Icallback)item_find_action_cb); IupSetCallback(btn_find, "ACTION", (Icallback)item_find_action_cb); IupSetCallback(item_goto, "ACTION", (Icallback)item_goto_action_cb); IupSetCallback(item_font, "ACTION", (Icallback)item_font_action_cb); IupSetCallback(item_about, "ACTION", (Icallback)item_about_action_cb); IupSetCallback(multitext, "CARET_CB", (Icallback)multitext_caret_cb); file_menu = IupMenu( item_open, item_saveas, IupSeparator(), item_exit, NULL); edit_menu = IupMenu( item_find, item_goto, NULL); format_menu = IupMenu( item_font, NULL); help_menu = IupMenu( item_about, NULL); sub_menu_file = IupSubmenu("&File", file_menu); sub_menu_edit = IupSubmenu("&Edit", edit_menu); sub_menu_format = IupSubmenu("F&ormat", format_menu); sub_menu_help = IupSubmenu("&Help", help_menu); menu = IupMenu( sub_menu_file, sub_menu_edit, sub_menu_format, sub_menu_help, NULL); vbox = IupVbox( toolbar_hb, multitext, lbl_statusbar, NULL); dlg = IupDialog(vbox); IupSetAttributeHandle(dlg, "MENU", menu); IupSetAttribute(dlg, "TITLE", "Simple Notepad"); IupSetAttribute(dlg, "SIZE", "HALFxHALF"); /* parent for pre-defined dialogs in closed functions (IupMessage) */ IupSetAttributeHandle(NULL, "PARENTDIALOG", dlg); IupSetCallback(dlg, "K_cO", (Icallback)item_open_action_cb); IupSetCallback(dlg, "K_cS", (Icallback)item_saveas_action_cb); IupSetCallback(dlg, "K_cF", (Icallback)item_find_action_cb); IupSetCallback(dlg, "K_cG", (Icallback)item_goto_action_cb); IupShowXY(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT); IupSetAttribute(dlg, "USERSIZE", NULL); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
VALUE rb_IupImageLibOpen(VALUE self) { IupImageLibOpen(); return Qnil; }