Пример #1
0
static void *list_get_item(list_t *list, int index) {
	if (index >= list->items)
		return NULL;

	return list->item[index];
}

static void list_destroy(list_t *list) {
	if (list->item)
		free(list->item);
	free(list);
}

gg_class_id gg_container_get_class_id(void) {
	GG_CHILD(gg_widget_get_class_id())
}

void gg_container_destroy(gg_widget_t *widget) {
	gg_container_t *container = GG_CONTAINER(widget);
	int i;

	for (i = 0; i < list_get_size(container->widget_list); i++) {
		gg_widget_t *item = GG_WIDGET(list_get_item(container->widget_list, i));
		item->destroy(item);
	}

	list_destroy(container->widget_list);
	gg_widget_destroy(widget);
}
Пример #2
0
**  (at your option) any later version.
**
**  This program is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**  GNU General Public License for more details.
**
**  You should have received a copy of the GNU General Public License
**  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <gamegui/box.h>

gg_class_id gg_box_get_class_id()
{
    GG_CHILD(gg_select_get_class_id())
}

void gg_box_set_alignment(gg_box_t *box, float align)
{
    box->align = align;
}

void gg_box_init(gg_box_t *box, int spacing)
{
    gg_select_init((gg_select_t *) box);

    box->id = gg_box_get_class_id();
    box->spacing = spacing;
}