Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
3.5 KiB

  1. #ifndef __BMOBJECT_H__
  2. #define __BMOBJECT_H__
  3. class CBmObjSequence;
  4. // Get*Prop return type
  5. enum GPT
  6. {
  7. invalid, // Not a known property or disabled
  8. valid, // Value is correct
  9. ambiguous // Multiple selection with different values
  10. };
  11. // Selection Object
  12. class CFileBuffer;
  13. class CBitmapObj : public CObject
  14. {
  15. DECLARE_DYNCREATE( CBitmapObj )
  16. public:
  17. CBitmapObj();
  18. ~CBitmapObj();
  19. void Clear();
  20. void InformDependants( UINT idChange );
  21. void AddDependant ( CBitmapObj* newDependant );
  22. void RemoveDependant ( CBitmapObj* oldDependant );
  23. // Notification Callback
  24. void OnInform( CBitmapObj* pChangedSlob, UINT idChange );
  25. // Property Management
  26. BOOL SetIntProp (UINT idProp, int val);
  27. GPT GetIntProp (UINT idProp, int& val);
  28. BOOL SetSizeProp(UINT nPropID, const CSize& val);
  29. BOOL MakeEmpty ();
  30. BOOL Import ( LPCTSTR szFileName );
  31. BOOL Export ( LPCTSTR szFileName );
  32. // Specify the type of header to put on a resource
  33. typedef enum _PBResType
  34. {
  35. rtFile,
  36. rtDIB,
  37. rtPaintOLEObj,
  38. rtPBrushOLEObj,
  39. } PBResType;
  40. BOOL ReadResource ( HGLOBAL hDib );
  41. BOOL ReadResource ( CFile* pfile, PBResType rtType = rtFile );
  42. BOOL WriteResource ( CFile* pfile, PBResType rtType = rtFile );
  43. #ifdef PCX_SUPPORT
  44. BOOL ReadPCX ( CFile* pfile );
  45. BOOL WritePCX ( CFile* pfile );
  46. BOOL PackBuff ( CFileBuffer *FileBuffer, BYTE *PtrDib, int byteWidth);
  47. #endif
  48. BOOL CreateImg ();
  49. BOOL SaveResource ( BOOL bClear = TRUE );
  50. void ReLoadImage ( CPBDoc* pbDoc );
  51. void UndoAction ( CBmObjSequence* pSeq, UINT nActionID );
  52. void DeleteUndoAction( CBmObjSequence* pSeq, UINT nActionID );
  53. BOOL FinishUndo ( const CRect* pRect );
  54. // Resource data access helpers...
  55. BOOL Alloc(); // m_hThing of size m_lMemSize
  56. void Free(); // m_hThing and set m_lMemSize to zero
  57. void Zap(); // frees memory and zeros out the file position
  58. // information - used to completely empty a resobject
  59. CString GetDefExtension(int iStringId=0);
  60. BOOL SetupForIcon( HBITMAP& hBitmap, HBITMAP& hMaskBitmap );
  61. // Load m_hThing with the resource data from the res file
  62. inline BOOL IsDirty() const { return m_bDirty; }
  63. void SetDirty(BOOL bDirty = TRUE);
  64. #ifdef ICO_SUPPORT
  65. BOOL IsSaveIcon() { return(m_bSaveIcon); }
  66. #endif
  67. struct IMG* m_pImg;
  68. // Properties...
  69. int m_nWidth;
  70. int m_nHeight;
  71. int m_nColors;
  72. int m_nSaveColors;
  73. #ifdef ICO_SUPPORT
  74. BOOL m_bSaveIcon;
  75. #endif
  76. #ifdef PCX_SUPPORT
  77. BOOL m_bPCX;
  78. #endif
  79. BOOL m_bCompressed;
  80. BOOL m_nShrink; // 0=crop, 1=shrink, 2=ask
  81. BOOL m_bTempName; // true if not save as m_strFileName yet
  82. BOOL m_bDirty; // true if changed
  83. HGLOBAL m_hThing; // in memory resource (must be valid)
  84. DWORD m_dwOffBits; // offset of pixels in m_hThing; packed if 0
  85. LONG m_lMemSize; // size in bytes
  86. protected:
  87. CObList m_dependants;
  88. };
  89. // Standard Slob Notifications
  90. #define SN_DESTROY 0
  91. #define SN_ALL 1
  92. extern int mpncolorsbits[];
  93. void PBGetDefDims(int& pnWidth, int& pnHeight);
  94. #ifndef _WIN32
  95. #define POINTS POINT
  96. #endif
  97. #endif // __BMOBJECT_H__