mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 14:42:44 +00:00
Changed jwidget to a C++ class with methods.
This commit is contained in:
parent
973fe38847
commit
6f9bccd65b
@ -103,8 +103,8 @@ static void cmd_new_file_execute(const char *argument)
|
||||
else if (jwidget_is_selected(radio2)) imgtype = IMAGE_GRAYSCALE;
|
||||
else if (jwidget_is_selected(radio3)) imgtype = IMAGE_INDEXED;
|
||||
|
||||
w = ustrtol(jwidget_get_text(width), NULL, 10);
|
||||
h = ustrtol(jwidget_get_text(height), NULL, 10);
|
||||
w = width->text_int();
|
||||
h = height->text_int();
|
||||
bg = jlistbox_get_selected_index(bg_box);
|
||||
|
||||
w = MID(1, w, 9999);
|
||||
|
@ -226,7 +226,7 @@ void app_loop()
|
||||
|
||||
menubar = jmenubar_new();
|
||||
statusbar = statusbar_new();
|
||||
colorbar = colorbar_new(box_colorbar->align);
|
||||
colorbar = colorbar_new(box_colorbar->align());
|
||||
toolbar = toolbar_new();
|
||||
tabsbar = tabs_new(tabsbar_select_callback);
|
||||
view = editor_view_new();
|
||||
|
@ -62,13 +62,13 @@
|
||||
#define THUMBSIZE (32*guiscale())
|
||||
|
||||
/* height of the headers */
|
||||
#define HDRSIZE (3 + text_height(widget->text_font)*2 + 3 + 3)
|
||||
#define HDRSIZE (3 + text_height(widget->font())*2 + 3 + 3)
|
||||
|
||||
/* width of the frames */
|
||||
#define FRMSIZE (3 + THUMBSIZE + 3)
|
||||
|
||||
/* height of the layers */
|
||||
#define LAYSIZE (3 + MAX(text_height(widget->text_font), THUMBSIZE) + 4)
|
||||
#define LAYSIZE (3 + MAX(text_height(widget->font()), THUMBSIZE) + 4)
|
||||
|
||||
/* space between icons and other information in the layer */
|
||||
#define ICONSEP (2*guiscale())
|
||||
@ -951,11 +951,11 @@ static void anieditor_draw_header_part(JWidget widget, JRect clip, int x1, int y
|
||||
if (align1 < 0)
|
||||
x = x1+3;
|
||||
else if (align1 == 0)
|
||||
x = (x1+x2)/2 - text_length(widget->text_font, line1)/2;
|
||||
x = (x1+x2)/2 - text_length(widget->font(), line1)/2;
|
||||
else
|
||||
x = x2 - 3 - text_length(widget->text_font, line1);
|
||||
x = x2 - 3 - text_length(widget->font(), line1);
|
||||
|
||||
jdraw_text(widget->text_font, line1,
|
||||
jdraw_text(widget->font(), line1,
|
||||
x, y1+3,
|
||||
fg, face, TRUE);
|
||||
}
|
||||
@ -964,12 +964,12 @@ static void anieditor_draw_header_part(JWidget widget, JRect clip, int x1, int y
|
||||
if (align2 < 0)
|
||||
x = x1+3;
|
||||
else if (align2 == 0)
|
||||
x = (x1+x2)/2 - text_length(widget->text_font, line2)/2;
|
||||
x = (x1+x2)/2 - text_length(widget->font(), line2)/2;
|
||||
else
|
||||
x = x2 - 3 - text_length(widget->text_font, line2);
|
||||
x = x2 - 3 - text_length(widget->font(), line2);
|
||||
|
||||
jdraw_text(widget->text_font, line2,
|
||||
x, y1+3+ji_font_get_size(widget->text_font)+3,
|
||||
jdraw_text(widget->font(), line2,
|
||||
x, y1+3+ji_font_get_size(widget->font())+3,
|
||||
fg, face, TRUE);
|
||||
}
|
||||
}
|
||||
@ -1074,16 +1074,16 @@ static void anieditor_draw_layer(JWidget widget, JRect clip, int layer_index)
|
||||
u += ICONBORDER+icon2->w+ICONBORDER+ICONSEP;
|
||||
|
||||
/* draw the layer's name */
|
||||
jdraw_text(widget->text_font, layer->name,
|
||||
u, y_mid - ji_font_get_size(widget->text_font)/2,
|
||||
jdraw_text(widget->font(), layer->name,
|
||||
u, y_mid - ji_font_get_size(widget->font())/2,
|
||||
fg, bg, TRUE);
|
||||
|
||||
/* the background should be underlined */
|
||||
if (layer_is_background(layer)) {
|
||||
hline(ji_screen,
|
||||
u,
|
||||
y_mid - ji_font_get_size(widget->text_font)/2 + ji_font_get_size(widget->text_font) + 1,
|
||||
u + text_length(widget->text_font, layer->name),
|
||||
y_mid - ji_font_get_size(widget->font())/2 + ji_font_get_size(widget->font()) + 1,
|
||||
u + text_length(widget->font(), layer->name),
|
||||
fg);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ void dialogs_options()
|
||||
refresh_all_editors();
|
||||
}
|
||||
|
||||
undo_size_limit_value = ustrtol(jwidget_get_text(undo_size_limit), NULL, 10);
|
||||
undo_size_limit_value = undo_size_limit->text_int();
|
||||
undo_size_limit_value = MID(1, undo_size_limit_value, 9999);
|
||||
set_config_int("Options", "UndoSizeLimit", undo_size_limit_value);
|
||||
|
||||
|
@ -364,7 +364,7 @@ static JWidget tips_load_box(FILE *f, char *buf, int sizeof_buf, int *take)
|
||||
/* add a box with an static size to separate paragraphs */
|
||||
JWidget box = jbox_new(0);
|
||||
|
||||
jwidget_set_min_size(box, 0, text_height(box->text_font));
|
||||
jwidget_set_min_size(box, 0, text_height(box->font()));
|
||||
|
||||
jwidget_add_child(vbox, box);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ union jmessage;
|
||||
struct jrect;
|
||||
struct jregion;
|
||||
struct jtheme;
|
||||
struct jwidget;
|
||||
class jwidget;
|
||||
|
||||
/* alignment */
|
||||
#define JI_HORIZONTAL 0x0001
|
||||
@ -100,6 +100,7 @@ struct jwidget;
|
||||
#define JI_DECORATIVE 0x0200 /* to decorate windows */
|
||||
#define JI_HARDCAPTURE 0x0400 /* only windows use hard capture */
|
||||
#define JI_INITIALIZED 0x0800 /* the widget was already initialized by a theme */
|
||||
#define JI_NOTEXT 0x1000 /* the widget does not have text */
|
||||
|
||||
/* widget types */
|
||||
enum {
|
||||
@ -190,7 +191,6 @@ enum {
|
||||
JI_SIGNAL_ADD_CHILD,
|
||||
JI_SIGNAL_REMOVE_CHILD,
|
||||
JI_SIGNAL_NEW_PARENT,
|
||||
JI_SIGNAL_GET_TEXT,
|
||||
JI_SIGNAL_SET_TEXT,
|
||||
JI_SIGNAL_SET_FONT,
|
||||
JI_SIGNAL_INIT_THEME,
|
||||
@ -233,7 +233,7 @@ typedef struct jstream* JStream;
|
||||
typedef struct jrect* JRect;
|
||||
typedef struct jregion* JRegion;
|
||||
typedef struct jtheme* JTheme;
|
||||
typedef struct jwidget* JWidget;
|
||||
typedef class jwidget* JWidget;
|
||||
typedef struct jxml* JXml;
|
||||
typedef struct jxmlattr* JXmlAttr;
|
||||
typedef struct jxmlnode* JXmlNode;
|
||||
|
@ -71,7 +71,7 @@ static void box_request_size(JWidget widget, int *w, int *h)
|
||||
{
|
||||
#define GET_CHILD_SIZE(w, h) \
|
||||
{ \
|
||||
if (widget->align & JI_HOMOGENEOUS) \
|
||||
if (widget->align() & JI_HOMOGENEOUS) \
|
||||
*w = MAX(*w, req_##w); \
|
||||
else \
|
||||
*w += req_##w; \
|
||||
@ -81,7 +81,7 @@ static void box_request_size(JWidget widget, int *w, int *h)
|
||||
|
||||
#define FINAL_SIZE(w) \
|
||||
{ \
|
||||
if (widget->align & JI_HOMOGENEOUS) \
|
||||
if (widget->align() & JI_HOMOGENEOUS) \
|
||||
*w *= nvis_children; \
|
||||
\
|
||||
*w += widget->child_spacing * (nvis_children-1); \
|
||||
@ -109,7 +109,7 @@ static void box_request_size(JWidget widget, int *w, int *h)
|
||||
|
||||
jwidget_request_size(child, &req_w, &req_h);
|
||||
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
GET_CHILD_SIZE(w, h);
|
||||
}
|
||||
else {
|
||||
@ -118,7 +118,7 @@ static void box_request_size(JWidget widget, int *w, int *h)
|
||||
}
|
||||
|
||||
if (nvis_children > 0) {
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
FINAL_SIZE(w);
|
||||
}
|
||||
else {
|
||||
@ -135,7 +135,7 @@ static void box_set_position(JWidget widget, JRect rect)
|
||||
#define FIXUP(x, y, w, h, l, t, r, b) \
|
||||
{ \
|
||||
if (nvis_children > 0) { \
|
||||
if (widget->align & JI_HOMOGENEOUS) { \
|
||||
if (widget->align() & JI_HOMOGENEOUS) { \
|
||||
width = (jrect_##w(widget->rc) \
|
||||
- widget->border_width.l \
|
||||
- widget->border_width.r \
|
||||
@ -161,7 +161,7 @@ static void box_set_position(JWidget widget, JRect rect)
|
||||
child = (JWidget)link->data; \
|
||||
\
|
||||
if (!(child->flags & JI_HIDDEN)) { \
|
||||
if (widget->align & JI_HOMOGENEOUS) { \
|
||||
if (widget->align() & JI_HOMOGENEOUS) { \
|
||||
if (nvis_children == 1) \
|
||||
child_width = width; \
|
||||
else \
|
||||
@ -188,7 +188,7 @@ static void box_set_position(JWidget widget, JRect rect)
|
||||
\
|
||||
w = MAX(1, child_width); \
|
||||
\
|
||||
if (widget->align & JI_HORIZONTAL) \
|
||||
if (widget->align() & JI_HORIZONTAL) \
|
||||
jrect_replace(&cpos, x, y, x+w, y+h); \
|
||||
else \
|
||||
jrect_replace(&cpos, y, x, y+h, x+w); \
|
||||
@ -226,7 +226,7 @@ static void box_set_position(JWidget widget, JRect rect)
|
||||
|
||||
jwidget_request_size(widget, &req_w, &req_h);
|
||||
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
FIXUP(x, y, w, h, l, t, r, b);
|
||||
}
|
||||
else {
|
||||
|
@ -317,7 +317,7 @@ static bool combobox_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
/* get the text-length of every item and put in 'w' the maximum value */
|
||||
JI_LIST_FOR_EACH(combobox->items, link) {
|
||||
int item_w = 2+text_length(widget->text_font,
|
||||
int item_w = 2+text_length(widget->font(),
|
||||
((ComboItem *)link->data)->text)+2;
|
||||
|
||||
w = MAX(w, item_w);
|
||||
|
@ -218,10 +218,10 @@ void jdraw_text(FONT *font, const char *s, int x, int y,
|
||||
|
||||
void jdraw_widget_text(JWidget widget, int fg, int bg, bool fill_bg)
|
||||
{
|
||||
if (widget->text) {
|
||||
if (widget->text()) {
|
||||
struct jrect box, text, icon;
|
||||
jwidget_get_texticon_info(widget, &box, &text, &icon, 0, 0, 0);
|
||||
jdraw_text(widget->text_font, widget->text,
|
||||
jdraw_text(widget->font(), widget->text(),
|
||||
text.x1, text.y1, fg, bg, fill_bg);
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@
|
||||
|
||||
typedef struct Entry
|
||||
{
|
||||
int maxsize;
|
||||
int cursor;
|
||||
int scroll;
|
||||
int select;
|
||||
@ -72,20 +73,21 @@ JWidget jentry_new(int maxsize, const char *format, ...)
|
||||
Entry* entry = (Entry*)jnew(Entry, 1);
|
||||
char buf[4096];
|
||||
|
||||
/* formatted string */
|
||||
// formatted string
|
||||
if (format) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vsprintf(buf, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
/* empty string */
|
||||
// empty string
|
||||
else {
|
||||
ustrcpy(buf, empty_string);
|
||||
}
|
||||
|
||||
jwidget_add_hook(widget, JI_ENTRY, entry_msg_proc, entry);
|
||||
|
||||
entry->maxsize = maxsize;
|
||||
entry->cursor = 0;
|
||||
entry->scroll = 0;
|
||||
entry->select = 0;
|
||||
@ -98,9 +100,7 @@ JWidget jentry_new(int maxsize, const char *format, ...)
|
||||
|
||||
/* TODO support for text alignment and multi-line */
|
||||
/* widget->align = JI_LEFT | JI_MIDDLE; */
|
||||
widget->text_size = maxsize+1;
|
||||
widget->text = (char*)jmalloc(widget->text_size);
|
||||
jwidget_set_text(widget, buf);
|
||||
widget->text(buf);
|
||||
|
||||
jwidget_focusrest(widget, TRUE);
|
||||
jwidget_init_theme(widget);
|
||||
@ -157,7 +157,7 @@ void jentry_hide_cursor(JWidget widget)
|
||||
void jentry_set_cursor_pos(JWidget widget, int pos)
|
||||
{
|
||||
Entry* entry = reinterpret_cast<Entry*>(jwidget_get_data(widget, JI_ENTRY));
|
||||
const char *text = widget->text;
|
||||
const char *text = widget->text();
|
||||
int x, c;
|
||||
|
||||
entry->cursor = pos;
|
||||
@ -171,7 +171,7 @@ void jentry_set_cursor_pos(JWidget widget, int pos)
|
||||
do {
|
||||
x = widget->rc->x1 + widget->border_width.l;
|
||||
for (c=++entry->scroll; ; c++) {
|
||||
x += CHARACTER_LENGTH(widget->text_font,
|
||||
x += CHARACTER_LENGTH(widget->font(),
|
||||
(c < ustrlen(text))? ugetat(text, c): ' ');
|
||||
|
||||
if (x >= widget->rc->x2-widget->border_width.r)
|
||||
@ -188,7 +188,7 @@ void jentry_set_cursor_pos(JWidget widget, int pos)
|
||||
void jentry_select_text(JWidget widget, int from, int to)
|
||||
{
|
||||
Entry* entry = reinterpret_cast<Entry*>(jwidget_get_data(widget, JI_ENTRY));
|
||||
int end = ustrlen(widget->text);
|
||||
int end = ustrlen(widget->text());
|
||||
|
||||
entry->select = from;
|
||||
jentry_set_cursor_pos(widget, from); // to move scroll
|
||||
@ -271,13 +271,11 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
case JM_KEYPRESSED:
|
||||
if (jwidget_has_focus(widget) && !jentry_is_readonly(widget)) {
|
||||
char* text = (char*)jmalloc(widget->text_size);
|
||||
std::string text = widget->text();
|
||||
int c, selbeg, selend;
|
||||
|
||||
jtheme_entry_info(widget, NULL, NULL, NULL, &selbeg, &selend);
|
||||
|
||||
ustrcpy(text, widget->text);
|
||||
|
||||
switch (msg->key.scancode) {
|
||||
|
||||
case KEY_LEFT:
|
||||
@ -310,7 +308,7 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
if (msg->any.shifts & KB_CTRL_FLAG)
|
||||
entry_forward_word(widget);
|
||||
/* forward char */
|
||||
else if (entry->cursor < ustrlen (text))
|
||||
else if (entry->cursor < text.size())
|
||||
entry->cursor++;
|
||||
break;
|
||||
|
||||
@ -335,31 +333,30 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
else
|
||||
entry->select = -1;
|
||||
|
||||
entry->cursor = ustrlen(text);
|
||||
entry->cursor = text.size();
|
||||
break;
|
||||
|
||||
case KEY_DEL:
|
||||
/* delete the entire selection */
|
||||
// delete the entire selection
|
||||
if (selbeg >= 0) {
|
||||
/* *cut* text! */
|
||||
// *cut* text!
|
||||
if (msg->any.shifts & KB_SHIFT_FLAG) {
|
||||
char buf[1024];
|
||||
ustrcpy(buf, empty_string);
|
||||
for (c=selbeg; c<=selend; c++)
|
||||
uinsert(buf, ustrlen(buf), ugetat(text, c));
|
||||
uinsert(buf, ustrlen(buf), text[c]);
|
||||
jclipboard_set_text(buf);
|
||||
}
|
||||
|
||||
/* remove text */
|
||||
for (c=0; c<selend-selbeg+1; c++)
|
||||
uremove(text, selbeg);
|
||||
// remove text
|
||||
text.erase(selbeg, selend-selbeg+1);
|
||||
|
||||
entry->cursor = selbeg;
|
||||
}
|
||||
/* delete the next character */
|
||||
else {
|
||||
if (entry->cursor < ustrlen (text))
|
||||
uremove(text, entry->cursor);
|
||||
if (entry->cursor < text.size())
|
||||
text.erase(entry->cursor, 1);
|
||||
}
|
||||
|
||||
entry->select = -1;
|
||||
@ -370,20 +367,19 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
if (msg->any.shifts & KB_SHIFT_FLAG) {
|
||||
const char *clipboard;
|
||||
|
||||
if ((clipboard = jclipboard_get_text ())) {
|
||||
if ((clipboard = jclipboard_get_text())) {
|
||||
/* delete the entire selection */
|
||||
if (selbeg >= 0) {
|
||||
for (c=0; c<selend-selbeg+1; c++)
|
||||
uremove(text, selbeg);
|
||||
text.erase(selbeg, selend-selbeg+1);
|
||||
|
||||
entry->cursor = selbeg;
|
||||
entry->select = -1;
|
||||
}
|
||||
|
||||
/* paste text */
|
||||
for (c=0; c<ustrlen (clipboard); c++)
|
||||
if (ustrsizez(text) < widget->text_size)
|
||||
uinsert(text, entry->cursor+c, ugetat(clipboard, c));
|
||||
for (c=0; c<ustrlen(clipboard); c++)
|
||||
if (text.size() < entry->maxsize)
|
||||
text.insert(entry->cursor+c, 1, ugetat(clipboard, c));
|
||||
else
|
||||
break;
|
||||
|
||||
@ -395,7 +391,7 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
char buf[1024];
|
||||
ustrcpy(buf, empty_string);
|
||||
for (c=selbeg; c<=selend; c++)
|
||||
uinsert(buf, ustrlen(buf), ugetat(text, c));
|
||||
uinsert(buf, ustrlen(buf), text[c]);
|
||||
jclipboard_set_text(buf);
|
||||
}
|
||||
break;
|
||||
@ -403,15 +399,14 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
case KEY_BACKSPACE:
|
||||
/* delete the entire selection */
|
||||
if (selbeg >= 0) {
|
||||
for (c=0; c<selend-selbeg+1; c++)
|
||||
uremove(text, selbeg);
|
||||
text.erase(selbeg, selend-selbeg+1);
|
||||
|
||||
entry->cursor = selbeg;
|
||||
}
|
||||
/* delete the previous character */
|
||||
else {
|
||||
if (entry->cursor > 0)
|
||||
uremove(text, --entry->cursor);
|
||||
text.erase(--entry->cursor, 1);
|
||||
}
|
||||
|
||||
entry->select = -1;
|
||||
@ -421,34 +416,29 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
if (msg->key.ascii >= 32) {
|
||||
/* delete the entire selection */
|
||||
if (selbeg >= 0) {
|
||||
for (c=0; c<selend-selbeg+1; c++)
|
||||
uremove(text, selbeg);
|
||||
text.erase(selbeg, selend-selbeg+1);
|
||||
|
||||
entry->cursor = selbeg;
|
||||
}
|
||||
|
||||
/* put the character */
|
||||
if (ustrsizez(text) < widget->text_size)
|
||||
uinsert(text, entry->cursor++, msg->key.ascii);
|
||||
if (text.size() < entry->maxsize)
|
||||
text.insert(entry->cursor++, 1, msg->key.ascii);
|
||||
|
||||
entry->select = -1;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
jfree(text);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ustrcmp(widget->text, text) != 0) {
|
||||
jwidget_set_text(widget, text);
|
||||
if (text != widget->text()) {
|
||||
widget->text(text.c_str());
|
||||
jwidget_emit_signal(widget, JI_SIGNAL_ENTRY_CHANGE);
|
||||
}
|
||||
|
||||
jfree(text);
|
||||
|
||||
jentry_set_cursor_pos(widget, entry->cursor);
|
||||
jwidget_dirty(widget);
|
||||
widget->dirty();
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
@ -458,7 +448,7 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
case JM_MOTION:
|
||||
if (jwidget_has_capture(widget)) {
|
||||
const char *text = widget->text;
|
||||
const char *text = widget->text();
|
||||
bool move, dirty;
|
||||
int c, x;
|
||||
|
||||
@ -480,7 +470,7 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
entry->scroll++;
|
||||
x = widget->rc->x1 + widget->border_width.l;
|
||||
for (c=entry->scroll; ; c++) {
|
||||
x += CHARACTER_LENGTH(widget->text_font,
|
||||
x += CHARACTER_LENGTH(widget->font(),
|
||||
(c < ustrlen(text))? ugetat(text, c): ' ');
|
||||
if (x > widget->rc->x2-widget->border_width.r) {
|
||||
c--;
|
||||
@ -550,16 +540,18 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
static void entry_request_size(JWidget widget, int *w, int *h)
|
||||
{
|
||||
Entry* entry = reinterpret_cast<Entry*>(jwidget_get_data(widget, JI_ENTRY));
|
||||
|
||||
*w =
|
||||
+ widget->border_width.l
|
||||
+ ji_font_char_len(widget->text_font, 'w') * MIN(widget->text_size, 6)
|
||||
+ ji_font_char_len(widget->font(), 'w') * MIN(entry->maxsize, 6)
|
||||
+ 2 + widget->border_width.r;
|
||||
|
||||
*w = MIN(*w, JI_SCREEN_W/2);
|
||||
|
||||
*h =
|
||||
+ widget->border_width.t
|
||||
+ text_height(widget->text_font)
|
||||
+ text_height(widget->font())
|
||||
+ widget->border_width.b;
|
||||
}
|
||||
|
||||
@ -574,8 +566,8 @@ static int entry_get_cursor_from_mouse(JWidget widget, JMessage msg)
|
||||
widget->rc->x2-widget->border_width.r-1);
|
||||
|
||||
x = widget->rc->x1 + widget->border_width.l;
|
||||
for (c=entry->scroll; ugetat (widget->text, c); c++) {
|
||||
w = CHARACTER_LENGTH(widget->text_font, ugetat(widget->text, c));
|
||||
for (c=entry->scroll; ugetat(widget->text(), c); c++) {
|
||||
w = CHARACTER_LENGTH(widget->font(), ugetat(widget->text(), c));
|
||||
if (x+w >= widget->rc->x2-widget->border_width.r)
|
||||
break;
|
||||
if ((mx >= x) && (mx < x+w)) {
|
||||
@ -585,7 +577,7 @@ static int entry_get_cursor_from_mouse(JWidget widget, JMessage msg)
|
||||
x += w;
|
||||
}
|
||||
|
||||
if (!ugetat (widget->text, c))
|
||||
if (!ugetat(widget->text(), c))
|
||||
if ((mx >= x) &&
|
||||
(mx <= widget->rc->x2-widget->border_width.r-1))
|
||||
cursor = c;
|
||||
@ -602,14 +594,14 @@ static void entry_forward_word(JWidget widget)
|
||||
Entry* entry = reinterpret_cast<Entry*>(jwidget_get_data(widget, JI_ENTRY));
|
||||
int ch;
|
||||
|
||||
for (; entry->cursor<ustrlen (widget->text); entry->cursor++) {
|
||||
ch = ugetat(widget->text, entry->cursor);
|
||||
for (; entry->cursor<ustrlen(widget->text()); entry->cursor++) {
|
||||
ch = ugetat(widget->text(), entry->cursor);
|
||||
if (IS_WORD_CHAR (ch))
|
||||
break;
|
||||
}
|
||||
|
||||
for (; entry->cursor<ustrlen(widget->text); entry->cursor++) {
|
||||
ch = ugetat(widget->text, entry->cursor);
|
||||
for (; entry->cursor<ustrlen(widget->text()); entry->cursor++) {
|
||||
ch = ugetat(widget->text(), entry->cursor);
|
||||
if (!IS_WORD_CHAR(ch)) {
|
||||
entry->cursor++;
|
||||
break;
|
||||
@ -623,13 +615,13 @@ static void entry_backward_word(JWidget widget)
|
||||
int ch;
|
||||
|
||||
for (entry->cursor--; entry->cursor >= 0; entry->cursor--) {
|
||||
ch = ugetat(widget->text, entry->cursor);
|
||||
ch = ugetat(widget->text(), entry->cursor);
|
||||
if (IS_WORD_CHAR(ch))
|
||||
break;
|
||||
}
|
||||
|
||||
for (; entry->cursor >= 0; entry->cursor--) {
|
||||
ch = ugetat(widget->text, entry->cursor);
|
||||
ch = ugetat(widget->text(), entry->cursor);
|
||||
if (!IS_WORD_CHAR(ch)) {
|
||||
entry->cursor++;
|
||||
break;
|
||||
|
@ -176,7 +176,7 @@ static JWidget convert_tag_to_widget(JXmlElem elem)
|
||||
text ? TRANSLATE_ATTR(text): NULL);
|
||||
|
||||
if (readonly)
|
||||
jentry_readonly(widget, TRUE);
|
||||
jentry_readonly(widget, true);
|
||||
}
|
||||
}
|
||||
/* grid */
|
||||
@ -279,7 +279,7 @@ static JWidget convert_tag_to_widget(JXmlElem elem)
|
||||
/* TODO add translatable support */
|
||||
/* TODO here we need jxmlelem_get_text(elem) */
|
||||
/* widget = jtextbox_new(tag->text, wordwrap ? JI_WORDWRAP: 0); */
|
||||
assert(FALSE);
|
||||
assert(false);
|
||||
}
|
||||
/* view */
|
||||
else if (ustrcmp(elem_name, "view") == 0) {
|
||||
@ -303,6 +303,7 @@ static JWidget convert_tag_to_widget(JXmlElem elem)
|
||||
if (widget) {
|
||||
const char *name = jxmlelem_get_attr(elem, "name");
|
||||
const char *tooltip = jxmlelem_get_attr(elem, "tooltip");
|
||||
bool selected = jxmlelem_has_attr(elem, "selected");
|
||||
bool expansive = jxmlelem_has_attr(elem, "expansive");
|
||||
bool magnetic = jxmlelem_has_attr(elem, "magnetic");
|
||||
bool noborders = jxmlelem_has_attr(elem, "noborders");
|
||||
@ -321,11 +322,14 @@ static JWidget convert_tag_to_widget(JXmlElem elem)
|
||||
if (tooltip != NULL)
|
||||
jwidget_add_tooltip_text(widget, tooltip);
|
||||
|
||||
if (selected)
|
||||
jwidget_set_selected(widget, selected);
|
||||
|
||||
if (expansive)
|
||||
jwidget_expansive(widget, TRUE);
|
||||
jwidget_expansive(widget, true);
|
||||
|
||||
if (magnetic)
|
||||
jwidget_magnetic(widget, TRUE);
|
||||
jwidget_magnetic(widget, true);
|
||||
|
||||
if (noborders)
|
||||
jwidget_noborders(widget);
|
||||
|
@ -60,8 +60,7 @@ static bool image_msg_proc(JWidget widget, JMessage msg)
|
||||
struct jrect box, text, icon;
|
||||
|
||||
jwidget_get_texticon_info(widget, &box, &text, &icon,
|
||||
jwidget_get_align(widget),
|
||||
bmp->w, bmp->h);
|
||||
widget->align(), bmp->w, bmp->h);
|
||||
|
||||
msg->reqsize.w = widget->border_width.l + jrect_w(&box) + widget->border_width.r;
|
||||
msg->reqsize.h = widget->border_width.t + jrect_h(&box) + widget->border_width.b;
|
||||
@ -73,8 +72,7 @@ static bool image_msg_proc(JWidget widget, JMessage msg)
|
||||
struct jrect box, text, icon;
|
||||
|
||||
jwidget_get_texticon_info(widget, &box, &text, &icon,
|
||||
jwidget_get_align(widget),
|
||||
bmp->w, bmp->h);
|
||||
widget->align(), bmp->w, bmp->h);
|
||||
|
||||
jdraw_rectexclude(widget->rc, &icon,
|
||||
jwidget_get_bg_color(widget));
|
||||
|
@ -30,93 +30,72 @@
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
|
||||
#include "jinete/jmanager.h"
|
||||
#include "jinete/jtheme.h"
|
||||
#include "jinete/jwidget.h"
|
||||
#include "jinete/jwindow.h"
|
||||
|
||||
static JID nwidgets = 0;
|
||||
static JWidget *widgets = NULL;
|
||||
static std::vector<JWidget> widgets;
|
||||
|
||||
JWidget _ji_get_widget_by_id(JID widget_id)
|
||||
{
|
||||
assert((widget_id >= 0) && (widget_id < nwidgets));
|
||||
assert((widget_id >= 0) && (widget_id < widgets.size()));
|
||||
|
||||
return widgets[widget_id];
|
||||
}
|
||||
|
||||
JWidget *_ji_get_widget_array(int *n)
|
||||
JWidget* _ji_get_widget_array(int* n)
|
||||
{
|
||||
*n = nwidgets;
|
||||
return widgets;
|
||||
*n = widgets.size();
|
||||
return &widgets.front();
|
||||
}
|
||||
|
||||
JWidget _ji_get_new_widget()
|
||||
void _ji_add_widget(JWidget widget)
|
||||
{
|
||||
JID widget_id;
|
||||
|
||||
/* first widget */
|
||||
if (!widgets) {
|
||||
nwidgets = 2;
|
||||
widgets = (JWidget *)jmalloc(sizeof(JWidget) * nwidgets);
|
||||
// first widget
|
||||
if (widgets.empty()) {
|
||||
widgets.resize(2);
|
||||
|
||||
/* id=0 no widget */
|
||||
// id=0 no widget
|
||||
widgets[0] = NULL;
|
||||
|
||||
/* id>0 all widgets */
|
||||
widgets[1] = (JWidget)jnew(struct jwidget, 1);
|
||||
// id>0 all widgets
|
||||
widgets[1] = widget;
|
||||
widgets[1]->id = widget_id = 1;
|
||||
}
|
||||
else {
|
||||
/* find a free slot */
|
||||
for (widget_id=1; widget_id<nwidgets; widget_id++) {
|
||||
/* is it free? */
|
||||
if (widgets[widget_id]->id != widget_id)
|
||||
/* yeah */
|
||||
// find a free slot
|
||||
for (widget_id=1; widget_id<widgets.size(); widget_id++) {
|
||||
// is it free?
|
||||
if (widgets[widget_id] == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
/* we need make other widget? */
|
||||
if (widget_id == nwidgets) {
|
||||
nwidgets++;
|
||||
widgets = (JWidget *)jrealloc(widgets,
|
||||
sizeof(JWidget) * nwidgets);
|
||||
widgets[widget_id] = (JWidget)jnew(struct jwidget, 1);
|
||||
}
|
||||
// we need space for other widget more?
|
||||
if (widget_id == widgets.size())
|
||||
widgets.resize(widgets.size()+1);
|
||||
|
||||
/* using this */
|
||||
widgets[widget_id] = widget;
|
||||
widgets[widget_id]->id = widget_id;
|
||||
}
|
||||
|
||||
return widgets[widget_id];
|
||||
}
|
||||
|
||||
void _ji_free_widget(JWidget widget)
|
||||
void _ji_remove_widget(JWidget widget)
|
||||
{
|
||||
widgets[widget->id]->id = 0;
|
||||
}
|
||||
assert_valid_widget(widget);
|
||||
|
||||
void _ji_free_all_widgets()
|
||||
{
|
||||
int c;
|
||||
|
||||
if (nwidgets) {
|
||||
for (c=0; c<nwidgets; c++)
|
||||
if (widgets[c] != NULL)
|
||||
jfree(widgets[c]);
|
||||
|
||||
jfree(widgets);
|
||||
widgets = NULL;
|
||||
nwidgets = 0;
|
||||
}
|
||||
widgets[widget->id] = NULL;
|
||||
}
|
||||
|
||||
bool _ji_is_valid_widget(JWidget widget)
|
||||
{
|
||||
return (widget &&
|
||||
widget->id >= 0 &&
|
||||
widget->id < nwidgets &&
|
||||
widget->id < widgets.size() &&
|
||||
widgets[widget->id] &&
|
||||
widgets[widget->id]->id == widget->id);
|
||||
}
|
||||
@ -126,17 +105,17 @@ void _ji_set_font_of_all_widgets(struct FONT *f)
|
||||
int c;
|
||||
|
||||
/* first of all, we have to set the font to all the widgets */
|
||||
for (c=0; c<nwidgets; c++)
|
||||
for (c=0; c<widgets.size(); c++)
|
||||
if (_ji_is_valid_widget(widgets[c]))
|
||||
jwidget_set_font(widgets[c], f);
|
||||
widgets[c]->font(f);
|
||||
|
||||
/* then we can reinitialize the theme of each widget */
|
||||
for (c=0; c<nwidgets; c++)
|
||||
for (c=0; c<widgets.size(); c++)
|
||||
if (_ji_is_valid_widget(widgets[c]))
|
||||
jwidget_init_theme(widgets[c]);
|
||||
|
||||
/* remap the windows */
|
||||
for (c=0; c<nwidgets; c++)
|
||||
for (c=0; c<widgets.size(); c++)
|
||||
if (_ji_is_valid_widget(widgets[c])) {
|
||||
if (widgets[c]->type == JI_WINDOW)
|
||||
jwindow_remap(widgets[c]);
|
||||
|
@ -42,11 +42,9 @@ struct BITMAP;
|
||||
|
||||
JWidget _ji_get_widget_by_id(JID widget_id);
|
||||
JWidget *_ji_get_widget_array(int *nwidgets);
|
||||
JWidget _ji_get_new_widget();
|
||||
|
||||
void _ji_free_widget(JWidget widget);
|
||||
void _ji_free_all_widgets();
|
||||
|
||||
void _ji_add_widget(JWidget widget);
|
||||
void _ji_remove_widget(JWidget widget);
|
||||
bool _ji_is_valid_widget(JWidget widget);
|
||||
|
||||
void _ji_set_font_of_all_widgets(struct FONT *f);
|
||||
|
@ -52,7 +52,7 @@ static bool label_msg_proc(JWidget widget, JMessage msg)
|
||||
switch (msg->type) {
|
||||
|
||||
case JM_REQSIZE:
|
||||
if (widget->text) {
|
||||
if (widget->has_text()) {
|
||||
msg->reqsize.w = jwidget_get_text_length(widget);
|
||||
msg->reqsize.h = jwidget_get_text_height(widget);
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ static void listitem_request_size(JWidget widget, int *w, int *h)
|
||||
int req_w, req_h;
|
||||
JLink link;
|
||||
|
||||
if (widget->text) {
|
||||
if (widget->has_text()) {
|
||||
max_w = jwidget_get_text_length(widget);
|
||||
max_h = jwidget_get_text_height(widget);
|
||||
}
|
||||
|
@ -255,7 +255,6 @@ void jmanager_free(JWidget widget)
|
||||
_ji_theme_exit();
|
||||
_ji_font_exit();
|
||||
_ji_system_exit();
|
||||
_ji_free_all_widgets();
|
||||
|
||||
jlist_free(msg_queue);
|
||||
jlist_free(new_windows);
|
||||
|
@ -996,7 +996,7 @@ static void menuitem_request_size(JWidget widget, int *w, int *h)
|
||||
MenuItem *menuitem = MITEM(widget);
|
||||
int bar = widget->parent->parent->type == JI_MENUBAR;
|
||||
|
||||
if (widget->text) {
|
||||
if (widget->has_text()) {
|
||||
*w =
|
||||
+ widget->border_width.l
|
||||
+ jwidget_get_text_length(widget)
|
||||
@ -1011,7 +1011,7 @@ static void menuitem_request_size(JWidget widget, int *w, int *h)
|
||||
if (menuitem->accel) {
|
||||
char buf[256];
|
||||
jaccel_to_string(menuitem->accel, buf);
|
||||
*w += ji_font_text_len(widget->text_font, buf);
|
||||
*w += ji_font_text_len(widget->font(), buf);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1331,10 +1331,10 @@ static JWidget check_for_letter(JWidget menu, int ascii)
|
||||
if (menuitem->type != JI_MENUITEM)
|
||||
continue;
|
||||
|
||||
if (menuitem->text)
|
||||
for (c=0; menuitem->text[c]; c++)
|
||||
if ((menuitem->text[c] == '&') && (menuitem->text[c+1] != '&'))
|
||||
if (tolower(ascii) == tolower(menuitem->text[c+1]))
|
||||
if (menuitem->has_text())
|
||||
for (c=0; menuitem->text()[c]; c++)
|
||||
if ((menuitem->text()[c] == '&') && (menuitem->text()[c+1] != '&'))
|
||||
if (tolower(ascii) == tolower(menuitem->text()[c+1]))
|
||||
return menuitem;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ static bool panel_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
++bar;
|
||||
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
x1 = c1->rc->x2;
|
||||
y1 = widget->rc->y1;
|
||||
x2 = c2->rc->x1;
|
||||
@ -143,7 +143,7 @@ static bool panel_msg_proc(JWidget widget, JMessage msg)
|
||||
if (jwidget_has_capture(widget)) {
|
||||
Panel* panel = reinterpret_cast<Panel*>(jwidget_get_data(widget, JI_PANEL));
|
||||
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
panel->pos =
|
||||
100.0 * (msg->mouse.x-widget->rc->x1) / jrect_w(widget->rc);
|
||||
}
|
||||
@ -179,7 +179,7 @@ static bool panel_msg_proc(JWidget widget, JMessage msg)
|
||||
c1 = reinterpret_cast<JWidget>(link->data);
|
||||
c2 = reinterpret_cast<JWidget>(link->next->data);
|
||||
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
x1 = c1->rc->x2;
|
||||
y1 = widget->rc->y1;
|
||||
x2 = c2->rc->x1;
|
||||
@ -201,7 +201,7 @@ static bool panel_msg_proc(JWidget widget, JMessage msg)
|
||||
}
|
||||
|
||||
if (change_cursor) {
|
||||
if (widget->align & JI_HORIZONTAL)
|
||||
if (widget->align() & JI_HORIZONTAL)
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_L);
|
||||
else
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_T);
|
||||
@ -253,14 +253,14 @@ static void panel_request_size(JWidget widget, int *w, int *h)
|
||||
|
||||
jwidget_request_size(child, &req_w, &req_h);
|
||||
|
||||
if (widget->align & JI_HORIZONTAL)
|
||||
if (widget->align() & JI_HORIZONTAL)
|
||||
GET_CHILD_SIZE(w, h);
|
||||
else
|
||||
GET_CHILD_SIZE(h, w);
|
||||
}
|
||||
|
||||
if (nvis_children > 0) {
|
||||
if (widget->align & JI_HORIZONTAL)
|
||||
if (widget->align() & JI_HORIZONTAL)
|
||||
FINAL_SIZE(w);
|
||||
else
|
||||
FINAL_SIZE(h);
|
||||
@ -309,7 +309,7 @@ static void panel_set_position(JWidget widget, JRect rect)
|
||||
jwidget_request_size(child1, &req1_w, &req1_h);
|
||||
jwidget_request_size(child2, &req2_w, &req2_h);
|
||||
|
||||
if (widget->align & JI_HORIZONTAL)
|
||||
if (widget->align() & JI_HORIZONTAL)
|
||||
FIXUP(x, y, w, h, l, t, r, b);
|
||||
else
|
||||
FIXUP(y, x, h, w, t, l, b, r);
|
||||
|
@ -68,7 +68,7 @@ static bool separator_msg_proc(JWidget widget, JMessage msg)
|
||||
max_h = MAX(max_h, req_h);
|
||||
}
|
||||
|
||||
if (widget->text)
|
||||
if (widget->has_text())
|
||||
max_w = MAX(max_w, jwidget_get_text_length(widget));
|
||||
|
||||
msg->reqsize.w = widget->border_width.l + max_w + widget->border_width.r;
|
||||
|
@ -275,13 +275,13 @@ static void slider_request_size(JWidget widget, int *w, int *h)
|
||||
char buf[256];
|
||||
|
||||
usprintf(buf, "%d", slider->min);
|
||||
min_w = ji_font_text_len(widget->text_font, buf);
|
||||
min_w = ji_font_text_len(widget->font(), buf);
|
||||
|
||||
usprintf(buf, "%d", slider->max);
|
||||
max_w = ji_font_text_len(widget->text_font, buf);
|
||||
max_w = ji_font_text_len(widget->font(), buf);
|
||||
|
||||
*w = MAX(min_w, max_w);
|
||||
*h = text_height(widget->text_font);
|
||||
*h = text_height(widget->font());
|
||||
|
||||
*w += widget->border_width.l + widget->border_width.r;
|
||||
*h += widget->border_width.t + widget->border_width.b;
|
||||
|
@ -198,7 +198,7 @@ static void textbox_request_size(JWidget widget, int *w, int *h)
|
||||
|
||||
_ji_theme_textbox_draw(NULL, widget, w, h, 0, 0);
|
||||
|
||||
if (widget->align & JI_WORDWRAP) {
|
||||
if (widget->align() & JI_WORDWRAP) {
|
||||
JWidget view = jwidget_get_view(widget);
|
||||
int width, min = *w;
|
||||
|
||||
|
@ -255,14 +255,14 @@ void _ji_theme_textbox_draw(BITMAP *bmp, JWidget widget,
|
||||
int *w, int *h, int bg, int fg)
|
||||
{
|
||||
JWidget view = jwidget_get_view(widget);
|
||||
char *text = widget->text;
|
||||
char *text = (char*)widget->text(); // TODO warning: removing const modifier
|
||||
char *beg, *end;
|
||||
int x1, y1, x2, y2;
|
||||
int x, y, chr, len;
|
||||
char *beg, *end;
|
||||
int scroll_x, scroll_y;
|
||||
int viewport_w, viewport_h;
|
||||
int textheight = jwidget_get_text_height(widget);
|
||||
FONT *font = widget->text_font;
|
||||
FONT *font = widget->font();
|
||||
char *beg_end, *old_end;
|
||||
int width;
|
||||
|
||||
@ -288,7 +288,7 @@ void _ji_theme_textbox_draw(BITMAP *bmp, JWidget widget,
|
||||
chr = 0;
|
||||
|
||||
/* without word-wrap */
|
||||
if (!(widget->align & JI_WORDWRAP)) {
|
||||
if (!(widget->align() & JI_WORDWRAP)) {
|
||||
width = jrect_w(widget->rc);
|
||||
}
|
||||
/* with word-wrap */
|
||||
@ -322,7 +322,7 @@ void _ji_theme_textbox_draw(BITMAP *bmp, JWidget widget,
|
||||
x = x1 - scroll_x;
|
||||
|
||||
/* without word-wrap */
|
||||
if (!(widget->align & JI_WORDWRAP)) {
|
||||
if (!(widget->align() & JI_WORDWRAP)) {
|
||||
end = ustrchr(beg, '\n');
|
||||
if (end) {
|
||||
chr = *end;
|
||||
@ -372,9 +372,9 @@ void _ji_theme_textbox_draw(BITMAP *bmp, JWidget widget,
|
||||
if (bmp) {
|
||||
int xout;
|
||||
|
||||
if (widget->align & JI_CENTER)
|
||||
if (widget->align() & JI_CENTER)
|
||||
xout = x + width/2 - len/2;
|
||||
else if (widget->align & JI_RIGHT)
|
||||
else if (widget->align() & JI_RIGHT)
|
||||
xout = x + width - len;
|
||||
else /* left */
|
||||
xout = x;
|
||||
|
@ -351,12 +351,12 @@ static bool tipwindow_msg_proc(JWidget widget, JMessage msg)
|
||||
jdraw_rect(pos, makecol(0, 0, 0));
|
||||
|
||||
jrect_shrink(pos, 1);
|
||||
jdraw_rectfill(pos, widget->bg_color);
|
||||
jdraw_rectfill(pos, widget->bg_color());
|
||||
|
||||
oldt = widget->border_width.t;
|
||||
widget->border_width.t = 3;
|
||||
_ji_theme_textbox_draw(ji_screen, widget, NULL, NULL,
|
||||
widget->bg_color,
|
||||
widget->bg_color(),
|
||||
ji_color_foreground());
|
||||
widget->border_width.t = oldt;
|
||||
|
||||
|
@ -493,8 +493,8 @@ static bool scrollbar_msg_proc(JWidget widget, JMessage msg)
|
||||
jtheme_scrollbar_info(widget, &pos, &len);
|
||||
|
||||
view->wherepos = pos;
|
||||
view->whereclick = widget->align & JI_HORIZONTAL ? msg->mouse.x:
|
||||
msg->mouse.y;
|
||||
view->whereclick = widget->align() & JI_HORIZONTAL ? msg->mouse.x:
|
||||
msg->mouse.y;
|
||||
|
||||
x1 = widget->rc->x1;
|
||||
y1 = widget->rc->y1;
|
||||
@ -506,7 +506,7 @@ static bool scrollbar_msg_proc(JWidget widget, JMessage msg)
|
||||
u2 = x2 - widget->border_width.r;
|
||||
v2 = y2 - widget->border_width.b;
|
||||
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
/* in the bar */
|
||||
if (MOUSE_IN(u1+pos, v1, u1+pos+len-1, v2)) {
|
||||
/* capture mouse */
|
||||
@ -565,7 +565,7 @@ static bool scrollbar_msg_proc(JWidget widget, JMessage msg)
|
||||
old_pos = pos;
|
||||
|
||||
if (bar_size > len) {
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
pos = (view->wherepos + msg->mouse.x - view->whereclick);
|
||||
pos = MID(0, pos, bar_size - len);
|
||||
|
||||
@ -610,7 +610,7 @@ static void scrollbar_info(JWidget widget, int *_pos, int *_len,
|
||||
int pos, len, max, scroll;
|
||||
int border_width;
|
||||
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
max = view->max_w;
|
||||
scroll = view->scroll_x;
|
||||
bar_size = jrect_w(widget->rc)
|
||||
|
@ -58,104 +58,103 @@ int ji_register_widget_type()
|
||||
/* creates a new widget with an unique JID */
|
||||
JWidget jwidget_new(int type)
|
||||
{
|
||||
JWidget widget = _ji_get_new_widget();
|
||||
if (!widget)
|
||||
return NULL;
|
||||
return new jwidget(type);
|
||||
}
|
||||
|
||||
widget->type = type;
|
||||
widget->name = NULL;
|
||||
widget->rc = jrect_new(0, 0, 0, 0);
|
||||
widget->border_width.l = 0;
|
||||
widget->border_width.t = 0;
|
||||
widget->border_width.r = 0;
|
||||
widget->border_width.b = 0;
|
||||
widget->child_spacing = 0;
|
||||
widget->flags = 0;
|
||||
widget->emit_signals = 0;
|
||||
widget->min_w = 0;
|
||||
widget->min_h = 0;
|
||||
widget->max_w = INT_MAX;
|
||||
widget->max_h = INT_MAX;
|
||||
widget->children = jlist_new();
|
||||
widget->parent = NULL;
|
||||
widget->theme = ji_get_theme();
|
||||
widget->hooks = jlist_new();
|
||||
widget->draw_type = type;
|
||||
widget->draw_method = NULL;
|
||||
jwidget::jwidget(int type)
|
||||
{
|
||||
_ji_add_widget(this);
|
||||
|
||||
widget->align = 0;
|
||||
widget->text_size = 0;
|
||||
widget->text = NULL;
|
||||
widget->text_size_pix = 0;
|
||||
widget->text_font = widget->theme ? widget->theme->default_font: NULL;
|
||||
widget->bg_color = -1;
|
||||
this->type = type;
|
||||
this->name = NULL;
|
||||
this->rc = jrect_new(0, 0, 0, 0);
|
||||
this->border_width.l = 0;
|
||||
this->border_width.t = 0;
|
||||
this->border_width.r = 0;
|
||||
this->border_width.b = 0;
|
||||
this->child_spacing = 0;
|
||||
this->flags = 0;
|
||||
this->emit_signals = 0;
|
||||
this->min_w = 0;
|
||||
this->min_h = 0;
|
||||
this->max_w = INT_MAX;
|
||||
this->max_h = INT_MAX;
|
||||
this->children = jlist_new();
|
||||
this->parent = NULL;
|
||||
this->theme = ji_get_theme();
|
||||
this->hooks = jlist_new();
|
||||
this->draw_type = type;
|
||||
this->draw_method = NULL;
|
||||
|
||||
widget->update_region = jregion_new(NULL, 0);
|
||||
this->m_align = 0;
|
||||
this->m_text = "";
|
||||
this->m_font = this->theme ? this->theme->default_font: NULL;
|
||||
this->m_bg_color = -1;
|
||||
|
||||
widget->theme_data[0] = NULL;
|
||||
widget->theme_data[1] = NULL;
|
||||
widget->theme_data[2] = NULL;
|
||||
widget->theme_data[3] = NULL;
|
||||
this->update_region = jregion_new(NULL, 0);
|
||||
|
||||
widget->user_data[0] = NULL;
|
||||
widget->user_data[1] = NULL;
|
||||
widget->user_data[2] = NULL;
|
||||
widget->user_data[3] = NULL;
|
||||
this->theme_data[0] = NULL;
|
||||
this->theme_data[1] = NULL;
|
||||
this->theme_data[2] = NULL;
|
||||
this->theme_data[3] = NULL;
|
||||
|
||||
jwidget_add_hook(widget, JI_WIDGET, widget_msg_proc, NULL);
|
||||
this->user_data[0] = NULL;
|
||||
this->user_data[1] = NULL;
|
||||
this->user_data[2] = NULL;
|
||||
this->user_data[3] = NULL;
|
||||
|
||||
return widget;
|
||||
jwidget_add_hook(this, JI_WIDGET, widget_msg_proc, NULL);
|
||||
}
|
||||
|
||||
void jwidget_free(JWidget widget)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
delete widget;
|
||||
}
|
||||
|
||||
jwidget::~jwidget()
|
||||
{
|
||||
JLink link, next;
|
||||
JMessage msg;
|
||||
|
||||
assert_valid_widget(widget);
|
||||
|
||||
/* send destroy message */
|
||||
msg = jmessage_new(JM_DESTROY);
|
||||
jwidget_send_message(widget, msg);
|
||||
jwidget_send_message(this, msg);
|
||||
jmessage_free(msg);
|
||||
|
||||
/* break relationship with the manager */
|
||||
jmanager_free_widget(widget);
|
||||
jmanager_remove_messages_for(widget);
|
||||
jmanager_remove_msg_filter_for(widget);
|
||||
jmanager_free_widget(this);
|
||||
jmanager_remove_messages_for(this);
|
||||
jmanager_remove_msg_filter_for(this);
|
||||
|
||||
/* remove from parent */
|
||||
if (widget->parent)
|
||||
jwidget_remove_child(widget->parent, widget);
|
||||
if (this->parent)
|
||||
jwidget_remove_child(this->parent, this);
|
||||
|
||||
/* remove children */
|
||||
JI_LIST_FOR_EACH_SAFE(widget->children, link, next)
|
||||
JI_LIST_FOR_EACH_SAFE(this->children, link, next)
|
||||
jwidget_free(reinterpret_cast<JWidget>(link->data));
|
||||
jlist_free(widget->children);
|
||||
jlist_free(this->children);
|
||||
|
||||
/* destroy the update region */
|
||||
if (widget->update_region)
|
||||
jregion_free(widget->update_region);
|
||||
|
||||
/* destroy the text */
|
||||
if (widget->text)
|
||||
jfree(widget->text);
|
||||
if (this->update_region)
|
||||
jregion_free(this->update_region);
|
||||
|
||||
/* destroy the name */
|
||||
if (widget->name)
|
||||
jfree(widget->name);
|
||||
if (this->name)
|
||||
jfree(this->name);
|
||||
|
||||
/* destroy widget position */
|
||||
if (widget->rc)
|
||||
jrect_free(widget->rc);
|
||||
if (this->rc)
|
||||
jrect_free(this->rc);
|
||||
|
||||
/* destroy hooks */
|
||||
JI_LIST_FOR_EACH(widget->hooks, link)
|
||||
JI_LIST_FOR_EACH(this->hooks, link)
|
||||
jhook_free(reinterpret_cast<JHook>(link->data));
|
||||
jlist_free(widget->hooks);
|
||||
jlist_free(this->hooks);
|
||||
|
||||
/* low level free */
|
||||
_ji_free_widget(widget);
|
||||
_ji_remove_widget(this);
|
||||
}
|
||||
|
||||
void jwidget_free_deferred(JWidget widget)
|
||||
@ -278,23 +277,7 @@ const char *jwidget_get_name(JWidget widget)
|
||||
const char *jwidget_get_text(JWidget widget)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
|
||||
jwidget_emit_signal(widget, JI_SIGNAL_GET_TEXT);
|
||||
return widget->text;
|
||||
}
|
||||
|
||||
int jwidget_get_align(JWidget widget)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
|
||||
return widget->align;
|
||||
}
|
||||
|
||||
FONT *jwidget_get_font(JWidget widget)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
|
||||
return widget->text_font;
|
||||
return widget->text();
|
||||
}
|
||||
|
||||
void jwidget_set_name(JWidget widget, const char *name)
|
||||
@ -311,61 +294,77 @@ void jwidget_set_text(JWidget widget, const char *text)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
|
||||
jwidget_set_text_soft(widget, text);
|
||||
widget->set_text_quiet(text);
|
||||
|
||||
jwidget_emit_signal(widget, JI_SIGNAL_SET_TEXT);
|
||||
jwidget_dirty(widget);
|
||||
}
|
||||
|
||||
void jwidget_set_text_soft(JWidget widget, const char *text)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
|
||||
if (text) {
|
||||
/* more space needed */
|
||||
if (!widget->text || widget->text_size < strlen(text)+1) {
|
||||
widget->text_size = strlen(text)+1;
|
||||
widget->text = (char*)jrealloc(widget->text, widget->text_size);
|
||||
}
|
||||
|
||||
/* copy the text string */
|
||||
strcpy(widget->text, text);
|
||||
|
||||
if (widget->text_font)
|
||||
widget->text_size_pix = ji_font_text_len(widget->text_font,
|
||||
widget->text);
|
||||
}
|
||||
/* NULL text */
|
||||
else if (widget->text) {
|
||||
widget->text_size = 0;
|
||||
jfree(widget->text);
|
||||
widget->text = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void jwidget_set_align(JWidget widget, int align)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
|
||||
widget->align = align;
|
||||
|
||||
jwidget_dirty(widget);
|
||||
widget->align(align);
|
||||
}
|
||||
|
||||
void jwidget_set_font(JWidget widget, FONT *font)
|
||||
int jwidget::text_int() const
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
return ustrtol(m_text.c_str(), NULL, 10);
|
||||
}
|
||||
|
||||
widget->text_font = font;
|
||||
double jwidget::text_double() const
|
||||
{
|
||||
return ustrtod(m_text.c_str(), NULL);
|
||||
}
|
||||
|
||||
if (widget->text && widget->text_font)
|
||||
widget->text_size_pix = ji_font_text_len(widget->text_font,
|
||||
widget->text);
|
||||
else
|
||||
widget->text_size_pix = 0;
|
||||
void jwidget::textf(const char *format, ...)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
jwidget_emit_signal(widget, JI_SIGNAL_SET_FONT);
|
||||
jwidget_dirty(widget);
|
||||
// formatted string
|
||||
if (format) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vsprintf(buf, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
// empty string
|
||||
else {
|
||||
ustrcpy(buf, empty_string);
|
||||
}
|
||||
|
||||
text(buf);
|
||||
}
|
||||
|
||||
void jwidget::set_text_quiet(const char *text)
|
||||
{
|
||||
if (text) {
|
||||
m_text = text;
|
||||
flags &= ~JI_NOTEXT;
|
||||
}
|
||||
else {
|
||||
m_text.clear();
|
||||
flags |= JI_NOTEXT;
|
||||
}
|
||||
}
|
||||
|
||||
void jwidget::align(int align)
|
||||
{
|
||||
m_align = align;
|
||||
dirty();
|
||||
}
|
||||
|
||||
FONT *jwidget::font()
|
||||
{
|
||||
return m_font;
|
||||
}
|
||||
|
||||
void jwidget::font(FONT* f)
|
||||
{
|
||||
m_font = f;
|
||||
|
||||
jwidget_emit_signal(this, JI_SIGNAL_SET_FONT);
|
||||
dirty();
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
@ -953,10 +952,7 @@ int jwidget_get_bg_color(JWidget widget)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
|
||||
if (widget->bg_color < 0 && widget->parent)
|
||||
return jwidget_get_bg_color(widget->parent);
|
||||
else
|
||||
return widget->bg_color;
|
||||
return widget->bg_color();
|
||||
}
|
||||
|
||||
JTheme jwidget_get_theme(JWidget widget)
|
||||
@ -969,7 +965,7 @@ JTheme jwidget_get_theme(JWidget widget)
|
||||
int jwidget_get_text_length(JWidget widget)
|
||||
{
|
||||
#if 1
|
||||
return ji_font_text_len(widget->text_font, widget->text);
|
||||
return ji_font_text_len(widget->font(), widget->text());
|
||||
#else /* use cached text size */
|
||||
return widget->text_size_pix;
|
||||
#endif
|
||||
@ -979,7 +975,7 @@ int jwidget_get_text_height(JWidget widget)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
|
||||
return text_height(widget->text_font);
|
||||
return text_height(widget->font());
|
||||
}
|
||||
|
||||
void jwidget_get_texticon_info(JWidget widget,
|
||||
@ -1002,7 +998,7 @@ void jwidget_get_texticon_info(JWidget widget,
|
||||
text_x = text_y = 0;
|
||||
|
||||
/* size of the text */
|
||||
if (widget->text) {
|
||||
if (widget->has_text()) {
|
||||
text_w = jwidget_get_text_length(widget);
|
||||
text_h = jwidget_get_text_height(widget);
|
||||
}
|
||||
@ -1019,32 +1015,32 @@ void jwidget_get_texticon_info(JWidget widget,
|
||||
/* with the icon in the top or bottom */
|
||||
else {
|
||||
box_w = MAX(icon_w, text_w);
|
||||
box_h = icon_h + ((widget->text)? widget->child_spacing: 0) + text_h;
|
||||
box_h = icon_h + (widget->has_text() ? widget->child_spacing: 0) + text_h;
|
||||
}
|
||||
}
|
||||
/* with the icon in left or right that doesn't care by now */
|
||||
else {
|
||||
box_w = icon_w + ((widget->text)? widget->child_spacing: 0) + text_w;
|
||||
box_w = icon_w + (widget->has_text() ? widget->child_spacing: 0) + text_w;
|
||||
box_h = MAX(icon_h, text_h);
|
||||
}
|
||||
|
||||
/* box position */
|
||||
if (widget->align & JI_RIGHT)
|
||||
if (widget->align() & JI_RIGHT)
|
||||
box_x = widget->rc->x2 - box_w - widget->border_width.r;
|
||||
else if (widget->align & JI_CENTER)
|
||||
else if (widget->align() & JI_CENTER)
|
||||
box_x = (widget->rc->x1+widget->rc->x2)/2 - box_w/2;
|
||||
else
|
||||
box_x = widget->rc->x1 + widget->border_width.l;
|
||||
|
||||
if (widget->align & JI_BOTTOM)
|
||||
if (widget->align() & JI_BOTTOM)
|
||||
box_y = widget->rc->y2 - box_h - widget->border_width.b;
|
||||
else if (widget->align & JI_MIDDLE)
|
||||
else if (widget->align() & JI_MIDDLE)
|
||||
box_y = (widget->rc->y1+widget->rc->y2)/2 - box_h/2;
|
||||
else
|
||||
box_y = widget->rc->y1 + widget->border_width.t;
|
||||
|
||||
/* with text */
|
||||
if (widget->text) {
|
||||
if (widget->has_text()) {
|
||||
/* text/icon X position */
|
||||
if (icon_align & JI_RIGHT) {
|
||||
text_x = box_x;
|
||||
@ -1139,8 +1135,7 @@ void jwidget_set_max_size(JWidget widget, int w, int h)
|
||||
void jwidget_set_bg_color(JWidget widget, int color)
|
||||
{
|
||||
assert_valid_widget(widget);
|
||||
|
||||
widget->bg_color = color;
|
||||
widget->bg_color(color);
|
||||
}
|
||||
|
||||
void jwidget_set_theme(JWidget widget, JTheme theme)
|
||||
@ -1149,7 +1144,7 @@ void jwidget_set_theme(JWidget widget, JTheme theme)
|
||||
|
||||
widget->theme = theme;
|
||||
/* TODO mmhhh... maybe some JStyle in JWidget should be great */
|
||||
widget->text_font = widget->theme ? widget->theme->default_font: NULL;
|
||||
widget->font(widget->theme ? widget->theme->default_font: NULL);
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
@ -1499,10 +1494,12 @@ bool jwidget_check_underscored(JWidget widget, int scancode)
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
if (widget->text) {
|
||||
for (c=0; widget->text[c]; c++)
|
||||
if ((widget->text[c] == '&') && (widget->text[c+1] != '&'))
|
||||
if (ascii == tolower(widget->text[c+1]))
|
||||
if (widget->has_text()) {
|
||||
const char* text = widget->text();
|
||||
|
||||
for (c=0; text[c]; c++)
|
||||
if ((text[c] == '&') && (text[c+1] != '&'))
|
||||
if (ascii == tolower(text[c+1]))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
#include "jinete/jbase.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifndef NDEBUG
|
||||
#include "jinete/jintern.h"
|
||||
#define assert_valid_widget(widget) assert((widget) != NULL && \
|
||||
@ -45,57 +47,6 @@
|
||||
struct FONT;
|
||||
struct BITMAP;
|
||||
|
||||
struct jwidget
|
||||
{
|
||||
JID id; /* identify code */
|
||||
int type; /* widget's type */
|
||||
|
||||
char *name; /* widget's name */
|
||||
JRect rc; /* position rectangle */
|
||||
struct {
|
||||
int l, t, r, b;
|
||||
} border_width; /* border separation with the parent */
|
||||
int child_spacing; /* separation between children */
|
||||
|
||||
/* flags */
|
||||
int flags;
|
||||
int emit_signals; /* emit signal counter */
|
||||
|
||||
/* widget size limits */
|
||||
int min_w, min_h;
|
||||
int max_w, max_h;
|
||||
|
||||
/* structures */
|
||||
JList children; /* sub-objects */
|
||||
JWidget parent; /* who is the parent? */
|
||||
JTheme theme; /* widget's theme */
|
||||
|
||||
/* virtual properties */
|
||||
JList hooks; /* hooks with msg_proc and specific data */
|
||||
int draw_type;
|
||||
JDrawFunc draw_method; /* virtual method to draw the widget
|
||||
(the default msg_proc uses it) */
|
||||
|
||||
/* common widget properties */
|
||||
int align; /* widget alignment */
|
||||
int text_size; /* text size (in characters) */
|
||||
char *text; /* widget text */
|
||||
int text_size_pix; /* cached text size in pixels */
|
||||
struct FONT *text_font; /* text font type */
|
||||
int bg_color; /* background color */
|
||||
|
||||
/* drawable cycle */
|
||||
JRegion update_region; /* region to be redrawed */
|
||||
|
||||
/* more properties... */
|
||||
|
||||
/* for JTheme */
|
||||
void *theme_data[4];
|
||||
|
||||
/* for user */
|
||||
void *user_data[4];
|
||||
};
|
||||
|
||||
int ji_register_widget_type();
|
||||
|
||||
JWidget jwidget_new(int type);
|
||||
@ -116,14 +67,10 @@ void *jwidget_get_data(JWidget widget, int type);
|
||||
int jwidget_get_type(JWidget widget);
|
||||
const char *jwidget_get_name(JWidget widget);
|
||||
const char *jwidget_get_text(JWidget widget);
|
||||
int jwidget_get_align(JWidget widget);
|
||||
struct FONT *jwidget_get_font(JWidget widget);
|
||||
|
||||
void jwidget_set_name(JWidget widget, const char *name);
|
||||
void jwidget_set_text(JWidget widget, const char *text);
|
||||
void jwidget_set_text_soft(JWidget widget, const char *text);
|
||||
void jwidget_set_align(JWidget widget, int align);
|
||||
void jwidget_set_font(JWidget widget, struct FONT *font);
|
||||
|
||||
/* behavior properties */
|
||||
|
||||
@ -233,4 +180,105 @@ void jwidget_release_mouse(JWidget widget);
|
||||
JWidget jwidget_find_name(JWidget widget, const char *name);
|
||||
bool jwidget_check_underscored(JWidget widget, int scancode);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
class jwidget
|
||||
{
|
||||
public:
|
||||
JID id; /* identify code */
|
||||
int type; /* widget's type */
|
||||
|
||||
char *name; /* widget's name */
|
||||
JRect rc; /* position rectangle */
|
||||
struct {
|
||||
int l, t, r, b;
|
||||
} border_width; /* border separation with the parent */
|
||||
int child_spacing; /* separation between children */
|
||||
|
||||
/* flags */
|
||||
int flags;
|
||||
int emit_signals; /* emit signal counter */
|
||||
|
||||
/* widget size limits */
|
||||
int min_w, min_h;
|
||||
int max_w, max_h;
|
||||
|
||||
/* structures */
|
||||
JList children; /* sub-objects */
|
||||
JWidget parent; /* who is the parent? */
|
||||
JTheme theme; /* widget's theme */
|
||||
|
||||
/* virtual properties */
|
||||
JList hooks; /* hooks with msg_proc and specific data */
|
||||
int draw_type;
|
||||
JDrawFunc draw_method; /* virtual method to draw the widget
|
||||
(the default msg_proc uses it) */
|
||||
|
||||
/* common widget properties */
|
||||
private:
|
||||
int m_align; // widget alignment
|
||||
std::string m_text; // widget text
|
||||
struct FONT *m_font; // text font type
|
||||
int m_bg_color; // background color
|
||||
public:
|
||||
|
||||
/* drawable cycle */
|
||||
JRegion update_region; /* region to be redrawed */
|
||||
|
||||
/* more properties... */
|
||||
|
||||
/* for JTheme */
|
||||
void *theme_data[4];
|
||||
|
||||
/* for user */
|
||||
void *user_data[4];
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Methods
|
||||
|
||||
jwidget(int type);
|
||||
~jwidget();
|
||||
|
||||
bool has_text() { return flags & JI_NOTEXT ? false: true; }
|
||||
|
||||
const char* text() const { return m_text.c_str(); }
|
||||
int text_int() const;
|
||||
double text_double() const;
|
||||
void text(const char* text) { jwidget_set_text(this, text); }
|
||||
size_t text_size() const { return m_text.size(); }
|
||||
void textf(const char* text, ...);
|
||||
void set_text_quiet(const char* text);
|
||||
|
||||
bool selected() { return jwidget_is_selected(this); }
|
||||
void selected(bool state) { jwidget_set_selected(this, state); }
|
||||
|
||||
int align() const { return m_align; }
|
||||
void align(int align);
|
||||
|
||||
struct FONT* font();
|
||||
void font(struct FONT* font);
|
||||
|
||||
int bg_color()
|
||||
{
|
||||
if (m_bg_color < 0 && parent)
|
||||
return parent->bg_color();
|
||||
else
|
||||
return m_bg_color;
|
||||
}
|
||||
|
||||
void bg_color(int bg_color)
|
||||
{
|
||||
m_bg_color = bg_color;
|
||||
}
|
||||
|
||||
// Returns a widget in the same window that is located "sibling".
|
||||
inline JWidget find_sibling(const char* name)
|
||||
{
|
||||
return jwidget_find_name(jwidget_get_window(this), name);
|
||||
}
|
||||
|
||||
void dirty() { jwidget_dirty(this); }
|
||||
|
||||
};
|
||||
|
||||
#endif /* JINETE_WIDGET_H */
|
||||
|
@ -234,7 +234,7 @@ bool jwindow_is_toplevel(JWidget widget)
|
||||
if (!jlist_empty(manager->children))
|
||||
return (widget == jlist_first(manager->children)->data);
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool jwindow_is_foreground(JWidget widget)
|
||||
@ -493,7 +493,7 @@ static void window_request_size(JWidget widget, int *w, int *h)
|
||||
}
|
||||
}
|
||||
|
||||
if (widget->text)
|
||||
if (widget->has_text())
|
||||
max_w = MAX(max_w, jwidget_get_text_length(widget));
|
||||
|
||||
*w = widget->border_width.l + max_w + widget->border_width.r;
|
||||
@ -538,7 +538,7 @@ static int get_action(JWidget widget, int x, int y)
|
||||
cpos = jwidget_get_child_rect(widget);
|
||||
|
||||
/* move */
|
||||
if ((widget->text)
|
||||
if ((widget->has_text())
|
||||
&& (((x >= cpos->x1) &&
|
||||
(x < cpos->x2) &&
|
||||
(y >= pos->y1+widget->border_width.b) &&
|
||||
|
@ -374,12 +374,12 @@ static void theme_init_widget(JWidget widget)
|
||||
|
||||
case JI_SEPARATOR:
|
||||
/* frame */
|
||||
if ((widget->align & JI_HORIZONTAL) &&
|
||||
(widget->align & JI_VERTICAL)) {
|
||||
if ((widget->align() & JI_HORIZONTAL) &&
|
||||
(widget->align() & JI_VERTICAL)) {
|
||||
BORDER(4);
|
||||
}
|
||||
/* horizontal bar */
|
||||
else if (widget->align & JI_HORIZONTAL) {
|
||||
else if (widget->align() & JI_HORIZONTAL) {
|
||||
BORDER4(2, 4, 2, 0);
|
||||
}
|
||||
/* vertical bar */
|
||||
@ -387,10 +387,10 @@ static void theme_init_widget(JWidget widget)
|
||||
BORDER4(4, 2, 0, 2);
|
||||
}
|
||||
|
||||
if (widget->text) {
|
||||
if (widget->align & JI_TOP)
|
||||
if (widget->has_text()) {
|
||||
if (widget->align() & JI_TOP)
|
||||
widget->border_width.t = jwidget_get_text_height(widget);
|
||||
else if (widget->align & JI_BOTTOM)
|
||||
else if (widget->align() & JI_BOTTOM)
|
||||
widget->border_width.b = jwidget_get_text_height(widget);
|
||||
}
|
||||
break;
|
||||
@ -422,7 +422,7 @@ static void theme_init_widget(JWidget widget)
|
||||
|
||||
case JI_WINDOW:
|
||||
if (!jwindow_is_desktop(widget)) {
|
||||
if (widget->text) {
|
||||
if (widget->has_text()) {
|
||||
BORDER4(6, 4+jwidget_get_text_height(widget)+6, 6, 6);
|
||||
#if 1 /* add close button */
|
||||
if (!(widget->flags & JI_INITIALIZED)) {
|
||||
@ -662,7 +662,7 @@ static void theme_draw_entry(JWidget widget, JRect clip)
|
||||
{
|
||||
bool password = jentry_is_password(widget);
|
||||
int scroll, cursor, state, selbeg, selend;
|
||||
const char *text = widget->text;
|
||||
const char *text = widget->text();
|
||||
int c, ch, x, y, w, fg, bg;
|
||||
int x1, y1, x2, y2;
|
||||
int cursor_x;
|
||||
@ -696,7 +696,7 @@ static void theme_draw_entry(JWidget widget, JRect clip)
|
||||
x = widget->rc->x1 + widget->border_width.l;
|
||||
y = (widget->rc->y1+widget->rc->y2)/2 - jwidget_get_text_height(widget)/2;
|
||||
|
||||
for (c=scroll; ugetat (text, c); c++) {
|
||||
for (c=scroll; ugetat(text, c); c++) {
|
||||
ch = password ? '*': ugetat(text, c);
|
||||
|
||||
/* normal text */
|
||||
@ -718,15 +718,14 @@ static void theme_draw_entry(JWidget widget, JRect clip)
|
||||
fg = COLOR_DISABLED;
|
||||
}
|
||||
|
||||
w = CHARACTER_LENGTH(widget->text_font, ch);
|
||||
w = CHARACTER_LENGTH(widget->font(), ch);
|
||||
if (x+w > widget->rc->x2-3)
|
||||
return;
|
||||
|
||||
cursor_x = x;
|
||||
ji_font_set_aa_mode(widget->text_font,
|
||||
bg >= 0 ? bg: COLOR_BACKGROUND);
|
||||
widget->text_font->vtable->render_char(widget->text_font,
|
||||
ch, fg, bg, ji_screen, x, y);
|
||||
ji_font_set_aa_mode(widget->font(), bg >= 0 ? bg: COLOR_BACKGROUND);
|
||||
widget->font()->vtable->render_char(widget->font(),
|
||||
ch, fg, bg, ji_screen, x, y);
|
||||
x += w;
|
||||
|
||||
/* cursor */
|
||||
@ -783,9 +782,9 @@ static void theme_draw_listitem(JWidget widget, JRect clip)
|
||||
x = widget->rc->x1+widget->border_width.l;
|
||||
y = widget->rc->y1+widget->border_width.t;
|
||||
|
||||
if (widget->text) {
|
||||
if (widget->has_text()) {
|
||||
/* text */
|
||||
jdraw_text(widget->text_font, widget->text, x, y, fg, bg, TRUE);
|
||||
jdraw_text(widget->font(), widget->text(), x, y, fg, bg, TRUE);
|
||||
|
||||
/* background */
|
||||
jrectexclude
|
||||
@ -864,9 +863,9 @@ static void theme_draw_menuitem(JWidget widget, JRect clip)
|
||||
|
||||
/* text */
|
||||
if (bar)
|
||||
widget->align = JI_CENTER | JI_MIDDLE;
|
||||
widget->align(JI_CENTER | JI_MIDDLE);
|
||||
else
|
||||
widget->align = JI_LEFT | JI_MIDDLE;
|
||||
widget->align(JI_LEFT | JI_MIDDLE);
|
||||
|
||||
pos = jwidget_get_rect(widget);
|
||||
if (!bar)
|
||||
@ -902,7 +901,7 @@ static void theme_draw_menuitem(JWidget widget, JRect clip)
|
||||
}
|
||||
/* draw the keyboard shortcut */
|
||||
else if (jmenuitem_get_accel(widget)) {
|
||||
int old_align = widget->align;
|
||||
int old_align = widget->align();
|
||||
char buf[256];
|
||||
|
||||
pos = jwidget_get_rect(widget);
|
||||
@ -910,9 +909,9 @@ static void theme_draw_menuitem(JWidget widget, JRect clip)
|
||||
|
||||
jaccel_to_string(jmenuitem_get_accel(widget), buf);
|
||||
|
||||
widget->align = JI_RIGHT | JI_MIDDLE;
|
||||
widget->align(JI_RIGHT | JI_MIDDLE);
|
||||
draw_textstring(buf, fg, bg, FALSE, widget, pos, 0);
|
||||
widget->align = old_align;
|
||||
widget->align(old_align);
|
||||
|
||||
jrect_free(pos);
|
||||
}
|
||||
@ -937,7 +936,7 @@ static void theme_draw_panel(JWidget widget, JRect clip)
|
||||
c1 = (JWidget)link->data;
|
||||
c2 = (JWidget)link->next->data;
|
||||
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
/* vline(ji_screen, */
|
||||
/* (c1->pos->x+c1->pos->w+c2->pos->x-1)/2, */
|
||||
/* widget->rect->y, */
|
||||
@ -1018,20 +1017,20 @@ static void theme_draw_separator(JWidget widget, JRect clip)
|
||||
jdraw_rectfill(widget->rc, BGCOLOR);
|
||||
|
||||
/* TOP line */
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
hline(ji_screen, x1, y1-1, x2, COLOR_DISABLED);
|
||||
hline(ji_screen, x1, y1, x2, COLOR_BACKGROUND);
|
||||
}
|
||||
|
||||
/* LEFT line */
|
||||
if (widget->align & JI_VERTICAL) {
|
||||
if (widget->align() & JI_VERTICAL) {
|
||||
vline(ji_screen, x1-1, y1, y2, COLOR_DISABLED);
|
||||
vline(ji_screen, x1, y1, y2, COLOR_BACKGROUND);
|
||||
}
|
||||
|
||||
/* frame */
|
||||
if ((widget->align & JI_HORIZONTAL) &&
|
||||
(widget->align & JI_VERTICAL)) {
|
||||
if ((widget->align() & JI_HORIZONTAL) &&
|
||||
(widget->align() & JI_VERTICAL)) {
|
||||
/* union between the LEFT and TOP lines */
|
||||
putpixel(ji_screen, x1-1, y1-1, COLOR_DISABLED);
|
||||
|
||||
@ -1048,7 +1047,7 @@ static void theme_draw_separator(JWidget widget, JRect clip)
|
||||
}
|
||||
|
||||
/* text */
|
||||
if (widget->text) {
|
||||
if (widget->has_text()) {
|
||||
int h = jwidget_get_text_height(widget);
|
||||
struct jrect r = { x1+h/2, y1-h/2, x2+1-h, y2+1+h };
|
||||
draw_textstring(NULL, -1, BGCOLOR, FALSE, widget, &r, 0);
|
||||
@ -1141,14 +1140,14 @@ static void theme_draw_slider(JWidget widget, JRect clip)
|
||||
|
||||
/* text */
|
||||
{
|
||||
char *old_text = widget->text;
|
||||
std::string old_text = widget->text();
|
||||
int cx1, cy1, cx2, cy2;
|
||||
JRect r;
|
||||
|
||||
usprintf(buf, "%d", value);
|
||||
|
||||
widget->align = JI_CENTER | JI_MIDDLE;
|
||||
widget->text = buf;
|
||||
widget->align(JI_CENTER | JI_MIDDLE);
|
||||
widget->text(buf);
|
||||
|
||||
r = jrect_new(x1, y1, x2+1, y2+1);
|
||||
|
||||
@ -1173,7 +1172,7 @@ static void theme_draw_slider(JWidget widget, JRect clip)
|
||||
|
||||
set_clip(ji_screen, cx1, cy1, cx2, cy2);
|
||||
|
||||
widget->text = old_text;
|
||||
widget->text(old_text.c_str());
|
||||
jrect_free(r);
|
||||
}
|
||||
}
|
||||
@ -1233,7 +1232,7 @@ static void theme_draw_view_scrollbar(JWidget widget, JRect clip)
|
||||
x1++, y1++, x2--, y2--;
|
||||
|
||||
/* horizontal bar */
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (widget->align() & JI_HORIZONTAL) {
|
||||
u1 = x1+pos;
|
||||
v1 = y1;
|
||||
u2 = x1+pos+len-1;
|
||||
@ -1287,7 +1286,7 @@ static void theme_draw_window(JWidget widget, JRect clip)
|
||||
jdraw_rectfill(pos, BGCOLOR);
|
||||
|
||||
/* draw title bar */
|
||||
if (widget->text) {
|
||||
if (widget->has_text()) {
|
||||
int bg = COLOR_SELECTED;
|
||||
|
||||
jrect_shrink(pos, 1);
|
||||
@ -1298,10 +1297,10 @@ static void theme_draw_window(JWidget widget, JRect clip)
|
||||
jrect_stretch(pos, 1);
|
||||
jdraw_rectedge(cpos, COLOR_DISABLED, COLOR_BACKGROUND);
|
||||
|
||||
jdraw_text(widget->text_font, widget->text,
|
||||
cpos->x1,
|
||||
pos->y1+jrect_h(pos)/2-text_height(widget->text_font)/2,
|
||||
COLOR_BACKGROUND, bg, FALSE);
|
||||
jdraw_text(widget->font(), widget->text(),
|
||||
cpos->x1,
|
||||
pos->y1+jrect_h(pos)/2-text_height(widget->font())/2,
|
||||
COLOR_BACKGROUND, bg, FALSE);
|
||||
}
|
||||
}
|
||||
/* desktop */
|
||||
@ -1326,33 +1325,33 @@ static void draw_textstring(const char *t, int fg_color, int bg_color,
|
||||
bool fill_bg, JWidget widget, const JRect rect,
|
||||
int selected_offset)
|
||||
{
|
||||
if (t || widget->text) {
|
||||
if (t || widget->has_text()) {
|
||||
int x, y, w, h;
|
||||
|
||||
if (!t) {
|
||||
t = widget->text;
|
||||
t = widget->text();
|
||||
w = jwidget_get_text_length(widget);
|
||||
h = jwidget_get_text_height(widget);
|
||||
}
|
||||
else {
|
||||
w = ji_font_text_len(widget->text_font, t);
|
||||
h = text_height(widget->text_font);
|
||||
w = ji_font_text_len(widget->font(), t);
|
||||
h = text_height(widget->font());
|
||||
}
|
||||
|
||||
/* horizontally text alignment */
|
||||
|
||||
if (widget->align & JI_RIGHT)
|
||||
if (widget->align() & JI_RIGHT)
|
||||
x = rect->x2 - w;
|
||||
else if (widget->align & JI_CENTER)
|
||||
else if (widget->align() & JI_CENTER)
|
||||
x = (rect->x1+rect->x2)/2 - w/2;
|
||||
else
|
||||
x = rect->x1;
|
||||
|
||||
/* vertically text alignment */
|
||||
|
||||
if (widget->align & JI_BOTTOM)
|
||||
if (widget->align() & JI_BOTTOM)
|
||||
y = rect->y2 - h;
|
||||
else if (widget->align & JI_MIDDLE)
|
||||
else if (widget->align() & JI_MIDDLE)
|
||||
y = (rect->y1+rect->y2)/2 - h/2;
|
||||
else
|
||||
y = rect->y1;
|
||||
@ -1374,17 +1373,17 @@ static void draw_textstring(const char *t, int fg_color, int bg_color,
|
||||
if (jwidget_is_disabled (widget)) {
|
||||
/* TODO avoid this */
|
||||
if (fill_bg) /* only to draw the background */
|
||||
jdraw_text(widget->text_font, t, x, y, 0, bg_color, fill_bg);
|
||||
jdraw_text(widget->font(), t, x, y, 0, bg_color, fill_bg);
|
||||
|
||||
/* draw white part */
|
||||
jdraw_text(widget->text_font, t, x+1, y+1,
|
||||
jdraw_text(widget->font(), t, x+1, y+1,
|
||||
COLOR_BACKGROUND, bg_color, fill_bg);
|
||||
|
||||
if (fill_bg)
|
||||
fill_bg = FALSE;
|
||||
}
|
||||
|
||||
jdraw_text(widget->text_font, t, x, y,
|
||||
jdraw_text(widget->font(), t, x, y,
|
||||
jwidget_is_disabled(widget) ?
|
||||
COLOR_DISABLED: (fg_color >= 0 ? fg_color :
|
||||
COLOR_FOREGROUND),
|
||||
|
@ -235,11 +235,11 @@ static void colorbutton_draw(JWidget widget)
|
||||
color_to_formalstring(colorbutton->imgtype,
|
||||
colorbutton->color, buf, sizeof(buf), FALSE);
|
||||
|
||||
jwidget_set_text_soft(widget, buf);
|
||||
widget->set_text_quiet(buf);
|
||||
jwidget_get_texticon_info(widget, &box, &text, &icon, 0, 0, 0);
|
||||
|
||||
rectfill(ji_screen, text.x1, text.y1, text.x2-1, text.y2-1, makecol(0, 0, 0));
|
||||
jdraw_text(widget->text_font, widget->text, text.x1, text.y1,
|
||||
jdraw_text(widget->font(), widget->text(), text.x1, text.y1,
|
||||
makecol(255, 255, 255),
|
||||
makecol(0, 0, 0), FALSE);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ JWidget colorselector_new(bool editable_palette)
|
||||
add_gfxicon_to_button(lock, GFX_BOX_LOCK, JI_CENTER | JI_MIDDLE);
|
||||
|
||||
/* tabs */
|
||||
jwidget_set_bg_color(tabs, window->bg_color);
|
||||
jwidget_set_bg_color(tabs, window->bg_color());
|
||||
|
||||
/* data for a better layout */
|
||||
grid1->child_spacing = 0;
|
||||
@ -278,7 +278,7 @@ static bool colorselector_msg_proc(JWidget widget, JMessage msg)
|
||||
JWidget idx = jwidget_find_name(widget, "idx");
|
||||
JWidget pal = jwidget_find_name(widget, "pal");
|
||||
JWidget grid2 = jwidget_find_name(widget, "grid2");
|
||||
int idxlen = ji_font_text_len(jwidget_get_font(idx), "Index=888");
|
||||
int idxlen = ji_font_text_len(idx->font(), "Index=888");
|
||||
|
||||
jwidget_set_min_size(idx, idxlen, 0);
|
||||
paledit_set_boxsize(pal, 4*guiscale());
|
||||
|
@ -105,7 +105,7 @@ static bool colorviewer_msg_proc(JWidget widget, JMessage msg)
|
||||
break;
|
||||
|
||||
case JM_REQSIZE: {
|
||||
msg->reqsize.w = ji_font_text_len(widget->text_font, "255,255,255,255");
|
||||
msg->reqsize.w = ji_font_text_len(widget->font(), "255,255,255,255");
|
||||
msg->reqsize.h = jwidget_get_text_height(widget);
|
||||
|
||||
msg->reqsize.w += widget->border_width.l + widget->border_width.r;
|
||||
@ -137,11 +137,11 @@ static bool colorviewer_msg_proc(JWidget widget, JMessage msg)
|
||||
color_to_formalstring(colorviewer->imgtype,
|
||||
colorviewer->color, buf, sizeof(buf), FALSE);
|
||||
|
||||
jwidget_set_text_soft(widget, buf);
|
||||
widget->set_text_quiet(buf);
|
||||
jwidget_get_texticon_info(widget, &box, &text, &icon, 0, 0, 0);
|
||||
|
||||
jdraw_rectfill(&text, makecol(0, 0, 0));
|
||||
jdraw_text(widget->text_font, widget->text, text.x1, text.y1,
|
||||
jdraw_text(widget->font(), widget->text(), text.x1, text.y1,
|
||||
makecol(255, 255, 255), makecol(0, 0, 0), FALSE);
|
||||
|
||||
jrect_free(rect);
|
||||
|
@ -332,7 +332,6 @@ void editor_draw_sprite(JWidget widget, int x1, int y1, int x2, int y2)
|
||||
image_free(rendered);
|
||||
destroy_bitmap(bmp);
|
||||
#else
|
||||
|
||||
acquire_bitmap(ji_screen);
|
||||
|
||||
use_current_sprite_rgb_map();
|
||||
|
@ -284,10 +284,10 @@ static bool fileview_msg_proc(JWidget widget, JMessage msg)
|
||||
x = widget->rc->x1+2;
|
||||
|
||||
if (fileitem_is_folder(fi)) {
|
||||
int icon_w = ji_font_text_len(widget->text_font, "[+]");
|
||||
int icon_h = ji_font_get_size(widget->text_font);
|
||||
int icon_w = ji_font_text_len(widget->font(), "[+]");
|
||||
int icon_h = ji_font_get_size(widget->font());
|
||||
|
||||
jdraw_text(widget->text_font,
|
||||
jdraw_text(widget->font(),
|
||||
"[+]", x, y+2,
|
||||
fgcolor, bgcolor, TRUE);
|
||||
|
||||
@ -314,7 +314,7 @@ static bool fileview_msg_proc(JWidget widget, JMessage msg)
|
||||
}
|
||||
|
||||
/* item name */
|
||||
jdraw_text(widget->text_font,
|
||||
jdraw_text(widget->font(),
|
||||
fileitem_get_displayname(fi).c_str(), x, y+2,
|
||||
fgcolor, bgcolor, TRUE);
|
||||
|
||||
@ -325,9 +325,9 @@ static bool fileview_msg_proc(JWidget widget, JMessage msg)
|
||||
widget->rc->x2-1, y+2+th+2-1,
|
||||
/* exclude where is the text located */
|
||||
x, y+2,
|
||||
x+ji_font_text_len(widget->text_font,
|
||||
x+ji_font_text_len(widget->font(),
|
||||
fileitem_get_displayname(fi).c_str())-1,
|
||||
y+2+ji_font_get_size(widget->text_font)-1,
|
||||
y+2+ji_font_get_size(widget->font())-1,
|
||||
/* fill with the background color */
|
||||
bgcolor);
|
||||
|
||||
@ -571,10 +571,10 @@ static void fileview_get_fileitem_size(JWidget widget, FileItem *fi, int *w, int
|
||||
int len = 0;
|
||||
|
||||
if (fileitem_is_folder(fi)) {
|
||||
len += ji_font_text_len(widget->text_font, "[+]")+2;
|
||||
len += ji_font_text_len(widget->font(), "[+]")+2;
|
||||
}
|
||||
|
||||
len += ji_font_text_len(widget->text_font,
|
||||
len += ji_font_text_len(widget->font(),
|
||||
fileitem_get_displayname(fi).c_str());
|
||||
|
||||
/* if (!fileitem_is_folder(fi)) { */
|
||||
|
@ -141,10 +141,7 @@ void statusbar_set_text(JWidget widget, int msecs, const char *format, ...)
|
||||
vsprintf(buf, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (widget->text)
|
||||
jfree(widget->text);
|
||||
|
||||
widget->text = jstrdup(buf);
|
||||
widget->text(buf);
|
||||
statusbar->timeout = ji_clock + msecs;
|
||||
jwidget_dirty(widget);
|
||||
}
|
||||
@ -283,12 +280,12 @@ static bool statusbar_msg_proc(JWidget widget, JMessage msg)
|
||||
jrect_shrink(rc, 1);
|
||||
|
||||
/* status bar text */
|
||||
if (widget->text) {
|
||||
if (widget->text()) {
|
||||
jdraw_rectfill(rc, ji_color_face());
|
||||
|
||||
textout_ex(ji_screen, widget->text_font, widget->text,
|
||||
textout_ex(ji_screen, widget->font(), widget->text(),
|
||||
rc->x1+2,
|
||||
(widget->rc->y1+widget->rc->y2)/2-text_height(widget->text_font)/2,
|
||||
(widget->rc->y1+widget->rc->y2)/2-text_height(widget->font())/2,
|
||||
ji_color_foreground(), -1);
|
||||
}
|
||||
|
||||
@ -332,9 +329,9 @@ static bool statusbar_msg_proc(JWidget widget, JMessage msg)
|
||||
buf+ustrsize(buf),
|
||||
sizeof(buf)-ustrsize(buf));
|
||||
|
||||
textout_right_ex(ji_screen, widget->text_font, buf,
|
||||
textout_right_ex(ji_screen, widget->font(), buf,
|
||||
rc->x2-2,
|
||||
(widget->rc->y1+widget->rc->y2)/2-text_height(widget->text_font)/2,
|
||||
(widget->rc->y1+widget->rc->y2)/2-text_height(widget->font())/2,
|
||||
ji_color_foreground(), -1);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "widgets/tabs.h"
|
||||
|
||||
#define CALC_TAB_WIDTH(widget, tab) \
|
||||
(4 + text_length(widget->text_font, tab->text) + 4)
|
||||
(4 + text_length(widget->font(), tab->text) + 4)
|
||||
|
||||
#define ARROW_W 12
|
||||
|
||||
@ -249,7 +249,7 @@ static bool tabs_msg_proc(JWidget widget, JMessage msg)
|
||||
bottom = ji_color_facelight();
|
||||
}
|
||||
|
||||
hline(ji_screen, box->x1, box->y1, box->x2-1, widget->bg_color);
|
||||
hline(ji_screen, box->x1, box->y1, box->x2-1, widget->bg_color());
|
||||
rectfill(ji_screen, box->x1+1, box->y1+1, box->x2-2, box->y2-1, face);
|
||||
hline(ji_screen, box->x1, rect->y2-1, box->x2-1, ji_color_selected());
|
||||
|
||||
@ -258,9 +258,9 @@ static bool tabs_msg_proc(JWidget widget, JMessage msg)
|
||||
ji_color_faceshadow(),
|
||||
bottom);
|
||||
|
||||
jdraw_text(widget->text_font, tab->text,
|
||||
jdraw_text(widget->font(), tab->text,
|
||||
box->x1+4,
|
||||
(box->y1+box->y2)/2-text_height(widget->text_font)/2,
|
||||
(box->y1+box->y2)/2-text_height(widget->font())/2,
|
||||
fg, face, FALSE);
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ static bool tabs_msg_proc(JWidget widget, JMessage msg)
|
||||
/* fill the gap to the right-side */
|
||||
if (box->x1 < rect->x2) {
|
||||
rectfill(ji_screen, box->x1, rect->y1, rect->x2-1, rect->y2-3,
|
||||
widget->bg_color);
|
||||
widget->bg_color());
|
||||
hline(ji_screen, box->x1, rect->y2-2, rect->x2-1, ji_color_facelight());
|
||||
hline(ji_screen, box->x1, rect->y2-1, rect->x2-1, ji_color_selected());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user