1 /*$ 2 Copyright (C) 2013-2020 Azel. 3 4 This file is part of AzPainter. 5 6 AzPainter is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 AzPainter is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program. If not, see <http://www.gnu.org/licenses/>. 18 $*/ 19 20 #ifndef MLIB_EXPANDER_H 21 #define MLIB_EXPANDER_H 22 23 #include "mContainerDef.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 #define M_EXPANDER(p) ((mExpander *)(p)) 30 31 typedef struct 32 { 33 uint32_t style; 34 char *text; 35 mRect padding; 36 int headerH; 37 mBool expand; 38 }mExpanderData; 39 40 typedef struct _mExpander 41 { 42 mWidget wg; 43 mContainerData ct; 44 mExpanderData exp; 45 }mExpander; 46 47 48 enum MEXPANDER_STYLE 49 { 50 MEXPANDER_S_BORDER_TOP = 1<<0, 51 MEXPANDER_S_HEADER_DARK = 1<<1 52 }; 53 54 enum MEXPANDER_NOTIFY 55 { 56 MEXPANDER_N_TOGGLE 57 }; 58 59 60 void mExpanderDestroyHandle(mWidget *p); 61 void mExpanderCalcHintHandle(mWidget *p); 62 int mExpanderEventHandle(mWidget *wg,mEvent *ev); 63 void mExpanderDrawHandle(mWidget *wg,mPixbuf *pixbuf); 64 65 mExpander *mExpanderNew(int size,mWidget *parent,uint32_t style); 66 mExpander *mExpanderCreate(mWidget *parent,int id,uint32_t style, 67 uint32_t fLayout,uint32_t marginB4,const char *text); 68 69 void mExpanderSetText(mExpander *p,const char *text); 70 void mExpanderSetPadding_b4(mExpander *p,uint32_t val); 71 void mExpanderSetExpand(mExpander *p,int type); 72 73 #ifdef __cplusplus 74 } 75 #endif 76 77 #endif 78