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_DOCKWIDGET_H 21 #define MLIB_DOCKWIDGET_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 typedef struct _mDockWidget mDockWidget; 28 29 typedef mWidget *(*mDockWidgetCallbackCreate)(mDockWidget *,int id,mWidget *parent); 30 typedef int (*mDockWidgetCallbackArrange)(mDockWidget *,int id1,int id2); 31 32 33 typedef struct _mDockWidgetState 34 { 35 uint32_t flags; 36 int dockH; 37 mBox boxWin; 38 }mDockWidgetState; 39 40 41 enum MDOCKWIDGET_STYLE 42 { 43 MDOCKWIDGET_S_HAVE_CLOSE = 1<<0, 44 MDOCKWIDGET_S_HAVE_SWITCH = 1<<1, 45 MDOCKWIDGET_S_HAVE_FOLD = 1<<2, 46 MDOCKWIDGET_S_EXPAND = 1<<3, 47 MDOCKWIDGET_S_NO_FOCUS = 1<<4, 48 49 MDOCKWIDGET_S_ALLBUTTON = MDOCKWIDGET_S_HAVE_CLOSE | MDOCKWIDGET_S_HAVE_SWITCH | MDOCKWIDGET_S_HAVE_FOLD 50 }; 51 52 enum MDOCKWIDGET_FLAGS 53 { 54 MDOCKWIDGET_F_EXIST = 1<<0, 55 MDOCKWIDGET_F_VISIBLE = 1<<1, 56 MDOCKWIDGET_F_WINDOW = 1<<2, 57 MDOCKWIDGET_F_FOLDED = 1<<3 58 }; 59 60 enum MDOCKWIDGET_NOTIFY 61 { 62 MDOCKWIDGET_NOTIFY_CLOSE = 1, 63 MDOCKWIDGET_NOTIFY_TOGGLE_SWITCH, 64 MDOCKWIDGET_NOTIFY_TOGGLE_FOLD 65 }; 66 67 68 /*------*/ 69 70 void mDockWidgetDestroy(mDockWidget *p); 71 mDockWidget *mDockWidgetNew(int id,uint32_t style); 72 73 void mDockWidgetSetCallback_create(mDockWidget *p,mDockWidgetCallbackCreate func); 74 void mDockWidgetSetCallback_arrange(mDockWidget *p,mDockWidgetCallbackArrange func); 75 76 void mDockWidgetSetWindowInfo(mDockWidget *p,mWindow *owner,uint32_t winstyle); 77 void mDockWidgetSetDockParent(mDockWidget *p,mWidget *parent); 78 void mDockWidgetSetState(mDockWidget *p,mDockWidgetState *info); 79 void mDockWidgetSetTitle(mDockWidget *p,const char *title); 80 void mDockWidgetSetParam(mDockWidget *p,intptr_t param); 81 void mDockWidgetSetFont(mDockWidget *p,mFont *font); 82 void mDockWidgetSetNotifyWidget(mDockWidget *p,mWidget *wg,int id); 83 84 void mDockWidgetGetState(mDockWidget *p,mDockWidgetState *state); 85 mBool mDockWidgetIsCreated(mDockWidget *p); 86 mBool mDockWidgetIsVisibleContents(mDockWidget *p); 87 mBool mDockWidgetCanTakeFocus(mDockWidget *p); 88 mBool mDockWidgetIsWindowMode(mDockWidget *p); 89 mWindow *mDockWidgetGetWindow(mDockWidget *p); 90 intptr_t mDockWidgetGetParam(mDockWidget *p); 91 92 void mDockWidgetCreateWidget(mDockWidget *p); 93 void mDockWidgetShowWindow(mDockWidget *p); 94 void mDockWidgetShow(mDockWidget *p,int type); 95 void mDockWidgetSetVisible(mDockWidget *p,int type); 96 void mDockWidgetSetWindowMode(mDockWidget *p,int type); 97 void mDockWidgetRelocate(mDockWidget *p,mBool relayout); 98 99 #ifdef __cplusplus 100 } 101 #endif 102 103 #endif 104