1 // Implementation of the <property-list> widget.
3 // Copyright (C) 2001 Steve BAKER
4 // Copyright (C) 2001 Jim WILSON
5 // Copyright (C) 2006 Melchior FRANZ
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef _PROPERTY_LIST_HXX
24 #define _PROPERTY_LIST_HXX
27 #include <plib/puAux.h>
28 #include <simgear/props/props.hxx>
32 class PropertyList : public puaList, public SGPropertyChangeListener, public GUI_ID {
34 PropertyList(int minx, int miny, int maxx, int maxy, SGPropertyNode *);
37 void update (bool restore_slider_pos = false);
38 void setCurrent(SGPropertyNode *p);
39 SGPropertyNode *getCurrent() const { return _curr; }
40 void publish(SGPropertyNode *p) { _return = p; invokeCallback(); }
41 void toggleVerbosity() { _verbose = !_verbose; }
43 // overridden plib pui methods
44 virtual char *getStringValue(void) { return (char *)(_return ? _return->getPath(true) : ""); }
45 //virtual char *getListStringValue() { return (char *)(_return ? _return->getPath(true) : ""); }
46 virtual void setValue(const char *);
49 virtual void valueChanged(SGPropertyNode *node);
53 NodeData() : listener(0) {}
56 node->removeChangeListener(listener);
58 void setListener(SGPropertyChangeListener *l) {
59 node->addChangeListener(listener = l);
61 SGPropertyNode_ptr node;
62 SGPropertyChangeListener *listener;
66 // update the text string in the puList using the given node and
67 // updating the requested offset.
68 void updateTextForEntry(NodeData&);
70 static void handle_select(puObject *b);
71 static int nodeNameCompare(const void *, const void *);
73 SGPropertyNode_ptr _curr;
74 SGPropertyNode_ptr _return;
82 bool _dot_files; // . and .. pseudo-dirs currently shown?
83 bool _verbose; // show SGPropertyNode flags
87 #endif // _PROP_PICKER_HXX