HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BM_InputSelector.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: BM_InputSelector.h ( Direct Manipulation Library, C++)
7  *
8  * COMMENTS:
9  * The base class for objects that select the inputs of an op.
10  */
11 
12 #ifndef __BM_InputSelector_h__
13 #define __BM_InputSelector_h__
14 
15 #include "BM_API.h"
16 #include <PI/PI_ResourceTemplate.h>
17 #include <SI/AP_Interface.h>
18 #include <RE/RE_RenderContext.h>
19 
20 class BM_View;
21 class OP_Node;
22 class RE_Render;
23 
25 {
26 public:
27  BM_InputSelector(BM_View &viewer,
28  PI_SelectorTemplate &templ);
29  ~BM_InputSelector() override;
30 
31  const char *className() const override;
32 
33  // The selector handles mouse events and modifies the selection
34  // accordingly. Return 1 if the event was consumed and 0 otherwise.
35  virtual int handleMouseEvent(UI_Event *event);
36 
37  // Return 1 if the event was consumed and 0 otherwise.
38  virtual int handleMouseWheelEvent(UI_Event *event);
39 
40  // Return true if handled.
41  virtual bool handleDoubleClickEvent(UI_Event *event);
42 
43  virtual void handleNodeDeleted(OP_Node &node);
44 
45  PI_SelectorTemplate &getTemplate() { return myTemplate; }
46  const PI_SelectorTemplate &getTemplate() const { return myTemplate; }
47 
48  // This method allows the resource manager can set the viewer (and
49  // associated scene manager) to something different if a selector is
50  // reused. It should not be used otherwise. A nil pointer is allowed so
51  // the select can remove any of its interests. However, methods of the
52  // selector should never be called when its viewer is nil. The method is
53  // virtual so descendants can also have a chance to clean up.
54  virtual void setViewer(BM_View *viewer);
55 
56  // Do any special rendering required by this selector.
57  virtual void doRender(RE_RenderContext r, int x, int y, int ghost);
58 
59  virtual void overlayRender(RE_RenderContext r, int x, int y);
60 
61  // This method is called by the resource manager after the selector is
62  // created.
63  void initializeUI();
64 
65  // Some states use this virtual to query whether or not this selector
66  // needs locate mouse messages (mouse moves with no buttons down).
67  virtual int hasLocates() const { return 0; }
68 
69  // The selector needs to be notified when it starts/stops selecting
70  // so it can add/remove interests (the selection type, etc.).
71  virtual void startSelecting();
72  virtual void stopSelecting();
73 
74  virtual const char *cursor() const;
75 
76 
77  virtual bool getStateParmNames(UT_StringArray &ret, const char* prefix=nullptr ) {return false;}
78  virtual bool evalStateParm(const char *name, UT_StringHolder &ret) {return false;}
79  virtual bool setStateParm(const char *name, const UT_StringHolder &val) {return false;}
80  virtual bool pressStateButton(const char *name) {return false;}
81 protected:
82  BM_View &baseViewer() { return *myBaseViewer; }
83  const BM_View &baseViewer() const { return *myBaseViewer; }
84 
85  // Do the AP_Interface initialization. This is called by initializeUI().
86  // By default this method does nothing, but subclasses have the option
87  // of parsing a UI file here.
88  void initApplication(UI_Manager *,
89  int,
90  const char **) override;
91 
92 private:
93  PI_SelectorTemplate &myTemplate;
94 
95  BM_View *myBaseViewer;
96  const char *myBumpedCursor; // cursor I'm replacing when active
97 };
98 
99 #endif
BM_View & baseViewer()
PI_SelectorTemplate & getTemplate()
const char * className() const override
GLint y
Definition: glcorearb.h:103
const PI_SelectorTemplate & getTemplate() const
virtual bool getStateParmNames(UT_StringArray &ret, const char *prefix=nullptr)
Temporary container for either a RV_Render and an RE_Render.
struct _cl_event * event
Definition: glcorearb.h:2961
virtual bool setStateParm(const char *name, const UT_StringHolder &val)
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual int hasLocates() const
GLint GLenum GLint x
Definition: glcorearb.h:409
#define BM_API
Definition: BM_API.h:10
virtual void initApplication(UI_Manager *uims, int argc, const char **argv)
const BM_View & baseViewer() const
GLuint GLfloat * val
Definition: glcorearb.h:1608
GLboolean r
Definition: glcorearb.h:1222
virtual bool evalStateParm(const char *name, UT_StringHolder &ret)
virtual bool pressStateButton(const char *name)