]> git.mxchange.org Git - flightgear.git/blob - src/GUI/prop_picker.hxx
Ctrl-Click on bool entry toggles property
[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_editOpen( const char * name, const char * value );
17
18 class fgPropPicker       ;
19 class fgPropEdit       ;
20
21 class fgPropPicker : 
22     public fgPopup,
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   NewGUI * _gui;
65
66 public:
67   puText    *proppath      ;
68   void find_props () ;
69   fgPropPicker ( int x, int y, int w, int h, int arrows,
70                  const char *dir, const char *title = "Pick a file" ) ;
71
72   ~fgPropPicker () {;}
73
74   static void go_up_one_directory ( char *fname ) ;
75   static void chop_file ( char *fname ) ;
76
77   // over-ride the method from SGPropertyNodeListener
78   virtual void valueChanged (SGPropertyNode * node);
79 } ;
80
81 class fgPropEdit : public fgPopup
82 {
83
84   static void fgPropEditHandleCancel ( puObject *b ) ;
85   static void fgPropEditHandleOK ( puObject* b );
86
87 protected:
88
89   puFrame   *frame         ;
90   puOneShot *cancel_button ;
91   puOneShot *ok_button     ;
92
93   NewGUI * _gui;
94
95 public:
96   puText    *propname     ;
97   puInput   *propinput     ;
98   char propPath [ PUSTRING_MAX * 2 ] ;
99
100   fgPropEdit ( const char *name, const char *value, char *proppath ) ;
101
102   ~fgPropEdit () {;}
103
104   static void go_up_one_directory ( char *fname ) ;
105   static void chop_file ( char *fname ) ;
106
107 } ;