#ifndef CLIENT_H
#define CLIENT_H
#include <ui/ui.h>
#include <cx/string.h>
#include <cx/json.h>
#include <cx/map.h>
#include "../ui/common/message.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct WindowData {
CxMap *widgets;
} WindowData;
typedef int (*json_msg_handler)(UiObject *parent,
const CxJsonValue *value, cxmutstr type);
void client_init(UiMessageHandler *handler);
void client_msg_received(cxstring msg);
int client_handle_json(UiObject *obj,
const CxJsonValue *value);
int client_handle_children(UiObject *parent,
const CxJsonValue *value);
void client_add_obj_mapping(UiObject *obj, cxmutstr id);
UiObject* client_get_mapped_obj(cxmutstr id);
void client_reg_widget(UiObject *obj, cxmutstr id,
UIWIDGET w);
UIWIDGET client_get_widget(UiObject *obj, cxmutstr id);
int msg_window(UiObject *parent,
const CxJsonValue *value, cxmutstr type);
int msg_show(UiObject *parent,
const CxJsonValue *value, cxmutstr type);
int msg_vbox(UiObject *parent,
const CxJsonValue *value, cxmutstr type);
int msg_hbox(UiObject *parent,
const CxJsonValue *value, cxmutstr type);
int msg_grid(UiObject *parent,
const CxJsonValue *value, cxmutstr type);
int msg_end(UiObject *parent,
const CxJsonValue *value, cxmutstr type);
int msg_button(UiObject *parent,
const CxJsonValue *value, cxmutstr type);
int msg_togglebutton(UiObject *parent,
const CxJsonValue *value, cxmutstr type);
#ifdef __cplusplus
}
#endif
#endif