1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVTOOLS_STDMENU_HXX
21 #define INCLUDED_SVTOOLS_STDMENU_HXX
23 #include <svtools/svtdllapi.h>
24 #include <tools/link.hxx>
25 #include <vcl/menu.hxx>
32 /*************************************************************************
41 Allows the selection of fonts. The menu is filled with the FontNames by
42 the method Fill(). Fill() automatically sorts the FontNames (incl. all
43 umlauts and language-dependent). Using SetCurName()/GetCurName(), the
44 current FontName can be set/requested. If SetCurName() is called with
45 an empty string, no entry is displayed as the current one.
46 Before the Select call, the selected name is automatically set as the
47 current one and would be displayed as the current name on the next call.
48 Because of this, the current FontName should be set using SetCurName()
49 if necessary before calling PopupMenu::Execute().
51 As the Ids and the internal structure of the menu are not known, a
52 Select handler must be set in order to notice the selection of a name.
54 No further items can be inserted into that menu.
56 Later on, the menu shall display the same bitmaps as the FontNameBox.
57 On many systems, where menues don't scroll automatically, an A-Z menu
58 might be interposed. As a menu has always needed long when many Fonts
59 are installed, this menu should only be generated once.
63 FontList; FontSizeMenu; FontNameBox
65 --------------------------------------------------------------------------
71 Allows the selection of font sizes. The FontSizeMenu is filled using
72 Fill(). The selected font size can be queried using GetCurHeight().
73 Using SetCurHeight()/GetCurHeight(), the current font size can be set/
74 requested. If SetCurHeight() is called with 0, no entry is displayed
76 Before the Select call, the selected size is automatically set as the
77 current one and would be displayed as the current size on the next call.
78 Because of this, the current font size should be set using SetCurHeight()
79 if necessary before calling PopupMenu::Execute(). As the font sizes
80 depend on the selected Font, the Menu should be re-filled with the
81 sizes of the font using Fill() after a change to the font name.
83 As the Ids and the internal structure of the menu are not known, a
84 Select handler must be set in order to notice the selection of a size.
86 All sizes are given in 1/10 points.
88 No further items can be inserted into that menu.
90 Later on, the menu shall display the sizes in respect to the system.
91 For example, Mac could possibly show an outline of the fonts that are
96 FontList; FontNameMenu; FontSizeBox
98 *************************************************************************/
100 class SVT_DLLPUBLIC FontNameMenu
: public PopupMenu
105 Link
<> maHighlightHdl
;
109 virtual ~FontNameMenu();
111 virtual void Select() SAL_OVERRIDE
;
112 virtual void Highlight() SAL_OVERRIDE
;
114 void Fill( const FontList
* pList
);
116 void SetCurName( const OUString
& rName
);
117 const OUString
& GetCurName() const { return maCurName
; }
119 void SetSelectHdl( const Link
<>& rLink
) { maSelectHdl
= rLink
; }
120 const Link
<>& GetSelectHdl() const { return maSelectHdl
; }
121 void SetHighlightHdl( const Link
<>& rLink
) { maHighlightHdl
= rLink
; }
122 const Link
<>& GetHighlightHdl() const { return maHighlightHdl
; }
125 class SVT_DLLPUBLIC FontSizeMenu
: public PopupMenu
131 Link
<> maHighlightHdl
;
135 virtual ~FontSizeMenu();
137 virtual void Select() SAL_OVERRIDE
;
138 virtual void Highlight() SAL_OVERRIDE
;
140 void Fill( const vcl::FontInfo
& rInfo
, const FontList
* pList
);
142 void SetCurHeight( long nHeight
);
143 long GetCurHeight() const { return mnCurHeight
; }
145 void SetSelectHdl( const Link
<>& rLink
) { maSelectHdl
= rLink
; }
146 const Link
<>& GetSelectHdl() const { return maSelectHdl
; }
147 void SetHighlightHdl( const Link
<>& rLink
) { maHighlightHdl
= rLink
; }
148 const Link
<>& GetHighlightHdl() const { return maHighlightHdl
; }
151 #endif // INCLUDED_SVTOOLS_STDMENU_HXX
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */