Skip to content

Commit

Permalink
fixed support for mnemonics in Windows and improved in Motif
Browse files Browse the repository at this point in the history
  • Loading branch information
scuri committed Nov 22, 2012
1 parent 62bbfb8 commit 0d757e9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
8 changes: 5 additions & 3 deletions html/en/history3.html
Expand Up @@ -58,7 +58,7 @@ <h2 align="center">History of Changes in Version 3.x</h2>

</p>

<h3>CVS (20/Nov/2012)</h3>
<h3>CVS (21/Nov/2012)</h3>

<ul>

Expand Down Expand Up @@ -93,10 +93,12 @@ <h3>CVS (20/Nov/2012)</h3>
during the callback and XAUTOHIDE=Yes or YAUTOHIDE=Yes.</li>
<li><span class="hist_fixed">Fixed:</span> maintain LASTADDNODE id
consistent when one or more nodes are removes in <strong>IupTree</strong>.</li>
<li><span class="hist_fixed">Fixed:</span> fixed key processing in <strong>
<li><span class="hist_fixed">Fixed:</span> key processing in <strong>
IupText</strong> and <strong>IupList</strong> on Motif to avoid Alt, Ctrl
and Sys keys to generate text input.</li>
<li><span class="hist_fixed">Fixed:</span> fixed GTK label mnemonic parsing.</li>
<li><span class="hist_fixed">Fixed:</span> <strong>IupLabel</strong> mnemonic parsing
in GTK.</li>
<li><span class="hist_fixed">Fixed:</span> Mnemonic processing in Windows.</li>

</ul>

Expand Down
9 changes: 9 additions & 0 deletions src/win/iupwin_common.c
Expand Up @@ -62,10 +62,19 @@ void iupdrvActivate(Ihandle* ih)
{
/* do not use BM_CLICK because it changes the focus
and does not animates the button press */

/* draw highlight */
SendMessage(ih->handle, BM_SETSTATE, TRUE, 0);
IupFlush();
Sleep(150);

if (IupClassMatch(ih, "toggle"))
IupSetAttribute(ih, "VALUE", "TOGGLE");

/* notify */
SendMessage(GetParent(ih->handle), WM_COMMAND, MAKEWPARAM(0, BN_CLICKED), (LPARAM)ih->handle);

/* remove highlight */
SendMessage(ih->handle, BM_SETSTATE, FALSE, 0);
}

Expand Down
21 changes: 19 additions & 2 deletions src/win/iupwin_toggle.c
Expand Up @@ -329,7 +329,9 @@ static int winToggleSetValueAttrib(Ihandle* ih, const char* value)
Ihandle *radio;
int check;

if (iupStrEqualNoCase(value,"NOTDEF"))
if (iupStrEqualNoCase(value,"TOGGLE"))
check = -1;
else if (iupStrEqualNoCase(value,"NOTDEF"))
check = BST_INDETERMINATE;
else if (iupStrBoolean(value))
check = BST_CHECKED;
Expand All @@ -341,9 +343,13 @@ static int winToggleSetValueAttrib(Ihandle* ih, const char* value)
radio = iupRadioFindToggleParent(ih);
if (radio)
{
Ihandle* last_tg;

int oldcheck = winToggleGetCheck(ih);
if (check == -1)
check = BST_CHECKED;

Ihandle* last_tg = (Ihandle*)iupAttribGet(radio, "_IUPWIN_LASTTOGGLE");
last_tg = (Ihandle*)iupAttribGet(radio, "_IUPWIN_LASTTOGGLE");
if (check)
{
if (iupObjectCheck(last_tg) && last_tg != ih)
Expand All @@ -355,7 +361,18 @@ static int winToggleSetValueAttrib(Ihandle* ih, const char* value)
winToggleSetCheck(ih, check);
}
else
{
if (check == -1)
{
int oldcheck = winToggleGetCheck(ih);
if (oldcheck)
check = BST_UNCHECKED;
else
check = BST_CHECKED;
}

winToggleSetCheck(ih, check);
}

if (ih->data->type==IUP_TOGGLE_IMAGE && !iupwin_comctl32ver6 && !ih->data->flat)
winToggleUpdateImage(ih, winToggleIsActive(ih), check);
Expand Down
4 changes: 2 additions & 2 deletions test/toggle.c
Expand Up @@ -208,9 +208,9 @@ void ToggleTest(void)

toggle1 = IupToggle(NULL, NULL);
toggle2 = IupToggle(NULL, NULL);
toggle3 = IupToggle("Text Toggle", NULL);
toggle3 = IupToggle("&Text Toggle", NULL);
// toggle4 = IupToggle("blue foreground color", NULL);
toggle4 = IupToggle("Radio &Text", NULL);
toggle4 = IupToggle("&Radio Text", NULL);
toggle5 = IupToggle("red background color", NULL);
toggle6 = IupToggle("multiple lines\nsecond line", NULL);
toggle7 = IupToggle("INACTIVE", NULL);
Expand Down

0 comments on commit 0d757e9

Please sign in to comment.