Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
018da058
Commit
018da058
authored
Apr 29, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
container deals with growable children
parent
69e2a15e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
7 deletions
+34
-7
common/utils/T/tracer/gui/container.c
common/utils/T/tracer/gui/container.c
+34
-7
No files found.
common/utils/T/tracer/gui/container.c
View file @
018da058
...
@@ -84,6 +84,8 @@ printf("ALLOCATE container vertical %p\n", _this);
...
@@ -84,6 +84,8 @@ printf("ALLOCATE container vertical %p\n", _this);
struct
gui
*
g
=
_gui
;
struct
gui
*
g
=
_gui
;
struct
container_widget
*
this
=
_this
;
struct
container_widget
*
this
=
_this
;
struct
widget_list
*
l
;
struct
widget_list
*
l
;
int
over_pixels
=
0
;
int
i
;
if
(
this
->
hints_are_valid
==
1
)
goto
hints_ok
;
if
(
this
->
hints_are_valid
==
1
)
goto
hints_ok
;
...
@@ -96,18 +98,29 @@ hints_ok:
...
@@ -96,18 +98,29 @@ hints_ok:
this
->
common
.
width
=
width
;
this
->
common
.
width
=
width
;
this
->
common
.
height
=
height
;
this
->
common
.
height
=
height
;
/* TODO: some pixels won't be allocated, take care of it? */
if
(
height
>
this
->
hint_height
)
{
int
ngrowable
=
0
;
for
(
i
=
0
;
i
<
this
->
nchildren
;
i
++
)
if
(
this
->
growable
[
i
])
ngrowable
++
;
if
(
ngrowable
)
over_pixels
=
(
height
-
this
->
hint_height
)
/
ngrowable
;
}
/* allocate */
/* allocate */
l
=
this
->
common
.
children
;
l
=
this
->
common
.
children
;
i
=
0
;
while
(
l
)
{
while
(
l
)
{
int
allocated_height
;
l
->
item
->
hints
(
g
,
l
->
item
,
&
cwidth
,
&
cheight
);
l
->
item
->
hints
(
g
,
l
->
item
,
&
cwidth
,
&
cheight
);
allocated_height
=
cheight
+
(
this
->
growable
[
i
]
?
over_pixels
:
0
);
l
->
item
->
allocate
(
g
,
l
->
item
,
this
->
common
.
x
,
this
->
common
.
y
+
cy
,
l
->
item
->
allocate
(
g
,
l
->
item
,
this
->
common
.
x
,
this
->
common
.
y
+
cy
,
//this->hint_width, cheight);
MAX
(
width
,
cwidth
),
allocated_height
);
MAX
(
width
,
cwidth
),
cheight
);
cy
+=
allocated_height
;
cy
+=
cheight
;
l
=
l
->
next
;
l
=
l
->
next
;
i
++
;
}
}
if
(
cy
!=
this
->
hint_height
)
ERR
(
"reachable?
\n
"
);
//
if (cy != this->hint_height) ERR("reachable?\n");
}
}
static
void
horizontal_allocate
(
gui
*
_gui
,
widget
*
_this
,
static
void
horizontal_allocate
(
gui
*
_gui
,
widget
*
_this
,
...
@@ -119,6 +132,8 @@ printf("ALLOCATE container horizontal %p\n", _this);
...
@@ -119,6 +132,8 @@ printf("ALLOCATE container horizontal %p\n", _this);
struct
gui
*
g
=
_gui
;
struct
gui
*
g
=
_gui
;
struct
container_widget
*
this
=
_this
;
struct
container_widget
*
this
=
_this
;
struct
widget_list
*
l
;
struct
widget_list
*
l
;
int
over_pixels
=
0
;
int
i
;
if
(
this
->
hints_are_valid
==
1
)
goto
hints_ok
;
if
(
this
->
hints_are_valid
==
1
)
goto
hints_ok
;
...
@@ -131,17 +146,29 @@ hints_ok:
...
@@ -131,17 +146,29 @@ hints_ok:
this
->
common
.
width
=
width
;
this
->
common
.
width
=
width
;
this
->
common
.
height
=
height
;
this
->
common
.
height
=
height
;
/* TODO: some pixels won't be allocated, take care of it? */
if
(
width
>
this
->
hint_width
)
{
int
ngrowable
=
0
;
for
(
i
=
0
;
i
<
this
->
nchildren
;
i
++
)
if
(
this
->
growable
[
i
])
ngrowable
++
;
if
(
ngrowable
)
over_pixels
=
(
width
-
this
->
hint_width
)
/
ngrowable
;
}
/* allocate */
/* allocate */
l
=
this
->
common
.
children
;
l
=
this
->
common
.
children
;
i
=
0
;
while
(
l
)
{
while
(
l
)
{
int
allocated_width
;
l
->
item
->
hints
(
g
,
l
->
item
,
&
cwidth
,
&
cheight
);
l
->
item
->
hints
(
g
,
l
->
item
,
&
cwidth
,
&
cheight
);
allocated_width
=
cwidth
+
(
this
->
growable
[
i
]
?
over_pixels
:
0
);
l
->
item
->
allocate
(
g
,
l
->
item
,
this
->
common
.
x
+
cx
,
this
->
common
.
y
,
l
->
item
->
allocate
(
g
,
l
->
item
,
this
->
common
.
x
+
cx
,
this
->
common
.
y
,
c
width
,
MAX
(
height
,
cheight
)
/* this->hint_height */
);
allocated_
width
,
MAX
(
height
,
cheight
)
/* this->hint_height */
);
cx
+=
c
width
;
cx
+=
allocated_
width
;
l
=
l
->
next
;
l
=
l
->
next
;
i
++
;
}
}
if
(
cx
!=
this
->
hint_width
)
ERR
(
"reachable?
\n
"
);
//
if (cx != this->hint_width) ERR("reachable?\n");
}
}
static
void
vertical_hints
(
gui
*
_gui
,
widget
*
_w
,
int
*
width
,
int
*
height
)
static
void
vertical_hints
(
gui
*
_gui
,
widget
*
_w
,
int
*
width
,
int
*
height
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment