Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/krb5/src/windows/leash/LeashUIApplication.h
34889 views
1
// -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
2
// leash/LeashUIApplication.h - UIApplication implementation for Leash
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
// The class description for the LeashUIApplication class, which
33
// implements the UIApplication interfaces. All applications using
34
// the windows framework are required to implement this interface.
35
// Leash is an MFC application, but in order to use the ribbon
36
// from the windows framework, we must implement this interface so
37
// that we have a UIApplication to hang the ribbon off of, even if we
38
// do not make use of any other UIApplication features.
39
40
#ifndef LEASH_LEASHUIAPPLICATION_H__
41
#define LEASH_LEASHUIAPPLICATION_H__
42
43
#include <UIRibbon.h>
44
45
#define WM_RIBBON_RESIZE (WM_USER + 10)
46
47
class LeashUIApplication : public IUIApplication
48
{
49
public:
50
// The "ribbon state" here is just whether it's minimized, and the
51
// contents of the Quick Access Toolbar.
52
HRESULT LoadRibbonState(IUIRibbon *ribbon);
53
HRESULT SaveRibbonState();
54
// Export how much space the ribbon is taking up.
55
UINT GetRibbonHeight();
56
// Do the real work here, not in the constructor
57
static HRESULT CreateInstance(IUIApplication **out, HWND hwnd);
58
59
// IUnknown virtual methods
60
ULONG STDMETHODCALLTYPE AddRef();
61
ULONG STDMETHODCALLTYPE Release();
62
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppv);
63
64
// IUIApplication virtual methods
65
HRESULT STDMETHODCALLTYPE OnViewChanged(UINT32 viewId, UI_VIEWTYPE typeID,
66
IUnknown *view, UI_VIEWVERB verb,
67
INT32 uReasonCode);
68
HRESULT STDMETHODCALLTYPE
69
OnCreateUICommand(UINT32 commandId, UI_COMMANDTYPE typeID,
70
IUICommandHandler **commandHandler);
71
HRESULT STDMETHODCALLTYPE
72
OnDestroyUICommand(UINT32 commandId, UI_COMMANDTYPE typeID,
73
IUICommandHandler *commandHandler);
74
75
private:
76
LeashUIApplication() : refcnt(1), commandHandler(NULL),
77
ribbonFramework(NULL) {}
78
HRESULT InitializeRibbon(HWND hwnd);
79
static HWND mainwin;
80
LONG refcnt;
81
UINT ribbonHeight;
82
IUICommandHandler *commandHandler;
83
IUIFramework *ribbonFramework;
84
};
85
86
#endif // LEASH_LEASHUIAPPLICATION_H__
87
88