Commit 1e786740cfd5944d63a7628baebae17dfdce0328
1 parent
a319240b
Exists in
master
and in
5 other branches
Iniciando implementação da função que permite selecionar um arquivo no plugin rexx
Showing
5 changed files
with
50 additions
and
0 deletions
Show diff stats
src/plugins/rx3270/rexx_methods.cc
@@ -33,6 +33,7 @@ | @@ -33,6 +33,7 @@ | ||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include "rx3270.h" | 35 | #include "rx3270.h" |
36 | + #include <gtk/gtk.h> | ||
36 | #include <time.h> | 37 | #include <time.h> |
37 | #include <string.h> | 38 | #include <string.h> |
38 | #include <ctype.h> | 39 | #include <ctype.h> |
@@ -527,3 +528,41 @@ RexxMethod5(int, rx3270_method_popup, CSELF, sessionPtr, CSTRING, s_id, CSTRING, | @@ -527,3 +528,41 @@ RexxMethod5(int, rx3270_method_popup, CSELF, sessionPtr, CSTRING, s_id, CSTRING, | ||
527 | 528 | ||
528 | return hSession->popup_dialog(id, title, message, "%s", det ? det : ""); | 529 | return hSession->popup_dialog(id, title, message, "%s", det ? det : ""); |
529 | } | 530 | } |
531 | + | ||
532 | +RexxMethod5(RexxStringObject, rx3270_method_get_filename, CSELF, sessionPtr, CSTRING, action_name, CSTRING, title, OPTIONAL_CSTRING, extension, OPTIONAL_CSTRING, filename) | ||
533 | +{ | ||
534 | + static const struct _action | ||
535 | + { | ||
536 | + const gchar * action_name; | ||
537 | + GtkFileChooserAction id; | ||
538 | + } action[] = | ||
539 | + { | ||
540 | + { "open", GTK_FILE_CHOOSER_ACTION_OPEN }, | ||
541 | + { "save", GTK_FILE_CHOOSER_ACTION_SAVE }, | ||
542 | + { "folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER }, | ||
543 | + { "select_folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER }, | ||
544 | + { "create_folder", GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER } | ||
545 | + }; | ||
546 | + | ||
547 | + GtkFileChooserAction id = GTK_FILE_CHOOSER_ACTION_OPEN; | ||
548 | + char * ret; | ||
549 | + | ||
550 | + for(int f=0;f<5;f++) | ||
551 | + { | ||
552 | + if(!strcasecmp(action_name,action[f].action_name)) | ||
553 | + { | ||
554 | + id = action[f].id; | ||
555 | + } | ||
556 | + } | ||
557 | + | ||
558 | + ret = ((rx3270 *) sessionPtr)->file_chooser_dialog(id, title, extension,filename); | ||
559 | + if(ret) | ||
560 | + { | ||
561 | + RexxStringObject obj = context->String(ret); | ||
562 | + ((rx3270 *) sessionPtr)->free(ret); | ||
563 | + return obj; | ||
564 | + } | ||
565 | + | ||
566 | + return context->String(""); | ||
567 | +} | ||
568 | + |
src/plugins/rx3270/rx3270.cc
@@ -203,3 +203,8 @@ int rx3270::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *mess | @@ -203,3 +203,8 @@ int rx3270::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *mess | ||
203 | return -1; | 203 | return -1; |
204 | } | 204 | } |
205 | 205 | ||
206 | +char * rx3270::file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename) | ||
207 | +{ | ||
208 | + return NULL; | ||
209 | +} | ||
210 | + |
src/plugins/rx3270/rx3270.cls
@@ -83,6 +83,7 @@ | @@ -83,6 +83,7 @@ | ||
83 | ::METHOD SETCLIPBOARD EXTERNAL "LIBRARY rx3270 rx3270_method_set_clipboard" | 83 | ::METHOD SETCLIPBOARD EXTERNAL "LIBRARY rx3270 rx3270_method_set_clipboard" |
84 | 84 | ||
85 | ::METHOD POPUP EXTERNAL "LIBRARY rx3270 rx3270_method_popup" | 85 | ::METHOD POPUP EXTERNAL "LIBRARY rx3270 rx3270_method_popup" |
86 | +::METHOD GETFILENAME EXTERNAL "LIBRARY rx3270 rx3270_method_get_filename" | ||
86 | 87 | ||
87 | ::method waitForStringAt | 88 | ::method waitForStringAt |
88 | use arg row, col, key, timeout | 89 | use arg row, col, key, timeout |
src/plugins/rx3270/rx3270.h
@@ -48,6 +48,7 @@ | @@ -48,6 +48,7 @@ | ||
48 | #include <lib3270/log.h> | 48 | #include <lib3270/log.h> |
49 | #include <lib3270/popup.h> | 49 | #include <lib3270/popup.h> |
50 | #include <stdarg.h> | 50 | #include <stdarg.h> |
51 | + #include <gtk/gtk.h> | ||
51 | 52 | ||
52 | #ifndef ETIMEDOUT | 53 | #ifndef ETIMEDOUT |
53 | #define ETIMEDOUT -1 | 54 | #define ETIMEDOUT -1 |
@@ -116,6 +117,7 @@ | @@ -116,6 +117,7 @@ | ||
116 | REXX_METHOD_PROTOTYPE(rx3270_method_get_clipboard); | 117 | REXX_METHOD_PROTOTYPE(rx3270_method_get_clipboard); |
117 | REXX_METHOD_PROTOTYPE(rx3270_method_set_clipboard); | 118 | REXX_METHOD_PROTOTYPE(rx3270_method_set_clipboard); |
118 | REXX_METHOD_PROTOTYPE(rx3270_method_popup); | 119 | REXX_METHOD_PROTOTYPE(rx3270_method_popup); |
120 | + REXX_METHOD_PROTOTYPE(rx3270_method_get_filename); | ||
119 | REXX_METHOD_PROTOTYPE(rx3270_method_get_cursor_addr); | 121 | REXX_METHOD_PROTOTYPE(rx3270_method_get_cursor_addr); |
120 | REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor_addr); | 122 | REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor_addr); |
121 | REXX_METHOD_PROTOTYPE(rx3270_method_input_text); | 123 | REXX_METHOD_PROTOTYPE(rx3270_method_input_text); |
@@ -200,7 +202,9 @@ | @@ -200,7 +202,9 @@ | ||
200 | virtual char * get_clipboard(void); | 202 | virtual char * get_clipboard(void); |
201 | virtual int set_clipboard(const char *text); | 203 | virtual int set_clipboard(const char *text); |
202 | 204 | ||
205 | + // Dialogs | ||
203 | virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); | 206 | virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
207 | + virtual char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); | ||
204 | 208 | ||
205 | }; | 209 | }; |
206 | 210 |
src/plugins/rx3270/rxapimain.cc
@@ -154,6 +154,7 @@ RexxMethodEntry rx3270_methods[] = | @@ -154,6 +154,7 @@ RexxMethodEntry rx3270_methods[] = | ||
154 | REXX_METHOD(rx3270_method_set_clipboard, rx3270_method_set_clipboard ), | 154 | REXX_METHOD(rx3270_method_set_clipboard, rx3270_method_set_clipboard ), |
155 | 155 | ||
156 | REXX_METHOD(rx3270_method_popup, rx3270_method_popup ), | 156 | REXX_METHOD(rx3270_method_popup, rx3270_method_popup ), |
157 | + REXX_METHOD(rx3270_method_get_filename, rx3270_method_get_filename ), | ||
157 | 158 | ||
158 | REXX_METHOD(rx3270_method_get_cursor_addr, rx3270_method_get_cursor_addr ), | 159 | REXX_METHOD(rx3270_method_get_cursor_addr, rx3270_method_get_cursor_addr ), |
159 | REXX_METHOD(rx3270_method_set_cursor_addr, rx3270_method_set_cursor_addr ), | 160 | REXX_METHOD(rx3270_method_set_cursor_addr, rx3270_method_set_cursor_addr ), |