Example #1
0
//---------------------------------------------------------------------------
void __fastcall TAuthenticateForm::FormShow(TObject * /*Sender*/)
{
  AdjustControls();

  if (FFocusControl != NULL)
  {
    ActiveControl = FFocusControl;
  }
}
Example #2
0
void CVAdjustPoint(CharView *cv, SplinePoint *sp) {

    if ( cv->info.x==sp->me.x && cv->info.y==sp->me.y )
return;
    sp->nextcp.x += (cv->info.x-sp->me.x);
    sp->nextcp.y += (cv->info.y-sp->me.y);
    sp->prevcp.x += (cv->info.x-sp->me.x);
    sp->prevcp.y += (cv->info.y-sp->me.y);
    sp->me.x = cv->info.x;
    sp->me.y = cv->info.y;
    AdjustControls(sp);
    CVSetCharChanged(cv,true);
}
Example #3
0
//---------------------------------------------------------------------------
__fastcall TCopyDialog::TCopyDialog(
  TComponent* Owner, bool ToRemote, bool Move, TStrings * FileList, int Options, int CopyParamAttrs)
        : TForm(Owner)
{
  FToRemote = ToRemote;
  FMove = Move;
  FOptions = Options;
  FCopyParamAttrs = CopyParamAttrs;
  FFileList = FileList;

  FOutputOptions = 0;

  AdjustControls();

  FPresetsMenu = new TPopupMenu(this);

  HotTrackLabel(CopyParamLabel);
  CopyParamListButton(TransferSettingsButton);

  UseSystemSettings(this);
}
Example #4
0
//---------------------------------------------------------------------------
bool __fastcall TAuthenticateForm::Execute(UnicodeString Status, TPanel * Panel,
  TWinControl * FocusControl, TButton * DefaultButton, TButton * CancelButton,
  bool FixHeight, bool Zoom, bool ForceLog)
{
  TModalResult DefaultButtonResult;
  TAlign Align = Panel->Align;
  try
  {
    assert(FStatus.IsEmpty());
    FStatus = Status;
    DefaultButton->Default = true;
    CancelButton->Cancel = true;

    DefaultButtonResult = DefaultResult(this);

    if (Zoom)
    {
      Panel->Align = alClient;
    }

    if (ForceLog || Visible)
    {
      if (ClientHeight < Panel->Height)
      {
        ClientHeight = Panel->Height;
      }
      // Panel being hidden gets not realigned automatically, even if it
      // has Align property set
      Panel->Top = ClientHeight - Panel->Height;
      Panel->Show();
      TCursor PrevCursor = Screen->Cursor;
      try
      {
        if (Zoom)
        {
          LogView->Hide();
        }
        else
        {
          if (LogView->Items->Count > 0)
          {
            TListItem * Item = LogView->ItemFocused;
            if (Item == NULL)
            {
              Item = LogView->Items->Item[LogView->Items->Count - 1];
            }
            Item->MakeVisible(false);
          }
        }
        Screen->Cursor = crDefault;

        if (!Visible)
        {
          assert(ForceLog);
          ShowAsModal();
        }

        ActiveControl = FocusControl;
        ModalResult = mrNone;
        AdjustControls();
        do
        {
          Application->HandleMessage();
        }
        while (!Application->Terminated && (ModalResult == mrNone));
      }
      __finally
      {
        Panel->Hide();
        Screen->Cursor = PrevCursor;
        if (Zoom)
        {
          LogView->Show();
        }
        Repaint();
      }
    }
    else
    {
      int PrevHeight = ClientHeight;
      int PrevMinHeight = Constraints->MinHeight;
      int PrevMaxHeight = Constraints->MaxHeight;
      try
      {
        Constraints->MinHeight = 0;
        ClientHeight = Panel->Height;
        if (FixHeight)
        {
          Constraints->MinHeight = Height;
          Constraints->MaxHeight = Height;
        }
        LogView->Hide();
        Panel->Show();
        FFocusControl = FocusControl;

        ShowModal();
      }
      __finally
      {
        FFocusControl = NULL;
        ClientHeight = PrevHeight;
        Constraints->MinHeight = PrevMinHeight;
        Constraints->MaxHeight = PrevMaxHeight;
        Panel->Hide();
        LogView->Show();
      }
    }
  }
//-----------------------------------------------------------------------------
// Purpose: called automatically on a resize.
//			calls the function to move the bar's controls around on a resize.
//			also calls the CWnd OnSize so it can do what it needs to.  
// Input  : passed in by windows
//			UINT nType
//			int cx - change in width
//			int cy - change in height
// Output : void
//-----------------------------------------------------------------------------
void CHammerBar::OnSize( UINT nType, int cx, int cy )
{
	CWnd::OnSize( nType, cx, cy );
	AdjustControls();
	
}
Example #6
0
void DoWaWEConfigureWindow(HWND hwndOwner)
{
  SWP swpTemp, swpParent;
  POINTL ptlTemp;
  unsigned short usTabTextLength=0, usTabTextHeight=0;

  // The user wants to configure WaWE!

  // Save old config for Undo!
  memcpy(&WaWEUndoConfiguration, &WaWEConfiguration, sizeof(WaWEConfiguration));

  // For this, we'll create a notebook window.
  // The first page of the notebook will contain the cache settings.
  // Later, it can have more notebook tabs, if required.

#ifdef DEBUG_BUILD
  printf("[DoWaWEConfigureWindow] : Loading dialog from EXE...\n");
#endif

  hwndConfigDlg=WinLoadDlg(HWND_DESKTOP, hwndOwner, (PFNWP)ConfigDlgProc, NULL,
                          DLG_CONFIGURATION, NULL);

  if (!hwndConfigDlg)
  {
#ifdef DEBUG_BUILD
    printf("[DoWaWEConfigureWindow] : Could not load resource!\n");
#endif
    return;
  }

#ifdef DEBUG_BUILD
  printf("[DoWaWEConfigureWindow] : Dialog loaded, others come...\n");
#endif

  // Query the handle of the notebook control
  hwndConfigNB = WinWindowFromID(hwndConfigDlg, NB_CONFIGURATION);

  // Now load and add the pages, one by one...
  hwndCacheNBP = WinLoadDlg(hwndConfigNB, hwndConfigNB, (PFNWP) fnCacheNotebookPage,
                            NULL, DLG_CONFIGURATION_CACHE, NULL);
  hwndInterfaceNBP = WinLoadDlg(hwndConfigNB, hwndConfigNB, (PFNWP) fnInterfaceNotebookPage,
                                NULL, DLG_CONFIGURATION_INTERFACE, NULL);

  // Save the size of one notebook page for later use.
  // (after adding, it will be resized, because of the AUDIOSIZE flag of notebook!)
  WinQueryWindowPos(hwndCacheNBP, &swpTemp);

  // Add pages to notebook:
  AddNotebookTab(hwndConfigNB, hwndInterfaceNBP, BKA_MAJOR, "Interface", "Interface settings", &(ulInterfaceNBPID), &usTabTextLength, &usTabTextHeight);
  AddNotebookTab(hwndConfigNB, hwndCacheNBP, BKA_MAJOR, "Cache", "Read-cache settings", &(ulCacheNBPID), &usTabTextLength, &usTabTextHeight);

  // The followings are discarder on Warp4, but makes things look better on Warp3:

  // Set notebook info field color (default is white... Yipe...)
  WinSendMsg(hwndConfigNB,
             BKM_SETNOTEBOOKCOLORS,
	     MPFROMLONG(SYSCLR_FIELDBACKGROUND), MPFROMSHORT(BKA_BACKGROUNDPAGECOLORINDEX));
  // Adjust tab size:
  WinSendMsg(hwndConfigNB,
             BKM_SETDIMENSIONS,
             MPFROM2SHORT(usTabTextLength + 10, (SHORT)((float)usTabTextHeight * 0.8)),
	     MPFROMSHORT(BKA_MAJORTAB));
  WinSendMsg(hwndConfigNB,
	     BKM_SETDIMENSIONS,
             MPFROM2SHORT(0, 0),
	     MPFROMSHORT(BKA_MINORTAB));


  // Adjust controls and window size
  AdjustControls(swpTemp.cx, swpTemp.cy);

  // Position the window in the middle of its parent!
  WinQueryWindowPos(hwndOwner, &swpParent);
  ptlTemp.x = swpParent.x;
  ptlTemp.y = swpParent.y;
  WinMapWindowPoints(hwndOwner, HWND_DESKTOP, &ptlTemp, 1);
  swpParent.x = ptlTemp.x;
  swpParent.y = ptlTemp.y;
  WinQueryWindowPos(hwndConfigDlg, &swpTemp);
  swpTemp.x = (swpParent.cx-swpTemp.cx)/2 + swpParent.x;
  swpTemp.y = (swpParent.cy-swpTemp.cy)/2 + swpParent.y;
  WinSetWindowPos(hwndConfigDlg, HWND_TOP,
                  swpTemp.x, swpTemp.y,
                  0, 0,
                  SWP_MOVE);

  // Show window
  WinShowWindow(hwndConfigDlg, TRUE);
  WinSetFocus(HWND_DESKTOP, hwndConfigNB);

#ifdef DEBUG_BUILD
  printf("[DoWaWEConfigureWindow] : Processing config window...\n");
#endif
  // Process messages
  WinProcessDlg(hwndConfigDlg);

#ifdef DEBUG_BUILD
  printf("[DoWaWEConfigureWindow] : End of configuration!\n");
#endif

  // Now cleanup
  WinDestroyWindow(hwndConfigDlg);
}
void CBCGPMessageBox::PreInitDialog ()
{
	CBCGPDialog::PreInitDialog ();

	// Setting font

	NONCLIENTMETRICS ncm;
	ZeroMemory (&ncm, sizeof (ncm));
	ncm.cbSize = sizeof (ncm);
	::SystemParametersInfo (SPI_GETNONCLIENTMETRICS, 0, (LPVOID)&ncm, 0);
	m_fntText.CreateFontIndirect (&ncm.lfMessageFont);

	// Calculating gaps, spaces and margins

	{
		MapDialogRect (&m_rectClientMargins);

		CRect rectTemp (m_cxIconSpacing, m_cyVerticalSpacing, m_cxButtonSpacing, m_cyCheckBoxHeight);
		MapDialogRect (&rectTemp);
		m_cxIconSpacing = rectTemp.left;
		m_cyVerticalSpacing = rectTemp.top;
		m_cxButtonSpacing = rectTemp.right;
		m_cyCheckBoxHeight = rectTemp.bottom;

		rectTemp.TopLeft () = m_szButton;
		MapDialogRect (&rectTemp);
		m_szButton = rectTemp.TopLeft ();
	}

	// Creating buttons

	m_bHasCancelButton = false;
	m_ptNextButtonPos.x = 0;
	m_ptNextButtonPos.y = 0;

	HINSTANCE hInst = ::LoadLibrary (_T("user32.dll"));

	if (!m_Params.bIgnoreStandardButtons)
	{
		switch (m_Params.dwStyle & MB_TYPEMASK)
		{
		case MB_OK:
			AddButton (IDOK, hInst);
			break;
		case MB_OKCANCEL:
			AddButton (IDOK, hInst);
			AddButton (IDCANCEL, hInst);
			break;
		case MB_ABORTRETRYIGNORE:
			AddButton (IDABORT, hInst);
			AddButton (IDRETRY, hInst);
			AddButton (IDIGNORE, hInst);
			break;
		case MB_YESNO:
			AddButton (IDYES, hInst);
			AddButton (IDNO, hInst);
			break;
		case MB_YESNOCANCEL:
			AddButton (IDYES, hInst);
			AddButton (IDNO, hInst);
			AddButton (IDCANCEL, hInst);
			break;
		case MB_RETRYCANCEL:
			AddButton (IDRETRY, hInst);
			AddButton (IDCANCEL, hInst);
			break;

		case MB_CANCELTRYCONTINUE:
			AddButton (IDCANCEL, hInst);
			AddButton (IDTRYAGAIN, hInst);
			AddButton (IDCONTINUE, hInst);
			break;
		}
	}

	for (int iBtn = 0; iBtn < BCGP_MSGBOXPARAMS::UserButtonsCount; ++iBtn)
	{
		if (m_Params.uiUserButtonID [iBtn] != 0)
		{
			LPCTSTR pszCaption = m_Params.lpszUserButtonText[iBtn];
			AddButton (m_Params.uiUserButtonID [iBtn], pszCaption == NULL ? hInst : m_Params.hInstance, pszCaption);
		}
	}

	if (hInst != NULL)
	{
		::FreeLibrary (hInst);
	}

	int nBtnCount = (int)m_arrButtons.GetSize ();
	ASSERT (nBtnCount != 0);

	if (nBtnCount == 1 && (m_Params.dwStyle & MB_TYPEMASK) == MB_OK)
	{
		m_bHasCancelButton = true;
	}

	// Calculate window size

	int nMinClientWidth = m_ptNextButtonPos.x;

	CRect rectScreen;
	::SystemParametersInfo (SPI_GETWORKAREA, 0, (LPVOID)&rectScreen, 0);

	int nMaxMessageBoxWidth = (rectScreen.Width () / 2) + 80;

	m_rectText.SetRect (0, 0, nMaxMessageBoxWidth, rectScreen.Height() - m_szButton.cy - m_cxButtonSpacing);
	if (!m_rectIcon.IsRectEmpty ())
	{
		m_rectText.right -= (m_rectIcon.Width () + m_cxIconSpacing);
	}


	HDC hdcScreen = ::GetDC (NULL); // Screen DC
	HFONT hOldFont =  (HFONT)::SelectObject (hdcScreen, m_fntText);

	m_dwDrawTextFlags = DT_NOPREFIX | DT_WORDBREAK | DT_EXPANDTABS;

	::DrawText (hdcScreen, m_strMessageText, -1, &m_rectText, m_dwDrawTextFlags | DT_CALCRECT);

	m_dwDrawTextFlags |= (m_bRightAlignment ? DT_RIGHT : DT_LEFT);

	// Calculate minimal width for message box window

	if (m_Params.bShowCheckBox)
	{
		SIZE szCheckBox;
		::GetTextExtentPoint32 (hdcScreen, m_strCheckBox, m_strCheckBox.GetLength (), &szCheckBox);
		szCheckBox.cx += 2 * m_cyCheckBoxHeight;
		if (m_hMessageIcon != NULL)
		{
			szCheckBox.cx += m_rectIcon.Width ();
		}
		nMinClientWidth = max (nMinClientWidth, szCheckBox.cx);
	}

	::SelectObject (hdcScreen, hOldFont);
	::ReleaseDC (NULL, hdcScreen);

	CSize szTotal (m_rectText.Width (), m_rectText.Height ());
	if (m_hMessageIcon != NULL)
	{
		CSize szTextOffset (m_rectIcon.Width () + m_cxIconSpacing, 0);

		if (m_rectIcon.Height () > m_rectText.Height ())
		{
			// Center text vertically against icon
			szTextOffset.cy = (m_rectIcon.Height () - m_rectText.Height()) / 2;
		}

		m_rectText.OffsetRect (szTextOffset);

		szTotal.cx += m_rectIcon.Width () + m_cxIconSpacing;
		szTotal.cy = max (szTotal.cy, m_rectIcon.Height ());
	}

	if (szTotal.cx < nMinClientWidth)
	{
		szTotal.cx = nMinClientWidth;
	}
	szTotal.cy += m_cyVerticalSpacing;

	if (m_bRightAlignment)
	{
		m_rectText.OffsetRect (szTotal.cx - m_rectText.right, 0);
	}

	// Adjusting buttons

	int yButtons = szTotal.cy + m_rectClientMargins.top;

	// Add check box if necessary

	m_cySeparatorLine = -1;

	if (m_Params.bShowCheckBox)
	{
		int xCheckBox = m_rectClientMargins.left;
		if (m_hMessageIcon != NULL)
		{
			xCheckBox += m_rectIcon.Width () + m_cxIconSpacing;
		}

		CRect rectCheckBox (xCheckBox, yButtons, m_rectClientMargins.left + szTotal.cx, yButtons + m_cyCheckBoxHeight);
		int yOffset = rectCheckBox.Height () + m_cyVerticalSpacing;

		if (m_Params.bShowSeparator)
		{
			m_cySeparatorLine = rectCheckBox.top;
			rectCheckBox.OffsetRect (0, m_cyVerticalSpacing);
			yOffset += m_cyVerticalSpacing;
		}

		m_wndDontAskCheckBox.Create (m_strCheckBox,
			WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_AUTOCHECKBOX,
			rectCheckBox, this, 0);

		if (m_Params.bIsChecked)
		{
			m_wndDontAskCheckBox.SetCheck(TRUE);
		}

		yButtons += yOffset;
		szTotal.cy += yOffset;
	}

	m_rectIcon.OffsetRect (m_rectClientMargins.left, m_rectClientMargins.top);
	m_rectText.OffsetRect (m_rectClientMargins.left, m_rectClientMargins.top);

	CRect rectButtons (m_rectClientMargins.left, yButtons, m_rectClientMargins.right + szTotal.cx, yButtons);
	AdjustControls (&m_arrButtons[0], (UINT)m_arrButtons.GetSize (), rectButtons, TA_CENTER);

	szTotal.cy += m_szButton.cy; // place for buttons

	CRect rectClient (0, 0, szTotal.cx, szTotal.cy);
	rectClient.InflateRect (m_rectClientMargins);

	AdjustWindowRectEx (&rectClient, 
		::GetWindowLong (GetSafeHwnd (), GWL_STYLE) | WS_CAPTION | WS_BORDER,
		false,
		::GetWindowLong (GetSafeHwnd (), GWL_EXSTYLE)
		);

	SetWindowPos (NULL, 0, 0, rectClient.Width (), rectClient.Height (),
		SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOSENDCHANGING);

	if (!m_bHasCancelButton)
	{
		GetSystemMenu (FALSE)->EnableMenuItem (SC_CLOSE, MF_GRAYED);
		UpdateCaptionButtons();
	}
}
// --------------------------------------------------------------------------------------
static void handleEvents(EventRecord *event)
{
	WindowRef window;
	Boolean activate;
	WindowPartCode partCode;
	OSErr error;
	Rect tempRect, newSize;
	long menuChoice;
	MenuCommand commandID;
	RgnHandle grayRegion;
	
	switch (event->what)	// handle events according to the priority 
	{						// determined by the system
		case activateEvt:
			window = (WindowRef)event->message;
			activate = (event->modifiers & activeFlag) != 0;
			HandleActivate(window, activate);
			break;
		
		case mouseDown:
			partCode = FindWindow(event->where, &window);
			
			switch(partCode)
			{
				case inMenuBar:
					menuChoice = MenuSelect(event->where);
					error = GetMenuItemCommandID(GetMenuRef(HiWord(menuChoice)), 
 													LoWord(menuChoice), &commandID);
					if (error == noErr)
					{
						if (commandID == 0)		// if the menu item clicked on does not have 
							commandID = (MenuCommand)menuChoice;	// a command ID
						HandleMenuChoice(commandID);
					}
					break;
				
				case inSysWindow:
					if (window != NULL)
						SystemClick(event, window);
					break;
				
				case inContent:		// the following window part codes will only be returned 
					if (window != FrontWindow())				// for the preferences window
						SelectWindow(window);
					else
						HandleContentClick(window, event->where, event->modifiers);
					break;
				
				case inDrag:
					grayRegion = GetGrayRgn();
					DragWindow(window, event->where, &((*grayRegion)->rgnBBox));
					break;
				
				case inGrow:	
					SetRect(&tempRect, kPrefsWindowPlatinumWidth, kPrefsWindowPlatinumHeight, 
							SHRT_MAX, SHRT_MAX);
					ResizeWindow(window, event->where, &tempRect, &newSize);
					AdjustControls(window);
					break;
				
				case inGoAway:
					ClosePrefsWindow(window);
					break;
			}
			break;
		
		case keyDown:
		case autoKey:	// a separate auto key handler would go after disk events
			if ((event->modifiers & cmdKey) != 0)
			{
				UInt32 keyMenuChoice;
				
				keyMenuChoice = MenuEvent(event);
				error = GetMenuItemCommandID(GetMenuRef(HiWord(keyMenuChoice)), 
												LoWord(keyMenuChoice), &commandID);
				if (error == noErr)
				{
					if (commandID == 0)		// if the menu item chosen does not have a 
						commandID = (MenuCommand)keyMenuChoice;		// command ID 
					HandleMenuChoice(commandID);					// (but they all should)
				}
			}
			else
			{
				window = FrontNonFloatingWindow();
				if (window != NULL)
				{
					char keyCode = (event->message & keyCodeMask) >> 8;
					
					HandleKeyDown(keyCode, window);
				}
			}
			break;
		
		case diskEvt:
			if (HiWord(event->message) != noErr) 
			{
				Point where;
			
				SetPt(&where, 70, 50);
				ShowCursor();
				DIBadMount(where, event->message);
			}		
			break;
		
		case updateEvt:
			window = (WindowRef)event->message;
			SetPortWindowPort(window);
			
			BeginUpdate(window);
			HandleDrawContent(window);
			EndUpdate(window);
			break;
		
		case kHighLevelEvent:		// an OS Event handler would go before high level events
			AEProcessAppleEvent(event);
			break;
	}
Example #9
0
// --------------------------------------------------------------------------------------
static pascal OSStatus windowEventHandler(EventHandlerCallRef nextHandler, EventRef event,
        void *junk)
{
#pragma unused (nextHandler, junk)

    OSStatus result = eventNotHandledErr;
    UInt32 eventClass, eventKind;
    WindowRef prefsWindow;
    Point mouseLocation, minWindowBounds;
    UInt32 modifiers;
    ControlRef listScrollBar;
    ListHandle iconList;
    Rect iconListRect;

    eventClass = GetEventClass(event);
    eventKind = GetEventKind(event);

    switch (eventClass)
    {
    case kEventClassWindow:
        GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL,
                          sizeof(WindowRef), NULL, &prefsWindow);

        switch (eventKind)
        {
        case kEventWindowActivated:
            HandleActivate(prefsWindow, true);
            result = noErr;
            break;

        case kEventWindowDeactivated:
            HandleActivate(prefsWindow, false);
            result = noErr;
            break;

        case kEventWindowHandleContentClick:
            GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL,
                              sizeof(Point), NULL, &mouseLocation);
            GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL,
                              sizeof(UInt32), NULL, &modifiers);

            HandleContentClick(prefsWindow, mouseLocation, (EventModifiers)modifiers);
            result = noErr;
            break;

        case kEventWindowGetMinimumSize:
            SetPt(&minWindowBounds, gPrefsWindowWidth, gPrefsWindowHeight);
            SetEventParameter(event, kEventParamDimensions, typeQDPoint, sizeof(Point),
                              &minWindowBounds);
            result = noErr;
            break;

        case kEventWindowResizeCompleted:
            AdjustControls(prefsWindow);
            result = noErr;
            break;

        case kEventWindowClose:
            ClosePrefsWindow(prefsWindow);
            result = noErr;
            break;

        case kEventWindowDrawContent:
            HandleDrawContent(prefsWindow);
            result = noErr;
            break;

        case kEventWindowContextualMenuSelect:
            result = noErr;		// eat contextual menu clicks
            break;
        }
        break;

    case kEventClassControl:	// we need to respond to clicks in the list's scroll bar
        switch (eventKind)				// kEventControlClick instead of kEventControlHit
        {   // because the control click must be tracked
        case kEventControlClick:	// with LClick instead of the default handler
            GetEventParameter(event, kEventParamDirectObject, typeControlRef,
                              NULL, sizeof(ControlRef), NULL, &listScrollBar);

            prefsWindow = GetControlOwner(listScrollBar);
            GetWindowProperty(prefsWindow, kAppSignature, kIconListTag,
                              sizeof(ListHandle), NULL, &iconList);
            if (listScrollBar == GetListVerticalScrollBar(iconList))
            {
                GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL,
                                  sizeof(Point), NULL, &mouseLocation);
                GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL,
                                  sizeof(UInt32), NULL, &modifiers);

                HandleContentClick(prefsWindow, mouseLocation,
                                   (EventModifiers)modifiers);
                result = noErr;
            }
            break;
        }
        break;

    case kEventClassMouse:
        switch (eventKind)
        {
        case kEventMouseWheelMoved:
            GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL,
                              sizeof(Point), NULL, &mouseLocation);
            GlobalToLocal(&mouseLocation);

            GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL,
                              sizeof(WindowRef), NULL, &prefsWindow);
            GetWindowProperty(prefsWindow, kAppSignature, kIconListTag,
                              sizeof(ListHandle), NULL, &iconList);
            GetListViewBounds(iconList, &iconListRect);
            iconListRect.right += kScrollBarWidth;

            if (PtInRect(mouseLocation, &iconListRect))
            {
                EventMouseWheelAxis axis;
                long mouseWheelDelta;
                SInt16 pixelDepth;
                Boolean isColorDevice;

                GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis,
                                  NULL, sizeof(EventMouseWheelAxis), NULL, &axis);
                GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger,
                                  NULL, sizeof(long), NULL, &mouseWheelDelta);

                GetWindowDeviceDepthAndColor(prefsWindow, &pixelDepth, &isColorDevice);
                SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice);
                // LScroll draws the newly visible cells immediately
                if (axis == kEventMouseWheelAxisX)			// (no update event)
                    LScroll(-mouseWheelDelta, 0, iconList);
                else	// axis == kEventMouseWheelAxisY
                    LScroll(0, -mouseWheelDelta, iconList);

                result = noErr;
            }
            break;
        }
        break;

    case kEventClassTextInput:
        switch (eventKind)
        {
        case kEventTextInputUnicodeForKeyEvent:
            prefsWindow = FrontNonFloatingWindow();

            if (prefsWindow != NULL)
            {
                EventRef keyboardEvent;
                UInt32 keyCode;

                GetEventParameter(event, kEventParamTextInputSendKeyboardEvent,
                                  typeEventRef, NULL, sizeof(EventRef), NULL,
                                  &keyboardEvent);
                GetEventParameter(keyboardEvent, kEventParamKeyCode, typeUInt32, NULL,
                                  sizeof(UInt32), NULL, &keyCode);

                HandleKeyDown((char)keyCode, prefsWindow);
                result = noErr;
            }
            break;
        }
        break;
    }

    return result;
} // windowEventHandler