initial work on GGroup
This commit is contained in:
parent
ac690d1d29
commit
3a08f65cfc
3 changed files with 79 additions and 2 deletions
46
include/gwin/ggroup.h
Normal file
46
include/gwin/ggroup.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* This file is subject to the terms of the GFX License. If a copy of
|
||||||
|
* the license was not distributed with this file, you can obtain one at:
|
||||||
|
*
|
||||||
|
* http://ugfx.org/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gwin/ggroup.h
|
||||||
|
* @brief GWIN Widgets header file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GGROUP_H
|
||||||
|
#define _GGROUP_H
|
||||||
|
|
||||||
|
/* This file is included within "gwin/gwin.h" */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup Widget Widget
|
||||||
|
* @ingroup GWIN
|
||||||
|
*
|
||||||
|
* @details Groups provide parent/child relation features and dynamic layouts.
|
||||||
|
*
|
||||||
|
* @pre GFX_NEED_GWIN needs to be set to TRUE in your gfxconf.h.
|
||||||
|
* @pre GWIN_NEED_GROUPS needs to be set to TRUE in your gfxconf.h.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A group object structure
|
||||||
|
* @note Do not access the members directly. Treat it as a black-box and use the method functions.
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef struct GGroupObject {
|
||||||
|
GWindowObject g;
|
||||||
|
|
||||||
|
GHandle parent; // @< The parent widget
|
||||||
|
GHandle sibling; // @< The widget to its left (add right later as well)
|
||||||
|
GHandle child; // @< The child widget
|
||||||
|
} GGroupObject;
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _GGROUP_H */
|
||||||
|
|
|
@ -55,7 +55,7 @@ typedef struct GWindowObject {
|
||||||
GHandle child; // @< The child widget
|
GHandle child; // @< The child widget
|
||||||
#endif
|
#endif
|
||||||
} GWindowObject, * GHandle;
|
} GWindowObject, * GHandle;
|
||||||
/* @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The structure to initialise a GWIN.
|
* @brief The structure to initialise a GWIN.
|
||||||
|
@ -70,7 +70,7 @@ typedef struct GWindowInit {
|
||||||
coord_t width, height; // @< The initial dimension
|
coord_t width, height; // @< The initial dimension
|
||||||
bool_t show; // @< Should the window be visible initially
|
bool_t show; // @< Should the window be visible initially
|
||||||
} GWindowInit;
|
} GWindowInit;
|
||||||
/* @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A window's minimized, maximized or normal size
|
* @brief A window's minimized, maximized or normal size
|
||||||
|
@ -906,6 +906,11 @@ extern "C" {
|
||||||
* Additional functionality
|
* Additional functionality
|
||||||
*-------------------------------------------------*/
|
*-------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Include groups */
|
||||||
|
#if GWIN_NEED_GROUPS || defined(__DOXYGEN__)
|
||||||
|
#include "gwin/ggroup.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Include widgets */
|
/* Include widgets */
|
||||||
#if GWIN_NEED_WIDGET || defined(__DOXYGEN__)
|
#if GWIN_NEED_WIDGET || defined(__DOXYGEN__)
|
||||||
#include "gwin/gwidget.h"
|
#include "gwin/gwidget.h"
|
||||||
|
|
26
src/gwin/ggroup.c
Normal file
26
src/gwin/ggroup.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* This file is subject to the terms of the GFX License. If a copy of
|
||||||
|
* the license was not distributed with this file, you can obtain one at:
|
||||||
|
*
|
||||||
|
* http://ugfx.org/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gfx.h"
|
||||||
|
|
||||||
|
#if GFX_USE_GWIN && GWIN_NEED_GROUPS
|
||||||
|
|
||||||
|
#include "gwin/class_gwin.h"
|
||||||
|
|
||||||
|
GHandle _ggroupCreate(GDisplay *g, GGroupObject *go, const GGroupInit *pInit) {
|
||||||
|
if (!(go = (GGroupObject *)_gwindowCreate(g, &go->g, &pInit->g, &vmt->g, GWIN_FLG_GROUP|GWIN_FLG_ENABLED)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
go->parent = NULL;
|
||||||
|
go->sibling = NULL;
|
||||||
|
go->child = NULL;
|
||||||
|
|
||||||
|
return &go->g;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* GFX_USE_GWIN && GWIN_NEED_GROUPS */
|
||||||
|
|
Loading…
Add table
Reference in a new issue