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