Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / include / fwl / core / fwl_grid.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FWL_GRID_H\r
8 #define _FWL_GRID_H\r
9 class IFWL_Widget;\r
10 class IFWL_Content;\r
11 class IFWL_Grid;\r
12 #define FWL_CLASS_Grid                  L"FWL_GRID"\r
13 #define FWL_CLASSHASH_Grid              3150298670\r
14 #define FWL_GRIDSTYLEEXT_ShowGridLines (1L << 0)\r
15 struct FWL_LAYOUTDATA : public CFX_Object {\r
16     FX_FLOAT fWidth;\r
17     FX_FLOAT fHeight;\r
18 };\r
19 enum FWL_GRIDUNIT {\r
20     FWL_GRIDUNIT_Auto = 0,\r
21     FWL_GRIDUNIT_Fixed,\r
22     FWL_GRIDUNIT_Scaled,\r
23     FWL_GRIDUNIT_Infinity,\r
24 };\r
25 enum FWL_GRIDMARGIN {\r
26     FWL_GRIDMARGIN_Left = 0,\r
27     FWL_GRIDMARGIN_Top,\r
28     FWL_GRIDMARGIN_Right,\r
29     FWL_GRIDMARGIN_Bottom,\r
30 };\r
31 enum FWL_GRIDSIZE {\r
32     FWL_GRIDSIZE_Width = 0,\r
33     FWL_GRIDSIZE_Height,\r
34     FWL_GRIDSIZE_MinWidth,\r
35     FWL_GRIDSIZE_MinHeight,\r
36     FWL_GRIDSIZE_MaxWidth,\r
37     FWL_GRIDSIZE_MaxHeight,\r
38 };\r
39 typedef struct _FWL_HGRIDCOLROW {\r
40     FX_LPVOID pData;\r
41 } * FWL_HGRIDCOLROW;\r
42 class IFWL_Grid : public IFWL_Content\r
43 {\r
44 public:\r
45     static IFWL_Grid*   Create();\r
46     FWL_ERR                             Initialize();\r
47     FWL_ERR                             Initialize(CFWL_WidgetImpProperties &properties);\r
48 \r
49     FWL_HGRIDCOLROW             InsertColRow(FX_BOOL bColumn, FX_INT32 nIndex = -1);\r
50     FX_INT32                    CountColRows(FX_BOOL bColumn);\r
51     FWL_HGRIDCOLROW             GetColRow(FX_BOOL bColumn, FX_INT32 nIndex);\r
52     FX_INT32                    GetIndex(FWL_HGRIDCOLROW hColRow);\r
53     FX_FLOAT                    GetSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT &eUnit);\r
54     FWL_ERR                             SetSize(FWL_HGRIDCOLROW hColRow, FX_FLOAT fSize, FWL_GRIDUNIT eUnit);\r
55     FX_FLOAT                    GetMinSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT &eUnit);\r
56     FWL_ERR                             SetMinSize(FWL_HGRIDCOLROW hColRow, FX_FLOAT fSize, FWL_GRIDUNIT eUnit);\r
57     FX_FLOAT                    GetMaxSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT &eUnit);\r
58     FWL_ERR                             SetMaxSize(FWL_HGRIDCOLROW hColRow, FX_FLOAT fSize, FWL_GRIDUNIT eUnit);\r
59     FX_BOOL                             DeleteColRow(FWL_HGRIDCOLROW hColRow);\r
60     FX_BOOL                             IsColumn(FWL_HGRIDCOLROW hColRow);\r
61     FX_INT32                    GetWidgetPos(IFWL_Widget *pWidget, FX_BOOL bColumn);\r
62     FWL_ERR                             SetWidgetPos(IFWL_Widget *pWidget, FX_INT32 iPos, FX_BOOL bColumn);\r
63     FX_INT32                    GetWidgetSpan(IFWL_Widget *pWidget, FX_BOOL bColumn);\r
64     FWL_ERR                             SetWidgetSpan(IFWL_Widget *pWidget, FX_INT32 iSpan, FX_BOOL bColumn);\r
65     FX_FLOAT                    GetWidgetSize(IFWL_Widget *pWidget, FWL_GRIDSIZE eSize, FWL_GRIDUNIT &eUnit);\r
66     FWL_ERR                             SetWidgetSize(IFWL_Widget *pWidget, FWL_GRIDSIZE eSize, FX_FLOAT fSize, FWL_GRIDUNIT eUit);\r
67     FX_BOOL                             GetWidgetMargin(IFWL_Widget *pWidget, FWL_GRIDMARGIN eMargin, FX_FLOAT &fMargin);\r
68     FWL_ERR                             SetWidgetMargin(IFWL_Widget *pWidget, FWL_GRIDMARGIN eMargin, FX_FLOAT fMargin);\r
69     FWL_ERR                             RemoveWidgetMargin(IFWL_Widget *pWidget, FWL_GRIDMARGIN eMargin);\r
70     FX_FLOAT                    GetGridSize(FWL_GRIDSIZE eSize, FWL_GRIDUNIT &eUnit);\r
71     FWL_ERR                             SetGridSize(FWL_GRIDSIZE eSize, FX_FLOAT fSize, FWL_GRIDUNIT eUit);\r
72 protected:\r
73     IFWL_Grid();\r
74     virtual ~IFWL_Grid();\r
75 };\r
76 #endif\r