00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id: e0ad848dc048b48daac446b872335d748ab24f01 $ 00013 // 00018 #ifndef _H_HUtilitySubwindow2_H 00019 #define _H_HUtilitySubwindow2_H 00020 00021 #ifdef H_PACK_8 00022 #pragma pack(push) 00023 #pragma pack(8) 00024 #endif 00025 00026 #include "HTools.h" 00027 #include "HEventListener.h" 00028 #include "HBaseOperator.h" 00029 #include "HEventManager.h" 00030 00031 00032 #define SUBWINDOW_NOTYPE 0 //!< The basic window type. 00033 00034 00035 #define SW_ACTION_NOACTION 0 //!< There is no subwindow action. 00036 #define SW_ACTION_MOVE 1 //!< Subwindow action is move. 00037 #define SW_ACTION_SIZING 2 //!< Subwindow action is resizing. 00038 #define SW_ACTION_DRAGGING 5 //!< Subwindow action is dragging the scene inside the subwindow. 00039 #define SW_ACTION_SCROLLING 6 //!< Subwindow action is dragging the scene inside the subwindow. 00040 00041 #define SW_BORDER 1 //!< Subwindow has borders. 00042 #define SW_SIZE_FIELD 2 //!< Subwindow has a resize area. 00043 #define SW_MOVE_FIELD 4 //!< Subwindow can be moved. 00044 #define SW_DRAG_FIELD 8 //!< Subwindow allows the scene to be moved inside the window. 00045 #define SW_DELETE_FIELD 16 //!< Subwindow has a close button. 00046 #define SW_SCROLL_FIELD 32 //!< Subwindow has a close button. 00047 #define SW_BACKGROUND_BOX 64 //!< Subwindow has a shadow. 00048 00049 00050 class HBaseView; 00051 00052 00054 class MVO_API HSubwindow2 : public HObject, public HBaseOperator, public HUpdateListener, public HFitWorldListener, public HObjectManipulationListener 00060 { 00061 00062 public: 00063 00071 HSubwindow2 (HBaseView* view, int DoRepeat=0, int DoCapture=1); 00075 HSubwindow2 (); 00076 virtual ~HSubwindow2(); 00077 00078 00089 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 = 00090 SW_BORDER | SW_SIZE_FIELD | SW_MOVE_FIELD | SW_DRAG_FIELD | SW_DELETE_FIELD | SW_BACKGROUND_BOX | SW_SCROLL_FIELD); 00091 00096 virtual void Reset(); 00097 00098 00102 virtual bool IsActive(); 00103 00108 virtual void GetFromKey(HC_KEY key); 00109 00114 virtual bool IsSubwindow(HC_KEY key); 00115 00123 virtual bool FindSubwindow(HBaseView *view, HPoint pos, bool &pointerselected); 00124 00130 virtual HC_KEY FindSubwindowFromSegment(HC_KEY key); 00131 00137 virtual void GetPosition(float &x,float &y); 00138 00144 virtual void SetPosition(float x,float y); 00145 00146 00150 virtual HC_KEY GetWindowKey(); 00151 00157 virtual void GetSize(float &x,float &y); 00158 00164 virtual void SetSize(float deltax, float deltay); 00165 00166 00167 00173 virtual void ConvertFromSubwindowToView(HPoint &in_point, HPoint &out_point); 00174 00180 virtual void ConvertFromViewToSubwindow(HPoint const & in_point, HPoint & out_point); 00181 00182 00189 virtual void ChangeType(int type, long appearance = SW_BORDER | SW_SIZE_FIELD | SW_MOVE_FIELD | SW_DRAG_FIELD | SW_DELETE_FIELD | SW_BACKGROUND_BOX); 00190 00191 00192 00200 virtual void SetSize(float left, float right, float bottom, float top); 00201 00211 virtual void ComputeCoordinates(HBaseView *view, const char *in_system, HPoint &from, const char *out_system, HPoint &to); 00212 00213 00214 00215 00220 virtual int GetType() { return m_Type; } 00221 00226 virtual HC_KEY GetKey() { return m_OuterKey; } 00227 00231 virtual const char * GetName(); 00235 static const char * GetStaticName(); 00236 00243 virtual int OnLButtonDown (HEventInfo &hevent); 00250 virtual int OnLButtonUp (HEventInfo &hevent); 00251 00258 virtual int PreFitWorldEvent(HBaseView *view); 00259 00266 virtual int PostFitWorldEvent(HBaseView *view); 00267 00268 00277 virtual int OnLButtonDownAndMove(HEventInfo &hevent); 00278 00286 virtual int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 00287 00295 virtual int ObjectMovedEvent(HBaseView *view, HC_KEY key, HPoint *p); 00303 virtual int ObjectScaledEvent(HBaseView *view, HC_KEY key, HPoint &scale); 00304 00305 virtual void DrawScrollBox(); 00306 00307 00308 protected: 00309 00313 void GetParameters(); 00319 bool IsInSizeArea(HPoint &point); 00320 bool IsInScrollArea(HPoint &point); 00321 00327 bool IsInMagnifyArea(HPoint &point); 00332 void CopyViewLight(HBaseView *view); 00337 void BuildMagnifyController(float pos); 00338 00339 00345 void ChangeMagnification(HBaseView *view, HPoint & p); 00350 void Magnify(HBaseView *view); 00351 00357 bool IsInCloseArea(HPoint &point); 00363 bool IsInDragArea(HPoint &point); 00364 00368 void BuildBorder(); 00374 bool IsInMoveArea(HPoint &point); 00380 void ChangeMagnification(HBaseView *view, float magnification); 00381 00382 00383 virtual void UpdateContent(); 00384 00385 HC_KEY m_OuterKey; 00386 HC_KEY m_WindowKey; 00389 float m_Left; 00390 float m_Right; 00391 float m_Bottom; 00392 float m_Top; 00394 int m_Type; 00395 long m_Appearance; 00396 HPoint m_Pointer; 00397 int m_Action; 00398 HPoint m_ptLast; 00399 char m_title[256]; 00400 int m_ScrollHeight; 00401 int m_ScrollPos; 00402 float m_MinWidth; 00403 float m_MinHeight; 00404 }; 00405 00406 00407 00408 00409 class MVO_API HTexturePickerWindow : public HSubwindow2 00410 { 00411 00412 public: 00413 HTexturePickerWindow(HBaseView* view, int DoRepeat=0, int DoCapture=1); 00414 HTexturePickerWindow (); 00415 00416 virtual void UpdateContent(); 00417 virtual int OnLButtonDown (HEventInfo &hevent); 00418 virtual int OnLButtonUp (HEventInfo &hevent); 00419 virtual int OnLButtonDownAndMove (HEventInfo &hevent); 00420 00421 00422 }; 00423 00424 #ifdef H_PACK_8 00425 #pragma pack(pop) 00426 #endif 00427 00428 #endif 00429 00430 00431 00432 00433 00434 00435 00436 00437