|
Last change
on this file was
8501,
checked in by westram, 14 years ago
|
- DRYed several Xt-calls using argument lists (aw_xargs)
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 1 | // ============================================================= // |
|---|
| 2 | // // |
|---|
| 3 | // File : aw_xargs.hxx // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Ralf Westram (coder@reallysoft.de) in March 2012 // |
|---|
| 7 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 8 | // http://www.arb-home.de/ // |
|---|
| 9 | // // |
|---|
| 10 | // ============================================================= // |
|---|
| 11 | |
|---|
| 12 | #ifndef AW_XARGS_HXX |
|---|
| 13 | #define AW_XARGS_HXX |
|---|
| 14 | |
|---|
| 15 | #ifndef ARBTOOLS_H |
|---|
| 16 | #include <arbtools.h> |
|---|
| 17 | #endif |
|---|
| 18 | #ifndef _XtIntrinsic_h |
|---|
| 19 | #include <X11/Intrinsic.h> |
|---|
| 20 | #endif |
|---|
| 21 | |
|---|
| 22 | class aw_xargs : virtual Noncopyable { |
|---|
| 23 | Arg *arg; |
|---|
| 24 | size_t max; |
|---|
| 25 | size_t count; |
|---|
| 26 | public: |
|---|
| 27 | aw_xargs(size_t maxcount) |
|---|
| 28 | : arg(new Arg[maxcount]), |
|---|
| 29 | max(maxcount), |
|---|
| 30 | count(0) |
|---|
| 31 | {} |
|---|
| 32 | ~aw_xargs() { |
|---|
| 33 | delete [] arg; |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | Arg *list() { return arg; } |
|---|
| 37 | int size() { return count; } |
|---|
| 38 | |
|---|
| 39 | void add(String name, XtArgVal value) { |
|---|
| 40 | aw_assert(count<max); |
|---|
| 41 | XtSetArg(arg[count], name, value); |
|---|
| 42 | count++; |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | void assign_to_widget(Widget w) { |
|---|
| 46 | XtSetValues(w, list(), size()); |
|---|
| 47 | } |
|---|
| 48 | }; |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | #else |
|---|
| 52 | #error aw_xargs.hxx included twice |
|---|
| 53 | #endif // AW_XARGS_HXX |
|---|
Note: See
TracBrowser
for help on using the repository browser.