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_DEF_GUI_H
21 #define MLIB_DEF_GUI_H
22 
23 typedef uint32_t  mRgbCol;
24 typedef uint32_t  mPixCol;
25 typedef uintptr_t mCursor;
26 typedef struct _mWidget    mWidget;
27 typedef struct _mContainer mContainer;
28 typedef struct _mWindow    mWindow;
29 typedef struct _mMenu      mMenu;
30 typedef struct _mEvent     mEvent;
31 typedef struct _mPixbuf    mPixbuf;
32 typedef struct _mImageBuf  mImageBuf;
33 typedef struct _mImageList mImageList;
34 
35 #define M_WID_OK		1
36 #define M_WID_CANCEL	2
37 
38 #define M_WIDGET(p)    ((mWidget *)(p))
39 #define M_CONTAINER(p) ((mContainer *)(p))
40 #define M_WINDOW(p)    ((mWindow *)(p))
41 
42 #define MACCKEY_SHIFT   0x8000
43 #define MACCKEY_CTRL    0x4000
44 #define MACCKEY_ALT     0x2000
45 #define MACCKEY_KEYMASK 0x0fff
46 #define MACCKEY_MODMASK 0xe000
47 
48 enum M_MODSTATE
49 {
50 	M_MODS_SHIFT = 1<<0,
51 	M_MODS_CTRL  = 1<<1,
52 	M_MODS_ALT   = 1<<2,
53 
54 	M_MODS_MASK_KEY = M_MODS_SHIFT|M_MODS_CTRL|M_MODS_ALT
55 };
56 
57 enum M_BUTTON
58 {
59 	M_BTT_NONE,
60 	M_BTT_LEFT,
61 	M_BTT_MIDDLE,
62 	M_BTT_RIGHT,
63 	M_BTT_SCR_UP,
64 	M_BTT_SCR_DOWN,
65 	M_BTT_SCR_LEFT,
66 	M_BTT_SCR_RIGHT
67 };
68 
69 
70 typedef struct
71 {
72 	uint16_t left,top,right,bottom;
73 }mWidgetSpacing;
74 
75 
76 /* function */
77 
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81 
82 mPixCol mRGBtoPix(mRgbCol col);
83 mPixCol mRGBtoPix2(uint8_t r,uint8_t g,uint8_t b);
84 mPixCol mGraytoPix(uint8_t c);
85 mRgbCol mPixtoRGB(mPixCol col);
86 mRgbCol mBlendRGB_256(mRgbCol colsrc,mRgbCol coldst,int a);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif
93