-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageBrowser.cpp
More file actions
57 lines (49 loc) · 1.14 KB
/
ImageBrowser.cpp
File metadata and controls
57 lines (49 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* ImageBrowser.cpp
* 3d Ink
*
* Created by David Roberts on 27/01/2010.
*
*/
#include "FileGUI.h"
#define OK 1
#define CANCEL 0
ImageBrowser* ImageBrowser::ptr=NULL;
ImageBrowser::ImageBrowser(int mainWindow, string *fName, bool *done) {
this->mainWindow = mainWindow;
this->fName = fName;
this->done = done;
ptr = this;
}
ImageBrowser::~ImageBrowser() {
}
void ImageBrowser::buildInterface() {
glui = GLUI_Master.create_glui("Image Browser");
glui->set_main_gfx_window(mainWindow);
fileText = glui->add_edittext("Image file", GLUI_EDITTEXT_TEXT, NULL, NULL);
fileText->set_w(200);
GLUI_Panel *panel = glui->add_panel("buttonPanel", GLUI_PANEL_NONE);
glui->add_button_to_panel(panel, "OK", OK, &process);
glui->add_column_to_panel(panel, false);
glui->add_button_to_panel(panel, "Cancel", CANCEL, &process);
}
void ImageBrowser::closeWindow() {
glui->close();
}
void ImageBrowser::getText() {
*fName = fileText->get_text();
};
void ImageBrowser::process(int id) {
switch (id) {
case OK:
ptr->getText();
ptr->closeWindow();
*ptr->done = true;
break;
case CANCEL:
ptr->closeWindow();
break;
default:
break;
}
}