VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.h

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/* $Id: UICocoaSpecialControls.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UICocoaSpecialControls class declaration.
4 */
5
6/*
7 * Copyright (C) 2009-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_platform_darwin_UICocoaSpecialControls_h
29#define FEQT_INCLUDED_SRC_platform_darwin_UICocoaSpecialControls_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33#ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
34
35/* Qt includes: */
36#include <QWidget>
37#ifndef VBOX_IS_QT6_OR_LATER /** @todo qt6: ... */
38# include <QMacCocoaViewContainer>
39#endif
40
41/* GUI includes: */
42#include "VBoxCocoaHelper.h"
43#include "UILibraryDefs.h"
44
45/* Add typedefs for Cocoa types: */
46ADD_COCOA_NATIVE_REF(NSButton);
47
48/** QMacCocoaViewContainer extension,
49 * used as cocoa button container. */
50class SHARED_LIBRARY_STUFF UICocoaButton
51#ifdef VBOX_IS_QT6_OR_LATER /** @todo qt6: ... */
52 : public QWidget
53#else
54 : public QMacCocoaViewContainer
55#endif
56{
57 Q_OBJECT
58
59signals:
60
61 /** Notifies about button click and whether it's @a fChecked. */
62 void clicked(bool fChecked = false);
63
64public:
65
66 /** Cocoa button types. */
67 enum CocoaButtonType
68 {
69 HelpButton,
70 CancelButton,
71 ResetButton
72 };
73
74 /** Constructs cocoa button passing @a pParent to the base-class.
75 * @param enmType Brings the button type. */
76 UICocoaButton(QWidget *pParent, CocoaButtonType enmType);
77 /** Destructs cocoa button. */
78 ~UICocoaButton();
79
80 /** Returns size-hint. */
81 QSize sizeHint() const;
82
83 /** Defines button @a strText. */
84 void setText(const QString &strText);
85 /** Defines button @a strToolTip. */
86 void setToolTip(const QString &strToolTip);
87
88 /** Handles button click. */
89 void onClicked();
90
91private:
92
93 /** Returns native cocoa button reference. */
94 NativeNSButtonRef nativeRef() const { return static_cast<NativeNSButtonRef>(cocoaView()); }
95};
96
97#endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
98#endif /* !FEQT_INCLUDED_SRC_platform_darwin_UICocoaSpecialControls_h */
99
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use