Add GWIN_FRAME_KEEPONCLOSE flag to prevent destruction of a frame on close

This commit is contained in:
inmarket 2016-02-10 13:57:04 +10:00
parent 3847f54dae
commit 507fb2d57e
3 changed files with 14 additions and 10 deletions

View File

@ -10,6 +10,7 @@ FEATURE: Added Altera-MAX10-NEEK board support
FIX: Vastly improving keyboard widget default rendering
FEATURE: Added ILI9342 driver
FIX: Fixing issues where wrong 'progress' color from widget style palette was used
FEATURE: Added GWIN_FRAME_KEEPONCLOSE flag to prevent destruction of a frame on close
*** Release 2.4 ***

View File

@ -28,11 +28,11 @@
#define FRM_BORDER_B 2 // Bottom Border
/* Internal state flags */
#define GWIN_FRAME_USER_FLAGS (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN)
#define GWIN_FRAME_CLOSE_PRESSED (GWIN_FRAME_MINMAX_BTN << 1)
#define GWIN_FRAME_MIN_PRESSED (GWIN_FRAME_MINMAX_BTN << 2)
#define GWIN_FRAME_MAX_PRESSED (GWIN_FRAME_MINMAX_BTN << 3)
#define GWIN_FRAME_REDRAW_FRAME (GWIN_FRAME_MINMAX_BTN << 4) // Only redraw the frame
#define GWIN_FRAME_USER_FLAGS (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN|GWIN_FRAME_KEEPONCLOSE)
#define GWIN_FRAME_CLOSE_PRESSED (GWIN_FRAME_KEEPONCLOSE << 1)
#define GWIN_FRAME_MIN_PRESSED (GWIN_FRAME_KEEPONCLOSE << 2)
#define GWIN_FRAME_MAX_PRESSED (GWIN_FRAME_KEEPONCLOSE << 3)
#define GWIN_FRAME_REDRAW_FRAME (GWIN_FRAME_KEEPONCLOSE << 4) // Only redraw the frame
#if GWIN_FRAME_CLOSE_BTN < GWIN_FIRST_CONTROL_FLAG
#error "GWIN Frame: - Flag definitions don't match"
#endif
@ -96,7 +96,8 @@ static void forceFrameRedraw(GWidgetObject *gw) {
gw->g.flags &= ~(GWIN_FRAME_CLOSE_PRESSED|GWIN_FRAME_MAX_PRESSED|GWIN_FRAME_MIN_PRESSED);
forceFrameRedraw(gw);
_gwinSendEvent(&gw->g, GEVENT_GWIN_CLOSE);
_gwinDestroy(&gw->g, REDRAW_INSESSION);
if (!(gw->g.flags & GWIN_FRAME_KEEPONCLOSE))
_gwinDestroy(&gw->g, REDRAW_INSESSION);
return;
}
if ((gw->g.flags & GWIN_FRAME_MAX_PRESSED)) {
@ -129,7 +130,8 @@ static void forceFrameRedraw(GWidgetObject *gw) {
gw->g.flags &= ~(GWIN_FRAME_CLOSE_PRESSED|GWIN_FRAME_MAX_PRESSED|GWIN_FRAME_MIN_PRESSED);
forceFrameRedraw(gw);
_gwinSendEvent(&gw->g, GEVENT_GWIN_CLOSE);
_gwinDestroy(&gw->g, REDRAW_INSESSION);
if (!(gw->g.flags & GWIN_FRAME_KEEPONCLOSE))
_gwinDestroy(&gw->g, REDRAW_INSESSION);
return;
}
pos -= FRM_BUTTON_X;

View File

@ -31,9 +31,10 @@
* @brief Flags for gwinFrameCreate()
* @{
*/
#define GWIN_FRAME_BORDER 0x00000000 // Deprecated. A border is always shown with a frame window now.
#define GWIN_FRAME_CLOSE_BTN 0x00000001
#define GWIN_FRAME_MINMAX_BTN 0x00000002
#define GWIN_FRAME_BORDER 0x00000000 /**< Deprecated. A border is always shown with a frame window now. */
#define GWIN_FRAME_CLOSE_BTN 0x00000001 /**< Should a close button be shown? */
#define GWIN_FRAME_MINMAX_BTN 0x00000002 /**< Should minimize and maximize buttons be shown? */
#define GWIN_FRAME_KEEPONCLOSE 0x00000004 /**< Don't automatically destroy the frame on close */
/** @} */
typedef GContainerObject GFrameObject;