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