1 /*$ 2 Copyright (C) 2016-2020 Azel. 3 4 This file is part of AzPainterB. 5 6 AzPainterB 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 AzPainterB 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_WIDGETDEF_H 21 #define MLIB_WIDGETDEF_H 22 23 struct _mWidget 24 { 25 mWindow *toplevel; 26 mWidget *parent, 27 *prev,*next, 28 *first,*last, 29 *notifyWidget; 30 mFont *font; 31 mCursor cursorCur; 32 33 int x,y,w,h, 34 id, 35 absX,absY, 36 hintW,hintH, 37 imX,imY; 38 uint16_t initW,initH, 39 hintOverW,hintOverH, 40 hintMinW,hintMinH; 41 uint32_t fState, 42 fOption, 43 fLayout, 44 fUI, 45 fEventFilter; 46 uint8_t fType, 47 fAcceptKeys, 48 notifyTarget, 49 notifyTargetInterrupt; 50 intptr_t param; 51 52 mWidgetSpacing margin; 53 54 void (*destroy)(mWidget *); 55 int (*event)(mWidget *,mEvent *); 56 void (*draw)(mWidget *,mPixbuf *); 57 void (*drawBkgnd)(mWidget *,mPixbuf *,mBox *); 58 void (*calcHint)(mWidget *); 59 void (*layout)(mWidget *); 60 void (*onSize)(mWidget *); 61 int (*onDND)(mWidget *,char **files); 62 }; 63 64 65 enum MWIDGET_TYPE_FLAGS 66 { 67 MWIDGET_TYPE_CONTAINER = 1<<0, 68 MWIDGET_TYPE_WINDOW = 1<<1, 69 MWIDGET_TYPE_CHECKBUTTON = 1<<2 70 }; 71 72 enum MWIDGET_STATE_FLAGS 73 { 74 MWIDGET_STATE_VISIBLE = 1<<0, 75 MWIDGET_STATE_ENABLED = 1<<1, 76 MWIDGET_STATE_FOCUSED = 1<<2, 77 MWIDGET_STATE_TAKE_FOCUS = 1<<3, 78 MWIDGET_STATE_DEFAULT_FOCUS = 1<<4, 79 MWIDGET_STATE_ENTER_DEFAULT = 1<<5, 80 MWIDGET_STATE_ENABLE_DROP = 1<<6 81 }; 82 83 enum MWIDGET_OPTION_FLAGS 84 { 85 MWIDGET_OPTION_NO_DRAW_BKGND = 1<<0, 86 MWIDGET_OPTION_DESTROY_CURSOR = 1<<1, 87 MWIDGET_OPTION_ONFOCUS_ALLKEY_TO_WINDOW = 1<<2, 88 MWIDGET_OPTION_ONFOCUS_NORMKEY_TO_WINDOW = 1<<3, 89 MWIDGET_OPTION_DISABLE_SCROLL_EVENT = 1<<4 90 }; 91 92 enum MWIDGET_UI_FLAGS 93 { 94 MWIDGET_UI_UPDATE = 1<<0, 95 MWIDGET_UI_FOLLOW_DRAW = 1<<1, 96 MWIDGET_UI_DRAW = 1<<2, 97 MWIDGET_UI_FOLLOW_CALC = 1<<3, 98 MWIDGET_UI_CALC = 1<<4, 99 MWIDGET_UI_LAYOUTED = 1<<5, 100 MWIDGET_UI_DRAWED_BKGND = 1<<6 101 }; 102 103 enum MWIDGET_EVENTFILTER_FLAGS 104 { 105 MWIDGET_EVENTFILTER_POINTER = 1<<0, 106 MWIDGET_EVENTFILTER_SCROLL = 1<<1, 107 MWIDGET_EVENTFILTER_KEY = 1<<2, 108 MWIDGET_EVENTFILTER_CHAR = 1<<3, 109 MWIDGET_EVENTFILTER_STRING = 1<<4, 110 MWIDGET_EVENTFILTER_PENTABLET = 1<<5 111 }; 112 113 enum MWIDGET_ACCEPTKEY_FLAGS 114 { 115 MWIDGET_ACCEPTKEY_TAB = 1<<0, 116 MWIDGET_ACCEPTKEY_ENTER = 1<<1, 117 MWIDGET_ACCEPTKEY_ESCAPE = 1<<2, 118 119 MWIDGET_ACCEPTKEY_ALL = 0xff 120 }; 121 122 enum MWIDGET_NOTIFY_TARGET 123 { 124 MWIDGET_NOTIFYTARGET_PARENT_NOTIFY, 125 MWIDGET_NOTIFYTARGET_SELF, 126 MWIDGET_NOTIFYTARGET_PARENT, 127 MWIDGET_NOTIFYTARGET_PARENT2, 128 MWIDGET_NOTIFYTARGET_TOPLEVEL, 129 MWIDGET_NOTIFYTARGET_WIDGET 130 }; 131 132 enum MWIDGET_NOTIFY_TARGET_INTERRUPT 133 { 134 MWIDGET_NOTIFYTARGET_INT_NONE, 135 MWIDGET_NOTIFYTARGET_INT_SELF 136 }; 137 138 enum MWIDGET_LAYOUT_FLAGS 139 { 140 MLF_FIX_HINT_W = 0, 141 MLF_FIX_HINT_H = 0, 142 MLF_FIX_W = 1<<0, 143 MLF_FIX_H = 1<<1, 144 MLF_EXPAND_X = 1<<2, 145 MLF_EXPAND_Y = 1<<3, 146 MLF_EXPAND_W = 1<<4, 147 MLF_EXPAND_H = 1<<5, 148 149 MLF_LEFT = 0, 150 MLF_TOP = 0, 151 MLF_RIGHT = 1<<6, 152 MLF_BOTTOM = 1<<7, 153 MLF_CENTER = 1<<8, 154 MLF_MIDDLE = 1<<9, 155 156 MLF_GRID_COL_W = 1<<10, 157 MLF_GRID_ROW_H = 1<<11, 158 159 MLF_CENTER_XY = MLF_CENTER | MLF_MIDDLE, 160 MLF_EXPAND_XY = MLF_EXPAND_X | MLF_EXPAND_Y, 161 MLF_EXPAND_WH = MLF_EXPAND_W | MLF_EXPAND_H, 162 MLF_FIX_WH = MLF_FIX_W | MLF_FIX_H 163 }; 164 165 #endif 166