Some cleanup and preparation for additions of dialogs, and text styles.

SVN revision: 28471
This commit is contained in:
titan 2007-02-25 04:30:57 +00:00 committed by titan
parent 78d88227c1
commit e069912a1c
6 changed files with 26 additions and 17 deletions

View File

@ -47,7 +47,7 @@ group
{ {
text: "text"; text: "text";
font: "ewl/default"; font: "ewl/default";
size: 10; size: 11;
min: 1 1; min: 1 1;
align: 0.5 0.5; align: 0.5 0.5;
} }

View File

@ -62,7 +62,8 @@ void ephoto_db_close(sqlite3 *db);
/* Ephoto Gui */ /* Ephoto Gui */
Ewl_Widget *add_button(Ewl_Widget *c, const char *txt, const char *img, void *cb, void *data); Ewl_Widget *add_button(Ewl_Widget *c, const char *txt, const char *img, void *cb, void *data);
Ewl_Widget *add_image(Ewl_Widget *c, const char *img, int thumbnail, void *cb, void *data); Ewl_Widget *add_image(Ewl_Widget *c, const char *img, int thumbnail, void *cb, void *data);
Ewl_Widget *add_label(Ewl_Widget *c, const char *lbl, int blue); Ewl_Widget *add_label(Ewl_Widget *c, const char *lbl);
Ewl_Widget *add_text(Ewl_Widget *c, const char *text);
Ewl_Widget *add_shadow(Ewl_Widget *c); Ewl_Widget *add_shadow(Ewl_Widget *c);
/* Ephoto Imaging */ /* Ephoto Imaging */

View File

@ -136,7 +136,7 @@ static void add_exif_to_container(Ewl_Widget *w, void *event, void *data)
void display_exif_dialog(Ewl_Widget *w, void *event, void *data) void display_exif_dialog(Ewl_Widget *w, void *event, void *data)
{ {
const char *img; const char *img;
Ewl_Widget *win, *vbox, *image, *sp, *list, *label; Ewl_Widget *win, *vbox, *image, *sp, *list, *text;
Ewl_Model *model; Ewl_Model *model;
Ewl_View *view; Ewl_View *view;
@ -159,14 +159,14 @@ void display_exif_dialog(Ewl_Widget *w, void *event, void *data)
ewl_container_child_append(EWL_CONTAINER(win), vbox); ewl_container_child_append(EWL_CONTAINER(win), vbox);
ewl_widget_show(vbox); ewl_widget_show(vbox);
label = add_label(vbox, "Preview", 0); text = add_text(vbox, "Preview");
image = add_image(vbox, img, 1, NULL, NULL); image = add_image(vbox, img, 1, NULL, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 120); ewl_image_constrain_set(EWL_IMAGE(image), 120);
ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER); ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(image), EWL_FLAG_FILL_SHRINK); ewl_object_fill_policy_set(EWL_OBJECT(image), EWL_FLAG_FILL_SHRINK);
label = add_label(vbox, "Image Information", 0); text = add_text(vbox, "Image Information");
sp = ewl_scrollpane_new(); sp = ewl_scrollpane_new();
ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_ALL); ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_ALL);

View File

@ -76,24 +76,35 @@ Ewl_Widget *add_image(Ewl_Widget *c, const char *img, int thumbnail, void *cb, v
} }
/*Add a label to the container c, with the text lbl, and whether you want it blue*/ /*Add a label to the container c, with the text lbl, and whether you want it blue*/
Ewl_Widget *add_label(Ewl_Widget *c, const char *lbl, int blue) Ewl_Widget *add_label(Ewl_Widget *c, const char *lbl)
{ {
Ewl_Widget *label; Ewl_Widget *label;
label = ewl_label_new(); label = ewl_label_new();
ewl_label_text_set(EWL_LABEL(label), lbl); ewl_label_text_set(EWL_LABEL(label), lbl);
ewl_object_alignment_set(EWL_OBJECT(label), EWL_FLAG_ALIGN_CENTER); ewl_object_alignment_set(EWL_OBJECT(label), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(label), EWL_FLAG_FILL_HFILL); ewl_object_fill_policy_set(EWL_OBJECT(label), EWL_FLAG_FILL_SHRINK);
ewl_container_child_append(EWL_CONTAINER(c), label); ewl_container_child_append(EWL_CONTAINER(c), label);
if(blue)
{
ewl_widget_state_set(label, "blue", EWL_STATE_PERSISTENT);
}
ewl_widget_show(label); ewl_widget_show(label);
return label; return label;
} }
/*Add a text widget to the container c*/
Ewl_Widget *add_text(Ewl_Widget *c, const char *txt)
{
Ewl_Widget *text;
text = ewl_text_new();
ewl_text_text_set(EWL_TEXT(text), txt);
ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_SHRINK);
ewl_container_child_append(EWL_CONTAINER(c), text);
ewl_widget_show(text);
return text;
}
/*Add a shadow to the container c*/ /*Add a shadow to the container c*/
Ewl_Widget *add_shadow(Ewl_Widget *c) Ewl_Widget *add_shadow(Ewl_Widget *c)
{ {

View File

@ -110,13 +110,10 @@ static void list_view_assign(Ewl_Widget *w, void *data)
image_pixels_string_get(image), image_pixels_string_get(image),
file_size_get(size)); file_size_get(size));
text = ewl_text_new(); text = add_text(w, info);
ewl_text_text_set(EWL_TEXT(text), info);
ewl_container_child_append(EWL_CONTAINER(w), text);
ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_SHRINK); ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_SHRINK);
ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_LEFT); ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_LEFT);
ewl_widget_show(text);
return; return;
} }

View File

@ -21,7 +21,7 @@ Ewl_Widget *add_normal_view(Ewl_Widget *c)
ewl_container_child_append(EWL_CONTAINER(sp), em->fbox); ewl_container_child_append(EWL_CONTAINER(sp), em->fbox);
ewl_widget_show(em->fbox); ewl_widget_show(em->fbox);
em->ilabel = add_label(em->fbox_vbox, "Image Information", 1); em->ilabel = add_label(em->fbox_vbox, "Image Information");
return em->fbox_vbox; return em->fbox_vbox;
} }