#ifndef CONTAINER_H
#define CONTAINER_H
#include "../ui/toolkit.h"
#include "../ui/container.h"
#include <ucx/list.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#define ui_reset_layout(layout) memset(&(layout),
0,
sizeof(UiLayout))
typedef struct MotifTabbedPane MotifTabbedPane;
typedef struct UiTab UiTab;
typedef struct UiBoxContainer UiBoxContainer;
typedef struct UiGridContainer UiGridContainer;
typedef struct UiTabViewContainer UiTabViewContainer;
typedef struct UiLayout UiLayout;
typedef Widget (*ui_container_add_f)(UiContainer*, Arg*,
int*, UiBool);
typedef enum UiLayoutBool UiLayoutBool;
typedef enum UiBoxOrientation UiBoxOrientation;
enum UiLayoutBool {
UI_LAYOUT_UNDEFINED =
0,
UI_LAYOUT_TRUE,
UI_LAYOUT_FALSE,
};
enum UiBoxOrientation {
UI_BOX_VERTICAL =
0,
UI_BOX_HORIZONTAL
};
struct UiLayout {
UiLayoutBool fill;
UiBool newline;
char *label;
UiBool hexpand;
UiBool vexpand;
int gridwidth;
};
struct UiContainer {
Widget widget;
Widget (*prepare)(UiContainer*, Arg *,
int*, UiBool);
void (*add)(UiContainer*, Widget);
UiLayout layout;
Widget current;
Widget menu;
};
struct UiBoxContainer {
UiContainer container;
Widget prev_widget;
UiBool has_fill;
UiBoxOrientation orientation;
int margin;
int spacing;
};
struct UiGridContainer {
UiContainer container;
UcxList *lines;
UcxList *current;
int columnspacing;
int rowspacing;
};
struct UiTabViewContainer {
UiContainer container;
UiContext *context;
Widget widget;
UcxList *tabs;
Widget current;
};
struct MotifTabbedPane {
UiTabbedPane view;
Widget tabbar;
UcxList *tabs;
UiTab *current;
int index;
Pixel bg1;
Pixel bg2;
int height;
};
struct UiTab {
MotifTabbedPane *tabbedpane;
UiObject *content;
Widget tab_button;
};
UiContainer* ui_frame_container(UiObject *obj, Widget frame);
Widget ui_frame_container_prepare(UiContainer *ct, Arg *args,
int *n, UiBool fill);
void ui_frame_container_add(UiContainer *ct, Widget widget);
UiContainer* ui_box_container(UiObject *obj, Widget box,
int margin,
int spacing, UiBoxOrientation orientation);
Widget ui_box_container_prepare(UiContainer *ct, Arg *args,
int *n, UiBool fill);
void ui_box_container_add(UiContainer *ct, Widget widget);
UiContainer* ui_grid_container(UiObject *obj, Widget form,
int columnspacing,
int rowspacing);
Widget ui_grid_container_prepare(UiContainer *ct, Arg *args,
int *n, UiBool fill);
void ui_grid_container_add(UiContainer *ct, Widget widget);
UiContainer* ui_scrolledwindow_container(UiObject *obj, Widget scrolledwindow);
Widget ui_scrolledwindow_container_prepare(UiContainer *ct, Arg *args,
int *n, UiBool fill);
void ui_scrolledwindow_container_add(UiContainer *ct, Widget widget);
UiContainer* ui_tabview_container(UiObject *obj, Widget rowcolumn);
Widget ui_tabview_container_prepare(UiContainer *ct, Arg *args,
int *n, UiBool fill);
void ui_tabview_container_add(UiContainer *ct, Widget widget);
void ui_tab_button_callback(Widget widget, UiTab *tab, XtPointer d);
void ui_change_tab(MotifTabbedPane *pane, UiTab *tab);
void ui_tab_set_document(UiContext *ctx,
void *document);
void ui_tab_detach_document(UiContext *ctx);
#ifdef __cplusplus
}
#endif
#endif