00001
00045 #ifndef INC_GRE_LRLEGND2_H
00046 #define INC_GRE_LRLEGND2_H
00047
00048 #ifndef INC_GRE_LAYER_H
00049 #include <gre/layer.h>
00050 #endif
00051
00052 #ifndef INC_MI32_GRLAYOUT_H
00053 #include <mi32/grlayout.h>
00054 #endif
00055
00056 namespace GRE {
00057
00058
00059 class LAYER_LEGEND2 : public GRE::LAYER {
00060 public:
00061
00063 class LAYERREF {
00064 public:
00065 MIUNICODE *m_name;
00066
00067 GRE::LAYER* m_layer;
00068 ELEMTYPE m_ElemType;
00069 UINT32 m_ID;
00070
00071 LAYERREF (
00072 ) :
00073 m_name(0),
00074 m_layer(0),
00075 m_ID(0),
00076 m_ElemType(ELEMTYPE_Empty)
00077 {
00078 }
00079
00080 LAYERREF (
00081 GRE::LAYER* lyr,
00082 ELEMTYPE et
00083 );
00084
00085 LAYERREF(const LAYERREF& rhs) :
00086 m_ID(rhs.m_ID),
00087 m_layer(rhs.m_layer),
00088 m_ElemType(rhs.m_ElemType)
00089 {
00090 m_name = rhs.m_name ? ucstrdup(rhs.m_name) : 0;
00091 }
00092
00093 ~LAYERREF() {
00094 MmFree(m_name);
00095 }
00096
00097 LAYERREF& operator= (const LAYERREF& rhs) {
00098 if (this != &rhs) {
00099 m_name = rhs.m_name ? ucstrdup(rhs.m_name) : 0;
00100 m_ID = rhs.m_ID;
00101 m_layer = rhs.m_layer;
00102 m_ElemType = rhs.m_ElemType;
00103 }
00104 return (*this);
00105 }
00106
00108 void SetLayer (
00109 GRE::LAYER* layer
00110 );
00111
00112 };
00113
00114
00115 class DISPPARM : public GRE::LAYER::DISPPARM {
00116 public:
00117
00118 class DLG;
00119
00120
00121 GRAPHICLAYOUT m_grlayout;
00122 UINT32 m_NumLayers;
00123 LAYERREF* m_layers;
00124
00125
00126
00127 DISPPARM ();
00128 DISPPARM (const DISPPARM& rhs) {
00129 Copy(rhs);
00130 }
00131 virtual ~DISPPARM () {
00132 Free();
00133 }
00134
00135 DISPPARM& operator= (const DISPPARM& rhs) {
00136 if (this != &rhs) {
00137 Free();
00138 Copy(rhs);
00139 }
00140 return (*this);
00141 }
00142
00143 static void GRECB_LayerCallback (
00144 const GRE::MSG* msg,
00145 void* cbdata
00146 );
00147
00148 static int SerializerCB_GRLayout (
00149 SERIALIZER& serializer,
00150 const SERIALIZERITEM *itemdef,
00151 void* cbdata,
00152 SERIALIZERITEM::ACTION action
00153 );
00154
00155
00158 INT32 GetLayerRefNum (
00159 GRE::LAYER* layer,
00160 ELEMTYPE ElemType,
00161 bool bAllocIfNotFound = false
00162 );
00163
00164 void OnLayerChange (
00165 INT32 LayerRefNum,
00166 bool deleting
00167 );
00168
00169 void OnLayoutLoaded (
00170 GRE::VIEWABLE* viewable
00171 );
00172
00173 protected:
00174 virtual const SERIALIZERITEM* SerialGetItemDef (SERIALIZER& serializer) const;
00175
00176 private:
00177 #ifndef GENERATING_DOXYGEN_OUTPUT
00178 LAYER_LEGEND2* m_layer;
00179 void Copy (const DISPPARM&);
00180 void Free ();
00181 friend class LAYER_LEGEND2;
00182 #endif
00183 };
00184
00186 #ifndef WIN32_NATIVE
00187 static void CB_NewLegend2 (
00188 Widget w,
00189 void *vsubtype,
00190 void *
00191 );
00192 #endif
00193
00195 static void RegisterType (
00196 );
00197
00199 explicit LAYER_LEGEND2 (
00200 GRE::GROUP *group,
00201 CREATEFLAGS createflags = CREATEFLAG_None,
00202 GRE::LISTPOS listpos = GRE::LISTPOS_Last,
00203 GRE::LAYER *reflayer = 0
00204 );
00205
00206 virtual ~LAYER_LEGEND2 ();
00207
00209 const DISPPARM& GetDispParm (
00210 ) const { return (m_dispparm); }
00211
00213 double GetScaleFactor (
00214 ) const;
00215
00223 ERRVALUE SetDispParm (
00224 const DISPPARM& dispparm
00225 );
00226
00227 void SetLayout (
00228 const GRAPHICLAYOUT& grlayout
00229 );
00230
00231 #if defined(X_NATIVE) && !defined(GENERATING_DOXYGEN_OUTPUT)
00232 static void CB_CreateDialog (Widget, void*, void*);
00233 #endif
00234
00235 protected:
00236
00237 DISPPARM m_dispparm;
00238
00239 private:
00240 #ifndef GENERATING_DOXYGEN_OUTPUT
00241
00242 static void GRECB_LayoutLoaded (const GRE::MSG* msg, void* cbdata);
00243
00245 #ifdef USE_MGUI
00246 virtual int v_ControlPanel (MDLGPARENT dlgparent,UINT32 flags = 0);
00247 #endif
00248 virtual GRE::LAYER* v_Copy (GRE::GROUP *group) const;
00249 virtual ERRVALUE v_Draw (GRE::LAYERDC& layerdc);
00250 virtual const char* v_SerialGetTagName () const;
00251 virtual void v_SetDftName (bool ReplaceExisting);
00252 virtual ERRVALUE v_TemplateRead (SERIALIZER& serializer);
00253 virtual int v_UpdateExtents (bool forceupdate);
00254 virtual bool v_UsesTransparency (const MGD::DEVICE *pDevice = 0) const;
00255
00256 friend class LAYER_LEGEND2::DISPPARM;
00257
00258 #endif
00259 };
00260
00261
00262 }
00263
00264 #endif