|
9 | 9 | namespace SharpShell.SharpDeskBand
|
10 | 10 | {
|
11 | 11 | [ServerType(ServerType.ShellDeskBand)]
|
12 |
| - public abstract class SharpDeskBand : SharpShellServer, IDeskBand2, IPersistStream, IObjectWithSite |
| 12 | + public abstract class SharpDeskBand : SharpShellServer, IDeskBand2, IPersistStream, IObjectWithSite, IInputObject |
13 | 13 | {
|
14 | 14 | protected SharpDeskBand()
|
15 | 15 | {
|
@@ -372,6 +372,51 @@ int IDeskBand2.GetCompositionState(out bool pfCompositionEnabled)
|
372 | 372 |
|
373 | 373 | #endregion
|
374 | 374 |
|
| 375 | + #region Implementation of IInputObject |
| 376 | + |
| 377 | + /// <summary> |
| 378 | + /// UI-activates or deactivates the object. |
| 379 | + /// </summary> |
| 380 | + /// <param name="fActivate">Indicates if the object is being activated or deactivated. If this value is nonzero, the object is being activated. If this value is zero, the object is being deactivated.</param> |
| 381 | + /// <param name="msg">A pointer to an MSG structure that contains the message that caused the activation change. This value may be NULL.</param> |
| 382 | + /// <returns> |
| 383 | + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. |
| 384 | + /// </returns> |
| 385 | + int IInputObject.UIActivateIO(bool fActivate, ref MSG msg) |
| 386 | + { |
| 387 | + // Set the focus to the UI if requested. |
| 388 | + if (fActivate) |
| 389 | + lazyDeskBand.Value.Focus(); |
| 390 | + |
| 391 | + // We're done. |
| 392 | + return WinError.S_OK; |
| 393 | + } |
| 394 | + |
| 395 | + /// <summary> |
| 396 | + /// Determines if one of the object's windows has the keyboard focus. |
| 397 | + /// </summary> |
| 398 | + /// <returns> |
| 399 | + /// Returns S_OK if one of the object's windows has the keyboard focus, or S_FALSE otherwise. |
| 400 | + /// </returns> |
| 401 | + int IInputObject.HasFocusIO() |
| 402 | + { |
| 403 | + return lazyDeskBand.Value.ContainsFocus ? WinError.S_OK : WinError.S_FALSE; |
| 404 | + } |
| 405 | + |
| 406 | + /// <summary> |
| 407 | + /// Enables the object to process keyboard accelerators. |
| 408 | + /// </summary> |
| 409 | + /// <param name="msg">The address of an MSG structure that contains the keyboard message that is being translated.</param> |
| 410 | + /// <returns> |
| 411 | + /// Returns S_OK if the accelerator was translated, or S_FALSE otherwise. |
| 412 | + /// </returns> |
| 413 | + int IInputObject.TranslateAcceleratorIO(ref MSG msg) |
| 414 | + { |
| 415 | + return WinError.S_OK; |
| 416 | + } |
| 417 | + |
| 418 | + #endregion |
| 419 | + |
375 | 420 | #region Custom Registration and Unregistration
|
376 | 421 |
|
377 | 422 | /// <summary>
|
|
0 commit comments