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.

87 lines
2.0 KiB

  1. /*
  2. * NineGridLayout
  3. */
  4. #ifndef DUI_NINEGRIDLAYOUT_H_INCLUDED
  5. #define DUI_NINEGRIDLAYOUT_H_INCLUDED
  6. #pragma once
  7. namespace DirectUI
  8. {
  9. // BorderLayout positions
  10. #define NGLP_TopLeft 0
  11. #define NGLP_Top 1
  12. #define NGLP_TopRight 2
  13. #define NGLP_Left 3
  14. #define NGLP_Client 4
  15. #define NGLP_Right 5
  16. #define NGLP_BottomLeft 6
  17. #define NGLP_Bottom 7
  18. #define NGLP_BottomRight 8
  19. ////////////////////////////////////////////////////////
  20. // NineGridLayout
  21. class NineGridLayout : public Layout
  22. {
  23. public:
  24. static HRESULT Create(int dNumParams, int* pParams, OUT Value** ppValue); // For parser
  25. static HRESULT Create(OUT Layout** ppLayout);
  26. // Layout callbacks
  27. virtual void DoLayout(Element* pec, int dWidth, int dHeight);
  28. virtual SIZE UpdateDesiredSize(Element* pec, int dConstW, int dConstH, Surface* psrf);
  29. virtual void OnAdd(Element* pec, Element** ppeAdd, UINT cCount);
  30. virtual void OnRemove(Element* pec, Element** ppeRemove, UINT cCount);
  31. virtual void OnLayoutPosChanged(Element* pec, Element* peChanged, int dOldLP, int dNewLP);
  32. virtual Element* GetAdjacent(Element* pec, Element* peFrom, int iNavDir, NavReference const* pnr, bool bKeyableOnly);
  33. NineGridLayout() { };
  34. void Initialize();
  35. virtual ~NineGridLayout() { };
  36. private:
  37. enum
  38. {
  39. };
  40. enum ESlot
  41. {
  42. Margin1 = 0,
  43. Left = 1,
  44. Top = 1,
  45. Margin2 = 2,
  46. Center = 3,
  47. Margin3 = 4,
  48. Right = 5,
  49. Bottom = 5,
  50. Margin4 = 6,
  51. NumSlots = 7
  52. };
  53. enum EDim
  54. {
  55. X = 0,
  56. Y = 1,
  57. NumDims = 2
  58. };
  59. enum EConst
  60. {
  61. NumCells = 9,
  62. CellsPerRow = 3
  63. };
  64. Element* _peTiles[NumCells];
  65. SIZE _sizeDesired;
  66. int _length[NumDims][NumSlots];
  67. void _UpdateTileList(int iTile, Element* pe);
  68. };
  69. } // namespace DirectUI
  70. #endif // DUI_NINEGRIDLAYOUT_H_INCLUDED