📄 framewin_setresizeable.c
字号:
/*
*********************************************************************************************************
* uC/GUI
* Universal graphic software for embedded applications
*
* (c) Copyright 2002, Micrium Inc., Weston, FL
* (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
* 礐/GUI is protected by international copyright laws. Knowledge of the
* source code may not be used to write a similar product. This file may
* only be used in accordance with a license and should not be redistributed
* in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File : FRAMEWIN_SetResizeable.c
Purpose :
---------------------------END-OF-HEADER------------------------------
*/
#include <stdlib.h>
#include "FRAMEWIN_Private.h"
#if GUI_WINSUPPORT
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#ifndef FRAMEWIN_REACT_BORDER
#define FRAMEWIN_REACT_BORDER 3
#endif
#ifndef FRAMEWIN_MINSIZE_X
#define FRAMEWIN_MINSIZE_X 20
#endif
#ifndef FRAMEWIN_MINSIZE_Y
#define FRAMEWIN_MINSIZE_Y 20
#endif
#define FRAMEWIN_RESIZE_X (1<<0)
#define FRAMEWIN_RESIZE_Y (1<<1)
#define FRAMEWIN_REPOS_X (1<<2)
#define FRAMEWIN_REPOS_Y (1<<3)
#define FRAMEWIN_MOUSEOVER (1<<4)
#define FRAMEWIN_RESIZE (FRAMEWIN_RESIZE_X | FRAMEWIN_RESIZE_Y | FRAMEWIN_REPOS_X | FRAMEWIN_REPOS_Y)
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
static GUI_HOOK _HOOK_Resizeable;
static int _CaptureX;
static int _CaptureY;
static int _CaptureFlags;
#if GUI_SUPPORT_CURSOR
static const GUI_CURSOR GUI_UNI_PTR * _pOldCursor;
#endif
/*********************************************************************
*
* Static data, cursors
*
**********************************************************************
*/
#if GUI_SUPPORT_CURSOR
/*********************************************************************
*
* Cursor colors
*/
static GUI_CONST_STORAGE GUI_COLOR _ColorsCursor[] = {
0x0000FF,0x000000,0xFFFFFF
};
static GUI_CONST_STORAGE GUI_LOGPALETTE _PalCursor = {
3, /* number of entries */
1, /* Has transparency */
&_ColorsCursor[0]
};
/*********************************************************************
*
* Cursor data, CursorH
*/
static GUI_CONST_STORAGE unsigned char _acResizeCursorH[] = {
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x40, 0x00, 0x40, 0x00,
0x01, 0x40, 0x00, 0x50, 0x00,
0x06, 0x40, 0x00, 0x64, 0x00,
0x1A, 0x55, 0x55, 0x69, 0x00,
0x6A, 0xAA, 0xAA, 0xAA, 0x40,
0x1A, 0x55, 0x55, 0x69, 0x00,
0x06, 0x40, 0x00, 0x64, 0x00,
0x01, 0x40, 0x00, 0x50, 0x00,
0x00, 0x40, 0x00, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
};
static GUI_CONST_STORAGE GUI_BITMAP _bmResizeCursorH = {
17, /* XSize */
17, /* YSize */
5, /* BytesPerLine */
2, /* BitsPerPixel */
_acResizeCursorH, /* Pointer to picture data (indices) */
&_PalCursor /* Pointer to palette */
};
static GUI_CONST_STORAGE GUI_CURSOR _ResizeCursorH = {
&_bmResizeCursorH, 8, 8
};
/*********************************************************************
*
* Cursor data, CursorV
*/
static GUI_CONST_STORAGE unsigned char _acResizeCursorV[] = {
0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x06, 0xA4, 0x00, 0x00,
0x00, 0x1A, 0xA9, 0x00, 0x00,
0x00, 0x55, 0x95, 0x40, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x55, 0x95, 0x40, 0x00,
0x00, 0x1A, 0xA9, 0x00, 0x00,
0x00, 0x06, 0xA4, 0x00, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x00, 0x40, 0x00, 0x00
};
static GUI_CONST_STORAGE GUI_BITMAP _bmResizeCursorV = {
17, /* XSize */
17, /* YSize */
5, /* BytesPerLine */
2, /* BitsPerPixel */
_acResizeCursorV, /* Pointer to picture data (indices) */
&_PalCursor /* Pointer to palette */
};
static GUI_CONST_STORAGE GUI_CURSOR _ResizeCursorV = {
&_bmResizeCursorV, 8, 8
};
/*********************************************************************
*
* Cursor data, CursorDD
*/
static GUI_CONST_STORAGE unsigned char _acResizeCursorDD[] = {
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x55, 0x00, 0x00, 0x00,
0x06, 0xA4, 0x00, 0x00, 0x00,
0x06, 0x90, 0x00, 0x00, 0x00,
0x06, 0x64, 0x00, 0x00, 0x00,
0x05, 0x19, 0x00, 0x00, 0x00,
0x04, 0x06, 0x40, 0x00, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x00, 0x00, 0x64, 0x04, 0x00,
0x00, 0x00, 0x19, 0x14, 0x00,
0x00, 0x00, 0x06, 0x64, 0x00,
0x00, 0x00, 0x01, 0xA4, 0x00,
0x00, 0x00, 0x06, 0xA4, 0x00,
0x00, 0x00, 0x15, 0x54, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
};
static GUI_CONST_STORAGE GUI_BITMAP _bmResizeCursorDD = {
17, /* XSize */
17, /* YSize */
5, /* BytesPerLine */
2, /* BitsPerPixel */
_acResizeCursorDD, /* Pointer to picture data (indices) */
&_PalCursor /* Pointer to palette */
};
static GUI_CONST_STORAGE GUI_CURSOR _ResizeCursorDD = {
&_bmResizeCursorDD, 8, 8
};
/*********************************************************************
*
* Cursor data, CursorDU
*/
static GUI_CONST_STORAGE unsigned char _acResizeCursorDU[] = {
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x15, 0x54, 0x00,
0x00, 0x00, 0x06, 0xA4, 0x00,
0x00, 0x00, 0x01, 0xA4, 0x00,
0x00, 0x00, 0x06, 0x64, 0x00,
0x00, 0x00, 0x19, 0x14, 0x00,
0x00, 0x00, 0x64, 0x04, 0x00,
0x00, 0x01, 0x90, 0x00, 0x00,
0x04, 0x06, 0x40, 0x00, 0x00,
0x05, 0x19, 0x00, 0x00, 0x00,
0x06, 0x64, 0x00, 0x00, 0x00,
0x06, 0x90, 0x00, 0x00, 0x00,
0x06, 0xA4, 0x00, 0x00, 0x00,
0x05, 0x55, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
};
static GUI_CONST_STORAGE GUI_BITMAP _bmResizeCursorDU = {
17, /* XSize */
17, /* YSize */
5, /* BytesPerLine */
2, /* BitsPerPixel */
_acResizeCursorDU, /* Pointer to picture data (indices) */
&_PalCursor /* Pointer to palette */
};
static GUI_CONST_STORAGE GUI_CURSOR _ResizeCursorDU = {
&_bmResizeCursorDU, 8, 8
};
#endif
/*********************************************************************
*
* Static code, helpers
*
**********************************************************************
*/
/*********************************************************************
*
* _SetResizeCursor
*/
#if GUI_SUPPORT_CURSOR
static void _SetResizeCursor(int Mode) {
const GUI_CURSOR GUI_UNI_PTR * pNewCursor = NULL;
if (Mode) {
int Direction;
Direction = Mode & (FRAMEWIN_RESIZE_X | FRAMEWIN_RESIZE_Y);
if (Direction == FRAMEWIN_RESIZE_X) {
pNewCursor = &_ResizeCursorH;
} else if (Direction == FRAMEWIN_RESIZE_Y) {
pNewCursor = &_ResizeCursorV;
} else {
Direction = Mode & (FRAMEWIN_REPOS_X | FRAMEWIN_REPOS_Y);
if ((Direction == (FRAMEWIN_REPOS_X | FRAMEWIN_REPOS_Y)) || !Direction) {
pNewCursor = &_ResizeCursorDD;
} else {
pNewCursor = &_ResizeCursorDU;
}
}
}
if (pNewCursor) {
const GUI_CURSOR GUI_UNI_PTR * pOldCursor;
pOldCursor = GUI_CURSOR_Select(pNewCursor);
if (_pOldCursor == NULL) {
_pOldCursor = pOldCursor;
}
} else if (_pOldCursor) {
GUI_CURSOR_Select(_pOldCursor);
_pOldCursor = NULL;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -