RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TREEVIEW.h Source File

TREEVIEW.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        : TREEVIEW.h
00040 Purpose     : TREEVIEW include
00041 --------------------END-OF-HEADER-------------------------------------
00042 */
00043 
00044 #ifndef TREEVIEW_H
00045 #define TREEVIEW_H
00046 
00047 #include "WM.h"
00048 #include "DIALOG_Intern.h"      /* Req. for Create indirect data structure */
00049 #include "WIDGET.h"
00050 
00051 #if GUI_WINSUPPORT
00052 
00053 #if defined(__cplusplus)
00054   extern "C" {     /* Make sure we have C-declarations in C++ programs */
00055 #endif
00056 
00057 /*********************************************************************
00058 *
00059 *       Defines
00060 *
00061 **********************************************************************
00062 */
00063 /* Status- and create flags */
00064 #define TREEVIEW_CF_HIDELINES       (1 << 0)
00065 #define TREEVIEW_CF_ROWSELECT       (1 << 1)
00066 #define TREEVIEW_CF_AUTOSCROLLBAR_H (1 << 2)
00067 #define TREEVIEW_CF_AUTOSCROLLBAR_V (1 << 3)
00068 #define TREEVIEW_SF_HIDELINES       TREEVIEW_CF_HIDELINES
00069 #define TREEVIEW_SF_ROWSELECT       TREEVIEW_CF_ROWSELECT
00070 #define TREEVIEW_SF_AUTOSCROLLBAR_H TREEVIEW_CF_AUTOSCROLLBAR_H
00071 #define TREEVIEW_SF_AUTOSCROLLBAR_V TREEVIEW_CF_AUTOSCROLLBAR_V
00072 
00073 /* Bitmap indices */
00074 #define TREEVIEW_BI_CLOSED 0
00075 #define TREEVIEW_BI_OPEN   1
00076 #define TREEVIEW_BI_LEAF   2
00077 #define TREEVIEW_BI_PLUS   3
00078 #define TREEVIEW_BI_MINUS  4
00079 #define TREEVIEW_BI_PM     5
00080 
00081 /* Color indices */
00082 #define TREEVIEW_CI_UNSEL    0
00083 #define TREEVIEW_CI_SEL      1
00084 #define TREEVIEW_CI_DISABLED 2
00085 
00086 /* Relative positions (create) */
00087 #define TREEVIEW_INSERT_ABOVE       0
00088 #define TREEVIEW_INSERT_BELOW       1
00089 #define TREEVIEW_INSERT_FIRST_CHILD 2
00090 
00091 /* Relative positions (retrieve) */
00092 #define TREEVIEW_GET_FIRST        0
00093 #define TREEVIEW_GET_LAST         1
00094 #define TREEVIEW_GET_NEXT_SIBLING 2
00095 #define TREEVIEW_GET_PREV_SIBLING 3
00096 #define TREEVIEW_GET_FIRST_CHILD  4
00097 #define TREEVIEW_GET_PARENT       5
00098 
00099 /* Item flags */
00100 #define TREEVIEW_ITEM_TYPE_LEAF (0 << 0)
00101 #define TREEVIEW_ITEM_TYPE_NODE (1 << 0)
00102 
00103 /* Selection mode */
00104 #define TREEVIEW_SELMODE_ROW  1
00105 #define TREEVIEW_SELMODE_TEXT 0
00106 
00107 /************************************************************
00108 *
00109 *       Types
00110 *
00111 *************************************************************
00112 */
00113 typedef WM_HMEM TREEVIEW_Handle;
00114 typedef WM_HMEM TREEVIEW_ITEM_Handle;
00115 
00116 typedef struct {
00117   int IsNode;
00118   int IsExpanded;
00119   int HasLines;
00120   int HasRowSelect;
00121   int Level;
00122 } TREEVIEW_ITEM_INFO;
00123 
00124 typedef struct {
00125   GUI_COLOR ColorBk;
00126   GUI_COLOR ColorText;
00127   GUI_COLOR ColorTextBk;
00128   GUI_COLOR ColorLines;
00129   GUI_RECT rText;
00130   TREEVIEW_ITEM_Handle hItem;
00131   const GUI_FONT * pFont;
00132   char * pText;
00133   U8 NumLines;
00134   I16 ax0[3];
00135   I16 ay0[3];
00136   I16 ax1[3];
00137   I16 ay1[3];
00138   U8 NumConnectors;
00139   I16 axc[16];
00140   const GUI_BITMAP * pBmPM;
00141   const GUI_BITMAP * pBmOCL;
00142   I16 xPosPM, xPosOCL;
00143   U8 IndexPM;
00144   U8 IndexOCL;
00145 } TREEVIEW_ITEM_DRAW_INFO;
00146 
00147 /*********************************************************************
00148 *
00149 *       Create functions
00150 *
00151 **********************************************************************
00152 */
00153 TREEVIEW_Handle      TREEVIEW_CreateEx      (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id);
00154 TREEVIEW_Handle      TREEVIEW_CreateUser    (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int NumExtraBytes);
00155 TREEVIEW_Handle      TREEVIEW_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb);
00156 
00157 /*********************************************************************
00158 *
00159 *       The callback ...
00160 *
00161 * Do not call it directly ! It is only to be used from within an
00162 * overwritten callback.
00163 */
00164 void TREEVIEW_Callback(WM_MESSAGE * pMsg);
00165 
00166 /*********************************************************************
00167 *
00168 *       Common functions
00169 *
00170 **********************************************************************
00171 */
00172 int                  TREEVIEW_AttachItem     (TREEVIEW_Handle hObj, TREEVIEW_ITEM_Handle hItem, TREEVIEW_ITEM_Handle hItemAt, int Position);
00173 void                 TREEVIEW_DecSel         (TREEVIEW_Handle hObj);
00174 TREEVIEW_ITEM_Handle TREEVIEW_GetItem        (TREEVIEW_Handle hObj, TREEVIEW_ITEM_Handle hItem, int Flags);
00175 TREEVIEW_ITEM_Handle TREEVIEW_GetSel         (TREEVIEW_Handle hObj);
00176 int                  TREEVIEW_GetUserData    (TREEVIEW_Handle hObj, void * pDest, int NumBytes);
00177 void                 TREEVIEW_IncSel         (TREEVIEW_Handle hObj);
00178 TREEVIEW_ITEM_Handle TREEVIEW_InsertItem     (TREEVIEW_Handle hObj, int IsNode, TREEVIEW_ITEM_Handle hItemPrev, int Position, const char * s);
00179 int                  TREEVIEW_OwnerDraw      (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
00180 void                 TREEVIEW_ScrollToSel    (TREEVIEW_Handle hObj);
00181 void                 TREEVIEW_SetAutoScrollH (TREEVIEW_Handle hObj, int State);
00182 void                 TREEVIEW_SetAutoScrollV (TREEVIEW_Handle hObj, int State);
00183 void                 TREEVIEW_SetBitmapOffset(TREEVIEW_Handle hObj, int Index, int xOff, int yOff);
00184 void                 TREEVIEW_SetBkColor     (TREEVIEW_Handle hObj, int Index, GUI_COLOR Color);
00185 void                 TREEVIEW_SetFont        (TREEVIEW_Handle hObj, const GUI_FONT * pFont);
00186 void                 TREEVIEW_SetHasLines    (TREEVIEW_Handle hObj, int State);
00187 void                 TREEVIEW_SetImage       (TREEVIEW_Handle hObj, int Index, const GUI_BITMAP * pBitmap);
00188 int                  TREEVIEW_SetIndent      (TREEVIEW_Handle hObj, int Indent);
00189 void                 TREEVIEW_SetLineColor   (TREEVIEW_Handle hObj, int Index, GUI_COLOR Color);
00190 void                 TREEVIEW_SetOwnerDraw   (TREEVIEW_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawItem);
00191 void                 TREEVIEW_SetSel         (TREEVIEW_Handle hObj, TREEVIEW_ITEM_Handle hItem);
00192 void                 TREEVIEW_SetSelMode     (TREEVIEW_Handle hObj, int Mode);
00193 void                 TREEVIEW_SetTextColor   (TREEVIEW_Handle hObj, int Index, GUI_COLOR Color);
00194 int                  TREEVIEW_SetTextIndent  (TREEVIEW_Handle hObj, int TextIndent);
00195 int                  TREEVIEW_SetUserData    (TREEVIEW_Handle hObj, const void * pSrc, int NumBytes);
00196 
00197 
00198 /*********************************************************************
00199 *
00200 *       Treeview item related functions
00201 *
00202 **********************************************************************
00203 */
00204 void                 TREEVIEW_ITEM_Collapse   (TREEVIEW_ITEM_Handle hItem);
00205 void                 TREEVIEW_ITEM_CollapseAll(TREEVIEW_ITEM_Handle hItem);
00206 TREEVIEW_ITEM_Handle TREEVIEW_ITEM_Create     (int IsNode, const char * s, U32 UserData);
00207 void                 TREEVIEW_ITEM_Delete     (TREEVIEW_ITEM_Handle hItem);
00208 void                 TREEVIEW_ITEM_Detach     (TREEVIEW_ITEM_Handle hItem);
00209 void                 TREEVIEW_ITEM_Expand     (TREEVIEW_ITEM_Handle hItem);
00210 void                 TREEVIEW_ITEM_ExpandAll  (TREEVIEW_ITEM_Handle hItem);
00211 void                 TREEVIEW_ITEM_GetInfo    (TREEVIEW_ITEM_Handle hItem, TREEVIEW_ITEM_INFO * pInfo);
00212 void                 TREEVIEW_ITEM_GetText    (TREEVIEW_ITEM_Handle hItem, U8 * pBuffer, int MaxNumBytes);
00213 U32                  TREEVIEW_ITEM_GetUserData(TREEVIEW_ITEM_Handle hItem);
00214 void                 TREEVIEW_ITEM_SetImage   (TREEVIEW_ITEM_Handle hItem, int Index, const GUI_BITMAP * pBitmap);
00215 TREEVIEW_ITEM_Handle TREEVIEW_ITEM_SetText    (TREEVIEW_ITEM_Handle hItem, const char * s);
00216 void                 TREEVIEW_ITEM_SetUserData(TREEVIEW_ITEM_Handle hItem, U32 UserData);
00217 
00218 /*********************************************************************
00219 *
00220 *       Managing default values
00221 *
00222 **********************************************************************
00223 */
00224 GUI_COLOR        TREEVIEW_GetDefaultBkColor  (int Index);
00225 const GUI_FONT * TREEVIEW_GetDefaultFont     (void);
00226 GUI_COLOR        TREEVIEW_GetDefaultLineColor(int Index);
00227 GUI_COLOR        TREEVIEW_GetDefaultTextColor(int Index);
00228 void             TREEVIEW_SetDefaultBkColor  (int Index, GUI_COLOR Color);
00229 void             TREEVIEW_SetDefaultFont     (const GUI_FONT * pFont);
00230 void             TREEVIEW_SetDefaultLineColor(int Index, GUI_COLOR Color);
00231 void             TREEVIEW_SetDefaultTextColor(int Index, GUI_COLOR Color);
00232 
00233 #if defined(__cplusplus)
00234   }
00235 #endif
00236 
00237 #endif  // GUI_WINSUPPORT
00238 #endif  // TREEVIEW_H
00239 
00240 /*************************** End of file ****************************/