cosmetics in disasm
[k8lst.git] / src / lstfltk.cpp
blob6b6340f9ad8c430e2f7ade4336f198959676db7f
1 extern "C" {
2 #include "lstfltk.h"
3 #include <pthread.h>
6 #include <FL/Fl.H>
7 #include <FL/Fl_Double_Window.H>
8 #include <FL/Fl_Input.H>
9 #include <FL/Fl_Button.H>
10 #include <FL/Fl_Return_Button.H>
11 #include <FL/fl_ask.H>
14 static void update_input_text(Fl_Widget* o, const char *input) {
15 if (input) {
16 o->copy_label(input);
17 o->redraw();
22 static void rename_me(Fl_Widget *o) {
23 const char *input = fl_input("Input:", o->label());
24 update_input_text(o, input);
28 static void rename_me_pwd(Fl_Widget *o) {
29 const char *input = fl_password("Input PWD:", o->label());
30 update_input_text(o, input);
34 static void window_callback (Fl_Widget *w, void *) {
35 int rep = fl_choice("Are you sure you want to quit?", "Cancel", "Quit", "Dunno");
36 if (rep == 1) {
37 ((Fl_Double_Window *)w)->hide();
38 return;
40 if (rep == 2) fl_message("Well, maybe you should know before we quit.");
44 static void fltkDo (void) {
45 char buffer[128] = "Test text";
46 char buffer2[128] = "MyPassword";
48 Fl_Double_Window *w = new Fl_Double_Window(200, 105);
50 Fl_Return_Button *b = new Fl_Return_Button(20, 10, 160, 35, buffer); b->callback(rename_me);
51 Fl_Button *b2 = new Fl_Return_Button(20, 50, 160, 35, buffer2); b2->callback(rename_me_pwd);
53 w->end();
55 w->callback(window_callback);
56 w->resizable(b);
57 w->show();
59 Fl::run();
61 w->redraw();
62 delete w;
64 printf("fltkDo: complete\n");
69 extern "C" {
70 static void *fltkWorkerThread (void *dummy) {
71 fltkDo();
72 return NULL;
76 static void runFLTKThread (void) {
77 pthread_t trd;
78 if (pthread_create(&trd, NULL, fltkWorkerThread, NULL) == 0) {
79 pthread_detach(trd);
84 LST_PRIMFN_NONSTATIC(lpFLTKAction) {
85 /*fltkDo();*/
86 runFLTKThread();
87 return lstNilObj;