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