Files
Robert Schmidt 8107939f08 Change OAI license to CSSL v1.0 (and others)
- all RAN code, CI code, configuration files, dockerfiles, in CSSL v1.0
- all deployment code (openshift, charts, ancillary files like shell
  scripts), in MIT
- documentation in CC-BY-4.0
- exceptions might apply and are listed in NOTICE
- there is a new LICENSES folder with all licenses
- CONTRIBUTIONS.md has been updated accordingly

For automated changes based on OAI PL v1.1:

    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.{c,h,cpp}
    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.ts
    perl -i~ -0pe 's/<!--.*Licensed to the OpenAirInterface.*openairinterface.org\n.*-->/<!-- SPDX-License-Identifier: LicenseRef-CSSL-1.0 -->/s' **/*.xml

The rest (cmake, files with missing license, cmake) manually.
2026-03-27 16:36:37 +01:00

98 lines
2.4 KiB
C

/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#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 key_modifiers, 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, key_modifiers, 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;
}