diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..393e987
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,74 @@
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+.DS_Store
+
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..73f69e0
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..633f335
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+Nedrysoft.Ribbon
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..79b3c94
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..3f6b1f2
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,147 @@
+#
+# Copyright (C) 2020 Adrian Carpenter
+#
+# https://github.com/fizzyade
+#
+# Created by Adrian Carpenter on 07/11/2020.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+# set up general cmake settings (common to the ribbon library and the designer plugin)
+
+cmake_minimum_required(VERSION 3.10)
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_AUTORCC ON)
+
+ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
+
+set(NEDRYSOFT_LIBRARY_RIBBON_EXPORT)
+
+# create the ribbon library
+
+project(Ribbon)
+
+set(library_SOURCES
+ RibbonCheckBox.cpp
+ RibbonCheckBox.h
+ RibbonComboBox.cpp
+ RibbonComboBox.h
+ RibbonDropButton.cpp
+ RibbonDropButton.h
+ RibbonFontManager.cpp
+ RibbonFontManager.h
+ RibbonGroup.cpp
+ RibbonGroup.h
+ RibbonLineEdit.cpp
+ RibbonLineEdit.h
+ RibbonPushButton.cpp
+ RibbonPushButton.h
+ RibbonResources.qrc
+ RibbonSlider.cpp
+ RibbonSlider.h
+ RibbonSpec.h
+ RibbonTabBar.cpp
+ RibbonTabBar.h
+ RibbonToolButton.cpp
+ RibbonToolButton.h
+ RibbonToolButtonPlugin.cpp
+ RibbonToolButtonPlugin.h
+ RibbonWidget.cpp
+ RibbonWidget.h
+ ThemeSupport.h
+ ThemeSupport.mm
+)
+
+add_library(${PROJECT_NAME} SHARED
+ ${library_SOURCES}
+)
+
+find_package(Qt5 COMPONENTS Widgets REQUIRED)
+
+target_link_libraries(${PROJECT_NAME} "-framework AppKit" "-framework Cocoa")
+
+target_link_libraries(${PROJECT_NAME} -lstdc++ -lobjc)
+
+target_link_libraries(${PROJECT_NAME} "Qt5::Widgets")
+
+if(DEFINED NEDRYSOFT_RIBBON_LIBRARY_DIR)
+ set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${NEDRYSOFT_RIBBON_LIBRARY_DIR}")
+ set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${NEDRYSOFT_RIBBON_LIBRARY_DIR}")
+else()
+ message(STATUS "Set NEDRYSOFT_RIBBON_LIBRARY_DIR to set the binary output dir.")
+endif()
+
+# designer widgets
+
+option(NEDRYSOFT_RIBBON_BUILD_DESIGNER_PLUGIN "Build Ribbon QtDesigner Plugin" OFF)
+
+if(NEDRYSOFT_RIBBON_BUILD_DESIGNER_PLUGIN)
+ project(Nedrysoft.Ribbon)
+
+ add_definitions(-DNEDRYSOFT_RIBBON_DESIGNER_EXPORT)
+
+ find_package(Qt5 COMPONENTS Widgets UiPlugin REQUIRED)
+
+ add_library(${PROJECT_NAME} SHARED
+ ${library_SOURCES}
+ RibbonCheckBoxPlugin.cpp
+ RibbonCheckBoxPlugin.h
+ RibbonComboBoxPlugin.cpp
+ RibbonComboBoxPlugin.h
+ RibbonDropButtonPlugin.cpp
+ RibbonDropButtonPlugin.h
+ RibbonGroupPlugin.cpp
+ RibbonGroupPlugin.h
+ RibbonLineEditPlugin.cpp
+ RibbonLineEditPlugin.h
+ RibbonPushButtonPlugin.cpp
+ RibbonPushButtonPlugin.h
+ RibbonWidgetsCollection.cpp
+ RibbonWidgetsCollection.h
+ RibbonWidgetPlugin.cpp
+ RibbonWidgetPlugin.h
+ )
+
+ if(APPLE)
+ target_sources(${PROJECT_NAME} "PRIVATE"
+ ThemeSupport.mm
+ ThemeSupport.h
+ )
+ endif()
+
+ target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::UiPlugin)
+
+ if(APPLE)
+ target_link_libraries(${PROJECT_NAME} "-framework AppKit" "-framework Cocoa")
+ endif()
+
+ if(DEFINED NEDRYSOFT_RIBBON_DESIGNER_DIR)
+ set(PLUGIN_OUTPUT_DIR ${NEDRYSOFT_RIBBON_DESIGNER_DIR}/Designer/${CMAKE_LIBRARY_ARCHITECTURE}/${Qt5_VERSION})
+
+ file(MAKE_DIRECTORY ${PLUGIN_OUTPUT_DIR})
+
+ set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}")
+ set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIR}")
+ else()
+ message(STATUS "Set NEDRYSOFT_RIBBON_DESIGNER_DIR to set the binary output dir.")
+ endif()
+else()
+ message(STATUS "Set NEDRYSOFT_RIBBON_BUILD_DESIGNER_PLUGIN to build the designer plugin.")
+endif()
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..e72bfdd
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/OpenSans/LICENSE.txt b/OpenSans/LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/OpenSans/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/OpenSans/OpenSans-Bold.ttf b/OpenSans/OpenSans-Bold.ttf
new file mode 100644
index 0000000..efdd5e8
Binary files /dev/null and b/OpenSans/OpenSans-Bold.ttf differ
diff --git a/OpenSans/OpenSans-BoldItalic.ttf b/OpenSans/OpenSans-BoldItalic.ttf
new file mode 100644
index 0000000..9bf9b4e
Binary files /dev/null and b/OpenSans/OpenSans-BoldItalic.ttf differ
diff --git a/OpenSans/OpenSans-ExtraBold.ttf b/OpenSans/OpenSans-ExtraBold.ttf
new file mode 100644
index 0000000..67fcf0f
Binary files /dev/null and b/OpenSans/OpenSans-ExtraBold.ttf differ
diff --git a/OpenSans/OpenSans-ExtraBoldItalic.ttf b/OpenSans/OpenSans-ExtraBoldItalic.ttf
new file mode 100644
index 0000000..0867228
Binary files /dev/null and b/OpenSans/OpenSans-ExtraBoldItalic.ttf differ
diff --git a/OpenSans/OpenSans-Italic.ttf b/OpenSans/OpenSans-Italic.ttf
new file mode 100644
index 0000000..1178567
Binary files /dev/null and b/OpenSans/OpenSans-Italic.ttf differ
diff --git a/OpenSans/OpenSans-Light.ttf b/OpenSans/OpenSans-Light.ttf
new file mode 100644
index 0000000..6580d3a
Binary files /dev/null and b/OpenSans/OpenSans-Light.ttf differ
diff --git a/OpenSans/OpenSans-LightItalic.ttf b/OpenSans/OpenSans-LightItalic.ttf
new file mode 100644
index 0000000..1e0c331
Binary files /dev/null and b/OpenSans/OpenSans-LightItalic.ttf differ
diff --git a/OpenSans/OpenSans-Regular.ttf b/OpenSans/OpenSans-Regular.ttf
new file mode 100644
index 0000000..29bfd35
Binary files /dev/null and b/OpenSans/OpenSans-Regular.ttf differ
diff --git a/OpenSans/OpenSans-SemiBold.ttf b/OpenSans/OpenSans-SemiBold.ttf
new file mode 100644
index 0000000..54e7059
Binary files /dev/null and b/OpenSans/OpenSans-SemiBold.ttf differ
diff --git a/OpenSans/OpenSans-SemiBoldItalic.ttf b/OpenSans/OpenSans-SemiBoldItalic.ttf
new file mode 100644
index 0000000..aebcf14
Binary files /dev/null and b/OpenSans/OpenSans-SemiBoldItalic.ttf differ
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6ce1781
--- /dev/null
+++ b/README.md
@@ -0,0 +1,55 @@
+# Nedrysoft Ribbon
+
+
+
+The ribbon library provides a simple ribbon bar implementation for Qt-based applications.
+
+## Features
+
+* Cross-platform and tested under macOS, Windows and Linux
+* RibbonWidget is the main ribbon widget.
+* RibbonGroup is a container for sub controls.
+* RibbonPushButton is a push-button styled for the ribbon.
+* RibbonDropButton is a push button with a drop-down button to allow multiple actions.
+* RibbonComboBox is a combo box styled for the ribbon.
+* RibbonCheckBox is a checkbox styled for the ribbon.
+* RibbonLineEdit is a line edit styled for the ribbon.
+* RibbonSlider is a slider styled for the ribbon.
+* RibbonToolBar is a tool button styled for the ribbon.
+
+You can build the designer plugin, which allows the layout of ribbon bars in Designer or Qt Creator.
+
+## Requirements
+
+* Qt 5
+* CMake
+
+## Building
+
+To build the library, invoke CMake or open the CMakeLists.txt file in your preferred IDE.
+
+Setting the following CMake variables allows the customisation of the build.
+
+```
+NEDRYSOFT_RIBBON_LIBRARY_DIR=
+```
+
+Sets the output folder for the dynamic library; if omitted, you can find the binaries in the default location.
+
+```
+NEDRYSOFT_RIBBON_BUILD_DESIGNER_PLUGIN=ON|OFF
+```
+
+Set to ON to build the designer plugin. (defaults to off)
+
+```
+NEDRYSOFT_RIBBON_DESIGNER_DIR=
+```
+
+Sets the output folder for the designer plugin; if omitted, you can find the binaries in the default location.
+
+# License
+
+This project is open source and released under the GPLv3 licence.
+
+Distributed as-is; no warranty is given.
diff --git a/RibbonCheckBox.cpp b/RibbonCheckBox.cpp
new file mode 100644
index 0000000..5794d53
--- /dev/null
+++ b/RibbonCheckBox.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonCheckBox.h"
+
+#include "RibbonFontManager.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+
+constexpr auto ThemeStylesheet = R"(
+ QCheckBox {
+ margin-top:4px;
+ margin-bottom:4px;
+ }
+
+ QCheckBox::indicator:checked {
+ image: url(':/Nedrysoft/Ribbon/icons/checked-[theme]@2x.png');
+ width: 14px;
+ height: 14px;
+ padding-right: 2px;
+ }
+
+ QCheckBox::indicator:checked:hover {
+ image: url(':/Nedrysoft/Ribbon/icons/checked-hover-[theme]@2x.png');
+ width: 14px;
+ height: 14px;
+ padding-right: 2px;
+ }
+
+ QCheckBox::indicator:unchecked {
+ image: url(':/Nedrysoft/Ribbon/icons/unchecked-[theme]@2x.png');
+ width: 14px;
+ height: 14px;
+ padding-right: 2px;
+ }
+
+ QCheckBox::indicator:unchecked:hover {
+ image: url(':/Nedrysoft/Ribbon/icons/unchecked-hover-[theme]@2x.png');
+ width: 14px;
+ height: 14px;
+ padding-right: 2px;
+ }
+)";
+
+Nedrysoft::Ribbon::RibbonCheckBox::RibbonCheckBox(QWidget *parent) :
+ QCheckBox(parent),
+ m_themeSupport(new Nedrysoft::Utils::ThemeSupport) {
+
+ setAttribute(Qt::WA_MacShowFocusRect,false);
+
+ connect(m_themeSupport, &Nedrysoft::Utils::ThemeSupport::themeChanged, [=](bool isDarkMode) {
+ updateStyleSheet(isDarkMode);
+ });
+
+ updateStyleSheet(Nedrysoft::Utils::ThemeSupport::isDarkMode());
+}
+
+Nedrysoft::Ribbon::RibbonCheckBox::~RibbonCheckBox() {
+}
+
+void Nedrysoft::Ribbon::RibbonCheckBox::updateStyleSheet(bool isDarkMode) {
+ QString styleSheet(ThemeStylesheet);
+
+ styleSheet.replace("[theme]", isDarkMode ? "dark" : "light");
+
+ setStyleSheet(styleSheet);
+}
diff --git a/RibbonCheckBox.h b/RibbonCheckBox.h
new file mode 100644
index 0000000..a0e4556
--- /dev/null
+++ b/RibbonCheckBox.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONCHECKBOX_H
+#define NEDRYSOFT_RIBBONCHECKBOX_H
+
+#include "RibbonSpec.h"
+#include "ThemeSupport.h"
+
+#include
+
+namespace Nedrysoft::Ribbon {
+ /**
+ * @brief The RibbonCheckBox widget provides a ribbon stylised check box.
+ *
+ * @details A CheckBox widget that is styled to match the RibbonBar.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonCheckBox :
+ public QCheckBox {
+
+ private:
+ Q_OBJECT
+
+ public:
+ /**
+ * @brief Constructs a new RibbonCheckBox instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonCheckBox(QWidget *parent=nullptr);
+
+ /**
+ * @brief Destroys the RibbonCheckBox.
+ */
+ ~RibbonCheckBox() override;
+
+ private:
+ /**
+ * @brief Updates the stylesheet when the operating system theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ void updateStyleSheet(bool isDarkMode);
+
+ private:
+ Nedrysoft::Utils::ThemeSupport *m_themeSupport; //! theme support instance
+ };
+}
+
+#endif //NEDRYSOFT_RIBBONCHECKBOX_H
diff --git a/RibbonCheckBoxPlugin.cpp b/RibbonCheckBoxPlugin.cpp
new file mode 100644
index 0000000..5920d3b
--- /dev/null
+++ b/RibbonCheckBoxPlugin.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonCheckBoxPlugin.h"
+#include "RibbonCheckBox.h"
+
+#include
+
+constexpr auto ConfigurationXML = R"(
+
+
+
+ CheckBox
+
+
+ true
+
+
+
+)";
+
+RibbonCheckBoxPlugin::RibbonCheckBoxPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+}
+
+void RibbonCheckBoxPlugin::initialize(QDesignerFormEditorInterface *core) {
+ Q_UNUSED(core);
+
+ if (m_initialized) {
+ return;
+ }
+
+ m_initialized = true;
+}
+
+bool RibbonCheckBoxPlugin::isInitialized() const {
+ return m_initialized;
+}
+
+QWidget *RibbonCheckBoxPlugin::createWidget(QWidget *parent) {
+ return new Nedrysoft::Ribbon::RibbonCheckBox(parent);
+}
+
+QString RibbonCheckBoxPlugin::name() const {
+ return QStringLiteral("Nedrysoft::Ribbon::RibbonCheckBox");
+}
+
+QString RibbonCheckBoxPlugin::group() const {
+ return QStringLiteral("Nedrysoft Ribbon Widgets");
+}
+
+QIcon RibbonCheckBoxPlugin::icon() const {
+ return QIcon(":/Nedrysoft/Ribbon/icons/ribbon.png");
+}
+
+QString RibbonCheckBoxPlugin::toolTip() const {
+ return tr("A Ribbon Check Box");
+}
+
+QString RibbonCheckBoxPlugin::whatsThis() const {
+ return tr("The Ribbon Check Box is a QCheckBox subclass that is styled to match the Ribbon.");
+}
+
+bool RibbonCheckBoxPlugin::isContainer() const {
+ return false;
+}
+
+QString RibbonCheckBoxPlugin::domXml() const {
+ return ConfigurationXML;
+}
+
+QString RibbonCheckBoxPlugin::includeFile() const {
+ return QStringLiteral("Ribbon/RibbonCheckBox.h");
+}
diff --git a/RibbonCheckBoxPlugin.h b/RibbonCheckBoxPlugin.h
new file mode 100644
index 0000000..4407e3e
--- /dev/null
+++ b/RibbonCheckBoxPlugin.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONCHECKBOXPLUGIN_H
+#define NEDRYSOFT_RIBBONCHECKBOXPLUGIN_H
+
+#include
+
+/**
+ * @brief Ribbon check box Qt Designer plugin.
+ *
+ * @details Exposes the RibbonCheckBox widget to Qt Designer, this class is responsible for creating instances of
+ * the widget and exposing properties and functions required for design.
+ */
+class RibbonCheckBoxPlugin :
+ public QObject,
+ public QDesignerCustomWidgetInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonCheckBoxPlugin instance which is a child of the parent.
+ *
+ * @param[in] parent the owner object.
+ */
+ explicit RibbonCheckBoxPlugin(QObject *parent = nullptr);
+
+ /**
+ * @brief Returns true if the widget is intended to be used as a container; otherwise returns false.
+ *
+ * @returns true if it container; otherwise false.
+ */
+ bool isContainer() const override;
+
+ /**
+ * @brief Returns true if the widget has been initialized; otherwise returns false.
+ *
+ * @returns true if initialised; otherwise false.
+ */
+ bool isInitialized() const override;
+
+ /**
+ * @brief Returns the icon used to represent the custom widget in Qt Designer's widget box.
+ *
+ * @returns the icon used to represent the custom widget in Qt Designer's widget box.
+ */
+ QIcon icon() const override;
+
+ /**
+ * @brief Returns the XML that is used to describe the custom widget's properties to Qt Designer.
+ *
+ * @returns the XML describing the widgets properties.
+ */
+ QString domXml() const override;
+
+ /**
+ * @brief Returns the name of the group to which the widget belongs.
+ *
+ * @returns the name of the group.
+ */
+ QString group() const override;
+
+ /**
+ * @brief Returns the path to the include file that uic uses when creating code for the widget.
+ *
+ * @returns the path to the include file.
+ */
+ QString includeFile() const override;
+
+ /**
+ * @brief Returns the class name of the widget supplied by the interface.
+ *
+ * @returns the name of the widget.
+ */
+ QString name() const override;
+
+ /**
+ * @brief Returns a short description of the widget that can be used by Qt Designer in a tool tip.
+ *
+ * @returns the description.
+ */
+ QString toolTip() const override;
+
+ /**
+ * @brief Returns a description of the widget that can be used by Qt Designer in "What's This?" help for the widget.
+ *
+ * @returns the description.
+ */
+ QString whatsThis() const override;
+
+ /**
+ * @brief Returns a new instance of the RibbonCheckBox class, with the given parent.
+ *
+ * @returns the widget instance.
+ */
+ QWidget *createWidget(QWidget *parent) override;
+
+ /**
+ * @brief Initializes the widget for use with the specified formEditor interface.
+ */
+ void initialize(QDesignerFormEditorInterface *core) override;
+
+ private:
+ bool m_initialized = false; //! holds whether designer has initialised the factory yet
+};
+
+#endif // NEDRYSOFT_RIBBONCHECKBOXPLUGIN_H
diff --git a/RibbonComboBox.cpp b/RibbonComboBox.cpp
new file mode 100644
index 0000000..f7ca727
--- /dev/null
+++ b/RibbonComboBox.cpp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonComboBox.h"
+
+#include "RibbonFontManager.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+
+constexpr auto ThemeStylesheet = R"(
+ QComboBox {
+ padding: 2px;
+ height: 13px;
+ border: 1px solid [border-colour];
+ background-color: [background-colour];
+ selection-background-color: [selected-background-colour];
+ }
+
+ QComboBox::drop-down {
+ background-color: [background-colour];
+ }
+
+ QComboBox::down-arrow {
+ image: url(':/Nedrysoft/Ribbon/icons/arrow-drop-[theme]@2x.png');
+ width: 5px;
+ height: 4px;
+ }
+
+ QComboBox::down-arrow:hover {
+ background-color: [hover-background-colour];
+ }
+)";
+
+Nedrysoft::Ribbon::RibbonComboBox::RibbonComboBox(QWidget *parent) :
+ QComboBox(parent),
+ m_themeSupport(new Nedrysoft::Utils::ThemeSupport) {
+
+ setAttribute(Qt::WA_MacShowFocusRect,false);
+
+ connect(m_themeSupport, &Nedrysoft::Utils::ThemeSupport::themeChanged, [=](bool isDarkMode) {
+ updateStyleSheet(isDarkMode);
+ });
+
+ updateStyleSheet(Nedrysoft::Utils::ThemeSupport::isDarkMode());
+}
+
+Nedrysoft::Ribbon::RibbonComboBox::~RibbonComboBox() {
+}
+
+void Nedrysoft::Ribbon::RibbonComboBox::updateStyleSheet(bool isDarkMode) {
+ QString styleSheet(ThemeStylesheet);
+
+ styleSheet.replace("[selected-background-colour]", Nedrysoft::Utils::ThemeSupport::getHighlightedBackground().name());
+ styleSheet.replace("[theme]", isDarkMode ? "dark" : "light");
+
+ if (isDarkMode) {
+ styleSheet.replace("[background-colour]", "#434343");
+ styleSheet.replace("[border-colour]", "#323232");
+ styleSheet.replace("[hover-background-colour]", "#626262");
+
+ } else {
+ styleSheet.replace("[background-colour]", "#ffffff");
+ styleSheet.replace("[border-colour]", "#B9B9B9");
+ styleSheet.replace("[hover-background-colour]", "#f5f5f5");
+ }
+
+ setStyleSheet(styleSheet);
+}
diff --git a/RibbonComboBox.h b/RibbonComboBox.h
new file mode 100644
index 0000000..37a35f9
--- /dev/null
+++ b/RibbonComboBox.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONCOMBOBOX_H
+#define NEDRYSOFT_RIBBONCOMBOBOX_H
+
+#include "RibbonSpec.h"
+#include "ThemeSupport.h"
+
+#include
+
+namespace Nedrysoft::Ribbon {
+ /**
+ * @brief The RibbonComboBox widget provides a ribbon stylised check box.
+ *
+ * @details A ComboBox widget that is styled to match the RibbonBar.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonComboBox :
+ public QComboBox {
+
+ private:
+ Q_OBJECT
+
+ public:
+ /**
+ * @brief Constructs a new RibbonComboBox instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonComboBox(QWidget *parent=nullptr);
+
+ /**
+ * @brief Destroys the RibbonComboBox.
+ */
+ ~RibbonComboBox() override;
+
+ private:
+ /**
+ * @brief Updates the stylesheet when the operating system theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ void updateStyleSheet(bool isDarkMode);
+
+ private:
+ Nedrysoft::Utils::ThemeSupport *m_themeSupport; //! theme support instance
+ };
+}
+
+#endif //NEDRYSOFT_RIBBONCOMBOBOX_H
diff --git a/RibbonComboBoxPlugin.cpp b/RibbonComboBoxPlugin.cpp
new file mode 100644
index 0000000..881fdfc
--- /dev/null
+++ b/RibbonComboBoxPlugin.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonComboBoxPlugin.h"
+#include "RibbonComboBox.h"
+
+#include
+
+constexpr auto ConfigurationXML = R"(
+
+
+
+
+ 0
+ 0
+ 100
+ 13
+
+
+
+
+)";
+
+RibbonComboBoxPlugin::RibbonComboBoxPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+}
+
+void RibbonComboBoxPlugin::initialize(QDesignerFormEditorInterface *core) {
+ Q_UNUSED(core);
+
+ if (m_initialized) {
+ return;
+ }
+
+ m_initialized = true;
+}
+
+bool RibbonComboBoxPlugin::isInitialized() const {
+ return m_initialized;
+}
+
+QWidget *RibbonComboBoxPlugin::createWidget(QWidget *parent) {
+ return new Nedrysoft::Ribbon::RibbonComboBox(parent);
+}
+
+QString RibbonComboBoxPlugin::name() const {
+ return QStringLiteral("Nedrysoft::Ribbon::RibbonComboBox");
+}
+
+QString RibbonComboBoxPlugin::group() const {
+ return QStringLiteral("Nedrysoft Ribbon Widgets");
+}
+
+QIcon RibbonComboBoxPlugin::icon() const {
+ return QIcon(":/Nedrysoft/Ribbon/icons/ribbon.png");
+}
+
+QString RibbonComboBoxPlugin::toolTip() const {
+ return tr("A Ribbon Combo Box");
+}
+
+QString RibbonComboBoxPlugin::whatsThis() const {
+ return tr("The Ribbon Combo Box is a QComboBox subclass that is styled to match the Ribbon.");
+}
+
+bool RibbonComboBoxPlugin::isContainer() const {
+ return false;
+}
+
+QString RibbonComboBoxPlugin::domXml() const {
+ return ConfigurationXML;
+}
+
+QString RibbonComboBoxPlugin::includeFile() const {
+ return QStringLiteral("Ribbon/RibbonComboBox.h");
+}
diff --git a/RibbonComboBoxPlugin.h b/RibbonComboBoxPlugin.h
new file mode 100644
index 0000000..e84a4ed
--- /dev/null
+++ b/RibbonComboBoxPlugin.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONCOMBOBOXPLUGIN_H
+#define NEDRYSOFT_RIBBONCOMBOBOXPLUGIN_H
+
+#include
+
+/**
+ * @brief Ribbon combo box with label Qt Designer plugin.
+ *
+ * @details Exposes the RibbonComboBox widget to Qt Designer, this class is responsible for creating instances of
+ * the widget and exposing properties and functions required for design.
+ */
+class RibbonComboBoxPlugin :
+ public QObject,
+ public QDesignerCustomWidgetInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonComboBoxPlugin instance which is a child of the parent.
+ *
+ * @param[in] parent the owner object.
+ */
+ explicit RibbonComboBoxPlugin(QObject *parent = nullptr);
+
+ /**
+ * @brief Returns true if the widget is intended to be used as a container; otherwise returns false.
+ *
+ * @returns true if it container; otherwise false.
+ */
+ bool isContainer() const override;
+
+ /**
+ * @brief Returns true if the widget has been initialized; otherwise returns false.
+ *
+ * @returns true if initialised; otherwise false.
+ */
+ bool isInitialized() const override;
+
+ /**
+ * @brief Returns the icon used to represent the custom widget in Qt Designer's widget box.
+ *
+ * @returns the icon used to represent the custom widget in Qt Designer's widget box.
+ */
+ QIcon icon() const override;
+
+ /**
+ * @brief Returns the XML that is used to describe the custom widget's properties to Qt Designer.
+ *
+ * @returns the XML describing the widgets properties.
+ */
+ QString domXml() const override;
+
+ /**
+ * @brief Returns the name of the group to which the widget belongs.
+ *
+ * @returns the name of the group.
+ */
+ QString group() const override;
+
+ /**
+ * @brief Returns the path to the include file that uic uses when creating code for the widget.
+ *
+ * @returns the path to the include file.
+ */
+ QString includeFile() const override;
+
+ /**
+ * @brief Returns the class name of the widget supplied by the interface.
+ *
+ * @returns the name of the widget.
+ */
+ QString name() const override;
+
+ /**
+ * @brief Returns a short description of the widget that can be used by Qt Designer in a tool tip.
+ *
+ * @returns the description.
+ */
+ QString toolTip() const override;
+
+ /**
+ * @brief Returns a description of the widget that can be used by Qt Designer in "What's This?" help for the widget.
+ *
+ * @returns the description.
+ */
+ QString whatsThis() const override;
+
+ /**
+ * @brief Returns a new instance of the RibbonComboBox class, with the given parent.
+ *
+ * @returns the widget instance.
+ */
+ QWidget *createWidget(QWidget *parent) override;
+
+ /**
+ * @brief Initializes the widget for use with the specified formEditor interface.
+ */
+ void initialize(QDesignerFormEditorInterface *core) override;
+
+ private:
+ bool m_initialized = false; //! holds whether designer has initialised the factory yet
+};
+
+#endif // NEDRYSOFT_RIBBONCOMBOBOXPLUGIN_H
diff --git a/RibbonDropButton.cpp b/RibbonDropButton.cpp
new file mode 100644
index 0000000..fe736be
--- /dev/null
+++ b/RibbonDropButton.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 11/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonDropButton.h"
+
+#include "RibbonWidget.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+
+constexpr auto ThemeStylesheet = R"(
+ QPushButton {
+ border: 0px;
+ padding: 3px;
+ }
+
+ QPushButton::hover {
+ background: [background-colour];
+ }
+)";
+
+Nedrysoft::Ribbon::RibbonDropButton::RibbonDropButton(QWidget *parent) :
+ QWidget(parent),
+ m_iconSize(QSize(RibbonDropButtonDefaultIconWidth,RibbonDropButtonDefaultIconHeight)),
+ m_themeSupport(new Nedrysoft::Utils::ThemeSupport) {
+
+ m_layout = new QVBoxLayout;
+ m_mainButton = new QPushButton;
+ m_dropButton = new QPushButton;
+
+ m_mainButton->installEventFilter(this);
+
+ m_layout->addWidget(m_mainButton);
+ m_layout->addWidget(m_dropButton);
+ m_layout->addSpacerItem(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding));
+
+ m_layout->setContentsMargins(0,0,0,0);
+ m_layout->setSpacing(0);
+
+ m_dropButton->setMinimumHeight(RibbonDropButtonDefaultHeight);
+ m_dropButton->setMaximumHeight(RibbonDropButtonDefaultHeight);
+
+ m_mainButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ m_dropButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+
+ m_dropButton->setIconSize(QSize(RubbonDropButtonArrowWidth,RubbonDropButtonArrowHeight));
+
+ m_dropButton->setFlat(true);
+ m_mainButton->setFlat(true);
+
+ setLayout(m_layout);
+
+ connect(m_mainButton, &QPushButton::clicked, [=] (bool checked) {
+ Q_EMIT clicked(false);
+ });
+
+ connect(m_dropButton, &QPushButton::clicked, [=] (bool checked) {
+ Q_EMIT clicked(true);
+ });
+
+ updateSizes();
+
+ connect(m_themeSupport, &Nedrysoft::Utils::ThemeSupport::themeChanged, [=](bool isDarkMode) {
+ updateStyleSheets(isDarkMode);
+ });
+
+ updateStyleSheets(Nedrysoft::Utils::ThemeSupport::isDarkMode());
+}
+
+Nedrysoft::Ribbon::RibbonDropButton::~RibbonDropButton() {
+ m_mainButton->deleteLater();
+ m_dropButton->deleteLater();
+ m_layout->deleteLater();
+}
+
+QIcon Nedrysoft::Ribbon::RibbonDropButton::icon() {
+ return m_mainButton->icon();
+}
+
+void Nedrysoft::Ribbon::RibbonDropButton::setIcon(QIcon &icon) {
+ m_mainButton->setIcon(icon);
+}
+
+QSize Nedrysoft::Ribbon::RibbonDropButton::iconSize() {
+ return m_iconSize;
+}
+
+void Nedrysoft::Ribbon::RibbonDropButton::setIconSize(QSize iconSize)
+{
+ m_iconSize = iconSize;
+
+ updateSizes();
+}
+
+void Nedrysoft::Ribbon::RibbonDropButton::updateSizes() {
+ m_mainButton->setMinimumSize(m_iconSize);
+ m_mainButton->setIconSize(m_iconSize);
+}
+
+void Nedrysoft::Ribbon::RibbonDropButton::updateStyleSheets(bool isDarkMode) {
+ QString styleSheet(ThemeStylesheet);
+
+ styleSheet.replace("[background-colour]", Nedrysoft::Utils::ThemeSupport::getColor(Nedrysoft::Ribbon::PushButtonColor).name());
+
+ m_mainButton->setStyleSheet(styleSheet);
+ m_dropButton->setStyleSheet(styleSheet);
+
+ if (isDarkMode) {
+ m_dropButton->setIcon(QIcon(":/Nedrysoft/Ribbon/icons/arrow-drop-dark@2x.png"));
+ } else {
+ m_dropButton->setIcon(QIcon(":/Nedrysoft/Ribbon/icons/arrow-drop-light@2x.png"));
+ }
+}
+
+bool Nedrysoft::Ribbon::RibbonDropButton::eventFilter(QObject *object, QEvent *event) {
+ if (event->type()==QEvent::MouseButtonPress) {
+ QString styleSheet(ThemeStylesheet);
+
+ styleSheet.replace("[background-colour]", "#292929");
+
+ m_mainButton->setStyleSheet(styleSheet);
+ } else if (event->type()==QEvent::MouseButtonRelease) {
+ updateStyleSheets(m_themeSupport->isDarkMode());
+ }
+
+ return false;
+}
\ No newline at end of file
diff --git a/RibbonDropButton.h b/RibbonDropButton.h
new file mode 100644
index 0000000..2645507
--- /dev/null
+++ b/RibbonDropButton.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 11/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONDROPBUTTON_H
+#define NEDRYSOFT_RIBBONDROPBUTTON_H
+
+#include "RibbonSpec.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+#include
+
+namespace Nedrysoft::Ribbon {
+ constexpr auto RibbonDropButtonDefaultIconWidth = 32;
+ constexpr auto RibbonDropButtonDefaultIconHeight = 48;
+ constexpr auto RibbonDropButtonDefaultHeight = 16;
+ constexpr auto RubbonDropButtonArrowWidth = 5;
+ constexpr auto RubbonDropButtonArrowHeight = 5;
+
+ /**
+ * @brief The RibbonDropButton widget provides a ribbon stylised push button with a drop down action.
+ *
+ * @details A PushButton widget that is styled to match the RibbonBar, consists of a main push button which
+ * is the primary action and a secondary drop down button which can provide further actions.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonDropButton :
+ public QWidget {
+
+ private:
+ Q_OBJECT
+
+ Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
+ Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonDropButton which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonDropButton(QWidget *parent=nullptr);
+
+ /**
+ * @brief Destroys the RibbonDropButton.
+ */
+ ~RibbonDropButton() override;
+
+ /**
+ * @brief Returns the icon that is currently assigned to the main button.
+ *
+ * @returns the icon assigned to the main button.
+ */
+ QIcon icon();
+
+ /**
+ * @brief Sets the icon to be displayed on the main button.
+ *
+ * @param[in] icon the icon to be displayed on the main button.
+ */
+ void setIcon(QIcon &icon);
+
+ /**
+ * @brief Returns the current size of the icon.
+ *
+ * @returns the current size of the icon.
+ */
+ QSize iconSize();
+
+ /**
+ * @brief Sets the current size of the icon.
+ *
+ * @param[in] iconSize the new size of the icon to be used.
+ */
+ void setIconSize(QSize iconSize);
+
+ private:
+ /**
+ * @brief Updates the child widgets when the size of the icon is changed.
+ */
+ void updateSizes();
+
+ /**
+ * @brief Updates the child widgets stylesheets when the operating system theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ void updateStyleSheets(bool isDarkMode);
+
+ public:
+ /**
+ * @brief This signal is emitted when the either the main or drop-down button has been clicked.
+ *
+ * @param[in] dropdown true if the drop-down section was clicked; otherwise false (main button section was clicked).
+ */
+ Q_SIGNAL void clicked(bool dropdown);
+
+ protected:
+ /**
+ * @brief Reimplements: QWidget::eventFilter(QObject *object, QEvent *event).
+ *
+ * @param[in] object the target object for the event.
+ * @param[in] event the event information.
+ */
+ bool eventFilter(QObject *object, QEvent *event) override;
+
+ private:
+ QVBoxLayout *m_layout; //! the layout for this widget
+ QPushButton *m_mainButton; //! the main button
+ QPushButton *m_dropButton; //! the drop down button
+ QSize m_iconSize; //! the size of the icon
+ Nedrysoft::Utils::ThemeSupport *m_themeSupport; //! theme support instance
+ };
+}
+
+#endif //NEDRYSOFT_RIBBONDROPBUTTON_H
diff --git a/RibbonDropButtonPlugin.cpp b/RibbonDropButtonPlugin.cpp
new file mode 100644
index 0000000..dd48d8a
--- /dev/null
+++ b/RibbonDropButtonPlugin.cpp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 11/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonDropButtonPlugin.h"
+#include "RibbonDropButton.h"
+
+#include
+
+constexpr auto ConfigurationXML = R"(
+
+
+
+
+)";
+
+RibbonDropButtonPlugin::RibbonDropButtonPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+}
+
+void RibbonDropButtonPlugin::initialize(QDesignerFormEditorInterface *core) {
+ Q_UNUSED(core);
+
+ if (m_initialized) {
+ return;
+ }
+
+ m_initialized = true;
+}
+
+bool RibbonDropButtonPlugin::isInitialized() const {
+ return m_initialized;
+}
+
+QWidget *RibbonDropButtonPlugin::createWidget(QWidget *parent) {
+ return new Nedrysoft::Ribbon::RibbonDropButton(parent);
+}
+
+QString RibbonDropButtonPlugin::name() const {
+ return QStringLiteral("Nedrysoft::Ribbon::RibbonDropButton");
+}
+
+QString RibbonDropButtonPlugin::group() const {
+ return QStringLiteral("Nedrysoft Ribbon Widgets");
+}
+
+QIcon RibbonDropButtonPlugin::icon() const {
+ return QIcon(":/Nedrysoft/Ribbon/icons/ribbon.png");
+}
+
+QString RibbonDropButtonPlugin::toolTip() const {
+ return tr("A Ribbon Drop Button");
+}
+
+QString RibbonDropButtonPlugin::whatsThis() const {
+ return tr("The Ribbon Drop Button is button which contains a main action button and a drop down button for extended actions and is styled to match the Ribbon.");
+}
+
+bool RibbonDropButtonPlugin::isContainer() const {
+ return true;
+}
+
+QString RibbonDropButtonPlugin::domXml() const {
+ return ConfigurationXML;
+}
+
+QString RibbonDropButtonPlugin::includeFile() const {
+ return QStringLiteral("Ribbon/RibbonDropButton.h");
+}
diff --git a/RibbonDropButtonPlugin.h b/RibbonDropButtonPlugin.h
new file mode 100644
index 0000000..a69b7ef
--- /dev/null
+++ b/RibbonDropButtonPlugin.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 11/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONDROPBUTTONPLUGIN_H
+#define NEDRYSOFT_RIBBONDROPBUTTONPLUGIN_H
+
+#include
+
+/**
+ * @brief Ribbon Bar Drop down menu button
+ *
+ * @details Creates instances of the ribbon styled PushButton with drop menu
+ */
+class RibbonDropButtonPlugin :
+ public QObject,
+ public QDesignerCustomWidgetInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonDropButtonPlugin instance which is a child of the parent.
+ *
+ * @param[in] parent the owner object.
+ */
+ explicit RibbonDropButtonPlugin(QObject *parent = nullptr);
+
+ /**
+ * @brief Returns true if the widget is intended to be used as a container; otherwise returns false.
+ *
+ * @returns true if it container; otherwise false.
+ */
+ bool isContainer() const override;
+
+ /**
+ * @brief Returns true if the widget has been initialized; otherwise returns false.
+ *
+ * @returns true if initialised; otherwise false.
+ */
+ bool isInitialized() const override;
+
+ /**
+ * @brief Returns the icon used to represent the custom widget in Qt Designer's widget box.
+ *
+ * @returns the icon used to represent the custom widget in Qt Designer's widget box.
+ */
+ QIcon icon() const override;
+
+ /**
+ * @brief Returns the XML that is used to describe the custom widget's properties to Qt Designer.
+ *
+ * @returns the XML describing the widgets properties.
+ */
+ QString domXml() const override;
+
+ /**
+ * @brief Returns the name of the group to which the widget belongs.
+ *
+ * @returns the name of the group.
+ */
+ QString group() const override;
+
+ /**
+ * @brief Returns the path to the include file that uic uses when creating code for the widget.
+ *
+ * @returns the path to the include file.
+ */
+ QString includeFile() const override;
+
+ /**
+ * @brief Returns the class name of the widget supplied by the interface.
+ *
+ * @returns the name of the widget.
+ */
+ QString name() const override;
+
+ /**
+ * @brief Returns a short description of the widget that can be used by Qt Designer in a tool tip.
+ *
+ * @returns the description.
+ */
+ QString toolTip() const override;
+
+ /**
+ * @brief Returns a description of the widget that can be used by Qt Designer in "What's This?" help for the widget.
+ *
+ * @returns the description.
+ */
+ QString whatsThis() const override;
+
+ /**
+ * @brief Returns a new instance of the RibbonDropButton class, with the given parent.
+ *
+ * @returns the widget instance.
+ */
+ QWidget *createWidget(QWidget *parent) override;
+
+ /**
+ * @brief Initializes the widget for use with the specified formEditor interface.
+ */
+ void initialize(QDesignerFormEditorInterface *core) override;
+
+ private:
+ bool m_initialized = false; //! holds whether designer has initialised the factory yet
+};
+
+#endif // NEDRYSOFT_RIBBONDROPBUTTONPLUGIN_H
diff --git a/RibbonFontManager.cpp b/RibbonFontManager.cpp
new file mode 100644
index 0000000..f4e74d2
--- /dev/null
+++ b/RibbonFontManager.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonFontManager.h"
+
+#include
+
+Nedrysoft::Ribbon::RibbonFontManager::RibbonFontManager() :
+ m_regularFontId(QFontDatabase::addApplicationFont(":/Nedrysoft/Ribbon/OpenSans/OpenSans-Regular.ttf")),
+ m_boldFontId(QFontDatabase::addApplicationFont(":/Nedrysoft/Ribbon/OpenSans/OpenSans-Bold.ttf")) {
+
+}
+
+Nedrysoft::Ribbon::RibbonFontManager *Nedrysoft::Ribbon::RibbonFontManager::getInstance() {
+ static auto instance = new RibbonFontManager();
+
+ return instance;
+}
+
+QString Nedrysoft::Ribbon::RibbonFontManager::normalFont() const {
+ auto families = QFontDatabase::applicationFontFamilies(m_regularFontId);
+
+ if (families.count()) {
+ return families.at(0);
+ }
+
+ return QString();
+}
+
+QString Nedrysoft::Ribbon::RibbonFontManager::boldFont() const {
+ auto families = QFontDatabase::applicationFontFamilies(m_boldFontId);
+
+ if (families.count()) {
+ return families.at(0);
+ }
+
+ return QString();
+}
diff --git a/RibbonFontManager.h b/RibbonFontManager.h
new file mode 100644
index 0000000..5a58f78
--- /dev/null
+++ b/RibbonFontManager.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONFONTMANAGER_H
+#define NEDRYSOFT_RIBBONFONTMANAGER_H
+
+#include "RibbonSpec.h"
+
+#include
+
+namespace Nedrysoft::Ribbon {
+ /**
+ * @brief The RibbonFont manager provides access to the system UI font.
+ *
+ * @details Singleton responsible for loading and returning the fonts used
+ * by the ribbon control. This class is a singleton and therefore cannot be instantiated directly
+ * the instace can be obtained using the getInstance() method.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonFontManager {
+ private:
+ /**
+ * @brief Constructs a new RibbonFontManager.
+ *
+ * @note Cannot be directly instantiated, this is a singleton class and the instance can be
+ * accessed through the getInstance() method.
+ */
+ explicit RibbonFontManager();
+
+ /**
+ * @brief Destroys the MainWindow.
+ */
+ ~RibbonFontManager();
+
+ /**
+ * @brief Delete the copy constructor.
+ */
+ RibbonFontManager(const RibbonFontManager&) = delete;
+
+ /**
+ * @brief Delete the assignment operator.
+ */
+ RibbonFontManager& operator=(const RibbonFontManager&) = delete;
+
+ public:
+ /**
+ * @brief Returns the singleton instance of the RibbonFontManager class.
+ *
+ * @returns the instance of the class
+ */
+ static Nedrysoft::Ribbon::RibbonFontManager *getInstance();
+
+ /**
+ * @brief Returns the normal font name
+ *
+ * @returns the normal font family name
+ */
+ [[nodiscard]] QString normalFont() const;
+
+ /**
+ * @brief Returns the bold font name
+ *
+ * @returns the bold font family name
+ */
+ [[nodiscard]] QString boldFont() const;
+
+ private:
+ int m_regularFontId; //! Regular font id after loading
+ int m_boldFontId; //! Bold font id after loading
+ };
+}
+
+#endif // NEDRYSOFT_RIBBONFONTMANAGER_H
diff --git a/RibbonGroup.cpp b/RibbonGroup.cpp
new file mode 100644
index 0000000..5cdd736
--- /dev/null
+++ b/RibbonGroup.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonGroup.h"
+
+#include "RibbonFontManager.h"
+#include "RibbonWidget.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+#include
+#include
+#include
+
+Nedrysoft::Ribbon::RibbonGroup::RibbonGroup(QWidget *parent) :
+ QWidget(parent),
+ m_fontMetrics(QFont()) {
+
+ auto fontManager = RibbonFontManager::getInstance();
+
+ m_font = QFont(fontManager->normalFont(), RibbonGroupDefaultFontSize);
+ m_fontMetrics = QFontMetrics(m_font);
+
+ setGroupName(QString("Group"));
+
+ connect(qobject_cast(QCoreApplication::instance()), &QApplication::paletteChanged, [=] (const QPalette &) {
+ // TODO: anything to do?
+ });
+
+ updateMargins();
+
+ setMinimumWidth(m_fontMetrics.maxWidth());
+}
+
+void Nedrysoft::Ribbon::RibbonGroup::paintEvent(QPaintEvent *event) {
+ QPainter painter(this);
+ auto widgetRect = rect();
+ auto currentTheme = Nedrysoft::Ribbon::Light;
+
+ if (Nedrysoft::Utils::ThemeSupport::isDarkMode()) {
+ currentTheme = Nedrysoft::Ribbon::Dark;
+ }
+
+ widgetRect.setTop(widgetRect.bottom()-m_textRect.height());
+
+ painter.save();
+
+ painter.setClipRect(event->rect());
+
+ painter.setFont(m_font);
+
+ painter.setPen(Ribbon::TextColor[currentTheme]);
+
+ auto textRect = contentsRect();
+
+ textRect.setBottom(rect().bottom());
+
+ painter.drawText(textRect, m_groupName, Qt::AlignBottom | Qt::AlignHCenter);
+
+ painter.setPen(Ribbon::GroupDividerColor[currentTheme]);
+
+ auto startPoint = QPoint(rect().right()-1, rect().top()+Ribbon::GroupDividerMargin);
+ auto endPoint = QPoint(rect().right()-1, rect().bottom()-Ribbon::GroupDividerMargin);
+
+ painter.drawLine(startPoint, endPoint);
+
+ painter.restore();
+
+ QWidget::paintEvent(event);
+}
+
+QString Nedrysoft::Ribbon::RibbonGroup::groupName() const {
+ return m_groupName;
+}
+
+void Nedrysoft::Ribbon::RibbonGroup::setGroupName(const QString &groupName) {
+ m_groupName = groupName;
+
+ updateMargins();
+}
+
+void Nedrysoft::Ribbon::RibbonGroup::updateMargins() {
+ m_textRect = m_fontMetrics.boundingRect(m_groupName);
+
+ setContentsMargins(RibbonGroupHorizontalMargins, 0, RibbonGroupHorizontalMargins, m_textRect.height());
+
+ update();
+}
\ No newline at end of file
diff --git a/RibbonGroup.h b/RibbonGroup.h
new file mode 100644
index 0000000..0b802c2
--- /dev/null
+++ b/RibbonGroup.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONGROUP_H
+#define NEDRYSOFT_RIBBONGROUP_H
+
+#include "RibbonSpec.h"
+
+#include
+#include
+#include
+
+namespace Nedrysoft::Ribbon {
+ constexpr auto RibbonGroupHorizontalMargins = 12;
+
+#if defined(Q_OS_MACOS)
+ constexpr int RibbonGroupDefaultFontSize = 10;
+#else
+ constexpr int RibbonGroupDefaultFontSize = 8;
+#endif
+
+ /**
+ * @brief The RibbonGroup widget provides a ribbon stylised group container.
+ *
+ * @details A RibbonGroup is a container for a logical grouping of controls, a RibbonWidget page will
+ * contain multiple groups which in turn contain multiple controls.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonGroup :
+ public QWidget {
+
+ private:
+ Q_OBJECT
+
+ Q_PROPERTY(QString groupName READ groupName WRITE setGroupName)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonGroup which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonGroup(QWidget *parent = nullptr);
+
+ /**
+ * @brief Destroys the RibbonGroup.
+ */
+ QString groupName() const;
+
+ /**
+ * @brief Sets the displayed name of the group.
+ *
+ * @param[in] name the name of the group which is displayed at the bottom of the group.
+ */
+ void setGroupName(const QString &name);
+
+ /**
+ * @brief Updates the margins to account for the group bordere.
+ */
+ void updateMargins();
+
+ protected:
+ /**
+ * @brief Reimplements: QWidget::paintEvent(QPaintEvent *event).
+ *
+ * @param[in] event the event information.
+ */
+ virtual void paintEvent(QPaintEvent *event) override;
+
+ private:
+ QString m_groupName; //! Group name that is displayed
+ QFont m_font; //! Font used to draw the group name
+ QFontMetrics m_fontMetrics; //! The font metrics of the selected font
+ QRect m_textRect; //! The rectangle of the group name in the selected font
+ };
+}
+
+#endif // NEDRYSOFT_RIBBONGROUP_H
diff --git a/RibbonGroupPlugin.cpp b/RibbonGroupPlugin.cpp
new file mode 100644
index 0000000..9ff3e27
--- /dev/null
+++ b/RibbonGroupPlugin.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonGroupPlugin.h"
+#include "RibbonGroup.h"
+#include "RibbonWidget.h"
+
+#include
+
+constexpr auto ConfigurationXML = R"(
+
+
+
+ Group
+
+
+
+
+ 0
+ 0
+ [default-width]
+ [default-height]
+
+
+
+
+)";
+
+RibbonGroupPlugin::RibbonGroupPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+}
+
+void RibbonGroupPlugin::initialize(QDesignerFormEditorInterface *core) {
+ Q_UNUSED(core);
+
+ if (m_initialized) {
+ return;
+ }
+
+ m_initialized = true;
+}
+
+bool RibbonGroupPlugin::isInitialized() const {
+ return m_initialized;
+}
+
+QWidget *RibbonGroupPlugin::createWidget(QWidget *parent) {
+ return new Nedrysoft::Ribbon::RibbonGroup(parent);
+}
+
+QString RibbonGroupPlugin::name() const {
+ return QStringLiteral("Nedrysoft::Ribbon::RibbonGroup");
+}
+
+QString RibbonGroupPlugin::group() const {
+ return QStringLiteral("Nedrysoft Ribbon Widgets");
+}
+
+QIcon RibbonGroupPlugin::icon() const {
+ return QIcon(":/Nedrysoft/Ribbon/icons/ribbon.png");
+}
+
+QString RibbonGroupPlugin::toolTip() const {
+ return tr("A Ribbon Group");
+}
+
+QString RibbonGroupPlugin::whatsThis() const {
+ return tr("The Ribbon Group is a container that contains a set of controls that are logically grouped together.");
+}
+
+bool RibbonGroupPlugin::isContainer() const {
+ return true;
+}
+
+QString RibbonGroupPlugin::domXml() const {
+ return QString(ConfigurationXML).replace("[default-width]", QString::number(Nedrysoft::Ribbon::RibbonBarDefaultWidth))
+ .replace("[default-height]", QString::number(Nedrysoft::Ribbon::RibbonBarHeight));
+}
+
+QString RibbonGroupPlugin::includeFile() const {
+ return QStringLiteral("Ribbon/RibbonGroup.h");
+}
diff --git a/RibbonGroupPlugin.h b/RibbonGroupPlugin.h
new file mode 100644
index 0000000..adb5c21
--- /dev/null
+++ b/RibbonGroupPlugin.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONGROUPPLUGIN_H
+#define NEDRYSOFT_RIBBONGROUPPLUGIN_H
+
+#include
+
+/**
+ * @brief Ribbon bar group Qt Designer plugin.
+ *
+ * @details Provides a group section of a RibbonBar, operations and tools are grouped logically.
+ */
+class RibbonGroupPlugin :
+ public QObject,
+ public QDesignerCustomWidgetInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonGroupPlugin instance which is a child of the parent.
+ *
+ * @param[in] parent the owner object.
+ */
+ explicit RibbonGroupPlugin(QObject *parent = nullptr);
+
+ /**
+ * @brief Returns true if the widget is intended to be used as a container; otherwise returns false.
+ *
+ * @returns true if it container; otherwise false.
+ */
+ bool isContainer() const override;
+
+ /**
+ * @brief Returns true if the widget has been initialized; otherwise returns false.
+ *
+ * @returns true if initialised; otherwise false.
+ */
+ bool isInitialized() const override;
+
+ /**
+ * @brief Returns the icon used to represent the custom widget in Qt Designer's widget box.
+ *
+ * @returns the icon used to represent the custom widget in Qt Designer's widget box.
+ */
+ QIcon icon() const override;
+
+ /**
+ * @brief Returns the XML that is used to describe the custom widget's properties to Qt Designer.
+ *
+ * @returns the XML describing the widgets properties.
+ */
+ QString domXml() const override;
+
+ /**
+ * @brief Returns the name of the group to which the widget belongs.
+ *
+ * @returns the name of the group.
+ */
+ QString group() const override;
+
+ /**
+ * @brief Returns the path to the include file that uic uses when creating code for the widget.
+ *
+ * @returns the path to the include file.
+ */
+ QString includeFile() const override;
+
+ /**
+ * @brief Returns the class name of the widget supplied by the interface.
+ *
+ * @returns the name of the widget.
+ */
+ QString name() const override;
+
+ /**
+ * @brief Returns a short description of the widget that can be used by Qt Designer in a tool tip.
+ *
+ * @returns the description.
+ */
+ QString toolTip() const override;
+
+ /**
+ * @brief Returns a description of the widget that can be used by Qt Designer in "What's This?" help for the widget.
+ *
+ * @returns the description.
+ */
+ QString whatsThis() const override;
+
+ /**
+ * @brief Returns a new instance of the RibbonGroup class, with the given parent.
+ *
+ * @returns the widget instance.
+ */
+ QWidget *createWidget(QWidget *parent) override;
+
+ /**
+ * @brief Initializes the widget for use with the specified formEditor interface.
+ */
+ void initialize(QDesignerFormEditorInterface *core) override;
+
+ private:
+ bool m_initialized = false; //! holds whether designer has initialised the factory yet
+};
+
+#endif // NEDRYSOFT_RIBBONGROUPPLUGIN_H
diff --git a/RibbonLineEdit.cpp b/RibbonLineEdit.cpp
new file mode 100644
index 0000000..a05247d
--- /dev/null
+++ b/RibbonLineEdit.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 12/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonLineEdit.h"
+
+#include "RibbonFontManager.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+
+constexpr auto ThemeStylesheet = R"(
+ QLineEdit {
+ background-color: [background-colour];
+ height: 13px;
+ border: 1px solid [border-colour];
+ padding: 2px;
+ }
+
+ QLineEdit:focus {
+ border-color: [border-colour];
+ }
+)";
+
+Nedrysoft::Ribbon::RibbonLineEdit::RibbonLineEdit(QWidget *parent) :
+ QLineEdit(parent),
+ m_themeSupport(new Nedrysoft::Utils::ThemeSupport) {
+
+ setAttribute(Qt::WA_MacShowFocusRect,false);
+
+ connect(m_themeSupport, &Nedrysoft::Utils::ThemeSupport::themeChanged, [=](bool isDarkMode) {
+ updateStyleSheet(isDarkMode);
+ });
+
+ updateStyleSheet(Nedrysoft::Utils::ThemeSupport::isDarkMode());
+}
+
+Nedrysoft::Ribbon::RibbonLineEdit::~RibbonLineEdit() {
+}
+
+void Nedrysoft::Ribbon::RibbonLineEdit::updateStyleSheet(bool isDarkMode) {
+ QString styleSheet(ThemeStylesheet);
+
+ if (isDarkMode) {
+ styleSheet.replace("[background-colour]", "#434343");
+ styleSheet.replace("[border-colour]", "none");
+ } else {
+ styleSheet.replace("[background-colour]", "#ffffff");
+ styleSheet.replace("[border-colour]", "#B9B9B9");
+ }
+
+ setStyleSheet(styleSheet);
+}
diff --git a/RibbonLineEdit.h b/RibbonLineEdit.h
new file mode 100644
index 0000000..59a3054
--- /dev/null
+++ b/RibbonLineEdit.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 12/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONLINEDIT_H
+#define NEDRYSOFT_RIBBONLINEDIT_H
+
+#include "RibbonSpec.h"
+#include "ThemeSupport.h"
+
+#include
+
+namespace Nedrysoft::Ribbon {
+ /**
+ * @brief The RibbonLineEdit widget provides a ribbon stylised line edit.
+ *
+ * @details A LineEdit widget that is styled to match the RibbonBar.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonLineEdit :
+ public QLineEdit {
+
+ private:
+ Q_OBJECT
+
+ public:
+ /**
+ * @brief Constructs a new RibbonLineEdit instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonLineEdit(QWidget *parent=nullptr);
+
+ /**
+ * @brief Destroys the RibbonLineEdit.
+ */
+ ~RibbonLineEdit() override;
+
+ private:
+ /**
+ * @brief Updates the stylesheet when the operating system theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ void updateStyleSheet(bool isDarkMode);
+
+ private:
+ Nedrysoft::Utils::ThemeSupport *m_themeSupport; //! theme support instance
+ };
+}
+
+#endif //NEDRYSOFT_RIBBONLINEDIT_H
diff --git a/RibbonLineEditPlugin.cpp b/RibbonLineEditPlugin.cpp
new file mode 100644
index 0000000..a6f201d
--- /dev/null
+++ b/RibbonLineEditPlugin.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 12/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonLineEditPlugin.h"
+#include "RibbonLineEdit.h"
+
+#include
+
+constexpr auto ConfigurationXML = R"(
+
+
+
+
+ 0
+ 0
+ 100
+ 13
+
+
+
+
+)";
+
+RibbonLineEditPlugin::RibbonLineEditPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+}
+
+void RibbonLineEditPlugin::initialize(QDesignerFormEditorInterface *core) {
+ Q_UNUSED(core);
+
+ if (m_initialized) {
+ return;
+ }
+
+ m_initialized = true;
+}
+
+bool RibbonLineEditPlugin::isInitialized() const {
+ return m_initialized;
+}
+
+QWidget *RibbonLineEditPlugin::createWidget(QWidget *parent) {
+ return new Nedrysoft::Ribbon::RibbonLineEdit(parent);
+}
+
+QString RibbonLineEditPlugin::name() const {
+ return QStringLiteral("Nedrysoft::Ribbon::RibbonLineEdit");
+}
+
+QString RibbonLineEditPlugin::group() const {
+ return QStringLiteral("Nedrysoft Ribbon Widgets");
+}
+
+QIcon RibbonLineEditPlugin::icon() const {
+ return QIcon(":/Nedrysoft/Ribbon/icons/ribbon.png");
+}
+
+QString RibbonLineEditPlugin::toolTip() const {
+ return tr("A Ribbon Line Edit");
+}
+
+QString RibbonLineEditPlugin::whatsThis() const {
+ return tr("The Ribbon Line Edit is a QLineEdit subclass that is styled to match the Ribbon.");
+}
+
+bool RibbonLineEditPlugin::isContainer() const {
+ return false;
+}
+
+QString RibbonLineEditPlugin::domXml() const {
+ return ConfigurationXML;
+}
+
+QString RibbonLineEditPlugin::includeFile() const {
+ return QStringLiteral("Ribbon/RibbonLineEdit.h");
+}
diff --git a/RibbonLineEditPlugin.h b/RibbonLineEditPlugin.h
new file mode 100644
index 0000000..20ad192
--- /dev/null
+++ b/RibbonLineEditPlugin.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 12/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONLINEDITPLUGIN_H
+#define NEDRYSOFT_RIBBONLINEDITPLUGIN_H
+
+#include
+
+/**
+ * @brief Ribbon line edit Qt Designer plugin.
+ *
+ * @details Exposes the RibbonLineEdit widget to Qt Designer, this class is responsible for creating instances of
+ * the widget and exposing properties and functions required for design.
+ */
+class RibbonLineEditPlugin :
+ public QObject,
+ public QDesignerCustomWidgetInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonLineEditPlugin instance which is a child of the parent.
+ *
+ * @param[in] parent the owner object.
+ */
+ explicit RibbonLineEditPlugin(QObject *parent = nullptr);
+
+ /**
+ * @brief Returns true if the widget is intended to be used as a container; otherwise returns false.
+ *
+ * @returns true if it container; otherwise false.
+ */
+ bool isContainer() const override;
+
+ /**
+ * @brief Returns true if the widget has been initialized; otherwise returns false.
+ *
+ * @returns true if initialised; otherwise false.
+ */
+ bool isInitialized() const override;
+
+ /**
+ * @brief Returns the icon used to represent the custom widget in Qt Designer's widget box.
+ *
+ * @returns the icon used to represent the custom widget in Qt Designer's widget box.
+ */
+ QIcon icon() const override;
+
+ /**
+ * @brief Returns the XML that is used to describe the custom widget's properties to Qt Designer.
+ *
+ * @returns the XML describing the widgets properties.
+ */
+ QString domXml() const override;
+
+ /**
+ * @brief Returns the name of the group to which the widget belongs.
+ *
+ * @returns the name of the group.
+ */
+ QString group() const override;
+
+ /**
+ * @brief Returns the path to the include file that uic uses when creating code for the widget.
+ *
+ * @returns the path to the include file.
+ */
+ QString includeFile() const override;
+
+ /**
+ * @brief Returns the class name of the widget supplied by the interface.
+ *
+ * @returns the name of the widget.
+ */
+ QString name() const override;
+
+ /**
+ * @brief Returns a short description of the widget that can be used by Qt Designer in a tool tip.
+ *
+ * @returns the description.
+ */
+ QString toolTip() const override;
+
+ /**
+ * @brief Returns a description of the widget that can be used by Qt Designer in "What's This?" help for the widget.
+ *
+ * @returns the description.
+ */
+ QString whatsThis() const override;
+
+ /**
+ * @brief Returns a new instance of the RibbonLineEdit class, with the given parent.
+ *
+ * @returns the widget instance.
+ */
+ QWidget *createWidget(QWidget *parent) override;
+
+ /**
+ * @brief Initializes the widget for use with the specified formEditor interface.
+ */
+ void initialize(QDesignerFormEditorInterface *core) override;
+
+ private:
+ bool m_initialized = false; //! holds whether designer has initialised the factory yet
+};
+
+#endif // NEDRYSOFT_RIBBONLINEDITPLUGIN_H
diff --git a/RibbonPushButton.cpp b/RibbonPushButton.cpp
new file mode 100644
index 0000000..6832841
--- /dev/null
+++ b/RibbonPushButton.cpp
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 11/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonPushButton.h"
+
+#include "RibbonFontManager.h"
+#include "RibbonWidget.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+#include
+
+#include
+
+constexpr auto ThemeStylesheet = R"(
+ QPushButton {
+ border: 0px;
+ padding: 3px;
+ }
+
+ QPushButton::hover {
+ background: [background-colour];
+ }
+)";
+
+Nedrysoft::Ribbon::RibbonPushButton::RibbonPushButton(QWidget *parent) :
+ QWidget(parent),
+ m_iconSize(QSize(RibbonPushButtonDefaultIconWidth, RibbonPushButtonDefaultIconHeight)),
+ m_themeSupport(new Nedrysoft::Utils::ThemeSupport) {
+
+ m_layout = new QVBoxLayout;
+ m_mainButton = new QPushButton;
+ m_buttonLabel = new QLabel;
+
+ m_buttonLabel->setAlignment(Qt::AlignHCenter);
+
+ auto fontManager = RibbonFontManager::getInstance();
+
+ auto font = QFont(fontManager->normalFont(), RibbonPushButtonDefaultFontSize);
+
+ m_mainButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ m_buttonLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+
+ m_mainButton->installEventFilter(this);
+
+ m_buttonLabel->setFont(font);
+
+ m_layout->addWidget(m_mainButton);
+ m_layout->addWidget(m_buttonLabel);
+ m_layout->addSpacerItem(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding));
+
+ m_layout->setContentsMargins(0,0,0,0);
+ m_layout->setSpacing(0);
+
+ m_mainButton->setFlat(true);
+
+ setLayout(m_layout);
+
+ connect(m_mainButton, &QPushButton::clicked, [=] (bool checked) {
+ Q_EMIT clicked();
+ });
+
+ connect(m_themeSupport, &Nedrysoft::Utils::ThemeSupport::themeChanged, [=](bool isDarkMode) {
+ updateStyleSheets(isDarkMode);
+ });
+
+ updateSizes();
+
+ updateStyleSheets(Nedrysoft::Utils::ThemeSupport::isDarkMode());
+}
+
+Nedrysoft::Ribbon::RibbonPushButton::~RibbonPushButton() {
+ m_mainButton->deleteLater();
+ m_buttonLabel->deleteLater();
+ m_layout->deleteLater();
+}
+
+QIcon Nedrysoft::Ribbon::RibbonPushButton::icon() {
+ return m_mainButton->icon();
+}
+
+void Nedrysoft::Ribbon::RibbonPushButton::setIcon(QIcon &icon) {
+ m_mainButton->setIcon(icon);
+}
+
+QSize Nedrysoft::Ribbon::RibbonPushButton::iconSize() {
+ return m_iconSize;
+}
+
+void Nedrysoft::Ribbon::RibbonPushButton::setIconSize(QSize iconSize)
+{
+ m_iconSize = iconSize;
+
+ updateSizes();
+}
+
+QString Nedrysoft::Ribbon::RibbonPushButton::text() {
+ return m_buttonLabel->text();
+}
+
+void Nedrysoft::Ribbon::RibbonPushButton::setText(QString text) {
+ m_buttonLabel->setText(text);
+
+ m_buttonLabel->setVisible(!m_buttonLabel->text().isEmpty());
+}
+
+void Nedrysoft::Ribbon::RibbonPushButton::updateSizes() {
+ m_mainButton->setMinimumSize(m_iconSize);
+ m_mainButton->setIconSize(m_iconSize);
+}
+
+void Nedrysoft::Ribbon::RibbonPushButton::updateStyleSheets(bool isDarkMode) {
+ QString styleSheet(ThemeStylesheet);
+
+ styleSheet.replace("[background-colour]", Nedrysoft::Utils::ThemeSupport::getColor(Nedrysoft::Ribbon::PushButtonColor).name());
+
+ m_mainButton->setStyleSheet(styleSheet);
+ m_buttonLabel->setStyleSheet(styleSheet);
+}
+
+bool Nedrysoft::Ribbon::RibbonPushButton::eventFilter(QObject *object, QEvent *event) {
+ if (event->type()==QEvent::MouseButtonPress) {
+ QString styleSheet(ThemeStylesheet);
+
+ styleSheet.replace("[background-colour]", "#292929");
+
+ m_mainButton->setStyleSheet(styleSheet);
+ } else if (event->type()==QEvent::MouseButtonRelease) {
+ updateStyleSheets(m_themeSupport->isDarkMode());
+ }
+
+ return false;
+}
+
diff --git a/RibbonPushButton.h b/RibbonPushButton.h
new file mode 100644
index 0000000..9051a93
--- /dev/null
+++ b/RibbonPushButton.h
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 11/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONPUSHBUTTON_H
+#define NEDRYSOFT_RIBBONPUSHBUTTON_H
+
+#include "RibbonSpec.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+#include
+#include
+
+namespace Nedrysoft::Ribbon {
+ constexpr auto RibbonPushButtonDefaultIconWidth = 32;
+ constexpr auto RibbonPushButtonDefaultIconHeight = 48;
+ constexpr auto RibbonPushButtonDefaultFontSize = 10;
+
+ /**
+ * @brief The RibbonPushButton widget provides a ribbon stylised push button with icon and optional text.
+ *
+ * @details A PushButton widget that is styled to match the RibbonBar.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonPushButton :
+ public QWidget {
+
+ private:
+ Q_OBJECT
+
+ Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
+ Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
+ Q_PROPERTY(QString text READ text WRITE setText)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonPushButton instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonPushButton(QWidget *parent=nullptr);
+
+ /**
+ * @brief Destroys the RibbonPushButton.
+ */
+ ~RibbonPushButton() override;
+
+ /**
+ * @brief Returns the icon that is currently assigned to the main button.
+ *
+ * @returns the icon assigned to the main button.
+ */
+ QIcon icon();
+
+ /**
+ * @brief Sets the icon to be displayed on the main button.
+ *
+ * @param[in] icon the icon to be displayed on the main button.
+ */
+ void setIcon(QIcon &icon);
+
+ /**
+ * @brief Returns the current size of the icon.
+ *
+ * @returns the current size of the icon.
+ */
+ QSize iconSize();
+
+ /**
+ * @brief Sets the current size of the icon.
+ *
+ * @param[in] iconSize the new size of the icon to be used.
+ */
+ void setIconSize(QSize iconSize);
+
+ /**
+ * @brief Returns the text that is displayed under the main button.
+ *
+ * @returns the text that is displayed under the main button.
+ */
+ QString text();
+
+ /**
+ * @brief Sets the text that is displayed under the main button.
+ *
+ * @note If the text is empty, then the RibbonPushButton modifies the layout so that the space
+ * that would contain the text is removed.
+ *
+ * @param[in] text the text that is displayed under the main button.
+ */
+ void setText(QString text);
+
+ private:
+ /**
+ * @brief Updates the child widgets when the size of the icon is changed.
+ */
+ void updateSizes();
+
+ /**
+ * @brief Updates the child widgets stylesheets when the operating system theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ void updateStyleSheets(bool isDarkMode);
+
+ public:
+ /**
+ * @brief This signal is emitted when the main button has been clicked.
+ */
+ Q_SIGNAL void clicked();
+
+ protected:
+ /**
+ * @brief Reimplements: QWidget::eventFilter(QObject *object, QEvent *event).
+ *
+ * @param[in] object the target object for the event.
+ * @param[in] event the event information.
+ */
+ bool eventFilter(QObject *object, QEvent *event) override;
+
+ private:
+ QVBoxLayout *m_layout; //! the layout for this widget
+ QPushButton *m_mainButton; //! the main button
+ QLabel *m_buttonLabel; //! the main button label
+ QSize m_iconSize; //! the size of the icon
+ Nedrysoft::Utils::ThemeSupport *m_themeSupport; //! an instance of theme support
+ };
+}
+
+#endif //NEDRYSOFT_RIBBONPUSHBUTTON_H
diff --git a/RibbonPushButtonPlugin.cpp b/RibbonPushButtonPlugin.cpp
new file mode 100644
index 0000000..3b4133b
--- /dev/null
+++ b/RibbonPushButtonPlugin.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 11/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonPushButtonPlugin.h"
+
+#include "RibbonPushButton.h"
+
+#include
+#include
+
+constexpr auto ConfigurationXML = R"(
+
+
+
+ Button
+
+
+
+)";
+
+RibbonPushButtonPlugin::RibbonPushButtonPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+}
+
+void RibbonPushButtonPlugin::initialize(QDesignerFormEditorInterface *core) {
+ Q_UNUSED(core);
+
+ if (m_initialized) {
+ return;
+ }
+
+ m_initialized = true;
+}
+
+bool RibbonPushButtonPlugin::isInitialized() const {
+ return m_initialized;
+}
+
+QWidget *RibbonPushButtonPlugin::createWidget(QWidget *parent) {
+ return new Nedrysoft::Ribbon::RibbonPushButton(parent);
+}
+
+QString RibbonPushButtonPlugin::name() const {
+ return QStringLiteral("Nedrysoft::Ribbon::RibbonPushButton");
+}
+
+QString RibbonPushButtonPlugin::group() const {
+ return QStringLiteral("Nedrysoft Ribbon Widgets");
+}
+
+QIcon RibbonPushButtonPlugin::icon() const {
+ return QIcon(":/Nedrysoft/Ribbon/icons/ribbon.png");
+}
+
+QString RibbonPushButtonPlugin::toolTip() const {
+ return tr("A Ribbon Push Button");
+}
+
+QString RibbonPushButtonPlugin::whatsThis() const {
+ return tr("The Ribbon Push Button is a control that provides a main push button with optional text and is styled to match the Ribbon.");
+}
+
+bool RibbonPushButtonPlugin::isContainer() const {
+ return true;
+}
+
+QString RibbonPushButtonPlugin::domXml() const {
+ return ConfigurationXML;
+}
+
+QString RibbonPushButtonPlugin::includeFile() const {
+ return QStringLiteral("Ribbon/RibbonPushButton.h");
+}
diff --git a/RibbonPushButtonPlugin.h b/RibbonPushButtonPlugin.h
new file mode 100644
index 0000000..97901ab
--- /dev/null
+++ b/RibbonPushButtonPlugin.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 11/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONPUSHBUTTONPLUGIN_H
+#define NEDRYSOFT_RIBBONPUSHBUTTONPLUGIN_H
+
+#include
+
+/**
+ * @brief Ribbon push button with label Qt Designer plugin.
+ *
+ * @details Exposes the RibbonPushButton widget to Qt Designer, this class is responsible for creating instances of
+ * the widget and exposing properties and functions required for design.
+ */
+class RibbonPushButtonPlugin :
+ public QObject,
+ public QDesignerCustomWidgetInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonPushButtonPlugin instance which is a child of the parent.
+ *
+ * @param[in] parent the owner object.
+ */
+ explicit RibbonPushButtonPlugin(QObject *parent = nullptr);
+
+ /**
+ * @brief Returns true if the widget is intended to be used as a container; otherwise returns false.
+ *
+ * @returns true if it container; otherwise false.
+ */
+ bool isContainer() const override;
+
+ /**
+ * @brief Returns true if the widget has been initialized; otherwise returns false.
+ *
+ * @returns true if initialised; otherwise false.
+ */
+ bool isInitialized() const override;
+
+ /**
+ * @brief Returns the icon used to represent the custom widget in Qt Designer's widget box.
+ *
+ * @returns the icon used to represent the custom widget in Qt Designer's widget box.
+ */
+ QIcon icon() const override;
+
+ /**
+ * @brief Returns the XML that is used to describe the custom widget's properties to Qt Designer.
+ *
+ * @returns the XML describing the widgets properties.
+ */
+ QString domXml() const override;
+
+ /**
+ * @brief Returns the name of the group to which the widget belongs.
+ *
+ * @returns the name of the group.
+ */
+ QString group() const override;
+
+ /**
+ * @brief Returns the path to the include file that uic uses when creating code for the widget.
+ *
+ * @returns the path to the include file.
+ */
+ QString includeFile() const override;
+
+ /**
+ * @brief Returns the class name of the widget supplied by the interface.
+ *
+ * @returns the name of the widget.
+ */
+ QString name() const override;
+
+ /**
+ * @brief Returns a short description of the widget that can be used by Qt Designer in a tool tip.
+ *
+ * @returns the description.
+ */
+ QString toolTip() const override;
+
+ /**
+ * @brief Returns a description of the widget that can be used by Qt Designer in "What's This?" help for the widget.
+ *
+ * @returns the description.
+ */
+ QString whatsThis() const override;
+
+ /**
+ * @brief Returns a new instance of the RibbonPushButton class, with the given parent.
+ *
+ * @returns the widget instance.
+ */
+ QWidget *createWidget(QWidget *parent) override;
+
+ /**
+ * @brief Initializes the widget for use with the specified formEditor interface.
+ */
+ void initialize(QDesignerFormEditorInterface *core) override;
+
+ private:
+ bool m_initialized = false; //! holds whether designer has initialised the factory yet
+};
+
+#endif // NEDRYSOFT_RIBBONPUSHBUTTONPLUGIN_H
diff --git a/RibbonResources.qrc b/RibbonResources.qrc
new file mode 100644
index 0000000..91cb113
--- /dev/null
+++ b/RibbonResources.qrc
@@ -0,0 +1,47 @@
+
+
+ OpenSans/OpenSans-Bold.ttf
+ OpenSans/OpenSans-BoldItalic.ttf
+ OpenSans/OpenSans-ExtraBold.ttf
+ OpenSans/OpenSans-ExtraBoldItalic.ttf
+ OpenSans/OpenSans-Italic.ttf
+ OpenSans/OpenSans-Light.ttf
+ OpenSans/OpenSans-LightItalic.ttf
+ OpenSans/OpenSans-Regular.ttf
+ OpenSans/OpenSans-SemiBold.ttf
+ OpenSans/OpenSans-SemiBoldItalic.ttf
+
+ icons/arrow-drop-light.png
+ icons/arrow-drop-light@2x.png
+ icons/arrow-drop-dark.png
+ icons/arrow-drop-dark@2x.png
+
+ icons/checked-dark.png
+ icons/checked-dark@2x.png
+ icons/checked-hover-dark.png
+ icons/checked-hover-dark@2x.png
+
+ icons/unchecked-dark.png
+ icons/unchecked-dark@2x.png
+ icons/unchecked-hover-dark.png
+ icons/unchecked-hover-dark@2x.png
+
+ icons/checked-light.png
+ icons/checked-light@2x.png
+ icons/checked-hover-light.png
+ icons/checked-hover-light@2x.png
+
+ icons/unchecked-light.png
+ icons/unchecked-light@2x.png
+ icons/unchecked-hover-light.png
+ icons/unchecked-hover-light@2x.png
+
+ icons/slider-dark.png
+ icons/slider-dark@2x.png
+ icons/slider-light.png
+ icons/slider-light@2x.png
+
+ icons/ribbon.png
+ icons/ribbon@2x.png
+
+
diff --git a/RibbonSlider.cpp b/RibbonSlider.cpp
new file mode 100644
index 0000000..467692e
--- /dev/null
+++ b/RibbonSlider.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonSlider.h"
+
+#include "RibbonFontManager.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+
+constexpr auto ThemeStylesheet = R"(
+ QSlider {
+ margin-top:4px;
+ margin-bottom:4px;
+ }
+
+ QSlider::groove:horizontal {
+ height: 4px;
+ background: [background-colour];
+ margin: 2px 0;
+ }
+
+ QSlider::handle:horizontal {
+ image: url(':/Nedrysoft/Ribbon/icons/slider-[theme]@2x.png');
+ width: 10px;
+ height: 10px;
+ margin: -5px 0px;
+ }
+)";
+
+Nedrysoft::Ribbon::RibbonSlider::RibbonSlider(QWidget *parent) :
+ QSlider(parent),
+ m_themeSupport(new Nedrysoft::Utils::ThemeSupport) {
+
+ setAttribute(Qt::WA_MacShowFocusRect,false);
+
+ connect(m_themeSupport, &Nedrysoft::Utils::ThemeSupport::themeChanged, [=](bool isDarkMode) {
+ updateStyleSheet(isDarkMode);
+ });
+
+ updateStyleSheet(Nedrysoft::Utils::ThemeSupport::isDarkMode());
+}
+
+Nedrysoft::Ribbon::RibbonSlider::~RibbonSlider() {
+}
+
+void Nedrysoft::Ribbon::RibbonSlider::updateStyleSheet(bool isDarkMode) {
+ QString styleSheet(ThemeStylesheet);
+
+ styleSheet.replace("[theme]", isDarkMode ? "dark" : "light");
+
+ if (isDarkMode) {
+ styleSheet.replace("[background-colour]", "#434343");
+ } else {
+ styleSheet.replace("[background-colour]", "#c8c9c8");
+ }
+
+ setStyleSheet(styleSheet);
+}
diff --git a/RibbonSlider.h b/RibbonSlider.h
new file mode 100644
index 0000000..a1d5fe2
--- /dev/null
+++ b/RibbonSlider.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONSLIDER_H
+#define NEDRYSOFT_RIBBONSLIDER_H
+
+#include "RibbonSpec.h"
+#include "ThemeSupport.h"
+
+#include
+
+namespace Nedrysoft::Ribbon {
+ /**
+ * @brief The RibbonSlider widget provides a ribbon stylised slider.
+ *
+ * @details A Slider widget that is styled to match the RibbonBar.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonSlider :
+ public QSlider {
+
+ private:
+ Q_OBJECT
+
+ public:
+ /**
+ * @brief Constructs a new RibbonSlider instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonSlider(QWidget *parent=nullptr);
+
+ /**
+ * @brief Destroys the RibbonSlider.
+ */
+ ~RibbonSlider() override;
+
+ private:
+ /**
+ * @brief Updates the stylesheet when the operating system theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ void updateStyleSheet(bool isDarkMode);
+
+ private:
+ Nedrysoft::Utils::ThemeSupport *m_themeSupport; //! theme support instance
+ };
+}
+
+#endif //NEDRYSOFT_RIBBONSLIDER_H
diff --git a/RibbonSliderPlugin.cpp b/RibbonSliderPlugin.cpp
new file mode 100644
index 0000000..96b5959
--- /dev/null
+++ b/RibbonSliderPlugin.cpp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonSliderPlugin.h"
+#include "RibbonSlider.h"
+
+#include
+
+constexpr auto ConfigurationXML = R"(
+
+
+
+
+)";
+
+RibbonSliderPlugin::RibbonSliderPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+}
+
+void RibbonSliderPlugin::initialize(QDesignerFormEditorInterface *core) {
+ Q_UNUSED(core);
+
+ if (m_initialized) {
+ return;
+ }
+
+ m_initialized = true;
+}
+
+bool RibbonSliderPlugin::isInitialized() const {
+ return m_initialized;
+}
+
+QWidget *RibbonSliderPlugin::createWidget(QWidget *parent) {
+ return new Nedrysoft::Ribbon::RibbonSlider(parent);
+}
+
+QString RibbonSliderPlugin::name() const {
+ return QStringLiteral("Nedrysoft::Ribbon::RibbonSlider");
+}
+
+QString RibbonSliderPlugin::group() const {
+ return QStringLiteral("Nedrysoft Ribbon Widgets");
+}
+
+QIcon RibbonSliderPlugin::icon() const {
+ return QIcon(":/Nedrysoft/Ribbon/icons/ribbon.png");
+}
+
+QString RibbonSliderPlugin::toolTip() const {
+ return QString();
+}
+
+QString RibbonSliderPlugin::whatsThis() const {
+ return tr("The Ribbon Line Edit is a QSlider subclass that is styled to match the Ribbon.");
+}
+
+bool RibbonSliderPlugin::isContainer() const {
+ return false;
+}
+
+QString RibbonSliderPlugin::domXml() const {
+ return ConfigurationXML;
+}
+
+QString RibbonSliderPlugin::includeFile() const {
+ return QStringLiteral("Ribbon/RibbonSlider.h");
+}
diff --git a/RibbonSliderPlugin.h b/RibbonSliderPlugin.h
new file mode 100644
index 0000000..c40dc87
--- /dev/null
+++ b/RibbonSliderPlugin.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 15/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONSLIDERPLUGIN_H
+#define NEDRYSOFT_RIBBONSLIDERPLUGIN_H
+
+#include
+
+/**
+ * @brief Ribbon slider Qt Designer plugin.
+ *
+ * @details Exposes the RibbonSlider widget to Qt Designer, this class is responsible for creating instances of
+ * the widget and exposing properties and functions required for design.
+ */
+class RibbonSliderPlugin :
+ public QObject,
+ public QDesignerCustomWidgetInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonSliderPlugin instance which is a child of the parent.
+ *
+ * @param[in] parent the owner object.
+ */
+ explicit RibbonSliderPlugin(QObject *parent = nullptr);
+
+ /**
+ * @brief Returns true if the widget is intended to be used as a container; otherwise returns false.
+ *
+ * @returns true if it container; otherwise false.
+ */
+ bool isContainer() const override;
+
+ /**
+ * @brief Returns true if the widget has been initialized; otherwise returns false.
+ *
+ * @returns true if initialised; otherwise false.
+ */
+ bool isInitialized() const override;
+
+ /**
+ * @brief Returns the icon used to represent the custom widget in Qt Designer's widget box.
+ *
+ * @returns the icon used to represent the custom widget in Qt Designer's widget box.
+ */
+ QIcon icon() const override;
+
+ /**
+ * @brief Returns the XML that is used to describe the custom widget's properties to Qt Designer.
+ *
+ * @returns the XML describing the widgets properties.
+ */
+ QString domXml() const override;
+
+ /**
+ * @brief Returns the name of the group to which the widget belongs.
+ *
+ * @returns the name of the group.
+ */
+ QString group() const override;
+
+ /**
+ * @brief Returns the path to the include file that uic uses when creating code for the widget.
+ *
+ * @returns the path to the include file.
+ */
+ QString includeFile() const override;
+
+ /**
+ * @brief Returns the class name of the widget supplied by the interface.
+ *
+ * @returns the name of the widget.
+ */
+ QString name() const override;
+
+ /**
+ * @brief Returns a short description of the widget that can be used by Qt Designer in a tool tip.
+ *
+ * @returns the description.
+ */
+ QString toolTip() const override;
+
+ /**
+ * @brief Returns a description of the widget that can be used by Qt Designer in "What's This?" help for the widget.
+ *
+ * @returns the description.
+ */
+ QString whatsThis() const override;
+
+ /**
+ * @brief Returns a new instance of the RibbonSlider class, with the given parent.
+ *
+ * @returns the widget instance.
+ */
+ QWidget *createWidget(QWidget *parent) override;
+
+ /**
+ * @brief Initializes the widget for use with the specified formEditor interface.
+ */
+ void initialize(QDesignerFormEditorInterface *core) override;
+
+ private:
+ bool m_initialized = false; //! holds whether designer has initialised the factory yet
+};
+
+#endif // NEDRYSOFT_RIBBONSLIDERPLUGIN_H
diff --git a/RibbonSpec.h b/RibbonSpec.h
new file mode 100644
index 0000000..c268b87
--- /dev/null
+++ b/RibbonSpec.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONSPEC_H
+#define NEDRYSOFT_RIBBONSPEC_H
+
+#if defined(RIBBON_DESIGNER_EXPORT)
+#include
+#define NEDRYSOFT_RIBBON_WIDGET_EXPORT Q_DECL_EXPORT
+#else
+#if defined(NEDRYSOFT_LIBRARY_RIBBON_EXPORT)
+#define NEDRYSOFT_RIBBON_WIDGET_EXPORT Q_DECL_EXPORT
+#else
+#define NEDRYSOFT_RIBBON_WIDGET_EXPORT Q_DECL_IMPORT
+#endif
+#endif
+
+#endif // NEDRYSOFT_RIBBONSPEC_H
diff --git a/RibbonTabBar.cpp b/RibbonTabBar.cpp
new file mode 100644
index 0000000..8bb58ca
--- /dev/null
+++ b/RibbonTabBar.cpp
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonTabBar.h"
+
+#include "RibbonFontManager.h"
+#include "RibbonWidget.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+#include
+#include
+
+constexpr auto ThemeStylesheet = R"(
+ QTabBar::tab {
+ padding: 18px
+ }
+)";
+
+Nedrysoft::Ribbon::RibbonTabBar::RibbonTabBar(QWidget *parent) :
+ QTabBar(parent),
+ m_themeSupport(new Nedrysoft::Utils::ThemeSupport) {
+
+ auto fontManager = Nedrysoft::Ribbon::RibbonFontManager::getInstance();
+
+ m_normalFont = QFont(fontManager->normalFont(), DefaultFontSize);
+ m_selectedFont = QFont(fontManager->boldFont(), DefaultFontSize, QFont::Bold);
+ m_mouseInWidget = false;
+
+ connect(m_themeSupport, &Nedrysoft::Utils::ThemeSupport::themeChanged, [=](bool isDarkMode) {
+ updateStyleSheet(isDarkMode);
+ });
+
+ updateStyleSheet(Nedrysoft::Utils::ThemeSupport::isDarkMode());
+
+#if defined(Q_OS_UNIX)
+ setMouseTracking(true);
+ installEventFilter(this);
+#endif
+}
+
+bool Nedrysoft::Ribbon::RibbonTabBar::eventFilter(QObject *watched, QEvent *event) {
+ Q_UNUSED(watched)
+
+ static auto lastTabIndex = -1;
+
+ switch(event->type()) {
+ case QEvent::Enter: {
+ auto enterEvent = reinterpret_cast(event);
+
+ lastTabIndex = tabAt(enterEvent->pos());
+
+ m_mouseInWidget = true;
+
+ update();
+
+ break;
+ }
+
+ case QEvent::Leave: {
+ lastTabIndex = -1;
+
+ m_mouseInWidget = false;
+
+ update();
+
+ break;
+ }
+
+ case QEvent::MouseMove: {
+ auto mouseEvent = reinterpret_cast(event);
+
+ if (lastTabIndex != tabAt(mouseEvent->pos())) {
+ update();
+
+ lastTabIndex = tabAt(mouseEvent->pos());
+ }
+
+ break;
+ }
+
+ default: {
+ break;
+ }
+ }
+
+ return false;
+}
+
+QSize Nedrysoft::Ribbon::RibbonTabBar::tabSizeHint(int index) const {
+ auto size = QTabBar::tabSizeHint(index);
+
+ size.setHeight(Ribbon::TabBarHeight);
+
+ return size;
+}
+
+void Nedrysoft::Ribbon::RibbonTabBar::paintEvent(QPaintEvent *event) {
+ Q_UNUSED(event)
+ auto globalCursorPos = QCursor::pos();
+ auto textRect = QRect();
+ auto cursorPos = mapFromGlobal(globalCursorPos);
+ auto hoveredTab = tabAt(cursorPos);
+ auto backgroundColor = QColor();
+ QPainter painter(this);
+ auto currentTheme = Ribbon::Light;
+
+ if (Nedrysoft::Utils::ThemeSupport::isDarkMode()) {
+ currentTheme = Nedrysoft::Ribbon::Dark;
+ }
+
+#if defined(Q_OS_MACOS)
+ if (!m_mouseInWidget) {
+ hoveredTab = -1;
+ }
+#endif
+
+ painter.save();
+
+ for(auto tabIndex=0;tabIndex.
+ */
+
+#ifndef NEDRYSOFT_RIBBONTABBAR_H
+#define NEDRYSOFT_RIBBONTABBAR_H
+
+#include "RibbonSpec.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+
+namespace Nedrysoft::Ribbon {
+ /**
+ * @brief The RibbonTabBar widget provides a ribbon stylised tab bar.
+ *
+ * @details A TabBar widget that is styled to match the RibbonBar, the TabBar on a QTabWidget is replaced
+ * with an instance of this class.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonTabBar :
+ public QTabBar {
+
+ private:
+ Q_OBJECT
+
+ public:
+ /**
+ * @brief Constructs a new RibbonTabBar instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonTabBar(QWidget *parent = nullptr);
+
+ protected:
+ /**
+ * @brief Reimplements: QWidget::paintEvent(QPaintEvent *event).
+ *
+ * @param[in] event the event information.
+ */
+ void paintEvent(QPaintEvent *event) override;
+
+ /**
+ * @brief Returns the size hint for the tab at position index.
+ *
+ * @param[in] index the index of the page.
+ *
+ * @returns the size hint for the tab at position index.
+ */
+ [[nodiscard]] QSize tabSizeHint(int index) const override;
+
+ /**
+ * @brief Reimplements: QObject::eventFilter(QObject *watched, QEvent *event).
+ *
+ * @param[in] watched the object that caused the event.
+ * @param[in] event the event information.
+ *
+ * @returns true if event was handled, otherwise false.
+ */
+ bool eventFilter(QObject *watched, QEvent *event) override;
+
+ private:
+ /**
+ * @brief Updates the widgets stylesheet when the operating system theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ void updateStyleSheet(bool isDarkMode);
+
+ private:
+ QFont m_selectedFont; //! font to use on selected tab
+ QFont m_normalFont; //! font to use on deselected tabs
+ bool m_mouseInWidget; //! tracks whether the mouse is tracked inside the widget
+
+ Nedrysoft::Utils::ThemeSupport *m_themeSupport; //! theme support instance
+ };
+}
+#endif // NEDRYSOFT_RIBBONTABBAR_H
diff --git a/RibbonToolButton.cpp b/RibbonToolButton.cpp
new file mode 100644
index 0000000..960c5bc
--- /dev/null
+++ b/RibbonToolButton.cpp
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 29/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonToolButton.h"
+
+#include "RibbonFontManager.h"
+#include "RibbonWidget.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+#include
+
+#include
+
+constexpr auto ThemeStylesheet = R"(
+ QToolButton {
+ border: 0px none;
+ background: [background-colour];
+ margin: 0px;
+ }
+
+ QToolButton::hover {
+ background: [hover-colour];
+ }
+)";
+
+Nedrysoft::Ribbon::RibbonToolButton::RibbonToolButton(QWidget *parent) :
+ QToolButton(parent),
+ m_themeSupport(new Nedrysoft::Utils::ThemeSupport) {
+
+ connect(m_themeSupport, &Nedrysoft::Utils::ThemeSupport::themeChanged, [=](bool isDarkMode) {
+ updateStyleSheet(isDarkMode);
+ });
+
+ updateStyleSheet(Nedrysoft::Utils::ThemeSupport::isDarkMode());
+}
+
+Nedrysoft::Ribbon::RibbonToolButton::~RibbonToolButton() {
+}
+
+void Nedrysoft::Ribbon::RibbonToolButton::updateStyleSheet(bool isDarkMode) {
+ QString styleSheet(ThemeStylesheet);
+
+ if (isDarkMode) {
+ styleSheet.replace("[background-colour]", "#434343");
+ styleSheet.replace("[hover-colour]", "#616161");
+ //styleSheet.replace("[border-colour]", "none");
+ } else {
+ styleSheet.replace("[background-colour]", "#ffffff");
+ //styleSheet.replace("[border-colour]", "#B9B9B9");
+ }
+
+ setStyleSheet(styleSheet);
+}
diff --git a/RibbonToolButton.h b/RibbonToolButton.h
new file mode 100644
index 0000000..92a267a
--- /dev/null
+++ b/RibbonToolButton.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 29/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONTOOLBUTTON_H
+#define NEDRYSOFT_RIBBONTOOLBUTTON_H
+
+#include "RibbonSpec.h"
+#include "ThemeSupport.h"
+
+#include
+
+namespace Nedrysoft::Ribbon {
+ /**
+ * @brief The RibbonToolButton widget provides a ribbon stylised push button with icon and optional text.
+ *
+ * @details A ToolButton widget that is styled to match the RibbonBar.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonToolButton :
+ public QToolButton {
+
+ private:
+ Q_OBJECT
+
+ public:
+ /**
+ * @brief Constructs a new RibbonToolButton instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonToolButton(QWidget *parent=nullptr);
+
+ /**
+ * @brief Destroys the RibbonToolButton.
+ */
+ ~RibbonToolButton() override;
+
+ private:
+ /**
+ * @brief Updates the stylesheet when the operating system theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ void updateStyleSheet(bool isDarkMode);
+
+ private:
+ Nedrysoft::Utils::ThemeSupport *m_themeSupport; //! an instance of theme support
+ };
+}
+
+#endif //NEDRYSOFT_RIBBONTOOLBUTTON_H
diff --git a/RibbonToolButtonPlugin.cpp b/RibbonToolButtonPlugin.cpp
new file mode 100644
index 0000000..bbeaa32
--- /dev/null
+++ b/RibbonToolButtonPlugin.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 29/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonToolButtonPlugin.h"
+
+#include "RibbonToolButton.h"
+
+#include
+#include
+
+constexpr auto ConfigurationXML = R"(
+
+
+
+ Button
+
+
+
+)";
+
+RibbonToolButtonPlugin::RibbonToolButtonPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+}
+
+void RibbonToolButtonPlugin::initialize(QDesignerFormEditorInterface *core) {
+ Q_UNUSED(core);
+
+ if (m_initialized) {
+ return;
+ }
+
+ m_initialized = true;
+}
+
+bool RibbonToolButtonPlugin::isInitialized() const {
+ return m_initialized;
+}
+
+QWidget *RibbonToolButtonPlugin::createWidget(QWidget *parent) {
+ return new Nedrysoft::Ribbon::RibbonToolButton(parent);
+}
+
+QString RibbonToolButtonPlugin::name() const {
+ return QStringLiteral("Nedrysoft::Ribbon::RibbonToolButton");
+}
+
+QString RibbonToolButtonPlugin::group() const {
+ return QStringLiteral("Nedrysoft Ribbon Widgets");
+}
+
+QIcon RibbonToolButtonPlugin::icon() const {
+ return QIcon(":/Nedrysoft/Ribbon/icons/ribbon.png");
+}
+
+QString RibbonToolButtonPlugin::toolTip() const {
+ return tr("A Ribbon Tool Button");
+}
+
+QString RibbonToolButtonPlugin::whatsThis() const {
+ return tr("The Ribbon Tool Button is a control that provides a tool button in the ribbon style.");
+}
+
+bool RibbonToolButtonPlugin::isContainer() const {
+ return true;
+}
+
+QString RibbonToolButtonPlugin::domXml() const {
+ return ConfigurationXML;
+}
+
+QString RibbonToolButtonPlugin::includeFile() const {
+ return QStringLiteral("Ribbon/RibbonToolButton.h");
+}
diff --git a/RibbonToolButtonPlugin.h b/RibbonToolButtonPlugin.h
new file mode 100644
index 0000000..a85321d
--- /dev/null
+++ b/RibbonToolButtonPlugin.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 29/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONTOOLBUTTONPLUGIN_H
+#define NEDRYSOFT_RIBBONTOOLBUTTONPLUGIN_H
+
+#include
+
+/**
+ * @brief Ribbon push button with label Qt Designer plugin.
+ *
+ * @details Exposes the RibbonToolButton widget to Qt Designer, this class is responsible for creating instances of
+ * the widget and exposing properties and functions required for design.
+ */
+class RibbonToolButtonPlugin :
+ public QObject,
+ public QDesignerCustomWidgetInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonToolButtonPlugin instance which is a child of the parent.
+ *
+ * @param[in] parent the owner object.
+ */
+ explicit RibbonToolButtonPlugin(QObject *parent = nullptr);
+
+ /**
+ * @brief Returns true if the widget is intended to be used as a container; otherwise returns false.
+ *
+ * @returns true if it container; otherwise false.
+ */
+ bool isContainer() const override;
+
+ /**
+ * @brief Returns true if the widget has been initialized; otherwise returns false.
+ *
+ * @returns true if initialised; otherwise false.
+ */
+ bool isInitialized() const override;
+
+ /**
+ * @brief Returns the icon used to represent the custom widget in Qt Designer's widget box.
+ *
+ * @returns the icon used to represent the custom widget in Qt Designer's widget box.
+ */
+ QIcon icon() const override;
+
+ /**
+ * @brief Returns the XML that is used to describe the custom widget's properties to Qt Designer.
+ *
+ * @returns the XML describing the widgets properties.
+ */
+ QString domXml() const override;
+
+ /**
+ * @brief Returns the name of the group to which the widget belongs.
+ *
+ * @returns the name of the group.
+ */
+ QString group() const override;
+
+ /**
+ * @brief Returns the path to the include file that uic uses when creating code for the widget.
+ *
+ * @returns the path to the include file.
+ */
+ QString includeFile() const override;
+
+ /**
+ * @brief Returns the class name of the widget supplied by the interface.
+ *
+ * @returns the name of the widget.
+ */
+ QString name() const override;
+
+ /**
+ * @brief Returns a short description of the widget that can be used by Qt Designer in a tool tip.
+ *
+ * @returns the description.
+ */
+ QString toolTip() const override;
+
+ /**
+ * @brief Returns a description of the widget that can be used by Qt Designer in "What's This?" help for the widget.
+ *
+ * @returns the description.
+ */
+ QString whatsThis() const override;
+
+ /**
+ * @brief Returns a new instance of the RibbonToolButton class, with the given parent.
+ *
+ * @returns the widget instance.
+ */
+ QWidget *createWidget(QWidget *parent) override;
+
+ /**
+ * @brief Initializes the widget for use with the specified formEditor interface.
+ */
+ void initialize(QDesignerFormEditorInterface *core) override;
+
+ private:
+ bool m_initialized = false; //! holds whether designer has initialised the factory yet
+};
+
+#endif // NEDRYSOFT_RIBBONTOOLBUTTONPLUGIN_H
diff --git a/RibbonWidget.cpp b/RibbonWidget.cpp
new file mode 100644
index 0000000..baeef16
--- /dev/null
+++ b/RibbonWidget.cpp
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonWidget.h"
+
+#include "RibbonTabBar.h"
+#include "ThemeSupport.h"
+
+#include
+#include
+#include
+
+constexpr auto ThemeStylesheet = R"(
+ QWidget {
+ font-family: "Open Sans";
+ font-size: 10pt;
+ }
+)";
+
+Nedrysoft::Ribbon::RibbonWidget::RibbonWidget(QWidget *parent) :
+ QTabWidget(parent) {
+
+ m_tabBar = new RibbonTabBar(this);
+
+ setTabBar(m_tabBar);
+ setStyleSheet(ThemeStylesheet);
+
+ setMinimumHeight(RibbonBarHeight+TabBarHeight);
+ setMaximumHeight(RibbonBarHeight+TabBarHeight);
+
+#if defined(Q_OS_MACOS)
+ setDocumentMode(true);
+#endif
+}
+
+void Nedrysoft::Ribbon::RibbonWidget::paintEvent(QPaintEvent *event) {
+ Q_UNUSED(event)
+ QPainter painter(this);
+ auto widgetRect = rect();
+ auto currentTheme = Nedrysoft::Ribbon::Light;
+
+ if (Nedrysoft::Utils::ThemeSupport::isDarkMode()) {
+ currentTheme = Nedrysoft::Ribbon::Dark;
+ }
+
+ painter.save();
+
+ painter.fillRect(widgetRect, TabBarBackgroundColor[currentTheme]);
+
+ widgetRect.setTop(widgetRect.bottom());
+
+ painter.fillRect(widgetRect, RibbonBorderColor[currentTheme]);
+
+ painter.restore();
+}
diff --git a/RibbonWidget.h b/RibbonWidget.h
new file mode 100644
index 0000000..338a086
--- /dev/null
+++ b/RibbonWidget.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONWIDGET_H
+#define NEDRYSOFT_RIBBONWIDGET_H
+
+#include "RibbonSpec.h"
+
+#include
+#include
+#include
+
+namespace Nedrysoft::Ribbon {
+ class RibbonTabBar;
+
+ /**
+ * @brief Represents the current theme that the application should use.
+ */
+ enum ThemeMode {
+ Light = 0, /**< Draw Ribbon in light mode. */
+ Dark = 1 /**< Draw Ribbon in dark mode. */
+ };
+
+ /**
+ * @brief TextColour of text on the control
+ */
+ static constexpr QRgb TextColor[] = {
+ qRgb(73, 69, 66),
+ qRgb(0xDC, 0xDC, 0xDC)
+ };
+
+ /**
+ * @brief Background colour of the tab bar
+ */
+ static constexpr QRgb TabBarBackgroundColor[] = {
+ qRgb(0xf5, 0xf5, 0xf5),
+ qRgb(0x2d, 0x2d, 0x2d)
+ };
+
+ /**
+ * @brief Highlight colour of a tab when hovered over
+ */
+ static constexpr QRgb TabHoverColor[] = {
+ qRgb(254, 251, 255),
+ TabBarBackgroundColor[Dark]
+ };
+
+ /**
+ * @brief Colour of a tab when the mouse is being held down
+ */
+ static constexpr QRgb TabSelectedColor[] = {
+ qRgb(51, 84, 151),
+ qRgb(0xdf, 0xdf, 0xdf)
+ };
+
+ /**
+ * @brief Colour of the ribbon divider at the bottom of the control
+ */
+ static constexpr QRgb RibbonBorderColor[] = {
+ qRgb(214, 211, 207),
+ qRgb(0, 0, 0)
+ };
+
+ /**
+ * @brief Colour of the group divider
+ */
+ static constexpr QRgb GroupDividerColor[] = {
+ qRgb(180, 178, 173),
+ qRgb(0x57, 0x57, 0x57)
+ };
+
+ /**
+ * @brief Colour of the push button
+ */
+ static constexpr QRgb PushButtonColor[] = {
+ qRgb(209, 198, 197),
+ qRgb(65, 65, 65)
+ };
+
+ /**
+ * @note Small tweaks are required on a OS level to ensure that the rendered RibbonBar looks correct
+ * on each platform.
+ */
+
+#if defined(Q_OS_MACOS)
+ static constexpr int TabBarHeight = 34; //! Height of the tab bar portion of the control
+ static constexpr int DefaultFontSize = 12; //! Default text size for macOS
+#else
+ static constexpr int TabBarHeight = 28; //! Height of the tab bar portion of the control
+ static constexpr int DefaultFontSize = 10; //! Default text size for targets other than macOS
+#endif
+ static constexpr int RibbonBarHeight = 100; //! Height of the entire control
+ static constexpr int TabHighlightHeight = 3; //! Height of the highlight mark on the selected page
+ static constexpr int GroupDividerMargin = 2; //! Width of the group divider
+
+ static constexpr int RibbonBarDefaultWidth = 200; //! Default width of the control used by designer plugins
+
+ /**
+ * @brief The RibbonWidget widget provides the main Ribbon container.
+ *
+ * @details A RibbonWidget is the top level Ribbon control, a RibbonWidget consists of multiple pages
+ * of functional blocks, each functional block is then sub divided into logical groups (RibbonGroup) and
+ * finally each RibbonGroup acts as a container for Ribbon widgets.
+ */
+ class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonWidget :
+ public QTabWidget {
+
+ private:
+ Q_OBJECT
+
+ public:
+ /**
+ * @brief Constructs a new RibbonWidget instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonWidget(QWidget *parent = nullptr);
+
+ friend class RibbonTabBar;
+ friend class RibbonGroup;
+
+ protected:
+ /**
+ * @brief Reimplements: QWidget::paintEvent(QPaintEvent *event).
+ *
+ * @param[in] event the event information.
+ */
+ void paintEvent(QPaintEvent *event) override;
+
+ private:
+ Nedrysoft::Ribbon::RibbonTabBar *m_tabBar; //! The tab bar associated with this ribbon
+ };
+}
+
+#endif // NEDRYSOFT_RIBBONWIDGET_H
diff --git a/RibbonWidgetPlugin.cpp b/RibbonWidgetPlugin.cpp
new file mode 100644
index 0000000..7008b6e
--- /dev/null
+++ b/RibbonWidgetPlugin.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonWidgetPlugin.h"
+
+#include "RibbonWidget.h"
+
+#include
+
+constexpr auto ConfigurationXML = R"(
+
+
+
+
+ 0
+ 0
+ [default-width]
+ [default-height]
+
+
+
+
+)";
+
+RibbonWidgetPlugin::RibbonWidgetPlugin(QObject *parent) :
+ QObject(parent) {
+
+ qRegisterMetaType("RibbonWidgetPlugin");
+}
+
+void RibbonWidgetPlugin::initialize(QDesignerFormEditorInterface *core) {
+ Q_UNUSED(core)
+
+ if (m_initialized) {
+ return;
+ }
+
+ m_initialized = true;
+}
+
+bool RibbonWidgetPlugin::isInitialized() const {
+ return m_initialized;
+}
+
+QWidget *RibbonWidgetPlugin::createWidget(QWidget *parent) {
+ return new Nedrysoft::Ribbon::RibbonWidget(parent);
+}
+
+QString RibbonWidgetPlugin::name() const {
+ return QStringLiteral("Nedrysoft::Ribbon::RibbonWidget");
+}
+
+QString RibbonWidgetPlugin::group() const {
+ return QStringLiteral("Nedrysoft Ribbon Widgets");
+}
+
+QIcon RibbonWidgetPlugin::icon() const {
+ return QIcon(":/Nedrysoft/Ribbon/icons/ribbon.png");
+}
+
+QString RibbonWidgetPlugin::toolTip() const {
+ return tr("A Ribbon Widget");
+}
+
+QString RibbonWidgetPlugin::whatsThis() const {
+ return tr("The Ribbon Widget is the top level container of the Ribbon Bar.");
+}
+
+bool RibbonWidgetPlugin::isContainer() const {
+ return false;
+}
+
+QString RibbonWidgetPlugin::domXml() const {
+ return QString(ConfigurationXML).replace("[default-width]", QString::number(Nedrysoft::Ribbon::RibbonBarDefaultWidth))
+ .replace("[default-height]", QString::number(Nedrysoft::Ribbon::RibbonBarHeight));
+}
+
+QString RibbonWidgetPlugin::includeFile() const {
+ return QStringLiteral("Ribbon/RibbonWidget.h");
+}
diff --git a/RibbonWidgetPlugin.h b/RibbonWidgetPlugin.h
new file mode 100644
index 0000000..f88047a
--- /dev/null
+++ b/RibbonWidgetPlugin.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONWIDGETPLUGIN_H
+#define NEDRYSOFT_RIBBONWIDGETPLUGIN_H
+
+#include
+
+/**
+ * @brief Provides the base Ribbon widget
+ */
+class RibbonWidgetPlugin :
+ public QObject,
+ public QDesignerCustomWidgetInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonWidget instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonWidgetPlugin(QObject *parent = nullptr);
+
+ /**
+ * @brief Returns true if the widget is intended to be used as a container; otherwise returns false.
+ *
+ * @returns true if it container; otherwise false.
+ */
+ [[nodiscard]] bool isContainer() const override;
+
+ /**
+ * @brief Returns true if the widget has been initialized; otherwise returns false.
+ *
+ * @returns true if initialised; otherwise false.
+ */
+ [[nodiscard]] bool isInitialized() const override;
+
+ /**
+ * @brief Returns the icon used to represent the custom widget in Qt Designer's widget box.
+ *
+ * @returns the icon used to represent the custom widget in Qt Designer's widget box.
+ */
+ [[nodiscard]] QIcon icon() const override;
+
+ /**
+ * @brief Returns the XML that is used to describe the custom widget's properties to Qt Designer.
+ *
+ * @returns the XML describing the widgets properties.
+ */
+ [[nodiscard]] QString domXml() const override;
+
+ /**
+ * @brief Returns the name of the group to which the widget belongs.
+ *
+ * @returns the name of the group.
+ */
+ [[nodiscard]] QString group() const override;
+
+ /**
+ * @brief Returns the path to the include file that uic uses when creating code for the widget.
+ *
+ * @returns the path to the include file.
+ */
+ [[nodiscard]] QString includeFile() const override;
+
+ /**
+ * @brief Returns the class name of the widget supplied by the interface.
+ *
+ * @returns the name of the widget.
+ */
+ [[nodiscard]] QString name() const override;
+
+ /**
+ * @brief Returns a short description of the widget that can be used by Qt Designer in a tool tip.
+ *
+ * @returns the description.
+ */
+ [[nodiscard]] QString toolTip() const override;
+
+ /**
+ * @brief Returns a description of the widget that can be used by Qt Designer in "What's This?" help for the widget.
+ *
+ * @returns the description.
+ */
+ [[nodiscard]] QString whatsThis() const override;
+
+ /**
+ * @brief Returns a new instance of the RibbonWidget class, with the given parent.
+ *
+ * @returns the widget instance.
+ */
+ QWidget *createWidget(QWidget *parent) override;
+
+ /**
+ * @brief Initializes the widget for use with the specified formEditor interface.
+ */
+ void initialize(QDesignerFormEditorInterface *core) override;
+
+ private:
+ bool m_initialized = false; //! holds whether designer has initialised the factory yet
+};
+
+#endif // NEDRYSOFT_RIBBONWIDGETPLUGIN_H
diff --git a/RibbonWidgetsCollection.cpp b/RibbonWidgetsCollection.cpp
new file mode 100644
index 0000000..c44da67
--- /dev/null
+++ b/RibbonWidgetsCollection.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "RibbonWidgetsCollection.h"
+
+#include "RibbonPushButtonPlugin.h"
+#include "RibbonCheckBoxPlugin.h"
+#include "RibbonComboBoxPlugin.h"
+#include "RibbonDropButtonPlugin.h"
+#include "RibbonGroupPlugin.h"
+#include "RibbonLineEditPlugin.h"
+#include "RibbonToolButtonPlugin.h"
+#include "RibbonWidgetPlugin.h"
+
+RibbonWidgetsCollection::RibbonWidgetsCollection(QObject *parent) :
+ QObject(parent) {
+
+ m_widgets.append(new RibbonGroupPlugin(this));
+ m_widgets.append(new RibbonWidgetPlugin(this));
+ m_widgets.append(new RibbonDropButtonPlugin(this));
+ m_widgets.append(new RibbonPushButtonPlugin(this));
+ m_widgets.append(new RibbonLineEditPlugin(this));
+ m_widgets.append(new RibbonComboBoxPlugin(this));
+ m_widgets.append(new RibbonCheckBoxPlugin(this));
+ m_widgets.append(new RibbonToolButtonPlugin(this));
+}
+
+QList RibbonWidgetsCollection::customWidgets() const {
+ return m_widgets;
+}
diff --git a/RibbonWidgetsCollection.h b/RibbonWidgetsCollection.h
new file mode 100644
index 0000000..5ab40f9
--- /dev/null
+++ b/RibbonWidgetsCollection.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_RIBBONWIDGETSCOLLECTION_H
+#define NEDRYSOFT_RIBBONWIDGETSCOLLECTION_H
+
+#include
+
+/**
+ * @brief Designer Collection plugin, provides a list of widgets that this plugin exposes to designer.
+ */
+class RibbonWidgetsCollection :
+ public QObject,
+ public QDesignerCustomWidgetCollectionInterface {
+
+ private:
+ Q_OBJECT
+
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface")
+
+ Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
+
+ public:
+ /**
+ * @brief Constructs a new RibbonWidgetsCollection instance which is a child of the parent.
+ *
+ * @param[in] parent the owner object.
+ */
+ explicit RibbonWidgetsCollection(QObject *parent = 0);
+
+ /**
+ * @brief Provides a list of widgets that this designer plugin.
+ *
+ * @returns the list of widget interfaces this plugin exposes.
+ */
+ [[nodiscard]] QList customWidgets() const override;
+
+ private:
+ QList m_widgets; //! the list of provided widgets
+};
+
+#endif // NEDRYSOFT_RIBBONWIDGETSCOLLECTION_H
diff --git a/ThemeSupport.h b/ThemeSupport.h
new file mode 100644
index 0000000..f82da6e
--- /dev/null
+++ b/ThemeSupport.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef NEDRYSOFT_THEMESUPPORT_H
+#define NEDRYSOFT_THEMESUPPORT_H
+
+#include
+#include
+#include
+#include
+
+namespace Nedrysoft::Utils {
+ /**
+ * @brief The ThemeSupport class provides helpers for handling dark/light themes.
+ *
+ * @details Provides OS level support for theming, currently only supports macOS but is able to
+ * to detect whether the OS is in light or dark mode and also signal when the
+ * current theme is changed.
+ */
+ class ThemeSupport :
+ public QObject {
+
+ public:
+ Q_OBJECT
+
+ public:
+ /**
+ * @brief Constructs a new ThemeSupport instance.
+ */
+ explicit ThemeSupport();
+
+ /**
+ * @brief Returns the current OS theme mode.
+ *
+ * @returns true if dark mode; otherwise false.
+ */
+#if defined(Q_OS_MACOS)
+ static bool isDarkMode();
+#else
+ static bool isDarkMode() {
+ return false;
+ }
+#endif
+
+ /**
+ * @brief This signal is emitted when OS theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ Q_SIGNAL void themeChanged(bool isDarkMode);
+
+ /**
+ * @brief Returns the Dark or Light colour for the given array.
+ *
+ * @note The array consists of 2 QRgb entries, one entry is for dark and the other for light mode.
+ *
+ * @returns the colour.
+ */
+ static QColor getColor(const QRgb PushButtonColor[]);
+
+ /**
+ * @brief Returns the highlighted text background color
+ *
+ * @note Qt does not return the correct color when using QPalette, this function directly queries
+ * the macOS to discover the real highlighed background color.
+ *
+ * @returns the colour
+ */
+ static QColor getHighlightedBackground();
+ };
+}
+
+#endif // NEDRYSOFT_THEMESUPPORT_H
+
diff --git a/ThemeSupport.mm b/ThemeSupport.mm
new file mode 100644
index 0000000..a89b025
--- /dev/null
+++ b/ThemeSupport.mm
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * Created by Adrian Carpenter on 07/11/2020.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "ThemeSupport.h"
+
+#include
+#include
+
+#import
+#import
+
+Nedrysoft::Utils::ThemeSupport::ThemeSupport() {
+ connect(qobject_cast(QCoreApplication::instance()), &QApplication::paletteChanged, [=] (const QPalette &) {
+ Q_EMIT themeChanged(Nedrysoft::Utils::ThemeSupport::isDarkMode());
+ });
+}
+
+bool Nedrysoft::Utils::ThemeSupport::isDarkMode() {
+ NSAppearance *appearance = nullptr;
+
+ if (@available(macOS 11, *)) {
+ appearance = NSAppearance.currentDrawingAppearance;
+ } else if (@available(macOS 10.14, *)) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ appearance = NSAppearance.currentAppearance;
+#pragma clang diagnostic pop
+ }
+
+ if (appearance) {
+ NSAppearanceName basicAppearance = [appearance bestMatchFromAppearancesWithNames:@[
+ NSAppearanceNameAqua,
+ NSAppearanceNameDarkAqua
+ ]];
+
+ return [basicAppearance isEqualToString:NSAppearanceNameDarkAqua]==YES;
+ } else {
+ return false;
+ }
+}
+
+QColor Nedrysoft::Utils::ThemeSupport::getColor(const QRgb colourPair[]) {
+ return QColor(colourPair[isDarkMode() ? 1 : 0]);
+}
+
+QColor Nedrysoft::Utils::ThemeSupport::getHighlightedBackground() {
+#if defined(Q_OS_MACOS)
+ CGColorRef a = [NSColor systemBlueColor].CGColor;
+
+ const CGFloat *color = CGColorGetComponents(a);
+
+ return QColor::fromRgbF(color[0], color[1], color[2]);
+#else
+ return qobject_cast(QCoreApplication::instance())->style()->standardPalette().color(QPalette::Highlight);
+#endif
+}
diff --git a/assets/arrows.afdesign b/assets/arrows.afdesign
new file mode 100644
index 0000000..69e6548
Binary files /dev/null and b/assets/arrows.afdesign differ
diff --git a/assets/checkbox.afdesign b/assets/checkbox.afdesign
new file mode 100644
index 0000000..460a81c
Binary files /dev/null and b/assets/checkbox.afdesign differ
diff --git a/assets/ribbon.afdesign b/assets/ribbon.afdesign
new file mode 100644
index 0000000..74774b7
Binary files /dev/null and b/assets/ribbon.afdesign differ
diff --git a/assets/slider.afdesign b/assets/slider.afdesign
new file mode 100644
index 0000000..a10b389
Binary files /dev/null and b/assets/slider.afdesign differ
diff --git a/contributing.md b/contributing.md
new file mode 100644
index 0000000..aa76f1a
--- /dev/null
+++ b/contributing.md
@@ -0,0 +1,710 @@
+# Contributing to the project
+
+The following document contains a set of guidelines for contributing to the project. Any pull-requests should be compliant with this guide. Code style is often fluent, if you have a suggestion which you think will improve the readability of the code then please open an issue so that we can discuss that potentially modify the style guide to accommodate any new changes.
+
+#C++ Style Guide
+
+The following guide should be followed to ensure consistent code throughout the project.
+
+## C++ Version
+
+Code should target the C++17 standard, C++11 is the minimum standard that should be used.
+
+## Header Files
+
+Header files should always start with a copyright block.
+
+```c++
+/*
+ * Copyright (C) 2020 Adrian Carpenter
+ *
+ * https://github.com/fizzyade
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+```
+
+## Includes
+
+Include files are logically grouped according to their scope and sorted alphabetically for clarity.
+
+### Source file
+
+1. The first header should be the corresponding header to the source file.
+2. *Empty Line*
+3. Local includes (sorted alphabetically)
+4. *Empty Line*
+5. System includes (sorted alphabetically)
+6. *Empty Line*
+7. Objective C imports
+
+### Header file
+
+1. Local includes (sorted alphabetically)
+2. *Empty Line*
+3. System includes (sorted alphabetically)
+
+### Exceptions
+
+If a file needs to be included at a specific location (i.e either the first include or the last include) then it also goes in the appropriate position but must include a comment explaining why the file is out of sequence.
+
+# C++
+
+## Include Guards
+
+All include files should have an include guard to prevent the file from being included more than once.
+
+```c++
+#ifndef NEDRYSOFT_RIBBONPUSHBUTTON_H
+#define NEDRYSOFT_RIBBONPUSHBUTTON_H
+...
+#endif // NEDRYSOFT_RIBBONPUSHBUTTON_H
+```
+
+The format of an include guard should be as follows:
+
+```c++
+[ORGANISATION]_[FILENAME]_H
+```
+
+## Namespaces
+
+All code must exist in an appropriate namespace to prevent clashes with third party code, when using an item from a namespace then the fully qualified name should be used, and "using " should not be used, by including the full namespace it makes it much easier to locate where a function can be found.
+
+* C++17 nested namespaces should always be used.
+* Braces should be on the same line as the namespace definition.
+* Items inside a namespace indent 1 level
+
+*Good*
+
+```c++
+namespace Nedrysoft::Utils {
+ ...
+}
+```
+
+*Bad*
+
+```c++
+namespace Nedrysoft {
+ namespace Utils {
+ ...
+ }
+}
+```
+```c++
+namespace Nedrysoft
+{
+ ...
+}
+```
+
+### Constants
+
+For constant values, it is preferred that ```constexpr``` is used rather than ```#define```. Constants should be limited to a namespace or the class scope and should not be global.
+
+*Good*
+
+```c++
+constexpr auto RibbonPushButtonDefaultIconWidth = 32;
+constexpr auto RibbonPushButtonDefaultIconHeight = 48;
+constexpr auto RibbonPushButtonDefaultFontSize = 10;
+```
+
+*Bad*
+
+```c++
+#define RibbonPushButtonDefaultIconWidth 32
+#define RibbonPushButtonDefaultIconHeight = 48
+#define RibbonPushButtonDefaultFontSize = 10;
+```
+
+### Line Breaks
+
+Line breaks are permitted when they improve clarity. A double indent must be used on the following lines.
+
+```c++
+QString filename =
+ fore(AnsiColour::WHITE)+
+ "\""+
+ fore(0xb0,0x85, 0xbe)+
+ fileInfo.fileName()+
+ fore(AnsiColour::WHITE)+
+ "\""+
+ fore(AnsiColour::YELLOW);
+```
+
+### Casting
+
+C++ style casts must be used, do not use C style casts.
+
+*Good*
+
+```c++
+auto asFloat = static_cast(exampleInteger);
+```
+
+*Bad*
+```c++
+auto asFloat = (float) exampleInteger;
+```
+
+### Comments
+
+Comments should be used where appropriate, code should use descriptive names which alleviates the need for large blocks of comments. Comments should be used to describe operations that may not be obvious at first glance exactly what they do.
+
+### Doxygen
+
+Doxygen comments must be included in every header file, the comments should follow the JavaDoc style for consistency.
+
+*Good*
+
+```c++
+/**
+ * @brief Reimplements: QObject::eventFilter(QObject *watched, QEvent *event).
+ *
+ * @param[in] watched the object that caused the event.
+ * @param[in] event the event information.
+ *
+ * @returns true if event was handled, otherwise false.
+ */
+bool eventFilter(QObject *watched, QEvent *event) override;
+```
+
+* The comment must directly before the method and there should be no gap between the comment and the function declaration.
+* A new line must exist between each section of the comment, params are grouped without newlines.
+* The ```@returns``` tag should be used instead of ```@return```.
+* Parameters should include the direction of data.
+
+### Class declarations
+
+The scope modifier should be indented one level and functions and variables also should be indented a further level.
+
+All class definitions should adhere to the following style:
+
+*Good*
+
+```c++
+class RibbonTabBar :
+ public QTabBar,
+ public MyInterface {
+ ...
+ }
+};
+```
+```c++
+class RibbonTabBar {
+ ...
+};
+```
+
+Bad
+
+```c++
+class RibbonTabBar
+{
+ ...
+};
+```
+```c++
+class RibbonTabBar {
+public:
+ ...
+};
+```
+```c++
+class RibbonTabBar
+{
+public:
+ ...
+};
+```
+
+### Class layout
+
+The layout of the class is designed such that items are grouped by their scope and type.
+
+```c++
+class NEDRYSOFT_RIBBON_WIDGET_EXPORT RibbonTabBar :
+ public QTabBar,
+ public MyInterface {
+ private:¹
+ Q_OBJECT
+
+ Q_INTERFACES(MyInterfaces)
+
+ public:²
+ enum RibbonType {
+ Standard,
+ Fresh
+ };
+
+ public:³
+ /**
+ * @brief Constructs a new RibbonTabBar instance which is a child of the parent.
+ *
+ * @param[in] parent the owner widget.
+ */
+ explicit RibbonTabBar(QWidget *parent = nullptr);
+
+ protected:⁴
+ /**
+ * @brief Reimplements: QWidget::paintEvent(QPaintEvent *event).
+ *
+ * @param[in] event contains information for painting this widget
+ */
+ void paintEvent(QPaintEvent *event) override;
+
+ private:⁵
+ /**
+ * @brief Updates the widgets stylesheet when the operating system theme is changed.
+ *
+ * @param[in] isDarkMode true if dark mode; otherwise false.
+ */
+ void updateStyleSheet(bool isDarkMode);
+
+ private:⁶
+ QFont m_selectedFont; //! the font to use on the selected tab
+ }
+}
+```
+
+1. This section should implicitly set the scope to private and should ***only*** include Qt macros. Macros are grouped logically together and each group is separated by a new line.
+2. This section (there may be more than one depending on scope) should define any ```enums``` or ```constexpr```.
+3. This section includes constructors, destructors, and any public methods that the class exposes.
+4. This section contains any overridden superclass functions.
+5. This section (there may be more than one depending on scope) contains internal functions.
+6. This section contains any member variables.
+
+### Case
+
+Class names should start (wherever possible) with a capital letter and the start of each further word is then capitalised.
+
+Functions should use camelCase.
+
+*Good*
+
+```c++
+class MyClass {
+ public:
+ void doSomething();
+};
+```
+
+*Bad*
+```c++
+class MyClass {
+ public:
+ void DoSomething();
+};
+```
+```c++
+class myclass {
+ public:
+ void DoSomething();
+};
+```
+
+### Member variables
+
+Member variables should use camelCase and be prefixed with ```m_```.
+
+```c++
+class MyClass {
+ public:
+ ...
+
+ private:
+ int m_totalCount;
+};
+```
+
+## Source Files
+
+Source files generally follow the same style as set out for include files, all code should adhere to these rules.
+
+### Function Definition
+
+Function names should be descriptive and whenever possible not truncated, using descriptive naming makes the code easier to follow and clearer and negates the need for comments.
+
+Each function definition must conform to the following code standard.
+
+1. Member variables should use initialiser lists instead of being assigned.
+2. The colon for the initialiser list must appear on the same line as the function definition.
+3. Each initialiser is indented by 2 levels.
+3. One initialiser per line.
+4. The final initialiser contains the opening brace for the function.
+5. A blank line should always follow the opening brace for constructors that have initialisers regardless of whether or not any statements follow. For constructors, without initialisers the blank line should be omitted.
+
+*Good*
+
+```c++
+RibbonDropButtonPlugin::RibbonDropButtonPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+ ...
+}
+
+Nedrysoft::Image::Image() :
+ m_data(nullptr),
+ m_width(0),
+ m_height(0),
+ m_stride(0),
+ m_imageId(0),
+ m_isValid(false),
+ m_length(0) {
+
+}
+
+
+```
+```c++
+RibbonDropButtonPlugin::RibbonDropButtonPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+ doSomething();
+ ...
+}
+```
+```c++
+RibbonDropButtonPlugin::RibbonDropButtonPlugin(QObject *parent) {
+ ...
+}
+```
+```c++
+RibbonDropButtonPlugin::RibbonDropButtonPlugin(QObject *parent) {
+ doSomething();
+ ...
+}
+```
+
+*Bad*
+
+```c++
+RibbonDropButtonPlugin::RibbonDropButtonPlugin(QObject *parent) : QObject(parent), m_initialized(false) {
+ ...
+}
+```
+```c++
+RibbonDropButtonPlugin::RibbonDropButtonPlugin(QObject *parent) : QObject(parent), m_initialized(false)
+{
+ ...
+}
+```
+```c++
+RibbonDropButtonPlugin::RibbonDropButtonPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+
+ ...
+}
+```
+```c++
+RibbonDropButtonPlugin::RibbonDropButtonPlugin(QObject *parent) :
+ QObject(parent),
+ m_initialized(false) {
+ doSomething();
+ ...
+}
+```
+```c++
+Nedrysoft::Image::Image() :
+ m_data(nullptr),
+ m_width(0),
+ m_height(0),
+ m_stride(0),
+ m_imageId(0),
+ m_isValid(false),
+ m_length(0) {
+}
+```
+### Return values
+
+Return values should not be enclosed in braces.
+
+*Good*
+
+```c++
+bool MyTest::isFinished() {
+ return m_isFinished;
+}
+```
+
+*Bad*
+
+```c++
+bool MyTest::isFinished() {
+ return(m_isFinished);
+}
+```
+
+### Program flow
+
+The program flow style is an extension of the rules described above.
+
+#### if conditional
+
+* Braces should always be used, even in the case of a single-line statement.
+* Braces appear on the same line as the terminating conditional statement
+* Multiple conditions may be split across multiple lines if it improves clarity.
+* Each conditional must be surrounded by braces to avoid ambiguity.
+
+*Good*
+
+```c++
+if (m_value>10) {
+ ...
+}
+```
+```c++
+if (m_value>10) {
+ ...
+} else {
+ ...
+}
+```
+```c++
+if (m_value>10) {
+ ...
+} else if (m_value>5) {
+ ...
+}
+```
+```c++
+if ((m_fileLoaded) &&
+ (m_fileSize<1024)) {
+ ...
+}
+```
+
+*Bad*
+
+```c++
+if (m_value>10)
+{
+ ...
+}
+```
+```c++
+if (m_value>10)
+ ...
+```
+```c++
+if (m_value>10)
+ ...
+else
+ ...
+```
+
+#### for loops
+
+* Wherever possible use range-based loops or iterators.
+* Use descriptive names for indices or iterators
+
+*Good*
+
+```c++
+for (auto fileEntry : files) {
+ ...
+}
+```
+```c++
+for (auto currentIndex=0; currentIndex statusFunction) {
+ statusFunction(DownloadStatus(InitiatingDownload));
+
+ startDownload(downloadInfo, statusFunction);
+}
+```
+
+#### Singletons
+
+* Singletons may be used where appropriate, for example, the MainWindow of the application may be accessed through a singleton which provides access to the object across the project easily.
+* Singletons must use the C++11 pattern.
+
+```c++
+MyClass::getInstance() {
+ static MyClass *instance = new MyClass;
+
+ return instance;
+}
+```
+
+### Qt Specific
+
+* Qt keyword definitions should be disabled as they may conflict with third party code.
+* The ```Q_EMIT Q_SIGNAL Q_SLOT``` macros should be used on each function declaration.
+
+```c++
+class MyObject :
+ public QObject {
+
+ private:
+ Q_OBJECT
+
+ public:
+ Q_SLOT valueChanged(int newValue);
+
+ Q_SIGNAL finished();
+};
+```
+
+### Typing
+
+The use of the keyword character "auto" should be used wherever possible, it produces a cleaner looking code. Primitive types such as int, float, long, etc may be typed if auto doesn't make sense or results in ambiguity.
+
+*Good*
+
+```c+++
+auto settingsDialog = SettingsDialog();
+
+int totalCount;
+```
+
+*Bad*
+
+```c+++
+QSettingsDialog settingsDialog;
+```
+
+### Variables
+
+Variable names should be descriptive, the more descriptive the name the easier and clearer the code is to understand. Variables should be named using camelCase.
+
+*Good*
+
+```c++
+for (int currentCharacter=0;currentCharacter