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_SPLITTER_H 21 #define MLIB_SPLITTER_H 22 23 #include "mWidgetDef.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 #define M_SPLITTER(p) ((mSplitter *)(p)) 30 31 typedef struct _mSplitter mSplitter; 32 33 typedef struct 34 { 35 mWidget *wgprev,*wgnext; 36 int prev_min,prev_max,prev_cur, 37 next_min,next_max,next_cur; 38 intptr_t param; 39 }mSplitterTargetInfo; 40 41 typedef int (*mSplitterCallbackGetTarget)(mSplitter *,mSplitterTargetInfo *); 42 43 44 typedef struct 45 { 46 uint32_t style; 47 int presspos,dragdiff; 48 uint8_t fdrag; 49 mSplitterTargetInfo info; 50 mSplitterCallbackGetTarget func_target; 51 }mSplitterData; 52 53 struct _mSplitter 54 { 55 mWidget wg; 56 mSplitterData spl; 57 }; 58 59 60 enum MSPLITTER_STYLE 61 { 62 MSPLITTER_S_HORZ = 0, 63 MSPLITTER_S_VERT = 1<<0, 64 MSPLITTER_S_NOTIFY_MOVED = 1<<1 65 }; 66 67 enum MSPLITTER_NOTIFY 68 { 69 MSPLITTER_N_MOVED 70 }; 71 72 73 void mSplitterDrawHandle(mWidget *p,mPixbuf *pixbuf); 74 int mSplitterEventHandle(mWidget *wg,mEvent *ev); 75 76 mSplitter *mSplitterNew(int size,mWidget *parent,uint32_t style); 77 void mSplitterSetCallback_getTarget(mSplitter *p,mSplitterCallbackGetTarget func,intptr_t param); 78 79 #ifdef __cplusplus 80 } 81 #endif 82 83 #endif 84