argument_list.h

Go to the documentation of this file.
00001 #ifndef ARGUMENT_LIST_CLASS
00002 #define ARGUMENT_LIST_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : argument_list                                                     *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *  Purpose:                                                                   *
00010 *                                                                             *
00011 *    This makes it easier to pass arguments to an X windows function.         *
00012 *                                                                             *
00013 *******************************************************************************
00014 * Copyright (c) 1991-$now By Author.  This program is free software; you can  *
00015 * redistribute it and/or modify it under the terms of the GNU General Public  *
00016 * License as published by the Free Software Foundation; either version 2 of   *
00017 * the License or (at your option) any later version.  This is online at:      *
00018 *     http://www.fsf.org/copyleft/gpl.html                                    *
00019 * Please send any updates to: fred@gruntose.com                               *
00020 \*****************************************************************************/
00021 
00022 #include "definitions_passive.h"
00023 
00024 #include <basis/array.h>
00025 #include <basis/object_base.h>
00026 
00027 struct argument_holder {
00028   String name;
00029   XtArgVal argument;
00030 };
00031 
00032 class WP_PASSIVE_CLASS_STYLE argument_list : private array<argument_holder>
00033 {
00034 public:
00035   argument_list();
00036   argument_list(const argument_list &to_copy);
00037   virtual ~argument_list();
00038 
00039   IMPLEMENT_CLASS_NAME("argument_list");
00040 
00041   void add(String argument_name, XtArgVal contents);
00042   void add(String argument_name, int contents);
00043   void add(String argument_name, window_string contents);
00044   void add(String argument_name, const istring &contents);
00045     // Puts another X windows argument into the list.  This can be done
00046     // dynamically after using the set of arguments in a call to an X windows
00047     // function.
00048 
00049   void remove(String argument_name);
00050     // Chucks an argument out of the array.  If the "argument_name" cannot
00051     // be found, the argument list is not changed.
00052 
00053   Arg *generate();
00054     // Creates a list of X windows arguments that can be passed to an X windows
00055     // function requiring them.  This call can be used repeatedly, and more
00056     // arguments can be added to the list in between calls to generate.  The
00057     // returned value should not be destructed externally.  This can also be
00058     // used within an XtGetValue call; the next call to generate returns a
00059     // list of arguments that were manipulated by XtGetValue and that set of
00060     // arguments will continue to be returned by generate until the next
00061     // call of "add" or "remove".
00062     // Note: This returns NIL if no arguments are in the list.
00063 
00064   int number() const;
00065     // Returns the current number of arguments.
00066 
00067   void apply(window_handle to_apply_to);
00068     // Gathers the arguments and passes them to the windowing system for
00069     // the handle "to_apply_to".
00070 
00071   argument_list &operator = (const argument_list &to_copy);
00072 
00073 private:
00074   Arg *created_list;
00075 
00076   void zap_created_list();
00077 };
00078 
00079 #endif
00080 

Generated on Wed Nov 19 04:28:41 2008 for HOOPLE Libraries by  doxygen 1.5.1