File: vtkBorlandRenderWindow.h

package info (click to toggle)
vtk 5.8.0-13
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 130,524 kB
  • sloc: cpp: 1,129,256; ansic: 708,203; tcl: 48,526; python: 20,875; xml: 6,779; yacc: 4,208; perl: 3,121; java: 2,788; lex: 931; sh: 660; asm: 471; makefile: 299
file content (168 lines) | stat: -rw-r--r-- 5,765 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//---------------------------------------------------------------------------
#ifndef vtkBorlandRenderWindowH
#define vtkBorlandRenderWindowH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>

#include "vtkCommand.h"
#include "vtkRenderer.h";
#include "vtkWin32OpenGLRenderWindow.h";
#include "vtkWin32RenderWindowInteractor.h";

typedef bool __fastcall (__closure *TvtkBorlandCloseEvent)(TObject *Sender);

// Callback for abort check
class vtkAbortCallback : public vtkCommand
{
public:
  static vtkAbortCallback *New()
    { return new vtkAbortCallback; }
  virtual void Execute(vtkObject *caller, unsigned long, void*)
    {
    vtkWin32OpenGLRenderWindow* ptrWin = reinterpret_cast<vtkWin32OpenGLRenderWindow*>(caller);
    if (ptrWin)
      {
      if(ptrWin->GetEventPending())
        {
        ptrWin->SetAbortRender( 1 );
       // Beep();
        }
      }
    }
  vtkAbortCallback(){};
};

//---------------------------------------------------------------------------
enum vtkBorlandInteractorMode { IM_JoystickCamera,IM_JoystickActor,
                                IM_TrackballCamera, IM_TrackballActor,
                                IM_Flight, IM_Image,IM_User };

//---------------------------------------------------------------------------
class PACKAGE TvtkBorlandRenderWindow : public TCustomControl
{
  typedef TCustomControl inherited;
private:
protected:
   //
    // Events and control related stuff
    //
    DYNAMIC void __fastcall MouseMove(TShiftState shift, int x, int y );
    DYNAMIC void __fastcall MouseDown(TMouseButton button, TShiftState shift, int x, int y );
    DYNAMIC void __fastcall MouseUp(TMouseButton button, TShiftState shift, int x, int y );
    DYNAMIC bool __fastcall DoMouseWheelDown(TShiftState Shift, const TPoint &MousePos);
    DYNAMIC bool __fastcall DoMouseWheelUp(TShiftState Shift, const TPoint &MousePos);

    //
    // Messages : We want to directly intercept these
    //
    void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
    void __fastcall WMGetDlgCode(TMessage &Message);
    void __fastcall WMKeyDown(TWMKey &Message);
    void __fastcall WMKeyUp(TWMKey &Message);
    void __fastcall WMChar(TWMKey &Message);
    void __fastcall WMTimer(TWMTimer &Message);
    // Here's the Dispatch(void &Message) message map for the above functions
    BEGIN_MESSAGE_MAP
        MESSAGE_HANDLER(WM_ERASEBKGND,       TWMEraseBkgnd,      WMEraseBkgnd)
        MESSAGE_HANDLER(WM_GETDLGCODE,       TMessage,           WMGetDlgCode)
        MESSAGE_HANDLER(WM_KEYDOWN,          TWMKeyDown,         WMKeyDown)
        MESSAGE_HANDLER(WM_KEYUP,            TWMKeyUp,           WMKeyUp)
        MESSAGE_HANDLER(WM_CHAR,             TWMChar,            WMChar)
        MESSAGE_HANDLER(WM_TIMER,            TWMTimer,           WMTimer)
    END_MESSAGE_MAP(inherited)
    //
    DYNAMIC void    __fastcall Resize(void);
    //
    // This does all the work
    //
    virtual void __fastcall Paint(void);
    //
    // Our Data Members
    //
    vtkWin32OpenGLRenderWindow      *FRenderWindow;
    vtkRenderer                     *FRenderer;
    vtkWin32RenderWindowInteractor  *FInteractor;
    //
    TvtkBorlandCloseEvent            FOnVtkClose;
    bool                             FUsevtkInteractor;
    vtkBorlandInteractorMode         FInteractorMode;
    vtkAbortCallback                *FAbortCallback;

    //
public:
    //
    // Constructor and Destructor
    //
        __fastcall TvtkBorlandRenderWindow(TComponent* Owner);
    virtual __fastcall ~TvtkBorlandRenderWindow(void);
    //
    // Make user friendly by handling a single rendererer and
    // assorted bits for the user
    //
    virtual vtkWin32OpenGLRenderWindow *      __fastcall GetRenderWindow(void);
    virtual vtkRenderer *                     __fastcall GetRenderer(void);
    virtual vtkWin32RenderWindowInteractor *  __fastcall GetInteractor(void);
    virtual void                              __fastcall SetInteractorMode(const vtkBorlandInteractorMode& im);

__published:
   // Some
    __property bool UsevtkInteractor = {read=FUsevtkInteractor, write=FUsevtkInteractor, default=true, stored=true};
    __property vtkBorlandInteractorMode InteractorMode = {read=FInteractorMode, write=FInteractorMode, default=IM_TrackballCamera, stored=true};
    //
    // Cosmetic Properties inherited from TCustomControl
    //
    __property Align;
    __property Anchors;
    __property Color;
    __property Constraints;
    __property Enabled;
    __property ParentColor;
    __property PopupMenu;
    __property TabOrder;
    __property TabStop;
    __property Visible;
    //
    // Cosmetic Properties inherited from TWinControl
    //
    __property BevelEdges;
    __property BevelInner;
    __property BevelOuter;
    __property BevelKind;
    __property BevelWidth;
    __property BorderWidth;

    //
    // Useful Event notifications
    //
    __property OnCanResize;
    __property OnClick;
    __property OnConstrainedResize;
    __property OnDblClick;
    __property OnDragDrop;
    __property OnDragOver;
    __property OnEnter;
    __property OnExit;
    __property OnResize;
    __property OnStartDrag;
    __property TvtkBorlandCloseEvent OnVtkClose = {read=FOnVtkClose, write=FOnVtkClose};
    //
    // Main events for user interaction
    //
    __property OnKeyUp;
    __property OnKeyDown;
    __property OnKeyPress;
    __property OnMouseDown;
    __property OnMouseMove;
    __property OnMouseUp;
    __property OnMouseWheelDown;
    __property OnMouseWheelUp;
};
//---------------------------------------------------------------------------
#endif

void CheckAbortFunc(void *);