Path: blob/main/crypto/krb5/src/windows/leash/LeashUIApplication.h
34889 views
// -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-1// leash/LeashUIApplication.h - UIApplication implementation for Leash2//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// The class description for the LeashUIApplication class, which32// implements the UIApplication interfaces. All applications using33// the windows framework are required to implement this interface.34// Leash is an MFC application, but in order to use the ribbon35// from the windows framework, we must implement this interface so36// that we have a UIApplication to hang the ribbon off of, even if we37// do not make use of any other UIApplication features.3839#ifndef LEASH_LEASHUIAPPLICATION_H__40#define LEASH_LEASHUIAPPLICATION_H__4142#include <UIRibbon.h>4344#define WM_RIBBON_RESIZE (WM_USER + 10)4546class LeashUIApplication : public IUIApplication47{48public:49// The "ribbon state" here is just whether it's minimized, and the50// contents of the Quick Access Toolbar.51HRESULT LoadRibbonState(IUIRibbon *ribbon);52HRESULT SaveRibbonState();53// Export how much space the ribbon is taking up.54UINT GetRibbonHeight();55// Do the real work here, not in the constructor56static HRESULT CreateInstance(IUIApplication **out, HWND hwnd);5758// IUnknown virtual methods59ULONG STDMETHODCALLTYPE AddRef();60ULONG STDMETHODCALLTYPE Release();61HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppv);6263// IUIApplication virtual methods64HRESULT STDMETHODCALLTYPE OnViewChanged(UINT32 viewId, UI_VIEWTYPE typeID,65IUnknown *view, UI_VIEWVERB verb,66INT32 uReasonCode);67HRESULT STDMETHODCALLTYPE68OnCreateUICommand(UINT32 commandId, UI_COMMANDTYPE typeID,69IUICommandHandler **commandHandler);70HRESULT STDMETHODCALLTYPE71OnDestroyUICommand(UINT32 commandId, UI_COMMANDTYPE typeID,72IUICommandHandler *commandHandler);7374private:75LeashUIApplication() : refcnt(1), commandHandler(NULL),76ribbonFramework(NULL) {}77HRESULT InitializeRibbon(HWND hwnd);78static HWND mainwin;79LONG refcnt;80UINT ribbonHeight;81IUICommandHandler *commandHandler;82IUIFramework *ribbonFramework;83};8485#endif // LEASH_LEASHUIAPPLICATION_H__868788