Exemplo n.º 1
0
/* ---------------------------------------------------------------------
 * ShellDlgCreateHook
 * Create dialog controls
 * ---------------------------------------------------------------------
 */
static void
ShellDlgCreateHook(void* w)
{
	CUIWINDOW* win = (CUIWINDOW*) w;
	CUIWINDOW* ctrl;
	SHELLDLGDATA* data = (SHELLDLGDATA*) win->InstData;
	CUIRECT rc;

	WindowGetClientRect(win, &rc);

	ctrl = TerminalNew(win,
		data->pTitle ? data->pTitle : L"",
		rc.X, rc.Y, rc.W, rc.H,
		IDC_TERMINAL,
		CWS_NONE, CWS_NONE);
	WindowCreate(ctrl);
	TerminalSetCoProcExitHook(ctrl, ShellDlgCoProcExitHook, win);

	if (data->pCommand)
	{
		TerminalWrite(ctrl, _T("\033[32m"), wcslen(_T("\033[32m")));
		TerminalWrite(ctrl, data->pCommand, wcslen(data->pCommand));
		TerminalWrite(ctrl, _T("\033[0m\n"), wcslen(_T("\033[0m\n")));
		TerminalRun(ctrl, data->pCommand);
	}
}
Exemplo n.º 2
0
/* ---------------------------------------------------------------------
 * TerminalVScrollHook
 * Terminal scroll bar mouse hook
 * ---------------------------------------------------------------------
 */
static void
TerminalVScrollHook(void* w, int sbcode, int pos)
{
	CUIWINDOW* win = (CUIWINDOW*) w;
	CUIRECT rc;
	int sbpos, range;
	
	CUI_USE_ARG(pos);

	WindowGetClientRect(win, &rc);
	sbpos = WindowGetVScrollPos(win);
	range = WindowGetVScrollRange(win);

	switch(sbcode)
	{
	case SB_LINEUP:
		if (sbpos > 0)
		{
			WindowSetVScrollPos(win, sbpos - 1);
			WindowInvalidate(win);
		}
		break;
	case SB_LINEDOWN:
		if (sbpos < range)
		{
			WindowSetVScrollPos(win, sbpos + 1);
			WindowInvalidate(win);
		}
		break;
	case SB_PAGEUP:
		if (sbpos > 0)
		{
			sbpos -= (rc.H - 1);
			sbpos = (sbpos < 0) ? 0 : sbpos;
			WindowSetVScrollPos(win, sbpos);
			WindowInvalidate(win);
		}
		break;
	case SB_PAGEDOWN:
		if (sbpos < range)
		{
			sbpos += (rc.H - 1);
			sbpos = (sbpos > range) ? range : sbpos;
			WindowSetVScrollPos(win, sbpos);
			WindowInvalidate(win);
		}
		break;
	case SB_THUMBTRACK:
		WindowInvalidate(win);
		break;
	}
}
Exemplo n.º 3
0
/* ---------------------------------------------------------------------
 * ShellDlgSizeHook
 * Handle size events
 * ---------------------------------------------------------------------
 */
static int
ShellDlgSizeHook(void* w)
{
	CUIWINDOW* win = (CUIWINDOW*) w;
	CUIWINDOW* ctrl;
	CUIRECT rc;

	WindowGetClientRect(win, &rc);

	ctrl = WindowGetCtrl(win, IDC_TERMINAL);
	if (ctrl)
	{
		WindowMove(ctrl, 0, 0, rc.W, rc.H);
	}
	return TRUE;
}
Exemplo n.º 4
0
/* ---------------------------------------------------------------------
 * TerminalPaintHook
 * Handle PAINT events by redrawing the list view control
 * ---------------------------------------------------------------------
 */
static void
TerminalPaintHook(void* w)
{
	CUIWINDOW*    win = (CUIWINDOW*) w;
	CUIRECT       rc;
	TERMINALDATA* data;
	int           yscroll;
	int           ypos;
	int           line;

	data = (TERMINALDATA*) win->InstData;
	if (!data) return;

	WindowGetClientRect(win, &rc);
	if ((rc.W <= 0)||(rc.H <= 0)) return;

	yscroll = WindowGetVScrollPos(win);

	ypos = 0;

	line = (data->FirstLine + yscroll) % MAX_TERMLINES;
	while (line != data->YCursor)
	{
		if (ypos < rc.H)
		{
			TerminalShowLine(win, ypos, line, &rc);
			ypos++;
		}
		line = (line + 1) % MAX_TERMLINES;
	}
	if (ypos < rc.H)
	{
		TerminalShowLine(win, ypos, line, &rc);
		ypos++;
	}

	ypos = ((data->YCursor - data->FirstLine + MAX_TERMLINES) % MAX_TERMLINES) - 
		yscroll;

	WindowSetCursor(win, data->XCursor, ypos);
}
Exemplo n.º 5
0
/* ---------------------------------------------------------------------
 * CbDropdownCalcPos
 * Recalculate Listbox position
 * ---------------------------------------------------------------------
 */
static void
CbDropdownCalcPos(CUIWINDOW* win)
{
	CUIRECT      rc;
	COMBOBOXDATA* data = (COMBOBOXDATA*) win->InstData;
	int          range;
	int          pos;  
        
	if (!data) return;
	if (win->IsCreated)
	{
		WindowGetClientRect(win, &rc);
                
		range = data->NumItems - rc.H;
		if (range < 0)
		{
			WindowSetVScrollRange(win, 0);
			WindowSetVScrollPos(win, 0);  
		}
		else
		{   
			WindowSetVScrollRange(win, range);
                        
			pos = WindowGetVScrollPos(win);
			if (data->SelIndex < 0)
			{
				WindowSetVScrollPos(win, 0);
			}
			else if (data->SelIndex - pos >= rc.H)
			{
				WindowSetVScrollPos(win, data->SelIndex - rc.H + 1);
			}
			else if (data->SelIndex - pos < 0)
			{
				WindowSetVScrollPos(win, data->SelIndex);
			}
		}
	}
}
Exemplo n.º 6
0
/* ---------------------------------------------------------------------
 * TerminalWrite
 * Write text into the terminal
 * ---------------------------------------------------------------------
 */
void
TerminalWrite(CUIWINDOW* win, const wchar_t* text, int numchar)
{
	int i;
	int width;

	if (win && (wcscmp(win->Class, _T("TERMINAL")) == 0))
	{
		TERMINALDATA* data = (TERMINALDATA*) win->InstData;
		CUIRECT rc;

		WindowGetClientRect(win, &rc);

		width = rc.W % MAX_TERMCOLS;

		width = rc.W;
		if (width > MAX_TERMCOLS)
		{
			width = MAX_TERMCOLS;
		}
	
		for(i = 0; i < numchar; i++)
		{
			if (data->InputState == STATE_NORMAL)
			{
				if (text[i] == 27)
				{
					data->InputState = STATE_INTRO;
				}
				else
				{
					switch(text[i])
					{
					case _T('\n'):
						TerminalNextLine(win);
						data->XCursor = 0;
						break;
					case _T('\r'):
						data->XCursor = 0;
						break;
					default:
						data->Lines[data->YCursor][data->XCursor] = text[i];
						data->Colors[data->YCursor][data->XCursor] = data->CurAttr;
						if (++data->XCursor >= width)
						{
							TerminalNextLine(win);
							data->XCursor = 0;
						}
					}
				}
			}
			else if (data->InputState == STATE_INTRO)
			{
				if (text[i] == _T('['))
				{
					data->InputState = STATE_SEQUENCE;
					data->InputPos = 0;
				}
				else
				{
					data->InputState = STATE_NORMAL;
					data->Lines[data->YCursor][data->XCursor] = 27;
					data->Colors[data->YCursor][data->XCursor] = data->CurAttr;
					if (++data->XCursor >= width)
					{
						TerminalNextLine(win);
						data->XCursor = 0;
					}
					data->Lines[data->YCursor][data->XCursor] = text[i];
					data->Colors[data->YCursor][data->XCursor] = data->CurAttr;
					if (++data->XCursor >= width)
					{
						TerminalNextLine(win);
						data->XCursor = 0;
					}
				}
			}
			else
			{
				if (data->InputPos < MAX_SEQUENCE)
				{
					data->EscSeq[data->InputPos++] = text[i];
				}
				if ((text[i] >= 64) && (text[i] <= 126))
				{
					data->EscSeq[data->InputPos] = 0;

					TerminalProcessEscSequence(win, &rc);

					data->InputState = STATE_NORMAL;
				}
			}
		}

		WindowInvalidateLayout(win);
	}
}
Exemplo n.º 7
0
/* ---------------------------------------------------------------------
 * TerminalKeyHook
 * Handle EVENT_KEY events
 * ---------------------------------------------------------------------
 */
static int
TerminalKeyHook(void* w, int key)
{
	CUIWINDOW*    win = (CUIWINDOW*) w;
	TERMINALDATA* data = (TERMINALDATA*) win->InstData;
	CUIRECT       rc;
	int           yrange;
	int           yscroll;

	if (!data) return FALSE;

	WindowGetClientRect(win, &rc);

	yscroll = WindowGetVScrollPos(win);
	yrange  = WindowGetVScrollRange(win);

	if (win->IsEnabled)
	{
		/* if the key is processed by the custom callback hook, we
		   are over and done with it, else processing continues */
		if (data->PreKeyHook)
		{
			if (data->PreKeyHook(data->PreKeyTarget, win, key))
			{
				return TRUE;
			}
		}

		switch(key)
		{
		case KEY_DOWN:
			if (yscroll < yrange)
			{
				WindowSetVScrollPos(win, yscroll + 1);
				WindowInvalidate(win);
				TerminalCursorOnOff(win);
			}
			return TRUE;
		case KEY_UP:
			if (yscroll > 0)
			{
				WindowSetVScrollPos(win, yscroll - 1);
				WindowInvalidate(win);
				TerminalCursorOnOff(win);
			}
			return TRUE;
		case KEY_NPAGE:
			if (yscroll < yrange)
			{
				yscroll += (rc.H - 1);
				if (yscroll > yrange)
				{
					yscroll = yrange;
				}
				WindowSetVScrollPos(win, yscroll);
				WindowInvalidate(win);
				TerminalCursorOnOff(win);
			}
			return TRUE;
		case KEY_PPAGE:
			if (yscroll > 0)
			{
				yscroll -= (rc.H - 1);
				if (yscroll < 0)
				{
					yscroll = 0;
				}
				WindowSetVScrollPos(win, yscroll);
				WindowInvalidate(win);
				TerminalCursorOnOff(win);
			}
			return TRUE;
		case KEY_HOME:
			if (yscroll > 0)
			{
				WindowSetVScrollPos(win, 0);
				WindowInvalidate(win);
				TerminalCursorOnOff(win);
			}
			return TRUE;
		case KEY_END:
			if (yscroll < yrange)
			{
				WindowSetVScrollPos(win, yrange);
				WindowInvalidate(win);
				TerminalCursorOnOff(win);
			}
			return TRUE;
		default:
			if (data->CoProc)
			{
				if ((key >= KEY_SPACE) && (key <= 255))
				{
					wchar_t c = (wchar_t) key;
					TerminalCoWrite(data->CoProc, &c, 1);
					return TRUE;
				}
				else if (key == KEY_RETURN)
				{
					TerminalCoWrite(data->CoProc, _T("\n"), 1);
					return TRUE;
				}
			}
			if (data->PostKeyHook)
			{
				if (data->PostKeyHook(data->PostKeyTarget, win, key))
				{
					return TRUE;
				}   
			}
		}
	}
	return FALSE;
}
Exemplo n.º 8
0
/* ---------------------------------------------------------------------
 * CbDropdownPaintHook
 * Handle PAINT events by redrawing the control
 * ---------------------------------------------------------------------
 */
static void
CbDropdownPaintHook(void* w)
{       
	CUIWINDOW*    win = (CUIWINDOW*) w;
	CUIRECT       rc;
	COMBOBOXDATA* data;
	COMBOBOXITEM* item;
	int           pos;
	int           cursor;
	int           index;
	int           len;
	int           x,y;
        
	data = (COMBOBOXDATA*) win->InstData;
	if (!data) return;
        
	WindowGetClientRect(win, &rc);
	if ((rc.W <= 0)||(rc.H <= 0)) return;
        
	pos = WindowGetVScrollPos(win);
	index = 0;
	y = 0;
	cursor = 0;
        
	item = data->FirstItem;
	while(item)
	{       
		if ((index >= pos) && (index < pos + rc.H))
		{       
			len = wcslen(item->ItemText);
			if (index == data->SelIndex)
			{       
				SetColor(win->Win, win->Color.SelTxtColor, win->Color.WndSelColor, TRUE);
				cursor = y;
			}
			else
			{       
				if (win->IsEnabled)
				{       
					SetColor(win->Win, win->Color.WndTxtColor, win->Color.WndColor, FALSE);
				}
				else
				{       
					SetColor(win->Win, win->Color.InactTxtColor, win->Color.WndColor, FALSE);
				}
			}
			MOVEYX(win->Win, y, 0);
			for (x = 0; x < rc.W; x++)
			{       
				if ((x > 0) && (x <= len))
				{
					PRINTN(win->Win, &item->ItemText[x - 1], 1);
				}
				else
				{
					PRINT(win->Win, _T(" "));
				}
			}
			y ++;
		}
		else if (index >= pos + rc.H)
		{
			break;
		}
		index++;
		item = (COMBOBOXITEM*) item->Next;
	}
	WindowSetCursor(win, 0, cursor);
}
Exemplo n.º 9
0
/* ---------------------------------------------------------------------
 * ComboboxPaintHook
 * Handle PAINT events by redrawing the edit control
 * ---------------------------------------------------------------------
 */
static void
ComboboxPaintHook(void* w)
{
	CUIWINDOW*     win = (CUIWINDOW*) w;
	CUIRECT        rc;
	COMBOBOXDATA*  data;
	int            x;
	int            len;
	int            index;
	const wchar_t*   text = _T("");

	data = win->InstData;
	if (!data) return;

	WindowGetClientRect(win, &rc);
	if (rc.W <= 0) return;

	index = data->DropdownState ? data->SelIndex : data->CtrlSelIndex;
	if (index >= 0)
	{
		COMBOBOXITEM* item = ComboboxGetItem(data, index);
		if (item)
		{
			text = item->ItemText;
		}
	}

	len = wcslen(text);
	if (win->IsEnabled)
	{
		SetColor(win->Win, win->Color.SelTxtColor, win->Color.WndSelColor, TRUE);
	}
	else
	{
		SetColor(win->Win, win->Color.InactTxtColor, win->Color.WndSelColor, TRUE);
	}

	MOVEYX(win->Win, 0, 0);
	for(x = 0; x < rc.W - 3; x++)
	{
		if (x < len)
		{
			PRINTN(win->Win, &text[x], 1);
		}
		else
		{
			PRINT(win->Win, _T(" "));
		}
	}

	if (win->IsEnabled)
	{
		SetColor(win->Win, win->Color.WndTxtColor, win->Color.WndColor, TRUE);
	}
	else
	{
		SetColor(win->Win, win->Color.InactTxtColor, win->Color.WndSelColor, TRUE);
	}
	if (rc.W > 3)
	{
		MOVEYX(win->Win, 0, x); PRINT(win->Win, _T("[v]"));
	}
	WindowSetCursor(win, 0, 0);
}
Exemplo n.º 10
0
/* ---------------------------------------------------------------------
 * CbDropdownMButtonHook
 * Button mouse click hook
 * ---------------------------------------------------------------------
 */
static void
CbDropdownMButtonHook(void* w, int x, int y, int flags)
{
	CUIWINDOW* win = (CUIWINDOW*) w;
	COMBOBOXDATA* data = (COMBOBOXDATA*) win->InstData;
	if ((flags & BUTTON1_CLICKED) || (flags & BUTTON1_DOUBLE_CLICKED))
	{
		int offsy = WindowGetVScrollPos(win);
		int nochange = FALSE;
		y += offsy;
                
		WindowReleaseCapture();
                
		if ((y != data->SelIndex) && (y < data->NumItems))
		{
			if (CbDropdownQueryChange(win, data))
			{
				data->SelIndex = y;
				CbDropdownUpdate(win);
				CbDropdownNotifyChange(win, data);
			}
			else
			{   
				nochange = TRUE;
			}
		}
		/* only execute clicked hook, if change was not rejected
		   by the application */
		if (!nochange)
		{
			if (data->SelIndex != data->CtrlSelIndex)
			{
				if (ComboboxQueryChange(data->Ctrl, data))
				{
					data->CtrlSelIndex = data->SelIndex;
					ComboboxNotifyChange(data->Ctrl, data);
				}
			}
			data->CloseKey = KEY_SPACE;
			WindowClose(win, IDOK);
		}
	}
	else if (flags & BUTTON1_PRESSED)
	{
		data->MouseDown = TRUE;
		WindowSetCapture(win); 
	}
	else if ((flags & BUTTON1_RELEASED) && (data->MouseDown))
	{
		CUIRECT rc;
		int nochange = FALSE;
		WindowGetClientRect(win, &rc);
                
		data->MouseDown = FALSE;
		WindowReleaseCapture(); 
                
		if ((x >= rc.X) && (x < (rc.X + rc.W)) &&
		    (y >= rc.Y) && (y < (rc.Y + rc.H)))  
		{
			int offsy = WindowGetVScrollPos(win);
                        
			y += offsy;
                        
			if ((y != data->SelIndex) && (y < data->NumItems))
			{
				CbDropdownQueryChange(win, data);
				data->SelIndex = y;
				CbDropdownUpdate(win);
				CbDropdownNotifyChange(win, data);
			}
			else
			{
				nochange = TRUE;
			}
		}
		if (!nochange)
		{
			if (data->SelIndex != data->CtrlSelIndex)
			{
				if (ComboboxQueryChange(data->Ctrl, data))
				{
					data->CtrlSelIndex = data->SelIndex;
					ComboboxNotifyChange(data->Ctrl, data);
				}
			}
			data->CloseKey = KEY_SPACE;
			WindowClose(win, IDOK);
		}
	}
}
Exemplo n.º 11
0
/* ---------------------------------------------------------------------
 * CbDropdownKeyHook
 * Handle EVENT_KEY events
 * ---------------------------------------------------------------------
 */
static int
CbDropdownKeyHook(void* w, int key)
{
	CUIWINDOW*   win = (CUIWINDOW*) w;
	COMBOBOXDATA* data = (COMBOBOXDATA*) win->InstData;
	CUIRECT      rc;
        
	if (!data) return FALSE;
        
	if (win->IsEnabled)
	{
		switch(key)
		{
		case KEY_UP:
			if ((data->SelIndex > 0) && CbDropdownQueryChange(win, data))
			{
				data->SelIndex--;
				CbDropdownCalcPos(win);
				CbDropdownUpdate(win); 
				CbDropdownNotifyChange(win, data);
			}
			return TRUE;
		case KEY_DOWN:
			if ((data->SelIndex < (data->NumItems - 1)) && CbDropdownQueryChange(win, data))
			{
				data->SelIndex++;
				CbDropdownCalcPos(win);
				CbDropdownUpdate(win); 
				CbDropdownNotifyChange(win, data);
			}
			return TRUE;
		case KEY_PPAGE:
			if ((data->SelIndex > 0) && CbDropdownQueryChange(win, data))
			{
				WindowGetClientRect(win, &rc);
                                
				data->SelIndex -= rc.H - 1;
				if (data->SelIndex < 0)
				{
					data->SelIndex = 0;
				}
				CbDropdownCalcPos(win);
				CbDropdownUpdate(win); 
				CbDropdownNotifyChange(win, data);
			}
			return TRUE;
		case KEY_NPAGE:
			if ((data->SelIndex < (data->NumItems - 1)) && CbDropdownQueryChange(win, data))
			{
				WindowGetClientRect(win, &rc);
                                
				data->SelIndex += rc.H - 1;
				if (data->SelIndex >=  (data->NumItems - 1))
				{
					data->SelIndex = (data->NumItems - 1);
				}
				CbDropdownCalcPos(win);
				CbDropdownUpdate(win); 
				CbDropdownNotifyChange(win, data);
			}
			return TRUE;
		case KEY_SPACE:
		case KEY_RETURN:
			if (data->SelIndex != data->CtrlSelIndex)
			{
				if (ComboboxQueryChange(data->Ctrl, data))
				{
					data->CtrlSelIndex = data->SelIndex;
					ComboboxNotifyChange(data->Ctrl, data);
				}
			}
			data->CloseKey = key;
			WindowClose(win, IDOK);
			return TRUE;
		case KEY_LEFT:
		case KEY_RIGHT:
		case KEY_TAB:
		case KEY_ESC:
			data->CloseKey = key;
			WindowClose(win, IDCANCEL);
			return TRUE;
		}
	}
	return FALSE;
}
Exemplo n.º 12
0
/* ---------------------------------------------------------------------
 * ListboxMButtonHook
 * Button mouse click hook
 * ---------------------------------------------------------------------
 */
static void
ListboxMButtonHook(void* w, int x, int y, int flags)
{
	CUIWINDOW* win = (CUIWINDOW*) w;
	LISTBOXDATA* data = (LISTBOXDATA*) win->InstData;
	
	if ((flags & BUTTON1_CLICKED) || (flags & BUTTON1_DOUBLE_CLICKED))
	{
		int offsy = WindowGetVScrollPos(win);
		int nochange = FALSE;
		y += offsy;

		WindowReleaseCapture();

		if ((y != data->SelIndex) && (y < data->NumItems))
		{
			if (ListboxQueryChange(win, data))
			{
				data->SelIndex = y;
				ListboxUpdate(win);
				ListboxNotifyChange(win, data);
			}
			else
			{
				nochange = TRUE;
			}
		}
		/* only execute clicked hook, if change was not rejected
		   by the application */
		if (!nochange)
		{
			if ((flags & BUTTON1_DOUBLE_CLICKED) && 
				(data->LbClickedHook))
			{
				data->LbClickedHook(data->LbClickedTarget, win);
			}
		}
	}
	else if (flags & BUTTON1_PRESSED)
	{
		data->MouseDown = TRUE;
		WindowSetCapture(win);
	}
	else if ((flags & BUTTON1_RELEASED) && (data->MouseDown))
	{
		CUIRECT rc;
		WindowGetClientRect(win, &rc);

		data->MouseDown = FALSE;
		WindowReleaseCapture();

		if ((x >= rc.X) && (x < (rc.X + rc.W)) &&
			(y >= rc.Y) && (y < (rc.Y + rc.H)))
		{
			int offsy = WindowGetVScrollPos(win);

			y += offsy;

			if ((y != data->SelIndex) && (y < data->NumItems))
			{
				ListboxQueryChange(win, data);
				data->SelIndex = y;
				ListboxUpdate(win);
				ListboxNotifyChange(win, data);
			}
		}
	}
}
Exemplo n.º 13
0
/* ---------------------------------------------------------------------
 * ListboxKeyHook
 * Handle EVENT_KEY events
 * ---------------------------------------------------------------------
 */
static int
ListboxKeyHook(void* w, int key)
{
	CUIWINDOW*   win = (CUIWINDOW*) w;
	LISTBOXDATA* data = (LISTBOXDATA*) win->InstData;
	CUIRECT      rc;

        if (!data) return FALSE;

	if (win->IsEnabled)
	{
		/* if the key is processed by the custom callback hook, we
		   are over and done with it, else processing continues */
		if (data->PreKeyHook)
		{
			if (data->PreKeyHook(data->PreKeyTarget, win, key))
			{
				return TRUE;
			}
		}

		switch(key)
		{
		case KEY_UP:
			if ((data->SelIndex > 0) && ListboxQueryChange(win, data))
			{
				data->SelIndex--;
				ListboxCalcPos(win);
				ListboxUpdate(win);
				ListboxNotifyChange(win, data);
			}
			return TRUE;
		case KEY_DOWN:
			if ((data->SelIndex < (data->NumItems - 1)) && ListboxQueryChange(win, data))
			{
				data->SelIndex++;
				ListboxCalcPos(win);
				ListboxUpdate(win);
				ListboxNotifyChange(win, data);
			}
			return TRUE;
		case KEY_PPAGE:
			if ((data->SelIndex > 0) && ListboxQueryChange(win, data))
			{
				WindowGetClientRect(win, &rc);

				data->SelIndex -= rc.H - 1;
				if (data->SelIndex < 0)
				{
					data->SelIndex = 0;
				}
				ListboxCalcPos(win);
				ListboxUpdate(win);
				ListboxNotifyChange(win, data);
			}
			return TRUE;
		case KEY_NPAGE:
			if ((data->SelIndex < (data->NumItems - 1)) && ListboxQueryChange(win, data))
			{
				WindowGetClientRect(win, &rc);

				data->SelIndex += rc.H - 1;
				if (data->SelIndex >=  (data->NumItems - 1))
				{
					data->SelIndex = (data->NumItems - 1);
				}
				ListboxCalcPos(win);
				ListboxUpdate(win);
				ListboxNotifyChange(win, data);
			}
			return TRUE;
		case KEY_SPACE:
			if (data->LbClickedHook)
			{
				data->LbClickedHook(data->LbClickedTarget, win);
			}
			return TRUE;
		default:
			if (data->PostKeyHook)
			{
				if (data->PostKeyHook(data->PostKeyTarget, win, key))
				{
					return TRUE;
				}   
			}
		}
	}
	return FALSE;
}