IPViewItem.h

Go to the documentation of this file.
00001 
00005 /**********************************************************************
00006  *<
00007     CREATED BY: Oleg Bayborodin
00008 
00009     HISTORY: created 02-21-02
00010 
00011  *> Copyright (c) 2001, All Rights Reserved.
00012  **********************************************************************/
00013 
00014 #pragma once
00015 
00016 #include "PFExport.h"
00017 #include "..\object.h"
00018 
00019 PFExport Object* GetPFObject(Object* obj);
00020 // interface ID
00021 #define PVIEWITEM_INTERFACE Interface_ID(0x74f93d08, 0x1eb34500) 
00022 #define GetPViewItemInterface(obj) ((IPViewItem*)((GetPFObject(obj))->GetInterface(PVIEWITEM_INTERFACE))) 
00023 
00024 // operator/test icon size in particle view
00025 enum {  kActionImageWidth=22, kActionImageHeight=22 }; // in pixels
00026 
00027 class IPViewItem : public FPMixinInterface
00028 {
00029 public:
00030 
00031     // function IDs
00032     enum {  kNumPViewParamBlocks,
00033             kGetPViewParamBlock,
00034             kHasComments,
00035             kGetComments,
00036             kSetComments,
00037             kGetWireExtension,
00038             kSetWireExtension
00039     }; 
00040 
00041     BEGIN_FUNCTION_MAP
00042     FN_0(kNumPViewParamBlocks, TYPE_INT, NumPViewParamBlocks );
00043     FN_1(kGetPViewParamBlock, TYPE_REFTARG, GetPViewParamBlock, TYPE_INDEX );
00044     FN_1(kHasComments, TYPE_bool, HasComments, TYPE_INODE );
00045     FN_1(kGetComments, TYPE_STRING, GetComments, TYPE_INODE );
00046     VFN_2(kSetComments, SetComments, TYPE_INODE, TYPE_STRING );
00047     FN_2(kGetWireExtension, TYPE_INT, GetWireExtension, TYPE_INODE, TYPE_INT );
00048     VFN_3(kSetWireExtension, SetWireExtension, TYPE_INODE, TYPE_INT, TYPE_INT );
00049     END_FUNCTION_MAP
00050 
00055     // constructor: inherited as a base class constructor
00056     IPViewItem() { m_numInstances = 1; }
00057 
00061     virtual int NumPViewParamBlocks() const = 0;
00062 
00066     virtual IParamBlock2* GetPViewParamBlock(int i) const = 0;
00067 
00071     PFExport int NumPViewParamMaps() const;
00072 
00076     PFExport IParamMap2* GetPViewParamMap(int i) const;
00077 
00081     PFExport void AddPViewParamMap(IParamMap2* map);
00082 
00086     PFExport void RemovePViewParamMap(IParamMap2* map);
00087 
00091     virtual bool HasCustomPViewIcons() { return false; }
00092 
00096     virtual HBITMAP GetActivePViewIcon() { return NULL; }  
00097 
00101     virtual HBITMAP GetInactivePViewIcon() { return NULL; }
00102 
00106     virtual HBITMAP GetTruePViewIcon() { return NULL; } 
00107 
00111     virtual HBITMAP GetFalsePViewIcon() { return NULL; } 
00112 
00116     PFExport int GetNumInstances() const;
00117 
00121     PFExport void SetNumInstances(int num);
00122 
00126     PFExport void IncNumInstances();
00127 
00132     PFExport bool HasComments(INode* itemNode) const;
00133 
00137     PFExport MSTR GetComments(INode* itemNode) const;
00138 
00142     PFExport void SetComments(INode* itemNode, MSTR comments);
00143 
00147     PFExport void EditComments(INode* itemNode, HWND parentWnd, long x, long y);
00148 
00152     PFExport LRESULT CALLBACK commentsProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
00153 
00157     virtual bool HasDynamicName(MSTR& nameSuffix) { UNUSED_PARAM(nameSuffix); return false; }
00158     
00163     PFExport static int GetWireExtension(INode* node, int& wireHeight);
00164 
00168     PFExport static void SetWireExtension(INode* node, int wireLen, int wireHight);
00169 
00173     FPInterfaceDesc* GetDesc() { return GetDescByID(PVIEWITEM_INTERFACE); }
00174 
00177 private:
00178     void add(INode* itemNode, HWND hWnd);
00179     INode* node(HWND hWnd);
00180     HWND hWnd(INode* itemNode);
00181     void erase(HWND hWnd);
00182 
00183 protected:
00184     Tab<IParamMap2*> m_paramMaps;
00185     int m_numInstances;
00186     Tab<INode*> m_nodes;
00187     Tab<HWND> m_hWnds;
00188 };
00189 
00190 inline IPViewItem* PViewItemInterface(Object* obj) {
00191     return ((obj == NULL) ? NULL : GetPViewItemInterface(obj));
00192 };
00193 
00194 inline IPViewItem* PViewItemInterface(INode* node) {
00195     return ((node == NULL) ? NULL : PViewItemInterface(node->GetObjectRef()));
00196 };
00197 
00198