VAPOR3 3.9.4
MouseModeParams.h
Go to the documentation of this file.
1//************************************************************************
2// *
3// Copyright (C) 1024 *
4// University Corporation for Atmospheric Research *
5// All Rights Reserved *
6// *
7//************************************************************************/
8//
9// File: MouseModeParams.h
10//
11// Author: Alan Norton
12// National Center for Atmospheric Research
13// PO 3000, Boulder, Colorado
14//
15// Date: April 2014
16//
17// Description: Defines the MouseModeParams class.
18// This Params class is global. Specifies the current MouseMode.
19//
20#ifndef MOUSEMODEPARAMS_H
21#define MOUSEMODEPARAMS_H
22
23#include <vector>
24#include <map>
25
26#include <vapor/ParamsBase.h>
27
36public:
37 struct MouseMode {
38 string name;
39 const char *const *icon;
40 };
41
43 //
45
47 //
49
51
53 const char *const *GetIcon(string name) const
54 {
55 auto itr = _modes.cbegin();
56 for (; itr != _modes.cend(); ++itr)
57 if (itr->name == name) break;
58 VAssert(itr != _modes.end());
59 return itr->icon;
60 }
61
64 //
65 string GetCurrentMouseMode() const { return GetValueString(_currentMouseModeTag, GetNavigateModeName()); }
66
70 //
71 void SetCurrentMouseMode(string name);
72
74 int GetNumMouseModes() { return _modes.size(); }
75
77 //
78 vector<string> GetAllMouseModes()
79 {
80 vector<string> v;
81 for (auto itr = _modes.cbegin(); itr != _modes.cend(); ++itr) { v.push_back(itr->name); }
82 return (v);
83 }
84
85 // Get static string identifier for this params class
86 //
87 static string GetClassType() { return ("MouseModeParamsTag"); }
88
89 static string GetNavigateModeName() { return ("Navigate"); }
90
91 static string GetRegionModeName() { return ("Region"); }
92
93private:
94 static const string _currentMouseModeTag;
95
96 vector<MouseMode> _modes;
97
98 void _init();
99 void _setUpDefault();
100};
101
102#endif // MOUSEMODEPARAMS_H
#define VAssert(expr)
Definition: VAssert.h:9
A class for describing mouse modes in use in VAPOR.
const char *const * GetIcon(string name) const
method identifies pixmap icon for each mode
vector< string > GetAllMouseModes()
Return a vector of all registered mouse mode names.
static string GetClassType()
static string GetNavigateModeName()
void SetCurrentMouseMode(string name)
int GetNumMouseModes()
method indicates how many mouse modes are available.
virtual ~MouseModeParams()
string GetCurrentMouseMode() const
static string GetRegionModeName()
MouseModeParams(VAPoR::ParamsBase::StateSave *ssave)
Create a MouseModeParams object from scratch.
MouseModeParams(VAPoR::ParamsBase::StateSave *ssave, VAPoR::XmlNode *node)
Create a MouseModeParams object from an existing XmlNode tree.
State capture class.
Definition: ParamsBase.h:62
Nodes with state in Xml tree representation.
Definition: ParamsBase.h:50
virtual string GetValueString(const string tag, string defaultVal) const
An Xml tree.
Definition: XmlNode.h:49
#define PARAMS_API
Definition: common.h:77
const char *const * icon