X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FGUI%2Fproperty_list.hxx;h=046c09435b3872c4d7d9871b7d04c48a5fd75032;hb=0f7f7fce6bd57bea6c93f5d40c89f1b741edff45;hp=b7b522debff33aedd10a86621745b19b46f9d380;hpb=18d09b569f0d45b7c465e4b98879bf3793de7ce9;p=flightgear.git diff --git a/src/GUI/property_list.hxx b/src/GUI/property_list.hxx index b7b522deb..046c09435 100644 --- a/src/GUI/property_list.hxx +++ b/src/GUI/property_list.hxx @@ -23,14 +23,14 @@ #ifndef _PROPERTY_LIST_HXX #define _PROPERTY_LIST_HXX +#include -#include +#include #include #include "dialog.hxx" -#include "puList.hxx" -class PropertyList : public puList, public SGPropertyChangeListener, public GUI_ID { +class PropertyList : public puaList, public SGPropertyChangeListener, public GUI_ID { public: PropertyList(int minx, int miny, int maxx, int maxy, SGPropertyNode *); ~PropertyList(); @@ -39,32 +39,23 @@ public: void setCurrent(SGPropertyNode *p); SGPropertyNode *getCurrent() const { return _curr; } void publish(SGPropertyNode *p) { _return = p; invokeCallback(); } - void toggleFlags() { _flags = !_flags; } + void toggleVerbosity() { _verbose = !_verbose; } // overridden plib pui methods - virtual char *getListStringValue() { return (char *)(_return ? _return->getPath(true) : ""); } - //virtual char *getStringValue(void) { return (char *)(_return ? _return->getPath(true) : ""); } + virtual char *getStringValue(void) + { + _return_path.clear(); + if (_return) + _return_path = _return->getPath(true); + return const_cast(_return_path.c_str()); + } + //virtual char *getListStringValue() { return (char *)(_return ? _return->getPath(true) : ""); } virtual void setValue(const char *); // listener method virtual void valueChanged(SGPropertyNode *node); private: - // update the text string in the puList using the given node and - // updating the requested offset. The value of dotFiles is taken - // into account before the index is applied, i.e this should be - // an index into 'children' - void updateTextForEntry(int index); - void delete_arrays(); - static void handle_select(puObject *b); - static int nodeNameCompare(const void *, const void *); - - SGPropertyNode_ptr _curr; - SGPropertyNode_ptr _return; - - char **_entries; - int _num_entries; - struct NodeData { NodeData() : listener(0) {} ~NodeData() { @@ -76,12 +67,28 @@ private: } SGPropertyNode_ptr node; SGPropertyChangeListener *listener; + char **text; }; + + // update the text string in the puList using the given node and + // updating the requested offset. + void updateTextForEntry(NodeData&); + void delete_arrays(); + static void handle_select(puObject *b); + static int nodeNameCompare(const void *, const void *); + + SGPropertyNode_ptr _curr; + SGPropertyNode_ptr _return; + + char **_entries; + int _num_entries; + NodeData *_children; int _num_children; bool _dot_files; // . and .. pseudo-dirs currently shown? - bool _flags; // show SGPropertyNode flags + bool _verbose; // show SGPropertyNode flags + std::string _return_path; };