]> git.mxchange.org Git - flightgear.git/blob - src/GUI/prop_picker.hxx
- unify several indentation and coding styles (and no, this is not my
[flightgear.git] / src / GUI / prop_picker.hxx
1 #ifndef _PROP_PICKER_HXX
2 #define _PROP_PICKER_HXX
3
4 #include <plib/pu.h>
5
6 #include <stdio.h>
7 #include "gui.h"
8 #include "dialog.hxx"
9 #include <simgear/props/props.hxx>
10
11 void prop_pickerInit();
12 void prop_pickerView( puObject * );
13 void prop_pickerRefresh();
14 void prop_editOpen( const char * name, const char * value );
15
16
17 class fgPropPicker;
18 class fgPropEdit;
19
20 class fgPropPicker : public fgPopup, public SGPropertyChangeListener {
21
22     static void handle_select ( puObject *b );
23     static void input_entered ( puObject *b );
24     static void fgPropPickerHandleSlider ( puObject * slider );
25     static void fgPropPickerHandleArrow ( puObject *arrow );
26     static void fgPropPickerHandleOk ( puObject* b );
27
28     void delete_arrays ();
29
30     // update the text string in the puList using the given node and
31     // updating the requested offset. The value of dotFiles is taken
32     // into account before the index is applied, i.e this should be
33     // an index into 'children' */
34     void updateTextForEntry(int index);
35
36     char** files;
37     int num_files;
38     int arrow_count;
39     char startDir [ PUSTRING_MAX * 2 ];
40
41     SGPropertyNode_ptr* children;
42     int num_children;
43
44     // set if we're display the . and .. entries at the start of the
45     // list
46     bool dotFiles;
47
48 protected:
49     puFrame *frame;
50     puListBox *list_box;
51     puSlider *slider;
52     puOneShot *cancel_button;
53     puOneShot *ok_button;
54     puArrowButton *down_arrow;
55     puArrowButton *up_arrow;
56
57     NewGUI * _gui;
58
59 public:
60     puText *proppath;
61     void find_props ( bool restore_slider_pos = false );
62     fgPropPicker ( int x, int y, int w, int h, int arrows,
63                    const char *dir, const char *title = "Pick a file" );
64
65     ~fgPropPicker () {}
66
67     static void go_up_one_directory ( char *fname );
68     static void chop_file ( char *fname );
69
70     // over-ride the method from SGPropertyNodeListener
71     virtual void valueChanged (SGPropertyNode * node);
72 };
73
74
75
76 class fgPropEdit : public fgPopup {
77
78   static void fgPropEditHandleCancel ( puObject *b );
79   static void fgPropEditHandleOK ( puObject* b );
80
81 protected:
82   puFrame *frame;
83   puOneShot *cancel_button;
84   puOneShot *ok_button;
85
86   NewGUI * _gui;
87
88 public:
89   puText *propname;
90   puInput *propinput;
91   char propPath [ PUSTRING_MAX * 2 ];
92
93   fgPropEdit ( const char *name, const char *value, char *proppath );
94
95   ~fgPropEdit () {}
96
97   static void go_up_one_directory ( char *fname );
98   static void chop_file ( char *fname );
99 };
100
101 #endif // _PROP_PICKER_HXX