Imported Upstream version 1.15.1
[platform/upstream/krb5.git] / src / windows / leash / LeashUICommandHandler.h
1 // -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
2 // leash/LeashUICommandHandler.h - implements IUICommandHandler interfaces
3 //
4 // Copyright (C) 2014 by the Massachusetts Institute of Technology.
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions
9 // are met:
10 //
11 // * Redistributions of source code must retain the above copyright
12 //   notice, this list of conditions and the following disclaimer.
13 //
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
17 //   distribution.
18 //
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.
31
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.
38
39 #ifndef WINDOWS_LEASHUICOMMANDHANDLER_H__
40 #define WINDOWS_LEASHUICOMMANDHANDLER_H__
41
42 #include <UIRibbon.h>
43 #include "LeashUIApplication.h"
44
45 class LeashUICommandHandler : public IUICommandHandler
46 {
47 public:
48     LeashUIApplication *app;
49     // Actual work for creation is done here, not the constructor.
50     static HRESULT CreateInstance(IUICommandHandler **out, HWND hwnd);
51
52     // IUnknown virtual methods
53     ULONG STDMETHODCALLTYPE AddRef();
54     ULONG STDMETHODCALLTYPE Release();
55     HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppv);
56
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,
62                                              REFPROPERTYKEY key,
63                                              const PROPVARIANT *currentValue,
64                                              PROPVARIANT *newValue);
65
66 private:
67     LeashUICommandHandler() : refcnt(1) {}
68     HWND mainwin; // Something to which to send messages.
69     LONG refcnt;
70 };
71
72 #endif // WINDOWS_LEASHUICOMMANDHANDLER_H__