Commit Diff


commit - 6fe77315ff1cd8c27265b1597b5d8192337868d8
commit + c3628d8176854d6bdc1cb7e104626478162bb09f
blob - c52ab9fae4608dd3cfc0d746b7daac487c1a7ca7
blob + 997759160218ddf2ff55d1e9695a54804b4cb3a6
--- layout.c
+++ layout.c
@@ -5,6 +5,30 @@
 #include "aui.h"
 #include "widget.h"
 
+static struct aui_placepar default_place = {
+	.x = 0,
+	.y = 0,
+	.relx = 0,
+	.rely = 0,
+	.width = 0,
+	.height = 0,
+	.relwidth = 0,
+	.relheight = 0,
+	.anchor = AUI_ANCHOR_NW,
+};
+
+static struct aui_packpar default_pack = {
+	.anchor = AUI_ANCHOR_NW,
+	.fill = AUI_FILL_NONE,
+	.side = AUI_SIDE_TOP,
+	.expand = 0,
+};
+
+static struct aui_gridpar default_grid = {
+	.column = 0,
+	.row = 0,
+};
+
 static int
 can_add(struct aui_widget *widget, enum aui_layout_type type)
 {
@@ -497,6 +521,9 @@ aui_place(struct aui_widget *widget, struct aui_placep
 	if (check == -1)
 		return -1;
 
+	if (par == NULL)
+		par = &default_place;
+
 	con = (struct aui_container *)widget->parent;
 	parent = (struct aui_widget *)widget->parent;
 	con->layout_type = AUI_LAYOUT_PLACE;
@@ -519,6 +546,9 @@ aui_pack(struct aui_widget *widget, struct aui_packpar
 	if (check == -1)
 		return - 1;
 
+	if (par == NULL)
+		par = &default_pack;
+
 	con = (struct aui_container *)widget->parent;
 	parent = widget->parent;
 	con->layout_type = AUI_LAYOUT_PACK;
@@ -546,6 +576,9 @@ aui_grid(struct aui_widget *widget, struct aui_gridpar
 	if (check == -1)
 		return -1;
 
+	if (par == NULL)
+		par = &default_grid;
+
 	con = (struct aui_container *)widget->parent;
 	parent = widget->parent;
 	con->layout_type = AUI_LAYOUT_GRID;