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 
19 class BM_View;
20 class OP_Node;
21 class RE_Render;
22 
24 {
25 public:
26  BM_InputSelector(BM_View &viewer,
27  PI_SelectorTemplate &templ);
28  ~BM_InputSelector() override;
29 
30  const char *className() const override;
31 
32  // The selector handles mouse events and modifies the selection
33  // accordingly. Return 1 if the event was consumed and 0 otherwise.
34  virtual int handleMouseEvent(UI_Event *event);
35 
36  // Return 1 if the event was consumed and 0 otherwise.
37  virtual int handleMouseWheelEvent(UI_Event *event);
38 
39  // Return true if handled.
40  virtual bool handleDoubleClickEvent(UI_Event *event);
41 
42  virtual void handleNodeDeleted(OP_Node &node);
43 
44  PI_SelectorTemplate &getTemplate() { return myTemplate; }
45  const PI_SelectorTemplate &getTemplate() const { return myTemplate; }
46 
47  // This method allows the resource manager can set the viewer (and
48  // associated scene manager) to something different if a selector is
49  // reused. It should not be used otherwise. A nil pointer is allowed so
50  // the select can remove any of its interests. However, methods of the
51  // selector should never be called when its viewer is nil. The method is
52  // virtual so descendants can also have a chance to clean up.
53  virtual void setViewer(BM_View *viewer);
54 
55  // Do any special rendering required by this selector.
56  virtual void doRender(RE_Render *r, int x, int y, int ghost);
57 
58  virtual void overlayRender(RE_Render *r, int x, int y);
59 
60  // This method is called by the resource manager after the selector is
61  // created.
62  void initializeUI();
63 
64  // Some states use this virtual to query whether or not this selector
65  // needs locate mouse messages (mouse moves with no buttons down).
66  virtual int hasLocates() const { return 0; }
67 
68  // The selector needs to be notified when it starts/stops selecting
69  // so it can add/remove interests (the selection type, etc.).
70  virtual void startSelecting();
71  virtual void stopSelecting();
72 
73  virtual const char *cursor() const;
74 
75 
76  virtual bool getStateParmNames(UT_StringArray &ret, const char* prefix=nullptr ) {return false;}
77  virtual bool evalStateParm(const char *name, UT_StringHolder &ret) {return false;}
78  virtual bool setStateParm(const char *name, const UT_StringHolder &val) {return false;}
79  virtual bool pressStateButton(const char *name) {return false;}
80 protected:
81  BM_View &baseViewer() { return *myBaseViewer; }
82  const BM_View &baseViewer() const { return *myBaseViewer; }
83 
84  // Do the AP_Interface initialization. This is called by initializeUI().
85  // By default this method does nothing, but subclasses have the option
86  // of parsing a UI file here.
87  void initApplication(UI_Manager *,
88  int,
89  const char **) override;
90 
91 private:
92  PI_SelectorTemplate &myTemplate;
93 
94  BM_View *myBaseViewer;
95  const char *myBumpedCursor; // cursor I'm replacing when active
96 };
97 
98 #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)
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)