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
常顺宇
OpenXG-RAN
Commits
16e17d34
Commit
16e17d34
authored
May 04, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
positioner widget - the child is positioned in the middle, does not grow
parent
a74f8659
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
3 deletions
+102
-3
common/utils/T/tracer/gui/Makefile
common/utils/T/tracer/gui/Makefile
+1
-1
common/utils/T/tracer/gui/gui.h
common/utils/T/tracer/gui/gui.h
+1
-0
common/utils/T/tracer/gui/gui_defs.h
common/utils/T/tracer/gui/gui_defs.h
+5
-1
common/utils/T/tracer/gui/positioner.c
common/utils/T/tracer/gui/positioner.c
+92
-0
common/utils/T/tracer/gui/widget.c
common/utils/T/tracer/gui/widget.c
+3
-1
No files found.
common/utils/T/tracer/gui/Makefile
View file @
16e17d34
...
...
@@ -2,7 +2,7 @@ CC=gcc
CFLAGS
=
-Wall
-g
-pthread
OBJS
=
init.o loop.o toplevel_window.o x.o container.o widget.o
\
gui.o label.o event.o xy_plot.o textlist.o notify.o
gui.o label.o event.o xy_plot.o textlist.o notify.o
positioner.o
gui.a
:
$(OBJS)
ar cr gui.a
$(OBJS)
...
...
common/utils/T/tracer/gui/gui.h
View file @
16e17d34
...
...
@@ -21,6 +21,7 @@ void widget_dirty(gui *gui, widget *this);
widget
*
new_toplevel_window
(
gui
*
gui
,
int
width
,
int
height
,
char
*
title
);
widget
*
new_container
(
gui
*
gui
,
int
vertical
);
widget
*
new_positioner
(
gui
*
gui
);
widget
*
new_label
(
gui
*
gui
,
const
char
*
text
);
widget
*
new_xy_plot
(
gui
*
gui
,
int
width
,
int
height
,
char
*
label
,
int
vruler_width
);
...
...
common/utils/T/tracer/gui/gui_defs.h
View file @
16e17d34
...
...
@@ -30,7 +30,7 @@ extern int volatile gui_logd;
/*************************************************************************/
enum
widget_type
{
TOPLEVEL_WINDOW
,
CONTAINER
,
TEXT_LIST
,
XY_PLOT
,
BUTTON
,
LABEL
TOPLEVEL_WINDOW
,
CONTAINER
,
POSITIONER
,
TEXT_LIST
,
XY_PLOT
,
BUTTON
,
LABEL
};
struct
widget_list
;
...
...
@@ -77,6 +77,10 @@ struct container_widget {
int
nchildren
;
};
struct
positioner_widget
{
struct
widget
common
;
};
struct
textlist_widget
{
struct
widget
common
;
char
**
text
;
...
...
common/utils/T/tracer/gui/positioner.c
0 → 100644
View file @
16e17d34
#include "gui.h"
#include "gui_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static
void
add_child
(
gui
*
g
,
widget
*
_this
,
widget
*
child
,
int
position
)
{
LOGD
(
"ADD_CHILD positioner
\n
"
);
struct
positioner_widget
*
this
=
_this
;
widget_add_child_internal
(
g
,
this
,
child
,
position
);
}
static
void
del_child
(
gui
*
g
,
widget
*
_this
,
widget
*
child
)
{
LOGD
(
"DEL_CHILD positioner
\n
"
);
struct
positioner_widget
*
this
=
_this
;
widget_del_child_internal
(
g
,
this
,
child
);
}
static
void
allocate
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
width
,
int
height
)
{
LOGD
(
"ALLOCATE positioner %p
\n
"
,
_this
);
struct
gui
*
g
=
_g
;
struct
positioner_widget
*
this
=
_this
;
struct
widget_list
*
l
=
this
->
common
.
children
;
int
cwidth
,
cheight
;
this
->
common
.
x
=
x
;
this
->
common
.
y
=
y
;
this
->
common
.
width
=
width
;
this
->
common
.
height
=
height
;
if
(
l
!=
NULL
)
{
l
->
item
->
hints
(
g
,
l
->
item
,
&
cwidth
,
&
cheight
);
l
->
item
->
allocate
(
g
,
l
->
item
,
x
+
(
width
-
cwidth
)
/
2
,
y
+
(
height
-
cheight
)
/
2
,
cwidth
,
cheight
);
}
}
static
void
hints
(
gui
*
_gui
,
widget
*
_w
,
int
*
width
,
int
*
height
)
{
LOGD
(
"HINTS positioner %p
\n
"
,
_w
);
struct
gui
*
g
=
_gui
;
struct
positioner_widget
*
this
=
_w
;
struct
widget_list
*
l
=
this
->
common
.
children
;
if
(
l
!=
NULL
)
l
->
item
->
hints
(
g
,
l
->
item
,
width
,
height
);
else
{
*
width
=
*
height
=
1
;
}
}
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
LOGD
(
"BUTTON positioner %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
struct
gui
*
g
=
_g
;
struct
positioner_widget
*
this
=
_this
;
struct
widget_list
*
l
=
this
->
common
.
children
;
if
(
l
!=
NULL
)
l
->
item
->
button
(
g
,
l
->
item
,
x
,
y
,
button
,
up
);
}
static
void
paint
(
gui
*
_gui
,
widget
*
_this
)
{
LOGD
(
"PAINT positioner
\n
"
);
struct
gui
*
g
=
_gui
;
struct
widget
*
this
=
_this
;
struct
widget_list
*
l
=
this
->
children
;
if
(
l
!=
NULL
)
l
->
item
->
paint
(
g
,
l
->
item
);
}
widget
*
new_positioner
(
gui
*
_gui
)
{
struct
gui
*
g
=
_gui
;
struct
positioner_widget
*
w
;
glock
(
g
);
w
=
new_widget
(
g
,
POSITIONER
,
sizeof
(
struct
positioner_widget
));
w
->
common
.
paint
=
paint
;
w
->
common
.
add_child
=
add_child
;
w
->
common
.
del_child
=
del_child
;
w
->
common
.
allocate
=
allocate
;
w
->
common
.
hints
=
hints
;
w
->
common
.
button
=
button
;
gunlock
(
g
);
return
w
;
}
common/utils/T/tracer/gui/widget.c
View file @
16e17d34
...
...
@@ -264,7 +264,8 @@ void widget_dirty(gui *_gui, widget *_this)
}
static
const
char
*
names
[]
=
{
"TOPLEVEL_WINDOW"
,
"CONTAINER"
,
"TEXT_LIST"
,
"XY_PLOT"
,
"BUTTON"
,
"LABEL"
"TOPLEVEL_WINDOW"
,
"CONTAINER"
,
"POSITIONER"
,
"TEXT_LIST"
,
"XY_PLOT"
,
"BUTTON"
,
"LABEL"
};
const
char
*
widget_name
(
enum
widget_type
type
)
{
...
...
@@ -272,6 +273,7 @@ const char *widget_name(enum widget_type type)
default:
break
;
case
TOPLEVEL_WINDOW
:
case
CONTAINER
:
case
POSITIONER
:
case
TEXT_LIST
:
case
XY_PLOT
:
case
BUTTON
:
...
...
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