RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LISTVIEW_Private.h Source File

LISTVIEW_Private.h

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH & Co. KG                *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2016  SEGGER Microcontroller GmbH & Co. KG       *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.38 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software has been licensed to  NXP Semiconductors USA, Inc.  whose
00019 registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose,
00020 CA 95134, USA  solely for  the  purposes  of  creating  libraries  for
00021 NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and
00022 distributed under the terms and conditions of the NXP End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 
00030 Licensor:                 SEGGER Microcontroller Systems LLC
00031 Licensed to:              NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA
00032 Licensed SEGGER software: emWin
00033 License number:           GUI-00186
00034 License model:            emWin License Agreement, dated August 20th 2011
00035 Licensed product:         -
00036 Licensed platform:        NXP's ARM 7/9, Cortex-M0,M3,M4
00037 Licensed number of seats: -
00038 ----------------------------------------------------------------------
00039 File        : LISTVIEW_Private.h
00040 Purpose     : Private LISTVIEW include
00041 --------------------END-OF-HEADER-------------------------------------
00042 */
00043 
00044 #ifndef LISTVIEW_PRIVATE_H
00045 #define LISTVIEW_PRIVATE_H
00046 
00047 #include "WM.h"
00048 
00049 #if GUI_WINSUPPORT
00050 
00051 #include <stddef.h>
00052 
00053 #include "LISTVIEW.h"
00054 #include "GUI_ARRAY.h"
00055 
00056 /*********************************************************************
00057 *
00058 *       Defines
00059 *
00060 **********************************************************************
00061 */
00062 #define SORT_TYPE                 U16
00063 
00064 #define LISTVIEW_CELL_INFO_COLORS (1 << 0)
00065 #define LISTVIEW_CELL_INFO_BITMAP (1 << 1)
00066 
00067 /*********************************************************************
00068 *
00069 *       Object definition
00070 *
00071 **********************************************************************
00072 */
00073 
00074 typedef struct {
00075   GUI_COLOR                    aBkColor[4];
00076   GUI_COLOR                    aTextColor[4];
00077   GUI_COLOR                    GridColor;
00078   const GUI_FONT             * pFont;
00079   U16                          ScrollStepH;
00080   GUI_WRAPMODE                 WrapMode;
00081   int                          DefaultAlign;
00082 } LISTVIEW_PROPS;
00083 
00084 typedef struct {
00085   void                      (* pfDraw)(LISTVIEW_Handle hObj, unsigned Column, unsigned Row, GUI_RECT * pRect);
00086   void                       * pData;
00087   GUI_COLOR                    aBkColor[4];
00088   GUI_COLOR                    aTextColor[4];
00089   I16                          xOff, yOff;
00090   U8                           Flags;
00091 } LISTVIEW_CELL_INFO;
00092 
00093 typedef struct {
00094   WM_HMEM                      hCellInfo;                                         // Optional cell info. If 0, there is no cell info. (Defaults used)
00095   char                         acText[1];
00096 } LISTVIEW_CELL;
00097 
00098 typedef struct {
00099   GUI_ARRAY                    hCellArray;
00100   char                         Disabled;
00101   U32                          UserData;
00102 } LISTVIEW_ROW;
00103 
00104 typedef struct {
00105   U8                           Align;
00106   int                       (* fpCompare)    (const void * p0, const void * p1);  // User function to be called to compare the contents of 2 cells
00107 } LISTVIEW_COLUMN;
00108 
00109 typedef struct LISTVIEW_Obj LISTVIEW_Obj;
00110 
00111 typedef struct {
00112   WM_HMEM                      hSortArray;
00113   SORT_TYPE                    SortArrayNumItems;
00114   int                       (* fpSort)(LISTVIEW_Handle hObj);                     // Function to be called to get a sorted array
00115   void                      (* fpFree)(WM_HMEM hObj);                             // Function to be called to free the sort object
00116   U8                           Reverse;
00117 } LISTVIEW_SORT;
00118 
00119 struct LISTVIEW_Obj {
00120   WIDGET                       Widget;
00121   HEADER_Handle                hHeader;
00122   WIDGET_DRAW_ITEM_FUNC *      pfDrawItem;
00123   GUI_ARRAY                    hRowArray;                                         // Each entry is a handle of LISTVIEW_ROW structure.
00124   GUI_ARRAY                    hColumnArray;                                      // Each entry is a handle of LISTVIEW_COLUMN structure.
00125   LISTVIEW_PROPS               Props;
00126   int                          Sel;
00127   int                          SelCol;
00128   int                          ShowGrid;
00129   int                          SortIndex;                                         // Column for sorting
00130   unsigned                     RowDistY;
00131   unsigned                     LBorder;
00132   unsigned                     RBorder;
00133   unsigned                     Fixed;
00134   WM_SCROLL_STATE              ScrollStateV;
00135   WM_SCROLL_STATE              ScrollStateH;
00136   WM_HMEM                      hSort;
00137   U8                           IsSorted;
00138   U8                           IsPresorted;
00139   U8                           ReverseSort;                                       // Set to 1 if reverse sorting is required
00140   U8                           Flags;
00141 };
00142 
00143 /*********************************************************************
00144 *
00145 *       Macros for internal use
00146 *
00147 **********************************************************************
00148 */
00149 #if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL
00150   #define LISTVIEW_INIT_ID(p) (p->Widget.DebugId = LISTVIEW_ID)
00151 #else
00152   #define LISTVIEW_INIT_ID(p)
00153 #endif
00154 
00155 #if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL
00156   LISTVIEW_Obj * LISTVIEW_LockH(LISTVIEW_Handle h);
00157   #define LISTVIEW_LOCK_H(h)   LISTVIEW_LockH(h)
00158 #else
00159   #define LISTVIEW_LOCK_H(h)   (LISTVIEW_Obj *)GUI_LOCK_H(h)
00160 #endif
00161 
00162 /*********************************************************************
00163 *
00164 *       Private (module internal) data
00165 *
00166 **********************************************************************
00167 */
00168 extern LISTVIEW_PROPS LISTVIEW_DefaultProps;
00169 
00170 /*********************************************************************
00171 *
00172 *       Private (module internal) functions
00173 *
00174 **********************************************************************
00175 */
00176 LISTVIEW_CELL_INFO * LISTVIEW__CreateCellInfoLocked (LISTVIEW_Handle   hObj, unsigned Column, unsigned Row);
00177 unsigned             LISTVIEW__GetNumColumns        (LISTVIEW_Obj    * pObj);
00178 unsigned             LISTVIEW__GetNumRows           (LISTVIEW_Obj    * pObj);
00179 LISTVIEW_CELL_INFO * LISTVIEW__GetpCellInfo         (LISTVIEW_Handle   hObj, unsigned Column, unsigned Row);
00180 LISTVIEW_ROW       * LISTVIEW__GetpRow              (LISTVIEW_Handle   hObj, int Row);
00181 unsigned             LISTVIEW__GetRowDistY          (LISTVIEW_Obj    * pObj);
00182 unsigned             LISTVIEW__GetRowSorted         (LISTVIEW_Handle   hObj, int Row);
00183 void                 LISTVIEW__InvalidateInsideArea (LISTVIEW_Handle   hObj);
00184 void                 LISTVIEW__InvalidateRow        (LISTVIEW_Handle   hObj, int Sel);
00185 void                 LISTVIEW__InvalidateRowAndBelow(LISTVIEW_Handle   hObj, int Sel);
00186 void                 LISTVIEW__SetSel               (LISTVIEW_Handle   hObj, int NewSel);
00187 void                 LISTVIEW__SetSelCol            (LISTVIEW_Handle   hObj, int NewSelCol);
00188 int                  LISTVIEW__UpdateScrollParas    (LISTVIEW_Handle   hObj);
00189 
00190 #endif // GUI_WINSUPPORT
00191 #endif // LISTVIEW_PRIVATE_H
00192 
00193 /*************************** End of file ****************************/