Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HOpSelectAreaOOC.h
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 
00010 #pragma once
00011 
00012 
00013 #ifdef HMFC_STATIC_LIB
00014 #   error "Code cannot be statically linked."
00015 #endif
00016 
00017 
00018 #ifdef H_PACK_8
00019 #   pragma pack(push)
00020 #   pragma pack(8)
00021 #endif
00022 
00023 
00025 
00026 
00027 #include "HOpSelectArea.h"
00028 #include "HSelectionSetOOC.h"
00029 
00030 
00032 
00033 
00039 template <typename SelectionSet>
00040 class HOpSelectAreaOOC : public HOpSelectArea {
00041 public:
00045     HOpSelectAreaOOC (HBaseView & view)
00046         : HOpSelectArea(&view)
00047     {}
00048 
00051     virtual char const * GetName ()
00052     {
00053         return "HOpSelectAreaOOC";
00054     }
00055 
00060     virtual HBaseOperator * Clone ()
00061     {
00062         return new HOpSelectAreaOOC(*GetView());
00063     }
00064 
00069     virtual int OnLButtonDown (HEventInfo & e)
00070     {
00071         if (!e.Control()) {
00072             GetSelectionSet().DeSelectAll();
00073         }
00074         return HOpSelectArea::OnLButtonDown(e);
00075     }
00076 
00082     virtual int OnLButtonUp (HEventInfo & e)
00083     {
00084         HSelectionSetOOC<SelectionSet> & selset = GetSelectionSet();
00085 
00086         return selset.SynchronizeWith([&] () -> int {
00087             int const result = HOpSelectArea::OnLButtonUp(e);
00088 
00089             ooc::Point window_min(m_ptRectangle[0].x, m_ptRectangle[0].y, 0);
00090             ooc::Point window_max(m_ptRectangle[1].x, m_ptRectangle[1].y, 0);
00091 
00092             selset.AddRectangleWindow(window_min, window_max);
00093 
00094             return result;
00095         });
00096     }
00097 
00098 private:
00099     HSelectionSetOOC<SelectionSet> & GetSelectionSet ()
00100     {
00101         HBaseView & view = *GetView();
00102         HSelectionSet & selset = *view.GetSelection();
00103         return static_cast<HSelectionSetOOC<SelectionSet> &>(selset);
00104     }
00105 };
00106 
00107 
00108