MatOCAD Logo

Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

ifmdefs.h

Go to the documentation of this file.
00001 
00012 #ifndef _IFM_DEFS_H_
00013 #define _IFM_DEFS_H_
00014 
00015 #include <wx/hashmap.h>
00016 #include <wx/dynarray.h>
00017 
00018 //#include <vector>
00019 //#include <map>
00020 
00021 // some wx compatability stuff
00022 /*
00023 This switch controls the use of the wx RTTI system.
00024 
00025   Default: 0 if your compiler doesn't suck
00026   Recommended: 0 unless you have a crappy compiler that doesn't support C++ RTTI
00027 */
00028 // aparently, this is not even defined on GCC, so screw it, using dynamic_cast directly
00029 //#ifdef HAVE_CXX_CASTS // wx/defs.h defines this when c++ casting is supported
00030 //#define IFM_USE_WX_RTTI 0
00031 //#else
00032 #define IFM_USE_WX_RTTI 1
00033 //#endif
00034 
00035 // macro to avoid having to use a million #ifdefs for wx RTTI and having to avoid a million dynamic_casts
00036 // this will hopefully become a templated function one day and should be one now
00037 #if IFM_USE_WX_RTTI
00038 #define IFM_GET_EXTENSION_DATA(c, d)    (wxDynamicCast((c)->GetExtensionData(d::DataKey()), d))
00039 #else
00040 #define IFM_GET_EXTENSION_DATA(c, d)    (dynamic_cast<d*>((c)->GetExtensionData(d::DataKey())))
00041 #endif
00042 
00043 /*
00044 Some forward declares
00045 */
00046 class wxIFMInterfacePluginBase;
00047 class wxIFMExtensionPluginBase;
00048 class wxIFMPluginEvent;
00049 class wxInterfaceManager;
00050 class wxIFMExtensionDataBase;
00051 class wxIFMFloatingData;
00052 class wxIFMComponent;
00053 class wxIFMChildDataBase;
00054 class wxIFMFloatingWindowBase;
00055 
00056 #ifdef _MSC_VER // shut up msvc
00057 #pragma warning(disable:4284)
00058 #pragma warning(disable:4100)
00059 #pragma warning(disable:4018)
00060 #pragma warning(disable:4245)
00061 #endif
00062 //typedef std::vector<wxIFMInterfacePluginBase *> wxIFMInterfacePluginArray;
00063 //typedef std::vector<wxIFMComponent *> wxIFMComponentArray;
00064 //typedef std::vector<wxIFMFloatingWindowBase *> wxIFMFloatingWindowArray;
00065 WX_DEFINE_ARRAY(wxIFMInterfacePluginBase*, wxIFMInterfacePluginArray);
00066 WX_DEFINE_ARRAY(wxIFMComponent*, wxIFMComponentArray);
00067 WX_DEFINE_ARRAY(wxIFMFloatingWindowBase*, wxIFMFloatingWindowArray);
00068 
00069 /*
00070 Data key stuff
00071 */
00072 typedef int wxIFMComponentDataKeyType; 
00073 //typedef std::map<const wxIFMComponentDataKeyType, wxIFMExtensionDataBase *> wxIFMComponentDataMap;
00074 WX_DECLARE_HASH_MAP(wxIFMComponentDataKeyType, wxIFMExtensionDataBase*, wxIntegerHash, wxIntegerEqual, wxIFMComponentDataMap);
00075 #define DECLARE_IFM_DATA_KEY(name)  extern const wxIFMComponentDataKeyType name;
00076 #define DEFINE_IFM_DATA_KEY(name)   const wxIFMComponentDataKeyType name = GetNewDataKey();
00077 
00078 /*
00079 Component type stuff
00080 */
00081 #define DECLARE_IFM_COMPONENT_TYPE(name)    extern const int name;
00082 #define DEFINE_IFM_COMPONENT_TYPE(name)     const int name = GetNewComponentType();
00083 #define IFM_COMPONENT_UNDEFINED 0 // uninitialized component (error!)
00084 #define IFM_COMPONENT_FLOATING_ROOT -1 
00085 
00086 /*
00087 Child types stuff
00088 */
00089 class wxWindow;
00090 //typedef std::map<const wxWindow*, wxIFMComponent*> wxIFMChildWindowMap;
00091 WX_DECLARE_HASH_MAP(unsigned int, wxIFMComponent*, wxIntegerHash, wxIntegerEqual, wxIFMChildWindowMap);
00092 #define DECLARE_IFM_CHILD_TYPE(name)    extern const int name;
00093 #define DEFINE_IFM_CHILD_TYPE(name)     const int name = GetNewChildType();
00094 #define IFM_CHILDTYPE_UNDEFINED 0 // don't know (error!)
00095 DECLARE_IFM_CHILD_TYPE(IFM_CHILD_GENERIC) // defined in manager.cpp
00096 DECLARE_IFM_CHILD_TYPE(IFM_CHILD_TOOLBAR) // defined in manager.cpp
00097 
00098 #define IFM_COORDS_ABSOLUTE     1 
00099 #define IFM_COORDS_BACKGROUND   2 
00101 #define IFM_COORDS_CLIENT       3 
00103 #define IFM_COORDS_FLOATINGWINDOW 4 
00104 
00105 #define IFM_ALIGN_NONE          0 
00106 #define IFM_ALIGN_HORIZONTAL    1 
00107 #define IFM_ALIGN_VERTICAL      2 
00108 
00109 /*
00110     Various flags
00111 */
00112 #define IFM_NO_RESIZE_UPDATE    0x00000001 
00113 #define IFM_DEFAULT_FLAGS       0
00114 
00115 #define IFM_DISABLE_STATUS_MESSAGES -1 
00116 #define IFM_USE_CURRENT_VALUE   -1 
00117 #define IFM_NO_MAXIMUM          -2 
00118 #define IFM_NO_MINIMUM          -3 
00119 #define IFM_NO_MAXIMUM_SIZE     wxSize(IFM_NO_MAXIMUM,IFM_NO_MAXIMUM) 
00120 #define IFM_NO_MINIMUM_SIZE     wxSize(IFM_NO_MINIMUM,IFM_NO_MINIMUM) 
00121 #define IFM_USE_CHILD_MINSIZE   wxSize(-2,-2) 
00122 #define IFM_USE_CURRENT_SIZE    wxSize(IFM_USE_CURRENT_VALUE,IFM_USE_CURRENT_VALUE)
00123 #define IFM_DEFAULT_INDEX       -1
00124 #define IFM_DEFAULT_POS         wxPoint(-1, -1)
00125 #define IFM_DEFAULT_SIZE        wxSize(100, 100)
00126 #define IFM_DEFAULT_RECT        wxRect(IFM_DEFAULT_POS, wxSize(-1,-1))
00127 #define IFM_INTERFACE_ACTIVE    -1
00128 #define IFM_INTERFACE_ALL       -2
00129 #define IFM_DEFAULT_COMPONENT_NAME  wxT("")
00130 
00131 // floating
00132 #if defined(__WXMSW__) || defined(__WXGTK__)
00133 #   define IFM_CANFLOAT    1 // floating supported
00134 #else
00135 #   define IFM_CANFLOAT    0 // no reparent yet
00136 #endif
00137 
00138 class wxIFMDimensions;
00139 
00143 class wxIFMDimensions
00144 {
00145 public:
00146     int top, bottom, left, right;
00147 
00148     wxIFMDimensions()
00149     {
00150         top =
00151         bottom =
00152         left =
00153         right = 0;
00154     }
00155 
00160     void Set(int i)
00161     {
00162         top =
00163         left =
00164         right =
00165         bottom = i;
00166     }
00167 
00168     wxIFMDimensions &operator =(const wxIFMDimensions &rect)
00169     {
00170         top = rect.top;
00171         bottom = rect.bottom;
00172         left = rect.left;
00173         right = rect.right;
00174         return *this;
00175     }
00176 };
00177 
00178 typedef wxIFMDimensions wxIFMBorders;
00179 typedef wxIFMDimensions wxIFMMargins;
00180 
00181 #define IFM_BORDER_Y    4
00182 
00183 #endif // _IFM_DEFS_H_

 

SourceForge Logo