Path: blob/main/crypto/krb5/src/windows/leash/LeashUICommandHandler.h
34889 views
// -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-1// leash/LeashUICommandHandler.h - implements IUICommandHandler interfaces2//3// Copyright (C) 2014 by the Massachusetts Institute of Technology.4// All rights reserved.5//6// Redistribution and use in source and binary forms, with or without7// modification, are permitted provided that the following conditions8// are met:9//10// * Redistributions of source code must retain the above copyright11// notice, this list of conditions and the following disclaimer.12//13// * Redistributions in binary form must reproduce the above copyright14// notice, this list of conditions and the following disclaimer in15// the documentation and/or other materials provided with the16// distribution.17//18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS21// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE22// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,23// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES24// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR25// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)26// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,27// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)28// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED29// OF THE POSSIBILITY OF SUCH DAMAGE.3031// This file contains the class definition for the leash implementation32// of the UICommandHandler interface. Its primary responsibility is33// to accept UI events (i.e., button presses) and perform the34// corresponding actions to the leash data structures and display35// presentation. It also supplies values for the state of various36// interface elements when the framework needs an authoritative value.3738#ifndef WINDOWS_LEASHUICOMMANDHANDLER_H__39#define WINDOWS_LEASHUICOMMANDHANDLER_H__4041#include <UIRibbon.h>42#include "LeashUIApplication.h"4344class LeashUICommandHandler : public IUICommandHandler45{46public:47LeashUIApplication *app;48// Actual work for creation is done here, not the constructor.49static HRESULT CreateInstance(IUICommandHandler **out, HWND hwnd);5051// IUnknown virtual methods52ULONG STDMETHODCALLTYPE AddRef();53ULONG STDMETHODCALLTYPE Release();54HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppv);5556// IUICommandHandler virtual methods57HRESULT STDMETHODCALLTYPE Execute(UINT32 commandId, UI_EXECUTIONVERB verb,58const PROPERTYKEY *key, const PROPVARIANT *currentValue,59IUISimplePropertySet *commandExecutionProperties);60HRESULT STDMETHODCALLTYPE UpdateProperty(UINT32 commandId,61REFPROPERTYKEY key,62const PROPVARIANT *currentValue,63PROPVARIANT *newValue);6465private:66LeashUICommandHandler() : refcnt(1) {}67HWND mainwin; // Something to which to send messages.68LONG refcnt;69};7071#endif // WINDOWS_LEASHUICOMMANDHANDLER_H__727374