Text sample field in utf8 test resizable

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8163 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2011-01-01 19:34:14 +00:00
parent 39818616b9
commit 4562798f69
2 changed files with 78 additions and 56 deletions

View File

@ -143,7 +143,6 @@ void create_the_forms() {
fontobj->box(FL_FRAME_BOX); fontobj->box(FL_FRAME_BOX);
fontobj->color(53,3); fontobj->color(53,3);
fontobj->callback(font_cb); fontobj->callback(font_cb);
form->resizable(fontobj);
sizeobj = new Fl_Hold_Browser(410, 190, 130, 170); sizeobj = new Fl_Hold_Browser(410, 190, 130, 170);
sizeobj->box(FL_FRAME_BOX); sizeobj->box(FL_FRAME_BOX);
sizeobj->color(53,3); sizeobj->color(53,3);
@ -153,6 +152,7 @@ void create_the_forms() {
tile->end(); tile->end();
form->resizable(tile);
form->end(); form->end();
} }

View File

@ -31,6 +31,7 @@
#include <FL/Fl_Choice.H> #include <FL/Fl_Choice.H>
#include <FL/Fl_Input.H> #include <FL/Fl_Input.H>
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
#include <FL/Fl_Tile.H>
#include <FL/Fl_Hold_Browser.H> #include <FL/Fl_Hold_Browser.H>
#include <FL/Fl_Value_Output.H> #include <FL/Fl_Value_Output.H>
#include <FL/Fl_Button.H> #include <FL/Fl_Button.H>
@ -322,8 +323,7 @@ static void own_face_cb(Fl_Widget *, void *)
static void create_font_widget() static void create_font_widget()
{ {
fnt_chooser_win = new Fl_Double_Window(380, 420, "Font Selector"); // Create the font sample label
strcpy(label, "Font Sample\n"); strcpy(label, "Font Sample\n");
int i = 12; // strlen(label); int i = 12; // strlen(label);
int n = 0; int n = 0;
@ -340,55 +340,77 @@ static void create_font_widget()
} }
label[i] = 0; label[i] = 0;
textobj = new FontDisplay(FL_FRAME_BOX, 10, 10, 360, 90, label); // Create the window layout
textobj->align(FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); fnt_chooser_win = new Fl_Double_Window(380, 420, "Font Selector");
textobj->color(53, 3); {
Fl_Tile *tile = new Fl_Tile(0, 0, 380, 420);
fontobj = new Fl_Hold_Browser(10, 110, 290, 270); {
fontobj->box(FL_FRAME_BOX); Fl_Group *textgroup = new Fl_Group(0, 0, 380, 105);
fontobj->color(53, 3); {
fontobj->callback(font_cb);
fnt_chooser_win->resizable(fontobj); textobj = new FontDisplay(FL_FRAME_BOX, 10, 10, 360, 90, label);
textobj->align(FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
sizeobj = new Fl_Hold_Browser(310, 110, 60, 270); textobj->color(53, 3);
sizeobj->box(FL_FRAME_BOX);
sizeobj->color(53, 3); textgroup->box(FL_FLAT_BOX);
sizeobj->callback(size_cb); textgroup->resizable(textobj);
textgroup->end();
// Create the status bar }
Fl_Group * stat_bar = new Fl_Group (10, 385, 380, 30); Fl_Group *fontgroup = new Fl_Group(0, 105, 380, 315);
stat_bar->begin(); {
fontobj = new Fl_Hold_Browser(10, 110, 290, 270);
fnt_cnt = new Fl_Value_Output(10, 390, 40, 20); fontobj->box(FL_FRAME_BOX);
fnt_cnt->label("fonts"); fontobj->color(53, 3);
fnt_cnt->align(FL_ALIGN_RIGHT); fontobj->callback(font_cb);
fnt_chooser_win->resizable(fontobj);
fix_prop = new Fl_Output(100, 390, 40, 20);
fix_prop->color(FL_BACKGROUND_COLOR); sizeobj = new Fl_Hold_Browser(310, 110, 60, 270);
fix_prop->value("prop"); sizeobj->box(FL_FRAME_BOX);
fix_prop->clear_visible_focus(); sizeobj->color(53, 3);
sizeobj->callback(size_cb);
own_face = new Fl_Check_Button(150, 390, 40, 20, "Self");
own_face->value(0); // Create the status bar
own_face->type(FL_TOGGLE_BUTTON); Fl_Group *stat_bar = new Fl_Group (10, 385, 380, 30);
own_face->clear_visible_focus(); {
own_face->callback(own_face_cb); fnt_cnt = new Fl_Value_Output(10, 390, 40, 20);
own_face->tooltip("Display font names in their own face"); fnt_cnt->label("fonts");
fnt_cnt->align(FL_ALIGN_RIGHT);
Fl_Box * dummy = new Fl_Box(220, 390, 1, 1);
fix_prop = new Fl_Output(100, 390, 40, 20);
choose_btn = new Fl_Button(240, 385, 60, 30); fix_prop->color(FL_BACKGROUND_COLOR);
choose_btn->label("Select"); fix_prop->value("prop");
choose_btn->callback(choose_cb); fix_prop->clear_visible_focus();
refresh_btn = new Fl_Button(310, 385, 60, 30); own_face = new Fl_Check_Button(150, 390, 40, 20, "Self");
refresh_btn->label("Refresh"); own_face->value(0);
refresh_btn->callback(refresh_cb); own_face->type(FL_TOGGLE_BUTTON);
own_face->clear_visible_focus();
stat_bar->end(); own_face->callback(own_face_cb);
stat_bar->resizable (dummy); own_face->tooltip("Display font names in their own face");
fnt_chooser_win->end(); Fl_Box * dummy = new Fl_Box(220, 390, 1, 1);
choose_btn = new Fl_Button(240, 385, 60, 30);
choose_btn->label("Select");
choose_btn->callback(choose_cb);
refresh_btn = new Fl_Button(310, 385, 60, 30);
refresh_btn->label("Refresh");
refresh_btn->callback(refresh_cb);
stat_bar->resizable (dummy);
stat_bar->end();
}
fontgroup->box(FL_FLAT_BOX);
fontgroup->resizable(fontobj);
fontgroup->end();
}
tile->end();
}
fnt_chooser_win->resizable(tile);
fnt_chooser_win->end();
}
} }
@ -437,7 +459,7 @@ int make_font_chooser(void)
own_face_cb(NULL, 0); own_face_cb(NULL, 0);
fontobj->value(1); fontobj->value(1);
// optional hard-coded font for testing - do not use! // optional hard-coded font for testing - do not use!
// fontobj->textfont(261); // fontobj->textfont(261);
font_cb(fontobj, 0); font_cb(fontobj, 0);
@ -551,7 +573,7 @@ int main(int argc, char** argv)
{ {
int l; int l;
const char *latin1 = const char *latin1 =
"\x41\x42\x43\x61\x62\x63\xe0\xe8\xe9\xef\xe2\xee\xf6\xfc\xe3\x31\x32\x33"; "\x41\x42\x43\x61\x62\x63\xe0\xe8\xe9\xef\xe2\xee\xf6\xfc\xe3\x31\x32\x33";
char *utf8 = (char*) malloc(strlen(latin1) * 5 + 1); char *utf8 = (char*) malloc(strlen(latin1) * 5 + 1);
l = 0; l = 0;
// l = fl_latin12utf((const unsigned char*)latin1, strlen(latin1), utf8); // l = fl_latin12utf((const unsigned char*)latin1, strlen(latin1), utf8);
@ -662,8 +684,8 @@ int main(int argc, char** argv)
// Now try Greg Ercolano's Japanese test sequence // Now try Greg Ercolano's Japanese test sequence
// SOME JAPANESE UTF8 TEXT // SOME JAPANESE UTF8 TEXT
const char *utfstr = const char *utfstr =
"\xe4\xbd\x95\xe3\x82\x82\xe8\xa1" "\xe4\xbd\x95\xe3\x82\x82\xe8\xa1"
"\x8c\xe3\x82\x8b\xe3\x80\x82"; "\x8c\xe3\x82\x8b\xe3\x80\x82";
UCharDropBox db(5, 300, 190, 30); UCharDropBox db(5, 300, 190, 30);
db.textsize(16); db.textsize(16);