1 // -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
2 // leash/LeashUICommandHandler.h - implements IUICommandHandler interfaces
4 // Copyright (C) 2014 by the Massachusetts Institute of Technology.
5 // All rights reserved.
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions
11 // * Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
14 // * Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in
16 // the documentation and/or other materials provided with the
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 // COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30 // OF THE POSSIBILITY OF SUCH DAMAGE.
32 // This file contains the class definition for the leash implementation
33 // of the UICommandHandler interface. Its primary responsibility is
34 // to accept UI events (i.e., button presses) and perform the
35 // corresponding actions to the leash data structures and display
36 // presentation. It also supplies values for the state of various
37 // interface elements when the framework needs an authoritative value.
39 #ifndef WINDOWS_LEASHUICOMMANDHANDLER_H__
40 #define WINDOWS_LEASHUICOMMANDHANDLER_H__
43 #include "LeashUIApplication.h"
45 class LeashUICommandHandler : public IUICommandHandler
48 LeashUIApplication *app;
49 // Actual work for creation is done here, not the constructor.
50 static HRESULT CreateInstance(IUICommandHandler **out, HWND hwnd);
52 // IUnknown virtual methods
53 ULONG STDMETHODCALLTYPE AddRef();
54 ULONG STDMETHODCALLTYPE Release();
55 HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppv);
57 // IUICommandHandler virtual methods
58 HRESULT STDMETHODCALLTYPE Execute(UINT32 commandId, UI_EXECUTIONVERB verb,
59 const PROPERTYKEY *key, const PROPVARIANT *currentValue,
60 IUISimplePropertySet *commandExecutionProperties);
61 HRESULT STDMETHODCALLTYPE UpdateProperty(UINT32 commandId,
63 const PROPVARIANT *currentValue,
64 PROPVARIANT *newValue);
67 LeashUICommandHandler() : refcnt(1) {}
68 HWND mainwin; // Something to which to send messages.
72 #endif // WINDOWS_LEASHUICOMMANDHANDLER_H__