HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 
23 {
24 public:
25  BM_InputSelector(BM_View &viewer,
26  PI_SelectorTemplate &templ);
27  virtual ~BM_InputSelector();
28 
29  virtual const char *className() const;
30 
31  // The selector handles mouse events and modifies the selection
32  // accordingly. Return 1 if the event was consumed and 0 otherwise.
33  virtual int handleMouseEvent(UI_Event *event);
34 
35  // Return 1 if the event was consumed and 0 otherwise.
36  virtual int handleMouseWheelEvent(UI_Event *event);
37 
38  // Return true if handled.
39  virtual bool handleDoubleClickEvent(UI_Event *event);
40 
41  virtual void handleNodeDeleted(OP_Node &node);
42 
43  PI_SelectorTemplate &getTemplate() { return myTemplate; }
44  const PI_SelectorTemplate &getTemplate() const { return myTemplate; }
45 
46  // This method allows the resource manager can set the viewer (and
47  // associated scene manager) to something different if a selector is
48  // reused. It should not be used otherwise. A nil pointer is allowed so
49  // the select can remove any of its interests. However, methods of the
50  // selector should never be called when its viewer is nil. The method is
51  // virtual so descendants can also have a chance to clean up.
52  virtual void setViewer(BM_View *viewer);
53 
54  // Do any special rendering required by this selector.
55  virtual void doRender(RE_Render *r, int x, int y, int ghost);
56 
57  virtual void overlayRender(RE_Render *r, int x, int y);
58 
59  // This method is called by the resource manager after the selector is
60  // created.
61  void initializeUI();
62 
63  // Some states use this virtual to query whether or not this selector
64  // needs locate mouse messages (mouse moves with no buttons down).
65  virtual int hasLocates() const { return 0; }
66 
67  // The selector needs to be notified when it starts/stops selecting
68  // so it can add/remove interests (the selection type, etc.).
69  virtual void startSelecting();
70  virtual void stopSelecting();
71 
72  virtual const char *cursor() const;
73 
74 protected:
75  BM_View &baseViewer() { return *myBaseViewer; }
76  const BM_View &baseViewer() const { return *myBaseViewer; }
77 
78  // Do the AP_Interface initialization. This is called by initializeUI().
79  // By default this method does nothing, but subclasses have the option
80  // of parsing a UI file here.
81  virtual void initApplication(UI_Manager *, int c, const char **v);
82 
83 private:
84  PI_SelectorTemplate &myTemplate;
85 
86  BM_View *myBaseViewer;
87  const char *myBumpedCursor; // cursor I'm replacing when active
88 };
89 
90 #endif
BM_View & baseViewer()
PI_SelectorTemplate & getTemplate()
const GLdouble * v
Definition: glcorearb.h:836
GLint y
Definition: glcorearb.h:102
const PI_SelectorTemplate & getTemplate() const
struct _cl_event * event
Definition: glcorearb.h:2960
virtual int hasLocates() const
#define BM_API
Definition: BM_API.h:10
virtual void initApplication(UI_Manager *uims, int argc, const char **argv)
const BM_View & baseViewer() const
GLint GLenum GLint x
Definition: glcorearb.h:408
virtual const char * className() const
GLboolean r
Definition: glcorearb.h:1221