Aggiunta fet_focus_window

git-svn-id: svn://10.65.10.50/trunk@2901 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-05-23 16:27:38 +00:00
parent 4df65915b0
commit 77b703f859
2 changed files with 18 additions and 48 deletions

View File

@ -92,49 +92,6 @@ XVT_FNTID xvt_default_font(bool bold)
if (font_ser_desc.empty())
font_ser_desc << "01\\Courier\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/Courier";
xvt_font_deserialize(DEF_FONT, (char *)(const char *) font_ser_desc);
/*
#if XVT_OS == XVT_OS_WIN
HFONT NormalFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
LOGFONT LogFont;
GetObject(NormalFont, sizeof(LOGFONT), &LogFont);
TConfig font(CONFIG_USER, "Font");
CHARY = (int)font.get_long("Height");
if (CHARY > 0)
{
LogFont.lfHeight = CHARY;
LogFont.lfWeight = font.get_int("Weight");
LogFont.lfPitchAndFamily = font.get_int("Pitch");
strcpy(LogFont.lfFaceName, font.get("Name"));
}
else
{
LogFont.lfHeight = CHARY = 10;
LogFont.lfWeight = 300; // Normal weight
}
NormalFont = CreateFontIndirect(&LogFont);
TToken_string desc(128, '/');
desc.add("WIN01"); // 0
desc.add(LogFont.lfHeight); // 1
desc.add(LogFont.lfWidth); // 2
desc.add(LogFont.lfEscapement); // 3
desc.add(LogFont.lfOrientation); // 4
desc.add(LogFont.lfWeight); // 5
desc.add(LogFont.lfItalic); // 6
desc.add(LogFont.lfUnderline);
desc.add(LogFont.lfStrikeOut);
desc.add(LogFont.lfCharSet);
desc.add(LogFont.lfOutPrecision);
desc.add(LogFont.lfClipPrecision);
desc.add(LogFont.lfQuality);
desc.add(LogFont.lfPitchAndFamily);
desc.add(LogFont.lfFaceName);
xvt_font_set_native_desc(DEF_FONT, (char*)(const char*)desc);
CHECK(xvt_font_has_valid_native_desc(DEF_FONT), "Bad font description");
#endif
*/
xvt_font_map_using_default(DEF_FONT);
CHECK(xvt_font_is_mapped(DEF_FONT), "Can't map native font");
@ -144,11 +101,6 @@ XVT_FNTID xvt_default_font(bool bold)
FAT_FONT = xvt_font_create();
xvt_font_copy(FAT_FONT, DEF_FONT, XVT_FA_ALL);
xvt_font_set_style(FAT_FONT, XVT_FS_BOLD);
/*
desc.add(600, 5);
xvt_font_set_native_desc(FAT_FONT, (char*)(const char*)desc);
CHECK(xvt_font_has_valid_native_desc(FAT_FONT), "Bad font description");
*/
xvt_font_map_using_default(FAT_FONT);
CHECK(xvt_font_is_mapped(FAT_FONT), "Can't map native font");
// Get true text size
@ -303,9 +255,11 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
def->v.itf->automatic_back_color = FALSE;
def->v.itf->back_color = MASK_BACK_COLOR;
def->v.itf->font_id = xvt_default_font();
def->v.itf->tab_on_enter = TRUE;
def->v.itf->win = win;
XI_OBJ* itf = xi_create(NULL, def);
CHECK(itf, "Can't create an interface");
@ -380,7 +334,20 @@ void attach_interface(WINDOW win, COLOR back)
xi_dequeue();
xi_tree_free(def);
}
short get_focus_id(WINDOW win)
{
XI_OBJ * itf = xi_get_itf(win);
XI_OBJ * obj = xi_get_focus(itf);
if (obj == NULL || obj->type == XIT_ITF)
return -1;
if (obj->type == XIT_CELL || (obj->type == XIT_BTN && obj->v.btn->type == XIBT_RADIOBTN))
obj = obj->parent;
return obj->cid;
}
HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
{
static bool notify_xvt = TRUE;
@ -1040,6 +1007,8 @@ void TButton_control::create(WINDOW win, short cid,
if (width <= 0) width = strlen(t)+3;
RCT rct; coord2rct(win, left, top, width, height, rct);
if (wc == WC_CHECKBOX)
rct.right += XI_FU_MULTIPLE / 2 ;
if (cid == DLG_F9)
{
rct.left++;

View File

@ -21,6 +21,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
const char* caption, TWindow* mask, bool tags);
void attach_interface(WINDOW win, COLOR back = COLOR_WHITE);
short get_focus_id(WINDOW win);
///////////////////////////////////////////////////////////