Screenshots:
Linux: | Windows_95:
|
|
|
russian.cxx:
#if 0
// Compiling (X11)
c++ -O5 -I/usr/X11R6/include -L/usr/X11R6/lib \
russian.cxx -o russian -lX11 -lXext -lfltk;
#endif
#include <FL/Fl_Window.H>
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl.H>
#include <locale.h>
// exit
void ok_cb(Fl_Widget*, void* v)
{
((Fl_Window*)v)->hide();
}
int main(int argc, char* argv[])
{
Fl_Window w(275, 120, "Russian");
#ifndef WIN32
Fl_Input input(5, 25, 265, 40, "÷×ÏÄ:"); // koi8r
#else
Fl_Input input(5, 25, 265, 40, "Ââîä:"); // cp-1251
#endif
{
Fl_Input& o=input;
o.labeltype(FL_EMBOSSED_LABEL);
o.labelfont(FL_COURIER);
o.labelsize(18);
o.labelcolor(FL_BLUE);
o.selection_color(FL_GREEN);
o.textfont(FL_COURIER);
o.textsize(18);
o.align(FL_ALIGN_TOP_LEFT);
}
#ifndef WIN32
Fl_Return_Button ok(70, 70, 150, 40, "äÏÂÒÏ"); // koi8r
#else
Fl_Return_Button ok(70, 70, 150, 40, "Äîáðî"); // cp-1251
#endif
{
Fl_Return_Button& o=ok;
o.labeltype(FL_ENGRAVED_LABEL);
o.labelfont(FL_TIMES_BOLD);
o.labelsize(18);
o.labelcolor(FL_RED);
o.callback(ok_cb, &w);
}
w.end();
// On systems with non-russian default locale you may have to use
// "env LC_ALL=ru_RU.KOI8-R ./russian" or LC_ALL=ru_SU command to
// make russian locale be the default locale of the process
// so that Xkb allows you to input russian.
setlocale(LC_CTYPE, ""); // default locale.
#ifndef WIN32
extern const char* fl_encoding;
fl_encoding="koi8-r"; // russian encoding.
#else
#if 0
// If you want your FLTK programm to run under non-russian windows
// (windows PE,etc.) and use Russian fonts you have to edit file
// fl_font_win32.cxx and change DEFAULT_CHARSET to RUSSIAN_CHARSET
// in CreateFont(); this will force Windows to use Russian(cp1251) fonts. On
// russian systems (with russian default charset) you do not have to do anything.
fid = CreateFont(
-size, // negative makes it use "char size"
0, // logical average character width
0, // angle of escapement
0, // base-line orientation angle
weight,
italic,
FALSE, // underline attribute flag
FALSE, // strikeout attribute flag
// DEFAULT_CHARSET, // character set identifier
RUSSIAN_CHARSET, // REPLACED
OUT_DEFAULT_PRECIS, // output precision
CLIP_DEFAULT_PRECIS,// clipping precision
DEFAULT_QUALITY, // output quality
DEFAULT_PITCH, // pitch and family
name // pointer to typeface name string
);
#endif
#endif
Fl::args(argc, argv); // process parameters given in comand-line.
w.show(argc, argv); // apply -display, etc. parameters to the window.
return Fl::run();
}