00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 00014 #ifndef _H_HUtilitySubwindow2_H 00015 #define _H_HUtilitySubwindow2_H 00016 00017 #ifdef H_PACK_8 00018 #pragma pack(push) 00019 #pragma pack(8) 00020 #endif 00021 00022 #include "HTools.h" 00023 #include "HEventListener.h" 00024 #include "HBaseOperator.h" 00025 #include "HEventManager.h" 00026 00027 00028 #define SUBWINDOW_NOTYPE 0 //!< The basic window type. 00029 00030 00031 #define SW_ACTION_NOACTION 0 //!< There is no subwindow action. 00032 #define SW_ACTION_MOVE 1 //!< Subwindow action is move. 00033 #define SW_ACTION_SIZING 2 //!< Subwindow action is resizing. 00034 #define SW_ACTION_DRAGGING 5 //!< Subwindow action is dragging the scene inside the subwindow. 00035 #define SW_ACTION_SCROLLING 6 //!< Subwindow action is dragging the scene inside the subwindow. 00036 00037 #define SW_BORDER 1 //!< Subwindow has borders. 00038 #define SW_SIZE_FIELD 2 //!< Subwindow has a resize area. 00039 #define SW_MOVE_FIELD 4 //!< Subwindow can be moved. 00040 #define SW_DRAG_FIELD 8 //!< Subwindow allows the scene to be moved inside the window. 00041 #define SW_DELETE_FIELD 16 //!< Subwindow has a close button. 00042 #define SW_SCROLL_FIELD 32 //!< Subwindow has a close button. 00043 #define SW_BACKGROUND_BOX 64 //!< Subwindow has a shadow. 00044 00045 00046 class HBaseView; 00047 00048 00050 class MVO_API HSubwindow2 : public HObject, public HBaseOperator, public HUpdateListener, public HFitWorldListener, public HObjectManipulationListener 00056 { 00057 00058 public: 00059 00067 HSubwindow2 (HBaseView* view, int DoRepeat=0, int DoCapture=1); 00071 HSubwindow2 (); 00072 virtual ~HSubwindow2(); 00073 00074 00085 virtual void Insert(float left, float right, float bottom, float top, char const * title = 0, float minwidth = 0, float minheight = 0,int type = SUBWINDOW_NOTYPE,long appearance = 00086 SW_BORDER | SW_SIZE_FIELD | SW_MOVE_FIELD | SW_DRAG_FIELD | SW_DELETE_FIELD | SW_BACKGROUND_BOX | SW_SCROLL_FIELD); 00087 00092 virtual void Reset(); 00093 00094 00098 virtual bool IsActive(); 00099 00104 virtual void GetFromKey(HC_KEY key); 00105 00110 virtual bool IsSubwindow(HC_KEY key); 00111 00119 virtual bool FindSubwindow(HBaseView *view, HPoint pos, bool &pointerselected); 00120 00126 virtual HC_KEY FindSubwindowFromSegment(HC_KEY key); 00127 00133 virtual void GetPosition(float &x,float &y); 00134 00140 virtual void SetPosition(float x,float y); 00141 00142 00146 virtual HC_KEY GetWindowKey(); 00147 00153 virtual void GetSize(float &x,float &y); 00154 00160 virtual void SetSize(float deltax, float deltay); 00161 00162 00163 00169 virtual void ConvertFromSubwindowToView(HPoint &in_point, HPoint &out_point); 00170 00176 virtual void ConvertFromViewToSubwindow(HPoint const & in_point, HPoint & out_point); 00177 00178 00185 virtual void ChangeType(int type, long appearance = SW_BORDER | SW_SIZE_FIELD | SW_MOVE_FIELD | SW_DRAG_FIELD | SW_DELETE_FIELD | SW_BACKGROUND_BOX); 00186 00187 00188 00196 virtual void SetSize(float left, float right, float bottom, float top); 00197 00207 virtual void ComputeCoordinates(HBaseView *view, const char *in_system, HPoint &from, const char *out_system, HPoint &to); 00208 00209 00210 00211 00216 virtual int GetType() { return m_Type; } 00217 00222 virtual HC_KEY GetKey() { return m_OuterKey; } 00223 00227 virtual const char * GetName(); 00231 static const char * GetStaticName(); 00232 00239 virtual int OnLButtonDown (HEventInfo &hevent); 00246 virtual int OnLButtonUp (HEventInfo &hevent); 00247 00254 virtual int PreFitWorldEvent(HBaseView *view); 00255 00262 virtual int PostFitWorldEvent(HBaseView *view); 00263 00264 00273 virtual int OnLButtonDownAndMove(HEventInfo &hevent); 00274 00282 virtual int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 00283 00291 virtual int ObjectMovedEvent(HBaseView *view, HC_KEY key, HPoint *p); 00299 virtual int ObjectScaledEvent(HBaseView *view, HC_KEY key, HPoint &scale); 00300 00301 virtual void DrawScrollBox(); 00302 00303 00304 protected: 00305 00309 void GetParameters(); 00315 bool IsInSizeArea(HPoint &point); 00316 bool IsInScrollArea(HPoint &point); 00317 00323 bool IsInMagnifyArea(HPoint &point); 00328 void CopyViewLight(HBaseView *view); 00333 void BuildMagnifyController(float pos); 00334 00335 00341 void ChangeMagnification(HBaseView *view, HPoint & p); 00346 void Magnify(HBaseView *view); 00347 00353 bool IsInCloseArea(HPoint &point); 00359 bool IsInDragArea(HPoint &point); 00360 00364 void BuildBorder(); 00370 bool IsInMoveArea(HPoint &point); 00376 void ChangeMagnification(HBaseView *view, float magnification); 00377 00378 00379 virtual void UpdateContent(); 00380 00381 HC_KEY m_OuterKey; 00382 HC_KEY m_WindowKey; 00385 float m_Left; 00386 float m_Right; 00387 float m_Bottom; 00388 float m_Top; 00390 int m_Type; 00391 long m_Appearance; 00392 HPoint m_Pointer; 00393 int m_Action; 00394 HPoint m_ptLast; 00395 char m_title[256]; 00396 int m_ScrollHeight; 00397 int m_ScrollPos; 00398 float m_MinWidth; 00399 float m_MinHeight; 00400 }; 00401 00402 00403 00404 00405 class MVO_API HTexturePickerWindow : public HSubwindow2 00406 { 00407 00408 public: 00409 HTexturePickerWindow(HBaseView* view, int DoRepeat=0, int DoCapture=1); 00410 HTexturePickerWindow (); 00411 00412 virtual void UpdateContent(); 00413 virtual int OnLButtonDown (HEventInfo &hevent); 00414 virtual int OnLButtonUp (HEventInfo &hevent); 00415 virtual int OnLButtonDownAndMove (HEventInfo &hevent); 00416 00417 00418 }; 00419 00420 #ifdef H_PACK_8 00421 #pragma pack(pop) 00422 #endif 00423 00424 #endif 00425 00426 00427 00428 00429 00430 00431 00432 00433