├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake └── Modules │ ├── FindFontConfig.cmake │ ├── FindGLFW.cmake │ ├── FindGLM.cmake │ └── FindOpenImageIO.cmake ├── cmake_uninstall.cmake.in ├── configure ├── data ├── CMakeLists.txt ├── blender_icons16.png ├── blender_icons32.png └── cursors │ ├── black.idraw │ ├── fleur.cfg │ ├── fleur.png │ ├── hand2.cfg │ ├── hand2.png │ ├── left_ptr.cfg │ ├── left_ptr.png │ ├── sb_h_double_arrow.cfg │ ├── sb_h_double_arrow.png │ ├── sb_v_double_arrow.cfg │ ├── sb_v_double_arrow.png │ ├── top_left_corner.cfg │ ├── top_left_corner.png │ ├── top_right_corner.cfg │ ├── top_right_corner.png │ ├── xterm.cfg │ └── xterm.png ├── doc ├── CMakeLists.txt ├── Doxyfile ├── Doxyfile.in ├── code_style.dox ├── compile.dox ├── cpp_events.dox ├── devel.dox ├── groups.dox ├── images │ ├── button_design.idraw │ ├── hello_linux.png │ └── hello_osx.png ├── main.dox ├── plot │ └── tab_button.plot ├── quick.dox └── uml │ └── main.mdj ├── editor ├── CMakeLists.txt ├── edit-space.cpp ├── edit-space.hpp ├── editor-window.cpp ├── editor-window.hpp ├── main.cpp ├── tool-bar.cpp └── tool-bar.hpp ├── extern └── rapidxml │ ├── license.txt │ ├── rapidxml.hpp │ ├── rapidxml_iterators.hpp │ ├── rapidxml_print.hpp │ └── rapidxml_utils.hpp ├── include └── blendint │ ├── config.hpp.in │ ├── core │ ├── color.hpp │ ├── freetype.hpp │ ├── image.hpp │ ├── input.hpp │ ├── margin.hpp │ ├── object.hpp │ ├── point.hpp │ ├── rect.hpp │ ├── refptr.hpp │ ├── size.hpp │ ├── string.hpp │ ├── timer.hpp │ └── types.hpp │ ├── cppevent │ ├── abstract-trackable.hpp │ ├── delegate-token.hpp │ ├── delegate.hpp │ ├── event-token.hpp │ ├── event.hpp │ └── invokable-token.hpp │ ├── font │ ├── fc-charset.hpp │ ├── fc-config.hpp │ ├── fc-fontset.hpp │ ├── fc-objectset.hpp │ ├── fc-pattern.hpp │ ├── ft-face.hpp │ └── ft-library.hpp │ ├── gui │ ├── abstract-adjustment.hpp │ ├── abstract-button.hpp │ ├── abstract-camera.hpp │ ├── abstract-cursor-theme.hpp │ ├── abstract-curve.hpp │ ├── abstract-dialog.hpp │ ├── abstract-form.hpp │ ├── abstract-frame.hpp │ ├── abstract-icon.hpp │ ├── abstract-item-model.hpp │ ├── abstract-item-view.hpp │ ├── abstract-layout.hpp │ ├── abstract-list-model.hpp │ ├── abstract-menu-item.hpp │ ├── abstract-node.hpp │ ├── abstract-primitive.hpp │ ├── abstract-round-form.hpp │ ├── abstract-round-frame.hpp │ ├── abstract-round-widget.hpp │ ├── abstract-scrollable.hpp │ ├── abstract-shadow.hpp │ ├── abstract-slider.hpp │ ├── abstract-view.hpp │ ├── abstract-viewport.hpp │ ├── abstract-widget.hpp │ ├── abstract-window.hpp │ ├── action.hpp │ ├── adaptive-adjustment.hpp │ ├── adaptive-layout.hpp │ ├── block.hpp │ ├── brightness-slider.hpp │ ├── button-group.hpp │ ├── check-button.hpp │ ├── check-icon.hpp │ ├── chess-board.hpp │ ├── clock.hpp │ ├── close-button.hpp │ ├── color-button.hpp │ ├── color-selector.hpp │ ├── color-wheel.hpp │ ├── combo-box.hpp │ ├── cube.hpp │ ├── cubic-bezier-curve.hpp │ ├── curve-edit.hpp │ ├── cv-image-view.hpp │ ├── dialog.hpp │ ├── dot-icon.hpp │ ├── end-point-icon.hpp │ ├── end-point.hpp │ ├── expander.hpp │ ├── file-browser.hpp │ ├── file-selector.hpp │ ├── filebutton.hpp │ ├── filesystem-model.hpp │ ├── flow-layout.hpp │ ├── folder-list.hpp │ ├── font-cache.hpp │ ├── font-model.hpp │ ├── font-selector.hpp │ ├── font.hpp │ ├── frame-shadow.hpp │ ├── frame-splitter.hpp │ ├── frame.hpp │ ├── free-camera.hpp │ ├── glyph.hpp │ ├── grid-floor.hpp │ ├── grid-guides.hpp │ ├── icon-texture.hpp │ ├── image-viewport.hpp │ ├── label.hpp │ ├── linear-adjustment.hpp │ ├── linear-layout.hpp │ ├── list-view.hpp │ ├── managed-ptr.hpp │ ├── menu-button.hpp │ ├── menu-item-separator.hpp │ ├── menu-item.hpp │ ├── menu.hpp │ ├── mesh.hpp │ ├── message-box.hpp │ ├── model-viewport.hpp │ ├── node-set.hpp │ ├── node-view.hpp │ ├── node.hpp │ ├── numerical-slider.hpp │ ├── option-label.hpp │ ├── ortho-camera.hpp │ ├── panel.hpp │ ├── perspective-camera.hpp │ ├── pixel-icon.hpp │ ├── progress-bar.hpp │ ├── push-button.hpp │ ├── radio-button.hpp │ ├── scroll-area.hpp │ ├── scroll-bar.hpp │ ├── scroll-view.hpp │ ├── separator.hpp │ ├── slider.hpp │ ├── spinner.hpp │ ├── splitter.hpp │ ├── stack-layout.hpp │ ├── stack.hpp │ ├── string-list-model.hpp │ ├── tab-button.hpp │ ├── tab-header.hpp │ ├── tab.hpp │ ├── table-adjustment.hpp │ ├── table-layout.hpp │ ├── text.hpp │ ├── textentry.hpp │ ├── texture-atlas.hpp │ ├── texture-view.hpp │ ├── time-ruler.hpp │ ├── toggle-button.hpp │ ├── tool-button.hpp │ ├── tree-view.hpp │ ├── vector-icon.hpp │ ├── view-buffer.hpp │ ├── viewport2d.hpp │ ├── viewport3d.hpp │ ├── widget-shadow.hpp │ ├── window.hpp │ └── workspace.hpp │ ├── opengl │ ├── gl-buffer.hpp │ ├── gl-framebuffer.hpp │ ├── gl-renderbuffer.hpp │ ├── gl-texture2d.hpp │ ├── gl-vertexarrays.hpp │ ├── glarraybuffer.hpp │ ├── glelementarraybuffer.hpp │ ├── glsl-program.hpp │ ├── glsl-shader.hpp │ └── opengl.hpp │ └── stock │ ├── icons.hpp │ ├── shaders.hpp │ └── theme.hpp └── lib ├── CMakeLists.txt ├── core ├── color.cpp ├── freetype.cpp ├── image.cpp ├── string.cpp └── timer.cpp ├── cppevent └── abstract-trackable.cpp ├── font ├── fc-pattern.cpp ├── ft-face.cpp └── ft-library.cpp ├── gui ├── abstract-button.cpp ├── abstract-camera.cpp ├── abstract-dialog.cpp ├── abstract-form.cpp ├── abstract-frame.cpp ├── abstract-icon.cpp ├── abstract-item-model.cpp ├── abstract-item-view.cpp ├── abstract-layout.cpp ├── abstract-list-model.cpp ├── abstract-menu-item.cpp ├── abstract-node.cpp ├── abstract-primitive.cpp ├── abstract-round-form.cpp ├── abstract-round-frame.cpp ├── abstract-round-widget.cpp ├── abstract-scrollable.cpp ├── abstract-shadow.cpp ├── abstract-slider.cpp ├── abstract-view.cpp ├── abstract-viewport.cpp ├── abstract-widget.cpp ├── abstract-window.cpp ├── action.cpp ├── adaptive-adjustment.cpp ├── adaptive-layout.cpp ├── block.cpp ├── brightness-slider.cpp ├── button-group.cpp ├── check-button.cpp ├── check-icon.cpp ├── chess-board.cpp ├── clock.cpp ├── close-button.cpp ├── color-button.cpp ├── color-selector.cpp ├── color-wheel.cpp ├── combo-box.cpp ├── cube.cpp ├── cubic-bezier-curve.cpp ├── curve-edit.cpp ├── cv-image-view.cpp ├── dialog.cpp ├── dot-icon.cpp ├── end-point-icon.cpp ├── expander.cpp ├── file-browser.cpp ├── file-selector.cpp ├── filebutton.cpp ├── filesystem-model.cpp ├── flow-layout.cpp ├── folder-list.cpp ├── font-cache.cpp ├── font-selector.cpp ├── font.cpp ├── frame-shadow.cpp ├── frame-splitter.cpp ├── frame.cpp ├── free-camera.cpp ├── grid-floor.cpp ├── grid-guides.cpp ├── icon-texture.cpp ├── image-viewport.cpp ├── label.cpp ├── linear-adjustment.cpp ├── linear-layout.cpp ├── list-view.cpp ├── managed-ptr.cpp ├── menu-button.cpp ├── menu-item.cpp ├── menu.cpp ├── mesh.cpp ├── message-box.cpp ├── model-viewport.cpp ├── node-view.cpp ├── node.cpp ├── numerical-slider.cpp ├── option-label.cpp ├── ortho-camera.cpp ├── panel.cpp ├── perspective-camera.cpp ├── pixel-icon.cpp ├── progress-bar.cpp ├── push-button.cpp ├── radio-button.cpp ├── scroll-area.cpp ├── scroll-bar.cpp ├── scroll-view.cpp ├── separator.cpp ├── slider.cpp ├── splitter.cpp ├── stack-layout.cpp ├── stack.cpp ├── string-list-model.cpp ├── tab-button.cpp ├── tab-header.cpp ├── tab.cpp ├── table-adjustment.cpp ├── table-layout.cpp ├── text.cpp ├── textentry.cpp ├── texture-atlas.cpp ├── texture-view.cpp ├── time-ruler.cpp ├── toggle-button.cpp ├── tool-button.cpp ├── tree-view.cpp ├── vector-icon.cpp ├── view-buffer.cpp ├── viewport2d.cpp ├── viewport3d.cpp ├── widget-shadow.cpp ├── window.cpp └── workspace.cpp ├── opengl ├── gl-framebuffer.cpp ├── gl-renderbuffer.cpp ├── gl-texture2d.cpp ├── glarraybuffer.cpp ├── glelementarraybuffer.cpp ├── glsl-program.cpp └── glsl-shader.cpp ├── pkgconfig └── blendint.pc.in └── stock ├── icons.cpp ├── shaders.cpp └── theme.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | 15 | # ctag file 16 | TAGS 17 | 18 | # temp files in Linux 19 | *~ 20 | 21 | # temp files in Mac 22 | *.DS_Store 23 | 24 | # Build directories 25 | Debug* 26 | Release* 27 | build 28 | CMakeLists.txt.user 29 | doc/html 30 | test/Debug* 31 | test/Release* 32 | demo/glfw/Debug* 33 | demo/glfw/Release* 34 | demo/qt5/qt5_demo.pro.user 35 | /Debug_Linux 36 | 37 | # CLion project 38 | .idea 39 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "demo"] 2 | path = demo 3 | url = https://github.com/zhanggyb/BlendInt_Demos.git 4 | [submodule "test"] 5 | path = test 6 | url = https://github.com/zhanggyb/BlendInt_UnitTests.git 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **This project is obselete, part of it will be merged to https://github.com/wiztk/framework** 2 | -------------------------------------------------------------------------------- /cmake/Modules/FindFontConfig.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find Fontconfig 2 | # Once done this will define 3 | # 4 | # FONTCONFIG_FOUND - system has Fontconfig 5 | # FONTCONFIG_INCLUDE_DIR - the Fontconfig include directory 6 | # FONTCONFIG_LIBRARY - Link these to use Fontconfig 7 | # Redistribution and use is allowed according to the terms of the BSD license. 8 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 9 | # 10 | 11 | 12 | if ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY ) 13 | # in cache already 14 | SET(Fontconfig_FIND_QUIETLY TRUE) 15 | endif ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY ) 16 | 17 | # use pkg-config to get the directories and then use these values 18 | # in the FIND_PATH() and FIND_LIBRARY() calls 19 | if( NOT WIN32 ) 20 | find_package(PkgConfig) 21 | 22 | pkg_check_modules(FONTCONFIG_PKG QUIET fontconfig) 23 | endif( NOT WIN32 ) 24 | 25 | FIND_PATH(FONTCONFIG_INCLUDE_DIR NAMES fontconfig/fontconfig.h 26 | PATHS 27 | /usr/local/include 28 | /usr/X11/include 29 | /usr/include 30 | HINTS 31 | ${FONTCONFIG_PKG_INCLUDE_DIRS} # Generated by pkg-config 32 | ) 33 | 34 | FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig ${FONTCONFIG_PKG_LIBRARY} 35 | PATHS 36 | /usr/local 37 | /usr/X11 38 | /usr 39 | HINTS 40 | ${FONTCONFIG_PKG_LIBRARY_DIRS} # Generated by pkg-config 41 | PATH_SUFFIXES 42 | lib64 43 | lib 44 | ) 45 | 46 | include(FindPackageHandleStandardArgs) 47 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR ) 48 | 49 | # show the FONTCONFIG_INCLUDE_DIR and FONTCONFIG_LIBRARY variables only in the advanced view 50 | MARK_AS_ADVANCED(FONTCONFIG_INCLUDE_DIR FONTCONFIG_LIBRARY ) 51 | -------------------------------------------------------------------------------- /cmake/Modules/FindGLFW.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find GLFW library and include path. 3 | # Once done this will define 4 | # 5 | # GLFW_FOUND 6 | # GLFW_INCLUDE_DIR 7 | # GLFW_LIBRARIES 8 | # 9 | 10 | if(NOT GLFW_FOUND) 11 | 12 | FIND_PATH(GLFW_INCLUDE_DIR GLFW/glfw3.h 13 | PATHS 14 | /usr/local/include 15 | /usr/X11/include 16 | /usr/include 17 | /opt/local/include 18 | NO_DEFAULT_PATH 19 | ) 20 | 21 | FIND_LIBRARY( GLFW_LIBRARIES NAMES glfw glfw3 22 | PATHS 23 | /usr/local 24 | /usr/X11 25 | /usr 26 | PATH_SUFFIXES 27 | a 28 | lib64 29 | lib 30 | NO_DEFAULT_PATH 31 | ) 32 | 33 | SET(GLFW_FOUND "NO") 34 | IF (GLFW_INCLUDE_DIR AND GLFW_LIBRARIES) 35 | SET(GLFW_FOUND "YES") 36 | ENDIF (GLFW_INCLUDE_DIR AND GLFW_LIBRARIES) 37 | 38 | if(GLFW_FOUND) 39 | message(STATUS "Found GLFW: ${GLFW_INCLUDE_DIR}") 40 | else(GLFW_FOUND) 41 | message(FATAL_ERROR "could NOT find GLFW") 42 | endif(GLFW_FOUND) 43 | 44 | endif(NOT GLFW_FOUND) 45 | -------------------------------------------------------------------------------- /cmake/Modules/FindGLM.cmake: -------------------------------------------------------------------------------- 1 | # FindGLM - attempts to locate the glm matrix/vector library. 2 | # 3 | # This module defines the following variables (on success): 4 | # GLM_INCLUDE_DIRS - where to find glm/glm.hpp 5 | # GLM_FOUND - if the library was successfully located 6 | # 7 | # It is trying a few standard installation locations, but can be customized 8 | # with the following variables: 9 | # GLM_ROOT_DIR - root directory of a glm installation 10 | # Headers are expected to be found in either: 11 | # /glm/glm.hpp OR 12 | # /include/glm/glm.hpp 13 | # This variable can either be a cmake or environment 14 | # variable. Note however that changing the value 15 | # of the environment varible will NOT result in 16 | # re-running the header search and therefore NOT 17 | # adjust the variables set by this module. 18 | 19 | #============================================================================= 20 | # Copyright 2012 Carsten Neumann 21 | # 22 | # Distributed under the OSI-approved BSD License (the "License"); 23 | # see accompanying file Copyright.txt for details. 24 | # 25 | # This software is distributed WITHOUT ANY WARRANTY; without even the 26 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 27 | # See the License for more information. 28 | #============================================================================= 29 | # (To distribute this file outside of CMake, substitute the full 30 | # License text for the above reference.) 31 | 32 | # default search dirs 33 | SET(_glm_HEADER_SEARCH_DIRS 34 | "/usr/include" 35 | "/usr/local/include") 36 | 37 | # check environment variable 38 | SET(_glm_ENV_ROOT_DIR "$ENV{GLM_ROOT_DIR}") 39 | 40 | IF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR) 41 | SET(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}") 42 | ENDIF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR) 43 | 44 | # put user specified location at beginning of search 45 | IF(GLM_ROOT_DIR) 46 | SET(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}" 47 | "${GLM_ROOT_DIR}/include" 48 | ${_glm_HEADER_SEARCH_DIRS}) 49 | ENDIF(GLM_ROOT_DIR) 50 | 51 | # locate header 52 | FIND_PATH(GLM_INCLUDE_DIR "glm/glm.hpp" 53 | PATHS ${_glm_HEADER_SEARCH_DIRS}) 54 | 55 | INCLUDE(FindPackageHandleStandardArgs) 56 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG 57 | GLM_INCLUDE_DIR) 58 | 59 | IF(GLM_FOUND) 60 | SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}") 61 | 62 | MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}") 63 | ENDIF(GLM_FOUND) 64 | -------------------------------------------------------------------------------- /cmake/Modules/FindOpenImageIO.cmake: -------------------------------------------------------------------------------- 1 | # - Find OpenImageIO library 2 | # Find the native OpenImageIO includes and library 3 | # This module defines 4 | # OPENIMAGEIO_INCLUDE_DIRS, where to find openimageio.h, Set when 5 | # OPENIMAGEIO_INCLUDE_DIR is found. 6 | # OPENIMAGEIO_LIBRARIES, libraries to link against to use OpenImageIO. 7 | # OPENIMAGEIO_ROOT_DIR, The base directory to search for OpenImageIO. 8 | # This can also be an environment variable. 9 | # OPENIMAGEIO_FOUND, If false, do not try to use OpenImageIO. 10 | # 11 | # also defined, but not for general use are 12 | # OPENIMAGEIO_LIBRARY, where to find the OpenImageIO library. 13 | 14 | #============================================================================= 15 | # Copyright 2011 Blender Foundation. 16 | # 17 | # Distributed under the OSI-approved BSD License (the "License"); 18 | # see accompanying file Copyright.txt for details. 19 | # 20 | # This software is distributed WITHOUT ANY WARRANTY; without even the 21 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 22 | # See the License for more information. 23 | #============================================================================= 24 | 25 | # If OPENIMAGEIO_ROOT_DIR was defined in the environment, use it. 26 | IF(NOT OPENIMAGEIO_ROOT_DIR AND NOT $ENV{OPENIMAGEIO_ROOT_DIR} STREQUAL "") 27 | SET(OPENIMAGEIO_ROOT_DIR $ENV{OPENIMAGEIO_ROOT_DIR}) 28 | ENDIF() 29 | 30 | SET(_openimageio_SEARCH_DIRS 31 | ${OPENIMAGEIO_ROOT_DIR} 32 | /usr/local 33 | /sw # Fink 34 | /opt/local # DarwinPorts 35 | /opt/csw # Blastwave 36 | /opt/lib/oiio 37 | ) 38 | 39 | FIND_PATH(OPENIMAGEIO_INCLUDE_DIR 40 | NAMES 41 | OpenImageIO/imageio.h 42 | HINTS 43 | ${_openimageio_SEARCH_DIRS} 44 | PATH_SUFFIXES 45 | include 46 | ) 47 | 48 | FIND_LIBRARY(OPENIMAGEIO_LIBRARY 49 | NAMES 50 | OpenImageIO 51 | HINTS 52 | ${_openimageio_SEARCH_DIRS} 53 | PATH_SUFFIXES 54 | lib64 lib 55 | ) 56 | 57 | # handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if 58 | # all listed variables are TRUE 59 | INCLUDE(FindPackageHandleStandardArgs) 60 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO DEFAULT_MSG 61 | OPENIMAGEIO_LIBRARY OPENIMAGEIO_INCLUDE_DIR) 62 | 63 | IF(OPENIMAGEIO_FOUND) 64 | SET(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY}) 65 | SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR}) 66 | ENDIF(OPENIMAGEIO_FOUND) 67 | 68 | MARK_AS_ADVANCED( 69 | OPENIMAGEIO_INCLUDE_DIR 70 | OPENIMAGEIO_LIBRARY 71 | ) 72 | -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif(NOT "${rm_retval}" STREQUAL 0) 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 21 | endforeach(file) 22 | 23 | # Remove empty directories: 24 | if(EXISTS "@CMAKE_INSTALL_PREFIX@/include/blendint") 25 | message("Remove @CMAKE_INSTALL_PREFIX@/include/blendint ...") 26 | file(REMOVE_RECURSE "@CMAKE_INSTALL_PREFIX@/include/blendint") 27 | endif() 28 | 29 | if(EXISTS "@CMAKE_INSTALL_PREFIX@/share/blendint") 30 | message("Remove @CMAKE_INSTALL_PREFIX@/share/blendint ...") 31 | file(REMOVE_RECURSE "@CMAKE_INSTALL_PREFIX@/share/blendint") 32 | endif() 33 | -------------------------------------------------------------------------------- /data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES "${PROJECT_SOURCE_DIR}/data/blender_icons16.png" DESTINATION share/blendint) 2 | install(FILES "${PROJECT_SOURCE_DIR}/data/blender_icons32.png" DESTINATION share/blendint) 3 | install(DIRECTORY "${PROJECT_SOURCE_DIR}/data/cursors" DESTINATION share/blendint) 4 | -------------------------------------------------------------------------------- /data/blender_icons16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/blender_icons16.png -------------------------------------------------------------------------------- /data/blender_icons32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/blender_icons32.png -------------------------------------------------------------------------------- /data/cursors/black.idraw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/cursors/black.idraw -------------------------------------------------------------------------------- /data/cursors/fleur.cfg: -------------------------------------------------------------------------------- 1 | 28 12 12 fleur.png 2 | -------------------------------------------------------------------------------- /data/cursors/fleur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/cursors/fleur.png -------------------------------------------------------------------------------- /data/cursors/hand2.cfg: -------------------------------------------------------------------------------- 1 | 28 9 4 hand2.png 2 | -------------------------------------------------------------------------------- /data/cursors/hand2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/cursors/hand2.png -------------------------------------------------------------------------------- /data/cursors/left_ptr.cfg: -------------------------------------------------------------------------------- 1 | 28 9 5 left_ptr.png 2 | -------------------------------------------------------------------------------- /data/cursors/left_ptr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/cursors/left_ptr.png -------------------------------------------------------------------------------- /data/cursors/sb_h_double_arrow.cfg: -------------------------------------------------------------------------------- 1 | 28 11 11 sb_h_double_arrow.png 2 | -------------------------------------------------------------------------------- /data/cursors/sb_h_double_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/cursors/sb_h_double_arrow.png -------------------------------------------------------------------------------- /data/cursors/sb_v_double_arrow.cfg: -------------------------------------------------------------------------------- 1 | 28 11 10 sb_v_double_arrow.png 2 | -------------------------------------------------------------------------------- /data/cursors/sb_v_double_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/cursors/sb_v_double_arrow.png -------------------------------------------------------------------------------- /data/cursors/top_left_corner.cfg: -------------------------------------------------------------------------------- 1 | 28 11 11 top_left_corner.png 2 | -------------------------------------------------------------------------------- /data/cursors/top_left_corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/cursors/top_left_corner.png -------------------------------------------------------------------------------- /data/cursors/top_right_corner.cfg: -------------------------------------------------------------------------------- 1 | 28 12 11 top_right_corner.png 2 | -------------------------------------------------------------------------------- /data/cursors/top_right_corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/cursors/top_right_corner.png -------------------------------------------------------------------------------- /data/cursors/xterm.cfg: -------------------------------------------------------------------------------- 1 | 28 12 11 xterm.png 2 | -------------------------------------------------------------------------------- /data/cursors/xterm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/data/cursors/xterm.png -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | 4 | FIND_PACKAGE(Doxygen) 5 | if(NOT DOXYGEN_FOUND) 6 | message(FATAL_ERROR "Doxygen is needed to build the documentation. Please 7 | install it correctly") 8 | endif() 9 | 10 | configure_file(Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE) 11 | add_custom_target(Docs ALL 12 | COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile 13 | SOURCES ${PROJECT_BINARY_DIR}/Doxyfile) 14 | 15 | install(DIRECTORY "${PROJECT_BINARY_DIR}/Documentation/html" DESTINATION 16 | share/doc/BlendInt) 17 | -------------------------------------------------------------------------------- /doc/code_style.dox: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @page code_style The C++ Coding Style Used in This Project 4 | 5 | This project follows Google's C++ coding style, see the document on its home page: 6 | http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 7 | 8 | */ 9 | -------------------------------------------------------------------------------- /doc/compile.dox: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @page page_compile Compile 4 | @tableofcontents 5 | 6 | @section sect_compile_require Requirements 7 | 8 | BlendInt depends on: 9 | - OpenGL (built-in framework) 10 | - GLEW (http://glew.sourceforge.net) 11 | - GLM (http://glm.g-truc.net) 12 | - boost (http://www.boost.org) 13 | - freetype 14 | - fontconfig 15 | - OpenImageIO 16 | 17 | @subsection sect_compile_require_install_in_linux Install requirements in Linux 18 | 19 | Most Linux distributions provide the packges already, install them through the 20 | default package management. 21 | 22 | For example, install by pacman command in ArchLinux: 23 | 24 | $ sudo pacman install glew glm boost boost-libs opencolorio openimageio 25 | 26 | @subsection sect_compile_require_install_in_Mac Install requirements in Mac OS X 27 | 28 | The required packages can be installed through homebrew (http://brew.sh/): 29 | 30 | $ brew install freetype fontconfig boost 31 | 32 | @section sect_compile_in_linux Compile in Linux 33 | 34 | @subsection sect_compile_in_linux_cmake Build with CMake 35 | 36 | $ cd 37 | $ mkdir build && cd build 38 | $ ../configure && make 39 | 40 | @section sect_compile_in_mac Compile in Mac OS X 41 | 42 | */ -------------------------------------------------------------------------------- /doc/groups.dox: -------------------------------------------------------------------------------- 1 | // Doxygen documentation 2 | 3 | /** 4 | * @defgroup blendint_core The Core module 5 | * 6 | * Some core data structures and classes. 7 | */ 8 | 9 | /** 10 | * @defgroup blendint_font The Font module 11 | * 12 | * C++ wrapper of Fontconfig and Freetype 13 | */ 14 | 15 | /** 16 | * @defgroup blendint_cppevents CppEvents module 17 | * 18 | * CppEvents module 19 | */ 20 | 21 | /** 22 | * @defgroup blendint_opengl C++ OpenGL warpper 23 | * 24 | * Some simple C++ warpper of OpenGL C APIs 25 | */ 26 | 27 | /** 28 | * @defgroup blendint_gui The GUI module 29 | * 30 | * The main module of this project, provides different types of gui classes 31 | */ 32 | 33 | /** 34 | * @defgroup blendint_gui_windows Windows 35 | * @ingroup blendint_gui 36 | * 37 | * Windows 38 | */ 39 | 40 | /** 41 | * @defgroup blendint_gui_frames Frames 42 | * @ingroup blendint_gui 43 | * 44 | * Frames 45 | */ 46 | 47 | /** 48 | * @defgroup blendint_gui_widgets Widgets 49 | * @ingroup blendint_gui 50 | * 51 | * Widgets 52 | */ 53 | 54 | /** 55 | * @defgroup blendint_gui_forms Forms 56 | * @ingroup blendint_gui 57 | * 58 | * 2D forms rendered with OpenGL API 59 | */ 60 | 61 | /** 62 | * @defgroup blendint_gui_nodes Nodes 63 | * @ingroup blendint_gui 64 | * 65 | * Nodes 66 | */ 67 | 68 | /** 69 | * @defgroup stock Stock resources for common usage 70 | * 71 | * Pre-defined icons, shaders, theme used in this project 72 | */ 73 | -------------------------------------------------------------------------------- /doc/images/button_design.idraw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/doc/images/button_design.idraw -------------------------------------------------------------------------------- /doc/images/hello_linux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/doc/images/hello_linux.png -------------------------------------------------------------------------------- /doc/images/hello_osx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhanggyb/BlendInt/0de65c2d5f3fd7d16423fb3c12c5a9499ae050fd/doc/images/hello_osx.png -------------------------------------------------------------------------------- /doc/main.dox: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @mainpage BlendInt -- a lightweight C++ GUI toolkit inspired by 4 | Blender @tableofcontents 5 | 6 | @section sect_intro Introduction 7 | 8 | BlendInt is a lightweight C++ GUI toolkit for building cross-platform 9 | application with Blender-like style, originally written for my own 10 | use. 11 | 12 | Please be noted that this project is under heavy development. Support 13 | cannot be guaranteed and it may not function as you expect. Besides, 14 | the Wiki page is under construction and the API may also change at any 15 | time. 16 | 17 | BlendInt currently lives on GitHub. 19 | 20 | @section usage_sec Usage 21 | 22 | @section sect_compile Compile 23 | 24 | @ref page_compile 25 | 26 | @section sect_quick_guide Quick Guide 27 | 28 | @ref page_quick_guide 29 | 30 | */ 31 | -------------------------------------------------------------------------------- /doc/plot/tab_button.plot: -------------------------------------------------------------------------------- 1 | # plot file for tab button 2 | 3 | set title "Tab Button shape" 4 | set xlabel "X" 5 | set ylabel "Y" 6 | set xrange [0:20] 7 | set yrange [0:20] 8 | plot 10 * sin((x - 5)/pi) + 10 9 | -------------------------------------------------------------------------------- /doc/quick.dox: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @page page_quick_guide Quick Guide 4 | @tableofcontents 5 | 6 | @section sect_opengl_window Choose an OpenGL Window 7 | 8 | BlendInt is a collection of code to draw widgets in OpenGL Context, it does not provide 9 | a window system to create opengl context and manage input events. You need to choose an 10 | opengl utility toolkit to create such window and pass events to BlendInt. Fortunately, 11 | there're many open-source, cross-platform toolkits you can use, for example: 12 | - GLFW: http://www.glfw.org 13 | - freeGLUT: http://freeglut.sourceforge.net 14 | - Qt (use the Qt OpenGL framework): http://www.qt-project.org 15 | - Gtk (GTK+ OpenGL extension): http://www.gtk.org 16 | 17 | Below we demonstrate how to use BlendInt in the OpenGL Context created by GLFW3 18 | 19 | @section sect_simple_example A simple example 20 | 21 | @subsection sect_including Including the BlendInt header 22 | 23 | @subsection sect_initialize Initializing Resources 24 | 25 | @subsection sect_terminate Terminating 26 | 27 | @subsection sect_create_and_render_widgets Create and Render Widgets 28 | 29 | @section sect_using_cpp_events Using CppEvents 30 | 31 | @include glfw/main.cpp 32 | @example glfw/main.cpp 33 | 34 | */ 35 | -------------------------------------------------------------------------------- /editor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMake file for BlendInt project 2 | # 3 | 4 | file(GLOB sourcefiles "*/*.cpp") 5 | list(APPEND editor_SRC ${sourcefiles}) 6 | file(GLOB sourcefiles "*.cpp") 7 | list(APPEND editor_SRC ${sourcefiles}) 8 | 9 | file(GLOB headerfiles "*.hpp") 10 | list(APPEND editor_SRC ${headerfiles}) 11 | file(GLOB headerfiles "*/*.hpp") 12 | list(APPEND editor_SRC ${headerfiles}) 13 | 14 | add_executable(editor ${editor_SRC}) 15 | 16 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) 17 | target_link_libraries(editor ${BLENDINT_LIB_NAME} ${LIBS}) 18 | 19 | #if(CMAKE_GENERATOR STREQUAL "Xcode") 20 | # if(CMAKE_BUILD_TYPE STREQUAL "Debug") 21 | # INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/bin/Debug/editor DESTINATION bin) 22 | # else() 23 | # INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/bin/Release/editor DESTINATION bin) 24 | # endif() 25 | #else() 26 | # INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/bin/editor DESTINATION bin) 27 | #endif() 28 | -------------------------------------------------------------------------------- /editor/edit-space.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include "edit-space.hpp" 25 | 26 | namespace BlendInt { 27 | 28 | EditSpace::EditSpace () 29 | : Workspace() 30 | { 31 | 32 | } 33 | 34 | EditSpace::~EditSpace () 35 | { 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /editor/edit-space.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class EditSpace: public Workspace 31 | { 32 | public: 33 | 34 | EditSpace (); 35 | 36 | virtual ~EditSpace (); 37 | 38 | }; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /editor/editor-window.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | #include "tool-bar.hpp" 30 | #include "edit-space.hpp" 31 | 32 | namespace BlendInt { 33 | 34 | class EditorWindow: public Window 35 | { 36 | public: 37 | 38 | EditorWindow (int width, int height, const char* name); 39 | 40 | virtual ~EditorWindow (); 41 | 42 | private: 43 | 44 | void OnResize (const Size& size); 45 | 46 | void OnMessageBoxDestroyed (AbstractFrame* sender); 47 | 48 | ToolBar* toolbar_; 49 | 50 | EditSpace* workspace_; 51 | 52 | MessageBox* dev_msg_; 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /editor/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include "editor-window.hpp" 25 | #include 26 | 27 | int main (int argc, char* argv[]) 28 | { 29 | using namespace BlendInt; 30 | 31 | if (Window::Initialize()) { 32 | EditorWindow win(1280, 800, "UI Editor"); 33 | win.Exec(); 34 | Window::Terminate(); 35 | } 36 | 37 | std::cout << "sizeof (AbstractView): " << sizeof(AbstractView) << std::endl; 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /include/blendint/config.hpp.in: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #define BLENDINT_SYSTEM_LINUX 0 27 | #define BLENDINT_SYSTEM_APPLE 1 28 | #define BLENDINT_SYSTEM_WINDOWS 2 29 | 30 | #define BLENDINT_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" 31 | #define BLENDINT_PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@" 32 | 33 | #define BLENDINT_SYSTEM_NAME @BLENDINT_SYSTEM_NAME@ 34 | 35 | #if BLENDINT_SYSTEM_NAME == BLENDINT_SYSTEM_LINUX 36 | // { 37 | #ifndef __UNIX__ 38 | #define __UNIX__ 39 | #endif 40 | #ifndef __LINUX__ 41 | #define __LINUX__ 42 | #endif 43 | // } 44 | #elif BLENDINT_SYSTEM_NAME == BLENDINT_SYSTEM_APPLE 45 | // { 46 | #ifndef __UNIX__ 47 | #define __UNIX__ 48 | #endif 49 | #ifndef __APPLE__ 50 | #define __APPLE__ 51 | #endif 52 | // } 53 | #elif BLENDINT_SYSTEM_NAME == BLENDINT_SYSTEM_WINDOWS 54 | // { 55 | #ifndef __WIN__ 56 | #define __WIN__ 57 | #endif 58 | // } 59 | #else 60 | #error "Host system is NOT supported!" 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /include/blendint/core/image.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | /** 33 | * @brief Image class focused on I/O and direct pixel access and manipulation 34 | * 35 | * @ingroup blendint_core 36 | */ 37 | class Image: public Object 38 | { 39 | public: 40 | 41 | Image (); 42 | 43 | ~Image (); 44 | 45 | bool Read (const char* filename); 46 | 47 | bool Read (const String& filename); 48 | 49 | bool Save (); 50 | 51 | void Clear (); 52 | 53 | const unsigned char* pixels () const 54 | { 55 | return &m_pixels[0]; 56 | } 57 | 58 | int height () const 59 | { 60 | return m_height; 61 | } 62 | 63 | int width () const 64 | { 65 | return m_width; 66 | } 67 | 68 | int channels () const 69 | { 70 | return m_channels; 71 | } 72 | 73 | private: 74 | 75 | String m_filename; 76 | 77 | int m_width; 78 | int m_height; 79 | int m_channels; 80 | 81 | std::vector m_pixels; 82 | }; 83 | } 84 | -------------------------------------------------------------------------------- /include/blendint/core/object.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #ifdef DEBUG 29 | #include 30 | #include 31 | #endif // DEBUG 32 | 33 | #include 34 | 35 | namespace BlendInt { 36 | 37 | /** 38 | * @brief The base class with reference count 39 | * 40 | * @ingroup blendint_core 41 | */ 42 | class Object 43 | { 44 | public: 45 | 46 | inline Object () 47 | : reference_count_(0) 48 | { 49 | } 50 | 51 | virtual ~Object () 52 | { 53 | } 54 | 55 | inline size_t reference_count () 56 | { 57 | return reference_count_; 58 | } 59 | 60 | private: 61 | 62 | // disallow copy and assignment: 63 | Object (const Object& orig); 64 | Object& operator = (const Object& orig); 65 | 66 | template friend class RefPtr; 67 | 68 | size_t reference_count_; 69 | 70 | }; 71 | 72 | } 73 | -------------------------------------------------------------------------------- /include/blendint/core/string.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | /** 33 | * @brief Strings 34 | * 35 | * @ingroup blendint_core 36 | */ 37 | class String: public std::u32string 38 | { 39 | public: 40 | 41 | String (); 42 | 43 | String (const char* str); 44 | 45 | String (const wchar_t* str); 46 | 47 | String (const char* str, size_t n); 48 | 49 | String (const wchar_t* str, size_t n); 50 | 51 | String (const std::string& str); 52 | 53 | String (const std::wstring& str); 54 | 55 | String (const String& orig); 56 | 57 | String& operator = (const char* str); 58 | 59 | String& operator = (const wchar_t* str); 60 | 61 | String& operator = (const std::string& str); 62 | 63 | String& operator = (const std::wstring& str); 64 | 65 | String& operator = (const String& orig); 66 | 67 | }; 68 | 69 | extern std::string ConvertFromString (const String& src); 70 | 71 | } 72 | -------------------------------------------------------------------------------- /include/blendint/cppevent/delegate-token.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 Freeman Zhang 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | #include 31 | 32 | namespace CppEvent { 33 | 34 | template 35 | class DelegateToken : public InvokableToken < ParamTypes... > 36 | { 37 | public: 38 | 39 | DelegateToken() = delete; 40 | 41 | inline DelegateToken(const Delegate& d); 42 | 43 | virtual ~DelegateToken(); 44 | 45 | virtual void Invoke(ParamTypes... Args) override; 46 | 47 | const Delegate& delegate () const 48 | { 49 | return delegate_; 50 | } 51 | 52 | private: 53 | 54 | Delegate delegate_; 55 | 56 | }; 57 | 58 | template 59 | inline DelegateToken::DelegateToken(const Delegate& d) 60 | : InvokableToken(), delegate_(d) 61 | { 62 | } 63 | 64 | template 65 | DelegateToken::~DelegateToken() 66 | { 67 | } 68 | 69 | template 70 | void DelegateToken::Invoke(ParamTypes... Args) 71 | { 72 | delegate_(Args...); 73 | } 74 | 75 | } // namespace CppEvent 76 | -------------------------------------------------------------------------------- /include/blendint/cppevent/event-token.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 Freeman Zhang 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | namespace CppEvent { 32 | 33 | // forward declaration 34 | template class Event; 35 | 36 | template 37 | class EventToken : public InvokableToken < ParamTypes... > 38 | { 39 | public: 40 | 41 | EventToken () = delete; 42 | 43 | inline EventToken(Event& event); 44 | 45 | virtual ~EventToken(); 46 | 47 | virtual void Invoke(ParamTypes... Args) override; 48 | 49 | inline const Event* event () const; 50 | 51 | private: 52 | 53 | Event* event_; 54 | }; 55 | 56 | template 57 | inline EventToken::EventToken (Event< 58 | ParamTypes...>& event) 59 | : InvokableToken(), event_(&event) 60 | { 61 | } 62 | 63 | template 64 | EventToken::~EventToken() 65 | { 66 | } 67 | 68 | template 69 | void EventToken::Invoke(ParamTypes... Args) 70 | { 71 | event_->Invoke(Args...); 72 | } 73 | 74 | template 75 | inline const Event* EventToken::event() const 76 | { 77 | return event_; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /include/blendint/cppevent/invokable-token.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 Freeman Zhang 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | namespace CppEvent { 32 | 33 | template 34 | class InvokableToken: public Token 35 | { 36 | public: 37 | 38 | inline InvokableToken (); 39 | 40 | virtual ~InvokableToken (); 41 | 42 | virtual void Invoke (ParamTypes ... Args); 43 | }; 44 | 45 | template 46 | inline InvokableToken::InvokableToken () 47 | : Token() 48 | { 49 | } 50 | 51 | template 52 | InvokableToken::~InvokableToken () 53 | { 54 | } 55 | 56 | template 57 | void InvokableToken::Invoke (ParamTypes ... Args) 58 | { 59 | // Override this in sub class 60 | } 61 | 62 | } // namespace CppEvent 63 | -------------------------------------------------------------------------------- /include/blendint/font/fc-charset.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_FONT_CHARSET_HPP_ 25 | #define _BLENDINT_FONT_CHARSET_HPP_ 26 | 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | namespace Fc { 32 | 33 | class CharSet 34 | { 35 | public: 36 | 37 | inline CharSet () 38 | : charset_(0) 39 | { 40 | charset_ = FcCharSetCreate(); 41 | } 42 | 43 | inline ~CharSet () 44 | { 45 | FcCharSetDestroy(charset_); 46 | } 47 | 48 | inline ::FcCharSet* charset () const 49 | { 50 | return charset_; 51 | } 52 | 53 | private: 54 | 55 | friend inline bool operator == (const CharSet& a, const CharSet& b); 56 | 57 | ::FcCharSet* charset_; 58 | }; 59 | 60 | bool operator == (const CharSet& a, const CharSet& b) 61 | { 62 | return FcCharSetEqual(a.charset_, b.charset_); 63 | } 64 | 65 | } 66 | 67 | } 68 | 69 | #endif /* _BLENDINT_FONT_CHARSET_HPP_ */ 70 | -------------------------------------------------------------------------------- /include/blendint/font/fc-fontset.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_FONT_FCFONTSET_HPP_ 25 | #define _BLENDINT_FONT_FCFONTSET_HPP_ 26 | 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | namespace BlendInt { 34 | 35 | namespace Fc { 36 | 37 | class FontSet: public Object 38 | { 39 | public: 40 | 41 | FontSet (::FcFontSet* fs = 0) 42 | : Object(), 43 | fontset_(fs) 44 | { 45 | if(fontset_ == 0) 46 | fontset_ = FcFontSetCreate(); 47 | } 48 | 49 | virtual ~FontSet () 50 | { 51 | FcFontSetDestroy(fontset_); 52 | } 53 | 54 | inline bool add (const Pattern& font) 55 | { 56 | return FcFontSetAdd (fontset_, font.pattern()); 57 | } 58 | 59 | inline void print () 60 | { 61 | FcFontSetPrint(fontset_); 62 | } 63 | 64 | inline ::FcFontSet* fontset () const 65 | { 66 | return fontset_; 67 | } 68 | 69 | private: 70 | 71 | FontSet (const FontSet& orig); 72 | 73 | FontSet& operator = (const FontSet& orig); 74 | 75 | ::FcFontSet* fontset_; 76 | }; 77 | 78 | } 79 | 80 | } 81 | 82 | #endif /* _BLENDINT_FONT_FCFONTSET_HPP_ */ 83 | -------------------------------------------------------------------------------- /include/blendint/font/fc-objectset.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_FONT_FCOBJECTSET_HPP_ 25 | #define _BLENDINT_FONT_FCOBJECTSET_HPP_ 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | namespace BlendInt { 33 | 34 | namespace Fc { 35 | 36 | class ObjectSet: public Object 37 | { 38 | public: 39 | 40 | ObjectSet (::FcObjectSet* os = 0) 41 | : Object(), 42 | object_set_(os) 43 | { 44 | if(object_set_ == 0) 45 | object_set_ = FcObjectSetCreate(); 46 | } 47 | 48 | virtual ~ObjectSet () 49 | { 50 | FcObjectSetDestroy(object_set_); 51 | } 52 | 53 | inline bool add (const char* object) 54 | { 55 | return FcObjectSetAdd (object_set_, object); 56 | } 57 | 58 | static inline RefPtr build (const char *first, ...) 59 | { 60 | va_list args; 61 | va_start(args, first); 62 | ::FcObjectSet* os = FcObjectSetBuild(first, args, NULL); 63 | va_end(args); 64 | 65 | return RefPtr(new ObjectSet(os)); 66 | } 67 | 68 | inline ::FcObjectSet* object_set () const 69 | { 70 | return object_set_; 71 | } 72 | 73 | private: 74 | 75 | ObjectSet (const ObjectSet& orig); 76 | 77 | ObjectSet& operator = (const ObjectSet& orig); 78 | 79 | ::FcObjectSet* object_set_; 80 | }; 81 | 82 | } 83 | 84 | } 85 | 86 | 87 | #endif /* _BLENDINT_FONT_FCOBJECTSET_HPP_ */ 88 | -------------------------------------------------------------------------------- /include/blendint/font/ft-library.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include FT_FREETYPE_H 30 | #include FT_LCD_FILTER_H 31 | 32 | namespace BlendInt { 33 | 34 | namespace Ft { 35 | 36 | class Library 37 | { 38 | public: 39 | 40 | Library (); 41 | 42 | ~Library (); 43 | 44 | bool Init (); 45 | 46 | bool SetLcdFilter (FT_LcdFilter filter); 47 | 48 | bool SetLcdFilterWeights (unsigned char* weights); 49 | 50 | bool GetVersion (FT_Int* major, FT_Int* minor, FT_Int* patch); 51 | 52 | bool Done (); 53 | 54 | const FT_Library& library () const 55 | { 56 | return library_; 57 | } 58 | 59 | private: 60 | 61 | FT_Library library_; 62 | }; 63 | 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /include/blendint/gui/abstract-adjustment.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | /** 31 | * @brief Used for layouts to adjust sub views' geometry 32 | * 33 | * @ingroup blendint_gui 34 | */ 35 | class AbstractAdjustment 36 | { 37 | public: 38 | 39 | AbstractAdjustment (AbstractView* view) 40 | : view_(view) 41 | { 42 | 43 | } 44 | 45 | virtual ~AbstractAdjustment () 46 | { 47 | 48 | } 49 | 50 | virtual void Adjust (int x, int y, int w, int h) = 0; 51 | 52 | protected: 53 | 54 | inline void move (AbstractView* sub, int x, int y) const 55 | { 56 | view_->MoveSubViewTo(sub, x, y); 57 | } 58 | 59 | inline void move (AbstractView* sub, const Point& point) const 60 | { 61 | view_->MoveSubViewTo(sub, point); 62 | } 63 | 64 | inline void resize (AbstractView* sub, int width, int height) const 65 | { 66 | view_->ResizeSubView(sub, width, height); 67 | } 68 | 69 | inline void resize (AbstractView* sub, const Size& size) const 70 | { 71 | view_->ResizeSubView(sub, size); 72 | } 73 | 74 | AbstractView* view () const 75 | { 76 | return view_; 77 | } 78 | 79 | private: 80 | 81 | AbstractView* view_; 82 | }; 83 | 84 | } 85 | -------------------------------------------------------------------------------- /include/blendint/gui/abstract-cursor-theme.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class AbstractCursorTheme 31 | { 32 | public: 33 | 34 | AbstractCursorTheme () 35 | : current_cursor_(ArrowCursor) 36 | { 37 | } 38 | 39 | virtual ~AbstractCursorTheme () 40 | { 41 | } 42 | 43 | /** 44 | * @brief Set the cursor 45 | * 46 | * Override this to set custom cursor 47 | */ 48 | virtual void SetCursor (int cursor_type) = 0; 49 | 50 | inline int current_cursor () const 51 | { 52 | return current_cursor_; 53 | } 54 | 55 | private: 56 | 57 | int current_cursor_; 58 | 59 | }; 60 | 61 | class BlankCursorTheme: public AbstractCursorTheme 62 | { 63 | public: 64 | 65 | BlankCursorTheme () 66 | : AbstractCursorTheme() 67 | { 68 | } 69 | 70 | virtual ~BlankCursorTheme () 71 | { 72 | 73 | } 74 | 75 | virtual void SetCursor (int cursor_type) 76 | { 77 | 78 | } 79 | }; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /include/blendint/gui/abstract-icon.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class AbstractIcon: public AbstractForm 31 | { 32 | public: 33 | 34 | inline AbstractIcon () 35 | : AbstractForm() 36 | {} 37 | 38 | inline AbstractIcon (int width, int height) 39 | : AbstractForm(width, height) 40 | {} 41 | 42 | virtual ~AbstractIcon () 43 | {} 44 | 45 | }; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /include/blendint/gui/abstract-item-view.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief The base class for item view classes. 33 | * 34 | * AbstractItemView class is the base class for every standard 35 | * view that uses a AbstractItemModel. It provides a standard 36 | * interface for interoperating with models. 37 | * 38 | * AbstractItemView is a subclass of AbstractScrollable, which 39 | * means it contains 2 native ScrollBars. The sub class of this 40 | * view should manage the display and behavior of these 2 41 | * ScrollBars by itself. 42 | * 43 | * Usually the sub class should use native widgets to display 44 | * the data in model. 45 | */ 46 | class AbstractItemView: public AbstractScrollable 47 | { 48 | public: 49 | 50 | AbstractItemView (); 51 | 52 | virtual ~AbstractItemView (); 53 | 54 | virtual const RefPtr GetModel () const = 0; 55 | 56 | virtual void SetModel (const RefPtr& model) = 0; 57 | 58 | virtual ModelIndex GetIndexAt (const Point& point) const = 0; 59 | 60 | CppEvent::EventRef<> model_changed () 61 | { 62 | return model_changed_; 63 | } 64 | 65 | protected: 66 | 67 | void set_model (const RefPtr& model) 68 | { 69 | model_ = model; 70 | } 71 | 72 | private: 73 | 74 | RefPtr model_; 75 | 76 | CppEvent::Event<> model_changed_; 77 | 78 | }; 79 | 80 | } 81 | -------------------------------------------------------------------------------- /include/blendint/gui/abstract-layout.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | class AbstractLayout: public AbstractWidget 32 | { 33 | public: 34 | 35 | AbstractLayout (); 36 | 37 | AbstractLayout (int width, int height); 38 | 39 | AbstractLayout (int width, int height, const Margin& margin); 40 | 41 | virtual ~AbstractLayout (); 42 | 43 | virtual AbstractWidget* AddWidget (AbstractWidget* widget) = 0; 44 | 45 | virtual AbstractWidget* InsertWidget (int index, AbstractWidget* widget) = 0; 46 | 47 | virtual AbstractWidget* InsertWidget (int row, int column, AbstractWidget* widget) = 0; 48 | 49 | virtual void Adjust () = 0; 50 | 51 | const Margin& margin () const 52 | { 53 | return margin_; 54 | } 55 | 56 | void SetMargin (const Margin& margin); 57 | 58 | protected: 59 | 60 | virtual Response Draw (AbstractWindow* context); 61 | 62 | virtual void PerformMarginUpdate (const Margin& margin); 63 | 64 | inline void set_margin (const Margin& margin) 65 | { 66 | margin_ = margin; 67 | } 68 | 69 | private: 70 | 71 | Margin margin_; 72 | 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /include/blendint/gui/abstract-menu-item.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_GUI_ABSTRACTMENUITEM_HPP_ 25 | #define _BLENDINT_GUI_ABSTRACTMENUITEM_HPP_ 26 | 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | class AbstractMenuItem: public AbstractWidget 32 | { 33 | public: 34 | 35 | AbstractMenuItem(); 36 | 37 | virtual ~AbstractMenuItem (); 38 | 39 | protected: 40 | 41 | 42 | }; 43 | 44 | } 45 | 46 | #endif /* _BLENDINT_GUI_ABSTRACTMENUITEM_HPP_ */ 47 | -------------------------------------------------------------------------------- /include/blendint/gui/abstract-primitive.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | namespace BlendInt { 33 | 34 | class AbstractPrimitive: public Object 35 | { 36 | public: 37 | 38 | AbstractPrimitive (); 39 | 40 | virtual ~AbstractPrimitive (); 41 | 42 | /** 43 | * @brief Render the primitive in Viewport3D 44 | * @param MVP 45 | * 46 | * The following OpenGL APIs should not be used in this virtual function: 47 | * - glClearColor 48 | * - glClear 49 | */ 50 | virtual void Render (const glm::mat4& projection_matrix, 51 | const glm::mat4& view_matrix) = 0; 52 | 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /include/blendint/gui/abstract-scrollable.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | /** 31 | * @brief Base class for widgets with native scroll bar 32 | */ 33 | class AbstractScrollable: public AbstractRoundWidget 34 | { 35 | public: 36 | 37 | AbstractScrollable (); 38 | 39 | AbstractScrollable (int width, int height); 40 | 41 | virtual ~AbstractScrollable (); 42 | 43 | CppEvent::EventRef scrolled () 44 | { 45 | return scrolled_; 46 | } 47 | 48 | // virtual Size GetContentSize () const; 49 | virtual Point GetOffset () const; 50 | 51 | protected: 52 | 53 | inline void set_offset (int x, int y) 54 | { 55 | offset_.reset(x, y); 56 | } 57 | 58 | inline void set_offset (const Point& offset) 59 | { 60 | offset_ = offset; 61 | } 62 | 63 | inline void fire_scrolled_event (int x, int y) 64 | { 65 | scrolled_.Invoke(x, y); 66 | } 67 | 68 | private: 69 | 70 | Point offset_; 71 | 72 | CppEvent::Event scrolled_; 73 | 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /include/blendint/gui/abstract-shadow.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | /** 31 | * @brief Abstract class for soft shadows 32 | * 33 | * @ingroup blendint_gui 34 | */ 35 | class AbstractShadow: public AbstractRoundForm 36 | { 37 | public: 38 | 39 | AbstractShadow (short shadow_width = 9); 40 | 41 | virtual ~AbstractShadow (); 42 | 43 | inline short shadow_width () const 44 | { 45 | return shadow_width_; 46 | } 47 | 48 | protected: 49 | 50 | inline void set_shadow_width (short width) 51 | { 52 | shadow_width_ = width; 53 | } 54 | 55 | void GenerateShadowVertices (std::vector& vertices, 56 | std::vector& elements); 57 | 58 | private: 59 | 60 | short shadow_width_; 61 | 62 | }; 63 | 64 | } 65 | -------------------------------------------------------------------------------- /include/blendint/gui/adaptive-adjustment.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class AdaptiveAdjustment: public AbstractAdjustment 31 | { 32 | public: 33 | 34 | AdaptiveAdjustment (AbstractView* view, Orientation orient, int alignment, int space); 35 | 36 | virtual ~AdaptiveAdjustment(); 37 | 38 | virtual void Adjust (int x, int y, int w, int h); 39 | 40 | private: 41 | 42 | void AdjustHorizontally (int x, int y, int w, int h); 43 | 44 | void AdjustVertically (int x, int y, int w, int h); 45 | 46 | Orientation orientation_; 47 | 48 | int alignment_; 49 | 50 | int space_; 51 | 52 | }; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /include/blendint/gui/block.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | /** 31 | * @brief Container which controls sub widget round corner. 32 | * 33 | * @ingroup blendint_gui_widgets 34 | */ 35 | class Block: public AbstractRoundWidget 36 | { 37 | public: 38 | 39 | Block (Orientation orienation = Horizontal); 40 | 41 | virtual ~Block (); 42 | 43 | AbstractWidget* AddWidget (AbstractRoundWidget* widget); 44 | 45 | AbstractWidget* InsertWidget (int index, AbstractRoundWidget* widget); 46 | 47 | virtual bool IsExpandX () const; 48 | 49 | virtual bool IsExpandY () const; 50 | 51 | virtual Size GetPreferredSize () const; 52 | 53 | protected: 54 | 55 | virtual void PerformSizeUpdate (const AbstractView* source, 56 | const AbstractView* target, 57 | int width, 58 | int height); 59 | 60 | virtual Response Draw (AbstractWindow* context); 61 | 62 | private: 63 | 64 | void FillInHBlock (const Size& out_size); 65 | 66 | void FillInHBlock (int x, int y, int w, int h); 67 | 68 | void FillInVBlock (const Size& out_size); 69 | 70 | void FillInVBlock (int x, int y, int w, int h); 71 | 72 | private: 73 | 74 | Orientation orientation_; 75 | 76 | }; 77 | 78 | } 79 | -------------------------------------------------------------------------------- /include/blendint/gui/brightness-slider.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | class BrightnessSlider: public AbstractSlider 33 | { 34 | DISALLOW_COPY_AND_ASSIGN(BrightnessSlider); 35 | 36 | public: 37 | 38 | BrightnessSlider (Orientation orientation = Horizontal); 39 | 40 | virtual ~BrightnessSlider (); 41 | 42 | virtual bool IsExpandX () const; 43 | 44 | virtual bool IsExpandY () const; 45 | 46 | virtual Size GetPreferredSize () const; 47 | 48 | protected: 49 | 50 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 51 | 52 | virtual void PerformRoundTypeUpdate (int round_type); 53 | 54 | virtual void PerformRoundRadiusUpdate (float radius); 55 | 56 | virtual Response Draw (AbstractWindow* context); 57 | 58 | private: 59 | 60 | void InitializeBrightnessSlider (); 61 | 62 | GLuint vao_[2]; 63 | 64 | GLBuffer vbo_; 65 | 66 | }; 67 | 68 | } 69 | -------------------------------------------------------------------------------- /include/blendint/gui/check-button.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | /** 33 | * @brief Check button 34 | * 35 | * @ingroup blendint_gui_widgets_buttons 36 | */ 37 | class CheckButton: public AbstractButton 38 | { 39 | DISALLOW_COPY_AND_ASSIGN(CheckButton); 40 | 41 | public: 42 | 43 | CheckButton (); 44 | 45 | CheckButton (const String& text); 46 | 47 | virtual ~CheckButton (); 48 | 49 | virtual Size GetPreferredSize () const override; 50 | 51 | protected: 52 | 53 | virtual Response Draw (AbstractWindow* context) final; 54 | 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /include/blendint/gui/check-icon.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief Icon used in CheckButton 33 | * 34 | * @ingroup blendint_gui_forms 35 | */ 36 | class CheckIcon: public AbstractIcon 37 | { 38 | public: 39 | 40 | CheckIcon (); 41 | 42 | virtual ~CheckIcon (); 43 | 44 | virtual void Draw (int x, 45 | int y, 46 | const float* color_ptr = Color(Palette::Black).data(), 47 | short gamma = 0, 48 | float rotate = 0.f, 49 | float scale_x = 1.f, 50 | float scale_y = 1.f) const final; 51 | 52 | virtual void DrawInRect (const Rect& rect, int align, const float* color_ptr = 53 | Color(Palette::Black).data(), 54 | short gamma = 0, float rotate = 0.f, bool scale = 55 | false) const final; 56 | 57 | protected: 58 | 59 | virtual void PerformSizeUpdate (int width, int height) final; 60 | 61 | virtual void PerformRoundTypeUpdate (int type) final; 62 | 63 | virtual void PerformRoundRadiusUpdate (float radius) final; 64 | 65 | private: 66 | 67 | GLuint vao_[2]; 68 | GLBuffer vbo_; 69 | 70 | }; 71 | 72 | } 73 | -------------------------------------------------------------------------------- /include/blendint/gui/clock.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_GUI_CLOCK_HPP_ 25 | #define _BLENDINT_GUI_CLOCK_HPP_ 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | namespace BlendInt { 34 | 35 | /** 36 | * @brief A widget to show a clock 37 | * 38 | * This widget is used for demo or timer testing. 39 | */ 40 | class Clock: public AbstractRoundWidget 41 | { 42 | DISALLOW_COPY_AND_ASSIGN(Clock); 43 | 44 | public: 45 | 46 | Clock(); 47 | 48 | virtual ~Clock(); 49 | 50 | void Start (); 51 | 52 | void Stop (); 53 | 54 | void set_background (const Color& color) 55 | { 56 | background_ = color; 57 | } 58 | 59 | virtual Size GetPreferredSize () const; 60 | 61 | protected: 62 | 63 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 64 | 65 | virtual Response Draw (AbstractWindow* context); 66 | 67 | void GenerateClockVertices (int radius, float border, 68 | std::vector& inner_vertices, 69 | std::vector& outer_vertices); 70 | 71 | private: 72 | 73 | void OnUpdateClockHands(); 74 | 75 | void InitializeClock (); 76 | 77 | // 0 - inner 78 | // 1 - outer 79 | // 2 - second hand 80 | GLuint vao_[3]; 81 | 82 | GLBuffer buffer_; 83 | 84 | int angle_; 85 | 86 | RefPtr timer_; 87 | 88 | Color background_; 89 | }; 90 | 91 | } 92 | 93 | #endif /* _BLENDINT_GUI_CLOCK_HPP_ */ 94 | -------------------------------------------------------------------------------- /include/blendint/gui/close-button.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief The most common button class 33 | * 34 | * @ingroup blendint_gui_widgets_buttons 35 | */ 36 | class CloseButton: public AbstractButton 37 | { 38 | DISALLOW_COPY_AND_ASSIGN(CloseButton); 39 | 40 | public: 41 | 42 | CloseButton (); 43 | 44 | virtual ~CloseButton (); 45 | 46 | virtual Size GetPreferredSize () const; 47 | 48 | protected: 49 | 50 | virtual void PerformSizeUpdate (const AbstractView* source, 51 | const AbstractView* target, 52 | int width, 53 | int height); 54 | 55 | virtual void PerformRoundTypeUpdate (int round_type); 56 | 57 | virtual void PerformRoundRadiusUpdate (float radius); 58 | 59 | virtual Response Draw (AbstractWindow* context); 60 | 61 | private: 62 | 63 | void InitializeCloseButtonOnce (); 64 | 65 | GLuint vao_[2]; 66 | 67 | GLBuffer buffer_; 68 | 69 | }; 70 | 71 | } 72 | -------------------------------------------------------------------------------- /include/blendint/gui/color-button.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | namespace BlendInt { 34 | 35 | /** 36 | * @brief The most common button class 37 | * 38 | * @ingroup blendint_gui_widgets_buttons 39 | */ 40 | class ColorButton: public AbstractButton 41 | { 42 | DISALLOW_COPY_AND_ASSIGN(ColorButton); 43 | 44 | public: 45 | 46 | ColorButton (); 47 | 48 | virtual ~ColorButton (); 49 | 50 | void SetColor (const Color& color); 51 | 52 | virtual bool IsExpandX () const override; 53 | 54 | virtual Size GetPreferredSize () const override; 55 | 56 | protected: 57 | 58 | virtual void PerformSizeUpdate (const AbstractView* source, 59 | const AbstractView* target, 60 | int width, 61 | int height) final; 62 | 63 | virtual void PerformRoundTypeUpdate (int round_type) final; 64 | 65 | virtual void PerformRoundRadiusUpdate (float radius) final; 66 | 67 | virtual void PerformHoverIn (AbstractWindow* context) final; 68 | 69 | virtual void PerformHoverOut (AbstractWindow* context) final; 70 | 71 | virtual Response Draw (AbstractWindow* context) final; 72 | 73 | private: 74 | 75 | void InitializeColorButton (); 76 | 77 | void OnClick (); 78 | 79 | void OnSelectorDestroyed (AbstractFrame* sender); 80 | 81 | GLuint vao_[2]; 82 | 83 | GLBuffer vbo_; 84 | 85 | Color color0_; 86 | Color color1_; 87 | 88 | ColorSelector* selector_; 89 | }; 90 | 91 | } 92 | -------------------------------------------------------------------------------- /include/blendint/gui/color-wheel.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | namespace BlendInt { 32 | 33 | class ColorWheel: public AbstractWidget 34 | { 35 | DISALLOW_COPY_AND_ASSIGN(ColorWheel); 36 | 37 | public: 38 | 39 | ColorWheel (); 40 | 41 | virtual ~ColorWheel (); 42 | 43 | virtual bool Contain (const Point& point) const; 44 | 45 | virtual bool IsExpandX () const; 46 | 47 | virtual bool IsExpandY () const; 48 | 49 | virtual Size GetPreferredSize () const; 50 | 51 | protected: 52 | 53 | virtual void PerformSizeUpdate (const AbstractView* source, 54 | const AbstractView* target, 55 | int width, 56 | int height); 57 | 58 | virtual Response Draw (AbstractWindow* context); 59 | 60 | void GenerateWheelVertices (int radius, 61 | std::vector& inner_vertices, 62 | std::vector& outer_vertices); 63 | 64 | private: 65 | 66 | void InitializeColorWheel (); 67 | 68 | GLuint vaos_[2]; 69 | 70 | RefPtr outer_; 71 | RefPtr inner_; 72 | 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /include/blendint/gui/cube.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | class Cube: public AbstractPrimitive 33 | { 34 | public: 35 | 36 | Cube (); 37 | 38 | virtual ~Cube (); 39 | 40 | virtual void Render (const glm::mat4& projection_matrix, 41 | const glm::mat4& view_matrix); 42 | 43 | private: 44 | 45 | void InitializeCube (); 46 | 47 | GLuint m_vao; 48 | 49 | GLuint m_vbo_cube_vertices; 50 | GLuint m_vbo_cube_colors; 51 | GLuint m_ibo_cube_elements; 52 | 53 | glm::mat4 mvp; 54 | }; 55 | 56 | } 57 | -------------------------------------------------------------------------------- /include/blendint/gui/curve-edit.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | /* 33 | * Currently for debuging shader 34 | */ 35 | 36 | /** 37 | * @brief A widget to show and edit curve 38 | * 39 | */ 40 | class CurveEdit: public AbstractWidget 41 | { 42 | public: 43 | 44 | CurveEdit (); 45 | 46 | virtual ~CurveEdit (); 47 | 48 | virtual Size GetPreferredSize () const; 49 | 50 | virtual bool IsExpandX () const; 51 | 52 | virtual bool IsExpandY () const; 53 | 54 | protected: 55 | 56 | virtual void PerformSizeUpdate (const AbstractView* source, 57 | const AbstractView* target, 58 | int width, 59 | int height); 60 | 61 | virtual Response Draw (AbstractWindow* context); 62 | 63 | private: 64 | 65 | GLuint vao_[2]; 66 | 67 | GLBuffer vbo_; 68 | 69 | }; 70 | 71 | } 72 | -------------------------------------------------------------------------------- /include/blendint/gui/dot-icon.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief Dot icon used in ColorWheel or BrightnessSlider 33 | * 34 | * @ingroup blendint_gui_forms 35 | */ 36 | class DotIcon: public AbstractIcon 37 | { 38 | public: 39 | 40 | /** 41 | * @brief Default constructor 42 | */ 43 | DotIcon (); 44 | 45 | /** 46 | * @brief Constructor 47 | */ 48 | virtual ~DotIcon (); 49 | 50 | virtual void Draw (int x, 51 | int y, 52 | const float* color_ptr = Color(Palette::White).data(), 53 | short gamma = 0, 54 | float rotate = 0.f, 55 | float scale_x = 1.f, 56 | float scale_y = 1.f) const final; 57 | 58 | virtual void DrawInRect (const Rect& rect, int align, const float* color_ptr = 59 | Color(Palette::Black).data(), 60 | short gamma = 0, float rotate = 0.f, bool scale = 61 | false) const final; 62 | 63 | protected: 64 | 65 | virtual void PerformSizeUpdate (int width, int height); 66 | 67 | virtual void PerformRoundTypeUpdate (int type); 68 | 69 | virtual void PerformRoundRadiusUpdate (float radius); 70 | 71 | private: 72 | 73 | GLuint vao_[2]; 74 | GLBuffer vbo_; 75 | }; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /include/blendint/gui/end-point-icon.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief Icon used in node 33 | * 34 | * @ingroup blendint_gui_forms 35 | */ 36 | class EndPointIcon: public AbstractIcon 37 | { 38 | public: 39 | 40 | EndPointIcon (); 41 | 42 | virtual ~EndPointIcon (); 43 | 44 | virtual void Draw (int x, 45 | int y, 46 | const float* color_ptr = Color(Palette::Black).data(), 47 | short gamma = 0, 48 | float rotate = 0.f, 49 | float scale_x = 1.f, 50 | float scale_y = 1.f) const final; 51 | 52 | virtual void DrawInRect (const Rect& rect, int align, const float* color_ptr = 53 | Color(Palette::Black).data(), 54 | short gamma = 0, float rotate = 0.f, bool scale = 55 | false) const final; 56 | 57 | protected: 58 | 59 | virtual void PerformSizeUpdate (int width, int height); 60 | 61 | private: 62 | 63 | GLuint vao_[2]; 64 | 65 | GLBuffer vbo_; 66 | 67 | }; 68 | 69 | } 70 | -------------------------------------------------------------------------------- /include/blendint/gui/end-point.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | namespace BlendInt { 34 | 35 | /** 36 | * @brief The end point of node 37 | * 38 | * @ingroup blendint_gui_nodes 39 | */ 40 | class EndPoint: public Object 41 | { 42 | 43 | public: 44 | 45 | EndPoint (); 46 | 47 | virtual EndPoint (); 48 | 49 | void Draw (); 50 | 51 | private: 52 | 53 | AbstractNode* node_; 54 | 55 | EndPoint* upstream_; 56 | 57 | EndPoint* downstream_; 58 | 59 | EndPoint* previous_; 60 | 61 | EndPoint* next_; 62 | 63 | Point position_; 64 | 65 | Color color_; 66 | 67 | static Size kSize; 68 | 69 | }; 70 | 71 | } 72 | -------------------------------------------------------------------------------- /include/blendint/gui/filebutton.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class AbstractFrame; 31 | class AbstractDialog; 32 | class FileSelector; 33 | 34 | /** 35 | * @brief A button used to call FileSelector 36 | * 37 | * @ingroup blendint_gui_widgets_buttons 38 | */ 39 | class FileButton: public AbstractButton 40 | { 41 | DISALLOW_COPY_AND_ASSIGN(FileButton); 42 | 43 | public: 44 | 45 | FileButton (); 46 | 47 | virtual ~FileButton (); 48 | 49 | const String& file () const 50 | { 51 | return file_; 52 | } 53 | 54 | CppEvent::EventRef<> file_selected() {return file_selected_;} 55 | 56 | virtual Size GetPreferredSize () const; 57 | 58 | protected: 59 | 60 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 61 | 62 | virtual void PerformRoundTypeUpdate (int round_type); 63 | 64 | virtual void PerformRoundRadiusUpdate (float radius); 65 | 66 | virtual Response Draw (AbstractWindow* context); 67 | 68 | private: 69 | 70 | void InitializeFileButtonOnce (); 71 | 72 | void OnClicked(); 73 | 74 | void OnOpened (AbstractDialog* dialog); 75 | 76 | void OnDialogDestroyed (AbstractFrame* dialog); 77 | 78 | GLuint vao_[2]; 79 | 80 | GLBuffer vbo_; 81 | 82 | FileSelector* dialog_; 83 | 84 | String file_; 85 | 86 | CppEvent::Event<> file_selected_; 87 | }; 88 | 89 | } 90 | -------------------------------------------------------------------------------- /include/blendint/gui/flow-layout.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class FlowLayout: public AbstractLayout 31 | { 32 | public: 33 | 34 | FlowLayout (); 35 | 36 | FlowLayout (int width, 37 | int height, 38 | const Margin& margin, 39 | int space, 40 | int align); 41 | 42 | virtual ~FlowLayout (); 43 | 44 | virtual AbstractWidget* AddWidget (AbstractWidget* widget); 45 | 46 | virtual AbstractWidget* InsertWidget (int index, AbstractWidget* widget); 47 | 48 | virtual AbstractWidget* InsertWidget (int row, 49 | int column, 50 | AbstractWidget* widget); 51 | 52 | virtual void Adjust (); 53 | 54 | virtual bool SizeUpdateTest (const AbstractView* source, 55 | const AbstractView* target, 56 | int width, 57 | int height) const; 58 | 59 | virtual bool PositionUpdateTest (const AbstractView* source, 60 | const AbstractView* target, 61 | int x, 62 | int y) const; 63 | 64 | private: 65 | 66 | int space_; 67 | 68 | int align_; 69 | 70 | }; 71 | 72 | } 73 | -------------------------------------------------------------------------------- /include/blendint/gui/folder-list.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_GUI_FOLDERLIST_HPP_ 25 | #define _BLENDINT_GUI_FOLDERLIST_HPP_ 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | namespace BlendInt { 33 | 34 | /** 35 | * @brief A simple widget to display and edit folders in FileSelector 36 | */ 37 | class FolderList: public AbstractRoundWidget 38 | { 39 | DISALLOW_COPY_AND_ASSIGN(FolderList); 40 | 41 | public: 42 | 43 | FolderList(); 44 | 45 | virtual ~FolderList (); 46 | 47 | virtual Size GetPreferredSize () const; 48 | 49 | protected: 50 | 51 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 52 | 53 | virtual void PerformRoundTypeUpdate (int round_type); 54 | 55 | virtual void PerformRoundRadiusUpdate (float radius); 56 | 57 | virtual Response Draw (AbstractWindow* context); 58 | 59 | private: 60 | 61 | void InitializeFolderListOnce (); 62 | 63 | GLuint vao_[2]; 64 | GLBuffer vbo_; 65 | 66 | RefPtr text_; 67 | 68 | }; 69 | } 70 | 71 | 72 | #endif /* _BLENDINT_GUI_FOLDERLIST_HPP_ */ 73 | -------------------------------------------------------------------------------- /include/blendint/gui/font-model.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_GUI_FONTMODEL_HPP_ 25 | #define _BLENDINT_GUI_FONTMODEL_HPP_ 26 | 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief A data model to manage local font files 33 | */ 34 | class FontModel: public AbstractItemModel 35 | { 36 | public: 37 | 38 | FontModel (); 39 | 40 | virtual ~FontModel (); 41 | 42 | }; 43 | 44 | } 45 | 46 | #endif /* _BLENDINT_GUI_FONTMODEL_HPP_ */ 47 | -------------------------------------------------------------------------------- /include/blendint/gui/font-selector.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | /** 31 | * @brief A dialog to select and show fonts 32 | * 33 | * @ingroup blendint_gui_frames 34 | */ 35 | class FontSelector: public AbstractDialog 36 | { 37 | public: 38 | 39 | FontSelector (); 40 | 41 | virtual ~FontSelector (); 42 | 43 | private: 44 | 45 | }; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /include/blendint/gui/frame-shadow.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | 30 | #include 31 | 32 | namespace BlendInt { 33 | 34 | /** 35 | * @brief Soft shadow for frames 36 | * 37 | * @ingroup blendint_gui_frames 38 | */ 39 | class FrameShadow: public AbstractShadow 40 | { 41 | 42 | public: 43 | 44 | FrameShadow (const Size& size = Size(100, 100), 45 | int round_type = RoundNone, 46 | float round_radius = 5.f); 47 | 48 | virtual ~FrameShadow (); 49 | 50 | virtual void Draw (int x, 51 | int y, 52 | const float* color_ptr = Color(Palette::Black).data(), 53 | short gamma = 0, 54 | float rotate = 0.f, 55 | float scale_x = 1.f, 56 | float scale_y = 1.f) const; 57 | 58 | protected: 59 | 60 | virtual void PerformSizeUpdate (int width, int height); 61 | 62 | virtual void PerformRoundTypeUpdate (int type); 63 | 64 | virtual void PerformRoundRadiusUpdate (float radius); 65 | 66 | private: 67 | 68 | void InitializeFrameShadowOnce (); 69 | 70 | GLuint vao_; 71 | 72 | GLBuffer vertex_buffer_; 73 | 74 | GLBuffer element_buffer_; 75 | 76 | }; 77 | 78 | } 79 | -------------------------------------------------------------------------------- /include/blendint/gui/free-camera.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_FREECAMERA_HPP_ 25 | #define _BLENDINT_FREECAMERA_HPP_ 26 | 27 | #include 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | class FreeCamera: public AbstractCamera 33 | { 34 | public: 35 | 36 | FreeCamera (); 37 | 38 | virtual ~FreeCamera (); 39 | 40 | virtual void Update (); 41 | 42 | private: 43 | 44 | }; 45 | 46 | } 47 | 48 | #endif /* _BLENDINT_FREECAMERA_HPP_ */ 49 | -------------------------------------------------------------------------------- /include/blendint/gui/glyph.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | namespace BlendInt { 27 | 28 | struct Glyph 29 | { 30 | Glyph () 31 | : bitmap_width(0), 32 | bitmap_height(0), 33 | bitmap_left(0), 34 | bitmap_top(0), 35 | advance_x(0), 36 | advance_y(0), 37 | offset_u(0), 38 | offset_v(0) 39 | { 40 | } 41 | 42 | Glyph (const Glyph& orig) 43 | : bitmap_width(orig.bitmap_width), 44 | bitmap_height(orig.bitmap_height), 45 | bitmap_left(orig.bitmap_left), 46 | bitmap_top(orig.bitmap_top), 47 | advance_x(orig.advance_x), 48 | advance_y(orig.advance_y), 49 | offset_u(orig.offset_u), 50 | offset_v(orig.offset_v) 51 | { 52 | } 53 | 54 | Glyph& operator = (const Glyph& orig) 55 | { 56 | bitmap_width = orig.bitmap_width; 57 | bitmap_height = orig.bitmap_height; 58 | bitmap_left = orig.bitmap_left; 59 | bitmap_top = orig.bitmap_top; 60 | 61 | advance_x = orig.advance_x; 62 | advance_y = orig.advance_y; 63 | 64 | offset_u = orig.offset_u; 65 | offset_v = orig.offset_v; 66 | 67 | return *this; 68 | } 69 | 70 | int bitmap_width; 71 | int bitmap_height; 72 | 73 | int bitmap_left; 74 | int bitmap_top; 75 | 76 | int advance_x; 77 | int advance_y; 78 | 79 | int offset_u; 80 | int offset_v; 81 | }; 82 | 83 | } /* namespace BlendInt */ 84 | -------------------------------------------------------------------------------- /include/blendint/gui/grid-floor.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | namespace BlendInt { 33 | 34 | class GridFloor: public AbstractPrimitive 35 | { 36 | public: 37 | 38 | GridFloor (); 39 | 40 | virtual ~GridFloor (); 41 | 42 | void SetLines (int lines); 43 | 44 | void SetScale (float scale); 45 | 46 | void SetAxis (const char* str); 47 | 48 | virtual void Render (const glm::mat4& projection_matrix, 49 | const glm::mat4& view_matrix); 50 | 51 | private: 52 | 53 | void InitializeGrid (); 54 | 55 | void GenerateGripFloorVertices (std::vector& vertices); 56 | 57 | /** 58 | * @brief Vertex array objects 59 | * 60 | * - 0: grid 61 | * - 1: x axis 62 | * - 2: y axis 63 | * - 3: z axis 64 | */ 65 | GLuint vaos_[4]; 66 | 67 | int lines_; 68 | float scale_; 69 | 70 | int subdivisions_; // default is 10 71 | 72 | RefPtr buffer_; 73 | 74 | RefPtr axis_x_; 75 | RefPtr axis_y_; 76 | RefPtr axis_z_; 77 | }; 78 | 79 | } 80 | -------------------------------------------------------------------------------- /include/blendint/gui/grid-guides.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | namespace BlendInt { 32 | 33 | /** 34 | * @brief Grid guides for NodeView 35 | */ 36 | class GridGuides: public AbstractForm 37 | { 38 | public: 39 | 40 | GridGuides (int width, int height); 41 | 42 | virtual ~GridGuides (); 43 | 44 | virtual void Draw (int x, // x coord 45 | int y, // y coord 46 | const float* color_ptr = Color(Palette::White).data(), // color 47 | short gamma = 0, 48 | float rotate = 0.f, 49 | float scale_x = 1.f, 50 | float scale_y = 1.f) const; 51 | 52 | virtual void DrawInRect (const Rect& rect, // rectangel to draw 53 | int align, // alignment 54 | const float* color_ptr = 55 | Color(Palette::White).data(), // color 56 | short gamma = 0, // gamma 57 | float rotate = 0.f, // rotate 58 | bool scale = false // scale 59 | ) const; 60 | 61 | protected: 62 | 63 | virtual void PerformSizeUpdate (int width, int height); 64 | 65 | private: 66 | 67 | GLuint vao_; 68 | 69 | GLBuffer vbo_; 70 | 71 | RefPtr texture_; 72 | 73 | static const int kUnit = 100; 74 | 75 | static const int kDivision = 5; 76 | 77 | }; 78 | 79 | } // namespace BlendInt 80 | -------------------------------------------------------------------------------- /include/blendint/gui/menu-button.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief A special button used in MenuBar only 33 | * 34 | * @ingroup blendint_gui_widgets_buttons 35 | */ 36 | class MenuButton: public AbstractButton 37 | { 38 | public: 39 | 40 | MenuButton (const String& text); 41 | 42 | virtual ~MenuButton (); 43 | 44 | protected: 45 | 46 | virtual void PerformSizeUpdate (const AbstractView* source, 47 | const AbstractView* target, 48 | int width, 49 | int height); 50 | 51 | virtual void PerformRoundTypeUpdate (int round_type); 52 | 53 | virtual void PerformRoundRadiusUpdate (float radius); 54 | 55 | virtual void PerformHoverIn (AbstractWindow* context); 56 | 57 | virtual void PerformHoverOut (AbstractWindow* context); 58 | 59 | virtual Response Draw (AbstractWindow* context); 60 | 61 | private: 62 | 63 | void InitializeMenuButton (); 64 | 65 | GLuint vao_; 66 | 67 | GLBuffer<> vbo_; 68 | 69 | bool hover_; 70 | }; 71 | 72 | } /* namespace BlendInt */ 73 | -------------------------------------------------------------------------------- /include/blendint/gui/menu-item-separator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MenuItemSeparator.hpp 3 | * 4 | * Created on: 2014年12月29日 5 | * Author: zhanggyb 6 | */ 7 | 8 | #ifndef _BLENDINT_GUI_MENUITEMSEPARATOR_HPP_ 9 | #define _BLENDINT_GUI_MENUITEMSEPARATOR_HPP_ 10 | 11 | #include 12 | 13 | 14 | 15 | #endif /* _BLENDINT_GUI_MENUITEMSEPARATOR_HPP_ */ 16 | -------------------------------------------------------------------------------- /include/blendint/gui/menu-item.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | namespace BlendInt { 32 | 33 | class MenuItem: public AbstractMenuItem 34 | { 35 | public: 36 | 37 | MenuItem (const String& text); 38 | 39 | MenuItem (const RefPtr& action); 40 | 41 | MenuItem (const String& text, const String& shortcut); 42 | 43 | MenuItem (const RefPtr& icon, const String& text); 44 | 45 | MenuItem (const RefPtr& icon, const String& text, const String& shortcut); 46 | 47 | virtual ~MenuItem(); 48 | 49 | virtual bool IsExpandX () const; 50 | 51 | virtual Size GetPreferredSize () const; 52 | 53 | protected: 54 | 55 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 56 | 57 | virtual void PerformHoverIn (AbstractWindow* context); 58 | 59 | virtual void PerformHoverOut (AbstractWindow* context); 60 | 61 | virtual Response Draw (AbstractWindow* context); 62 | 63 | private: 64 | 65 | void InitializeMenuItem (); 66 | 67 | GLuint vao_; 68 | 69 | GLBuffer<> vbo_; 70 | 71 | bool hovered_; 72 | 73 | RefPtr action_; 74 | 75 | static Margin kPadding; 76 | 77 | static int kSpace; // space between icon and text, or text and shortcut 78 | 79 | }; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /include/blendint/gui/mesh.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | namespace BlendInt { 35 | 36 | class Mesh: public AbstractPrimitive 37 | { 38 | public: 39 | 40 | Mesh (); 41 | 42 | virtual ~Mesh (); 43 | 44 | bool Load (const char* filename); 45 | 46 | virtual void Render (const glm::mat4& projection_matrix, 47 | const glm::mat4& view_matrix); 48 | 49 | static bool LoadObj (const char* filename, 50 | std::vector& vertices, 51 | std::vector& normals, 52 | std::vector& elements); 53 | 54 | private: 55 | 56 | void InitializeMesh (); 57 | 58 | GLuint vao_; 59 | 60 | RefPtr vertex_buffer_; 61 | RefPtr normal_buffer_; 62 | 63 | RefPtr index_buffer_; 64 | 65 | RefPtr program_; 66 | 67 | glm::mat4 model_matrix_; 68 | 69 | static const char* vertex_shader; 70 | static const char* fragment_shader; 71 | }; 72 | 73 | } 74 | -------------------------------------------------------------------------------- /include/blendint/gui/message-box.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | // forward declare 33 | class Font; 34 | class Label; 35 | class CloseButton; 36 | 37 | /** 38 | * @brief A message dialog 39 | * 40 | * @ingroup blendint_gui_frames 41 | */ 42 | class MessageBox: public AbstractDialog 43 | { 44 | public: 45 | 46 | MessageBox (const String& title, const String& description); 47 | 48 | virtual ~MessageBox (); 49 | 50 | void SetTitleFont (const Font& font); 51 | 52 | void SetTextFont (const Font& font); 53 | 54 | protected: 55 | 56 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 57 | 58 | virtual bool PreDraw (AbstractWindow* context); 59 | 60 | virtual Response Draw (AbstractWindow* context); 61 | 62 | private: 63 | 64 | void OnClose (); 65 | 66 | GLuint vao_[2]; 67 | 68 | GLBuffer vbo_; 69 | 70 | RefPtr shadow_; 71 | 72 | Label* title_; 73 | 74 | Label* text_; 75 | 76 | CloseButton* close_; 77 | 78 | glm::mat4 projection_matrix_; 79 | 80 | glm::mat3 model_matrix_; 81 | 82 | }; 83 | 84 | } 85 | -------------------------------------------------------------------------------- /include/blendint/gui/model-viewport.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | namespace BlendInt { 32 | 33 | /** 34 | * @brief A simple 3D viewport for demo and test only 35 | * 36 | * @ingroup blendint_gui_frames 37 | */ 38 | class ModelViewport: public AbstractViewport 39 | { 40 | DISALLOW_COPY_AND_ASSIGN(ModelViewport); 41 | 42 | public: 43 | 44 | ModelViewport (); 45 | 46 | virtual ~ModelViewport (); 47 | 48 | virtual Size GetPreferredSize () const; 49 | 50 | bool LoadPrimitive (const RefPtr& primitive); 51 | 52 | protected: 53 | 54 | virtual void PostPositionUpdate (); 55 | 56 | virtual void PostSizeUpdate (); 57 | 58 | virtual void RenderScene (); 59 | 60 | private: 61 | 62 | RefPtr gridfloor_; 63 | 64 | RefPtr default_camera_; 65 | 66 | RefPtr primitive_; 67 | 68 | glm::mat4 projection_matrix_; 69 | 70 | glm::mat3 model_matrix_; 71 | }; 72 | 73 | } 74 | -------------------------------------------------------------------------------- /include/blendint/gui/node-set.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | namespace BlendInt { 27 | 28 | /** 29 | * @brief A special node which contains sub nodes only 30 | * 31 | * @ingroup blendint_gui_nodes 32 | */ 33 | class NodeSet: public AbstractNode 34 | { 35 | public: 36 | 37 | NodeSet () 38 | { 39 | 40 | } 41 | 42 | virtual ~NodeSet () 43 | { 44 | 45 | } 46 | 47 | }; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /include/blendint/gui/node.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | namespace BlendInt { 33 | 34 | class String; 35 | 36 | /** 37 | * @brief A special view used to display and manage a node in NodeView 38 | * 39 | * ColorScheme name in theme: "node" 40 | * 41 | * @ingroup blendint_gui_nodes 42 | */ 43 | class Node: public AbstractNode 44 | { 45 | public: 46 | 47 | Node (const String& title); 48 | 49 | virtual ~Node (); 50 | 51 | bool AddWidget (AbstractWidget* widget); 52 | 53 | bool InsertWidget (int index, AbstractWidget* widget); 54 | 55 | virtual bool IsExpandX () const; 56 | 57 | virtual bool IsExpandY () const; 58 | 59 | virtual Size GetPreferredSize () const; 60 | 61 | void SetInnerColor (unsigned int color); 62 | 63 | void SetOuterColor (unsigned int color); 64 | 65 | protected: 66 | 67 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 68 | 69 | virtual void PerformRoundTypeUpdate (int round_type); 70 | 71 | virtual void PerformRoundRadiusUpdate (float radius); 72 | 73 | virtual Response Draw (AbstractWindow* context); 74 | 75 | private: 76 | 77 | /** 78 | * 0: inner 79 | * 1: outer 80 | * 2: header 81 | */ 82 | GLuint vao_[3]; 83 | 84 | GLBuffer vbo_; 85 | 86 | LinearLayout* main_layout_; 87 | 88 | LinearLayout* layout_; 89 | 90 | RefPtr shadow_; 91 | 92 | }; 93 | 94 | } 95 | -------------------------------------------------------------------------------- /include/blendint/gui/ortho-camera.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class OrthoCamera: public AbstractCamera 31 | { 32 | 33 | public: 34 | 35 | OrthoCamera (); 36 | 37 | virtual ~OrthoCamera (); 38 | 39 | void SetOrtho (float left, 40 | float right, 41 | float bottom, 42 | float top, 43 | float near = 100.f, 44 | float far = -100.f); 45 | 46 | float near () const 47 | { 48 | return near_; 49 | } 50 | 51 | float far () const 52 | { 53 | return far_; 54 | } 55 | 56 | protected: 57 | 58 | void set_near (float near) 59 | { 60 | near_ = near; 61 | } 62 | 63 | void set_far (float far) 64 | { 65 | far_ = far; 66 | } 67 | 68 | private: 69 | 70 | float left_; 71 | 72 | float right_; 73 | 74 | float bottom_; 75 | 76 | float top_; 77 | 78 | float near_; 79 | 80 | float far_; 81 | 82 | }; 83 | 84 | } 85 | -------------------------------------------------------------------------------- /include/blendint/gui/panel.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | /** 33 | * @brief A widget usually contains other Form or widget in a box with padding 34 | * 35 | * @ingroup blendint_gui_widgets 36 | */ 37 | class Panel: public AbstractRoundWidget 38 | { 39 | DISALLOW_COPY_AND_ASSIGN(Panel); 40 | 41 | public: 42 | 43 | Panel (AbstractLayout* layout); 44 | 45 | virtual ~Panel (); 46 | 47 | void AddWidget (AbstractWidget* widget); 48 | 49 | void InsertWidget (int index, AbstractWidget* widget); 50 | 51 | virtual bool IsExpandX () const; 52 | 53 | virtual bool IsExpandY () const; 54 | 55 | virtual Size GetPreferredSize () const; 56 | 57 | protected: 58 | 59 | virtual void PerformSizeUpdate (const AbstractView* source, 60 | const AbstractView* target, 61 | int width, 62 | int height); 63 | 64 | virtual void PerformRoundTypeUpdate (int round_type); 65 | 66 | virtual void PerformRoundRadiusUpdate (float radius); 67 | 68 | virtual Response Draw (AbstractWindow* context); 69 | 70 | virtual AbstractView* RemoveSubView (AbstractView* view); 71 | 72 | private: 73 | 74 | void InitializePanelOnce (); 75 | 76 | AbstractLayout* layout_; 77 | 78 | GLuint vao_[2]; 79 | 80 | GLBuffer vbo_; 81 | 82 | RefPtr view_buffer_; 83 | 84 | }; 85 | 86 | } /* namespace BlendInt */ 87 | -------------------------------------------------------------------------------- /include/blendint/gui/progress-bar.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_GUI_PROGRESSBAR_HPP_ 25 | #define _BLENDINT_GUI_PROGRESSBAR_HPP_ 26 | 27 | #include 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | class ProgressBar: public AbstractRoundWidget 33 | { 34 | DISALLOW_COPY_AND_ASSIGN(ProgressBar); 35 | 36 | public: 37 | 38 | ProgressBar (Orientation orientation = Horizontal); 39 | 40 | virtual ~ProgressBar (); 41 | 42 | virtual bool IsExpandX () const; 43 | 44 | virtual bool IsExpandY () const; 45 | 46 | virtual Size GetPreferredSize () const; 47 | 48 | protected: 49 | 50 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 51 | 52 | virtual void PerformRoundTypeUpdate (int round_type); 53 | 54 | virtual void PerformRoundRadiusUpdate (float radius); 55 | 56 | virtual Response Draw (AbstractWindow* context); 57 | 58 | private: 59 | 60 | void InitializeProgressBar (); 61 | 62 | GLuint vao_[2]; 63 | 64 | GLBuffer vbo_; 65 | 66 | Orientation orientation_; 67 | }; 68 | 69 | } 70 | 71 | 72 | #endif /* _BLENDINT_GUI_PROGRESSBAR_HPP_ */ 73 | -------------------------------------------------------------------------------- /include/blendint/gui/push-button.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief The most common button class 33 | * 34 | * @ingroup blendint_gui_widgets_buttons 35 | */ 36 | class PushButton: public AbstractButton 37 | { 38 | DISALLOW_COPY_AND_ASSIGN(PushButton); 39 | 40 | public: 41 | 42 | PushButton (); 43 | 44 | PushButton (const String& text); 45 | 46 | PushButton (const RefPtr& icon); 47 | 48 | PushButton (const RefPtr& icon, const String& text); 49 | 50 | virtual ~PushButton (); 51 | 52 | virtual Size GetPreferredSize () const; 53 | 54 | void SetText (const String& text); 55 | 56 | void SetIcon (const RefPtr& icon); 57 | 58 | protected: 59 | 60 | virtual void PerformSizeUpdate (const AbstractView* source, 61 | const AbstractView* target, 62 | int width, 63 | int height) final; 64 | 65 | virtual void PerformRoundTypeUpdate (int round_type) final; 66 | 67 | virtual void PerformRoundRadiusUpdate (float radius) final; 68 | 69 | virtual void PerformHoverIn (AbstractWindow* context) final; 70 | 71 | virtual void PerformHoverOut (AbstractWindow* context) final; 72 | 73 | virtual Response Draw (AbstractWindow* context) final; 74 | 75 | private: 76 | 77 | void InitializeButtonOnce (); 78 | 79 | GLuint vao_[2]; 80 | 81 | GLBuffer vbo_; 82 | 83 | }; 84 | 85 | } 86 | -------------------------------------------------------------------------------- /include/blendint/gui/radio-button.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief Radio button 33 | * 34 | * @ingroup blendint_gui_widgets_buttons 35 | */ 36 | class RadioButton: public AbstractButton 37 | { 38 | DISALLOW_COPY_AND_ASSIGN(RadioButton); 39 | 40 | public: 41 | 42 | RadioButton (); 43 | 44 | RadioButton (const String& test); 45 | 46 | RadioButton (const RefPtr& icon); 47 | 48 | RadioButton (const RefPtr& icon, const String& text); 49 | 50 | virtual ~RadioButton (); 51 | 52 | protected: 53 | 54 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height) final; 55 | 56 | virtual void PerformRoundTypeUpdate (int round_type) final; 57 | 58 | virtual void PerformRoundRadiusUpdate (float radius) final; 59 | 60 | virtual Response Draw (AbstractWindow* context) final; 61 | 62 | private: 63 | 64 | void InitializeRadioButtonOnce (); 65 | 66 | GLuint vao_[2]; 67 | 68 | GLBuffer vbo_; 69 | 70 | }; 71 | } 72 | -------------------------------------------------------------------------------- /include/blendint/gui/scroll-area.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | class Margin; 32 | class AbstractScrollable; 33 | class TableLayout; 34 | 35 | class ScrollArea: public AbstractWidget 36 | { 37 | DISALLOW_COPY_AND_ASSIGN(ScrollArea); 38 | 39 | public: 40 | 41 | ScrollArea (); 42 | 43 | ScrollArea (int width, int height, const Margin& margin, int space); 44 | 45 | virtual ~ScrollArea (); 46 | 47 | void SetScrollableWidget (AbstractScrollable* scrollable); 48 | 49 | virtual bool IsExpandX () const; 50 | 51 | virtual bool IsExpandY () const; 52 | 53 | virtual Size GetPreferredSize () const; 54 | 55 | protected: 56 | 57 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height) final; 58 | 59 | virtual Response Draw(AbstractWindow* context) final; 60 | 61 | private: 62 | 63 | TableLayout* layout_; 64 | }; 65 | } 66 | -------------------------------------------------------------------------------- /include/blendint/gui/separator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | /** 31 | * @brief A separator widget 32 | * 33 | * @ingroup blendint_gui_widgets 34 | */ 35 | class Separator: public AbstractWidget 36 | { 37 | DISALLOW_COPY_AND_ASSIGN(Separator); 38 | 39 | public: 40 | 41 | Separator (bool expand_x = false, bool expand_y = false); 42 | 43 | virtual ~Separator (); 44 | 45 | void SetExpandX (bool expand); 46 | 47 | void SetExpandY (bool expand); 48 | 49 | void SetExpand (bool expand_x, bool expand_y); 50 | 51 | virtual Size GetPreferredSize () const; 52 | 53 | virtual bool IsExpandX () const; 54 | 55 | virtual bool IsExpandY () const; 56 | 57 | protected: 58 | 59 | virtual Response PerformMousePress (AbstractWindow* context); 60 | 61 | virtual Response PerformMouseRelease (AbstractWindow* context); 62 | 63 | virtual bool PreDraw (AbstractWindow* context); 64 | 65 | virtual Response Draw (AbstractWindow* context); 66 | 67 | virtual void PostDraw (AbstractWindow* context); 68 | 69 | private: 70 | 71 | bool expand_x_; 72 | bool expand_y_; 73 | 74 | Size preferred_size_; 75 | }; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /include/blendint/gui/spinner.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | /** 31 | * @brief A special topmost frame show a spinner animation 32 | * 33 | * @ingroup blendint_gui_frames 34 | */ 35 | class Spinner: public AbstractFrame 36 | { 37 | public: 38 | 39 | Spinner (); 40 | 41 | virtual ~Spinner (); 42 | 43 | void Start (); 44 | 45 | void Stop (); 46 | 47 | private: 48 | 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /include/blendint/gui/stack.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class Stack: public AbstractWidget 31 | { 32 | DISALLOW_COPY_AND_ASSIGN(Stack); 33 | 34 | public: 35 | 36 | Stack (); 37 | 38 | virtual ~Stack (); 39 | 40 | void AddWidget (AbstractWidget* widget); 41 | 42 | void InsertWidget (int index, AbstractWidget* widget); 43 | 44 | void Remove (AbstractWidget* widget); 45 | 46 | int GetIndex () const; 47 | 48 | void SetIndex (int index); 49 | 50 | virtual bool IsExpandX () const override; 51 | 52 | virtual bool IsExpandY () const override; 53 | 54 | virtual Size GetPreferredSize () const override; 55 | 56 | virtual AbstractView* GetFirstSubView () const final; 57 | 58 | virtual AbstractView* GetLastSubView () const final; 59 | 60 | virtual AbstractView* GetNextSubView (const AbstractView* view) const final; 61 | 62 | virtual AbstractView* GetPreviousSubView (const AbstractView* view) const final; 63 | 64 | virtual int GetSubViewCount () const final; 65 | 66 | virtual bool IsSubViewActive (const AbstractView* subview) const final; 67 | 68 | inline AbstractWidget* active_widget () const 69 | { 70 | return active_widget_; 71 | } 72 | 73 | protected: 74 | 75 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height) final; 76 | 77 | virtual Response Draw (AbstractWindow* context) override; 78 | 79 | private: 80 | 81 | AbstractWidget* active_widget_; 82 | 83 | }; 84 | 85 | } 86 | -------------------------------------------------------------------------------- /include/blendint/gui/string-list-model.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class StringListModel: public AbstractListModel 31 | { 32 | public: 33 | 34 | StringListModel (); 35 | 36 | virtual ~StringListModel (); 37 | 38 | void AddString (const String& string); 39 | 40 | void InsertString (int row, const String& string); 41 | 42 | virtual int GetRowCount (const ModelIndex& parent = ModelIndex()) const; 43 | 44 | virtual int GetColumnCount (const ModelIndex& parent = ModelIndex()) const; 45 | 46 | virtual int GetPreferredColumnWidth (int index, const ModelIndex& parent = 47 | ModelIndex()) const override; 48 | 49 | virtual int GetPreferredRowHeight (int index, const ModelIndex& parent = 50 | ModelIndex()) const override; 51 | 52 | #ifdef DEBUG 53 | 54 | void Print (); 55 | 56 | #endif 57 | 58 | protected: 59 | 60 | virtual bool InsertColumns (int column, int count, const ModelIndex& parent = 61 | ModelIndex()); 62 | 63 | virtual bool RemoveColumns (int column, int count, const ModelIndex& parent = 64 | ModelIndex()); 65 | 66 | virtual bool InsertRows (int row, int count, const ModelIndex& parent = 67 | ModelIndex()); 68 | 69 | virtual bool RemoveRows (int row, int count, const ModelIndex& parent = 70 | ModelIndex()); 71 | 72 | private: 73 | 74 | int rows_; 75 | 76 | }; 77 | 78 | } 79 | -------------------------------------------------------------------------------- /include/blendint/gui/tab-button.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | /** 33 | * @brief Tab button 34 | * 35 | * @ingroup blendint_gui_widgets_buttons 36 | */ 37 | class TabButton: public AbstractButton 38 | { 39 | DISALLOW_COPY_AND_ASSIGN(TabButton); 40 | 41 | public: 42 | 43 | TabButton (); 44 | 45 | TabButton (const String& text); 46 | 47 | TabButton (const RefPtr& icon); 48 | 49 | TabButton (const RefPtr& icon, const String& text); 50 | 51 | virtual ~TabButton (); 52 | 53 | protected: 54 | 55 | virtual void PerformSizeUpdate (const AbstractView* source, 56 | const AbstractView* target, 57 | int width, 58 | int height) final; 59 | 60 | virtual void PerformRoundTypeUpdate (int round_type) final; 61 | 62 | virtual void PerformRoundRadiusUpdate (float radius) final; 63 | 64 | virtual Response Draw (AbstractWindow* context) final; 65 | 66 | private: 67 | 68 | void InitializeTabButtonOnce (); 69 | 70 | GLuint vao_[2]; 71 | 72 | GLBuffer vbo_; 73 | 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /include/blendint/gui/tab.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | /** 31 | * @brief Tab 32 | * 33 | * @ingroup blendint_gui_widgets 34 | */ 35 | class Tab: public AbstractWidget 36 | { 37 | DISALLOW_COPY_AND_ASSIGN(Tab); 38 | 39 | public: 40 | 41 | Tab (); 42 | 43 | virtual ~Tab (); 44 | 45 | void AddWidget (const String& title, AbstractWidget* widget); 46 | 47 | virtual bool IsExpandX () const override; 48 | 49 | virtual bool IsExpandY () const override; 50 | 51 | virtual Size GetPreferredSize () const override; 52 | 53 | int GetIndex () const; 54 | 55 | protected: 56 | 57 | virtual void PerformSizeUpdate (const AbstractView* source, 58 | const AbstractView* target, 59 | int width, 60 | int height); 61 | 62 | virtual Response Draw (AbstractWindow* context); 63 | 64 | private: 65 | 66 | void OnButtonToggled (int index, bool toggled); 67 | 68 | void FillSubWidgetsInTab (const Size& out_size); 69 | 70 | void FillSubWidgetsInTab (int x, int y, int w, int h); 71 | }; 72 | 73 | } 74 | -------------------------------------------------------------------------------- /include/blendint/gui/table-adjustment.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | namespace BlendInt { 32 | 33 | class TableAdjustment: public AbstractAdjustment 34 | { 35 | public: 36 | 37 | TableAdjustment (AbstractView* view, unsigned int row, unsigned int column, int space); 38 | 39 | virtual ~TableAdjustment (); 40 | 41 | virtual void Adjust (int x, int y, int w, int h); 42 | 43 | private: 44 | 45 | void Scan (); 46 | 47 | Size GetTotalPreferredSize () const; 48 | 49 | void DistributeHorizontallyWithSmallWidth (int x, int width) const; 50 | 51 | void DistributeHorizontallyWithPreferredWidth (int x, int width) const; 52 | 53 | void DistributeHorizontallyWithLargeWidth (int x, int width) const; 54 | 55 | void DistributeVerticallyWithSmallHeight (int y, int height) const; 56 | 57 | void DistributeVerticallyWithPreferredHeight(int y, int height) const; 58 | 59 | void DistributeVerticallyWithLargeHeight (int y, int height) const; 60 | 61 | unsigned int row_; 62 | 63 | unsigned int column_; 64 | 65 | int space_; 66 | 67 | std::vector column_expand_status_; 68 | std::vector row_expand_status_; 69 | 70 | std::vector column_width_list_; 71 | std::vector row_height_list_; 72 | 73 | int total_fixed_column_width_; 74 | int total_fixed_row_height_; 75 | 76 | int fixed_column_num_; 77 | int fixed_row_num_; 78 | 79 | bool expand_x_; 80 | bool expand_y_; 81 | }; 82 | 83 | } 84 | -------------------------------------------------------------------------------- /include/blendint/gui/texture-view.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | namespace BlendInt { 35 | 36 | class TextureView: public AbstractScrollable 37 | { 38 | public: 39 | 40 | TextureView (); 41 | 42 | virtual ~TextureView (); 43 | 44 | bool OpenFile (const char* filename); 45 | 46 | void LoadImage (const RefPtr& image); 47 | 48 | void SetTexture (const RefPtr& texture); 49 | 50 | void Clear (); 51 | 52 | virtual bool IsExpandX () const; 53 | 54 | virtual bool IsExpandY () const; 55 | 56 | virtual Size GetPreferredSize () const; 57 | 58 | protected: 59 | 60 | virtual void PerformSizeUpdate (const AbstractView* source, 61 | const AbstractView* target, 62 | int width, 63 | int height); 64 | 65 | virtual bool PreDraw (AbstractWindow* context); 66 | 67 | virtual Response Draw (AbstractWindow* context); 68 | 69 | virtual void PostDraw (AbstractWindow* context); 70 | 71 | private: 72 | 73 | void InitializeImageView (); 74 | 75 | // void AdjustImageArea (const Size& size); 76 | 77 | Size image_size_; 78 | 79 | /** 80 | * @brief Vertex Array Objects 81 | * 82 | * 0 - for background 83 | * 1 - for plane to display image texture 84 | */ 85 | 86 | GLuint vao_[2]; 87 | GLBuffer vbo_; 88 | 89 | RefPtr texture_; 90 | 91 | RefPtr chessboard_; 92 | }; 93 | 94 | } 95 | -------------------------------------------------------------------------------- /include/blendint/gui/time-ruler.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_GUI_TIMERULER_HPP_ 25 | #define _BLENDINT_GUI_TIMERULER_HPP_ 26 | 27 | #include 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | class TimeRuler: public AbstractRoundWidget 33 | { 34 | public: 35 | 36 | TimeRuler (); 37 | 38 | virtual ~TimeRuler (); 39 | 40 | virtual bool IsExpandX () const; 41 | 42 | virtual Size GetPreferredSize () const; 43 | 44 | protected: 45 | 46 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 47 | 48 | virtual Response Draw (AbstractWindow* context); 49 | 50 | private: 51 | 52 | GLuint vao_[2]; 53 | 54 | GLBuffer buffer_; 55 | 56 | }; 57 | 58 | } 59 | 60 | #endif /* _BLENDINT_GUI_TIMERULER_HPP_ */ 61 | -------------------------------------------------------------------------------- /include/blendint/gui/toggle-button.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief Toggle PushButton 33 | * 34 | * @ingroup blendint_gui_widgets_buttons 35 | */ 36 | class ToggleButton: public AbstractButton 37 | { 38 | DISALLOW_COPY_AND_ASSIGN(ToggleButton); 39 | 40 | public: 41 | 42 | ToggleButton (); 43 | 44 | ToggleButton (const String& text); 45 | 46 | ToggleButton (const RefPtr& icon); 47 | 48 | ToggleButton (const RefPtr& icon, const String& text); 49 | 50 | virtual ~ToggleButton (); 51 | 52 | virtual bool IsExpandX () const override; 53 | 54 | virtual Size GetPreferredSize () const override; 55 | 56 | protected: 57 | 58 | virtual void PerformSizeUpdate (const AbstractView* source, 59 | const AbstractView* target, 60 | int width, 61 | int height) final; 62 | 63 | virtual void PerformRoundTypeUpdate (int round_type) final; 64 | 65 | virtual void PerformRoundRadiusUpdate (float radius) final; 66 | 67 | virtual void PerformHoverIn (AbstractWindow* context) final; 68 | 69 | virtual void PerformHoverOut (AbstractWindow* context) final; 70 | 71 | virtual Response Draw (AbstractWindow* context) final; 72 | 73 | private: 74 | 75 | void InitializeToggleButtonOnce (); 76 | 77 | GLuint vao_[2]; 78 | 79 | GLBuffer vbo_; 80 | }; 81 | 82 | } 83 | -------------------------------------------------------------------------------- /include/blendint/gui/tree-view.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | class TreeView: public AbstractItemView 31 | { 32 | DISALLOW_COPY_AND_ASSIGN (TreeView); 33 | 34 | public: 35 | 36 | TreeView (); 37 | 38 | virtual ~TreeView (); 39 | 40 | virtual ModelIndex GetIndexAt (const Point& point) const; 41 | 42 | protected: 43 | 44 | virtual Response Draw (AbstractWindow* context); 45 | 46 | private: 47 | 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /include/blendint/gui/view-buffer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | namespace BlendInt { 32 | 33 | class ViewBuffer: public AbstractForm 34 | { 35 | public: 36 | 37 | ViewBuffer () = delete; // disable the default constructor 38 | 39 | ViewBuffer (int width, int height); 40 | 41 | virtual ~ViewBuffer (); 42 | 43 | virtual void Draw (int x = 0, 44 | int y = 0, 45 | const float* color_ptr = 0, 46 | short gamma = 0, 47 | float rotate = 0.f, 48 | float scale_x = 1.f, 49 | float scale_y = 1.f) const; 50 | 51 | virtual void DrawInRect (const Rect& rect, 52 | int align, 53 | const float* color_ptr = 0, 54 | short gamma = 0, 55 | float rotate = 0.f, 56 | bool scale = false) const; 57 | 58 | inline GLTexture2D* texture () 59 | { 60 | return &texture_; 61 | } 62 | 63 | #ifdef DEBUG 64 | void SaveToFile (const char* file); 65 | #endif 66 | 67 | protected: 68 | 69 | virtual void PerformSizeUpdate (int width, int height); 70 | 71 | private: 72 | 73 | GLuint vao_; 74 | 75 | GLBuffer<> vbo_; 76 | 77 | GLTexture2D texture_; 78 | 79 | }; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /include/blendint/gui/viewport2d.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #ifndef _BLENDINT_GUI_VIEWPORT2D_HPP_ 25 | #define _BLENDINT_GUI_VIEWPORT2D_HPP_ 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | namespace BlendInt { 33 | 34 | /** 35 | * @brief A special viewport with a OrthoCamera 36 | */ 37 | class Viewport2D: public AbstractRoundWidget 38 | { 39 | DISALLOW_COPY_AND_ASSIGN(Viewport2D); 40 | 41 | public: 42 | 43 | Viewport2D (); 44 | 45 | virtual ~Viewport2D (); 46 | 47 | virtual Size GetPreferredSize () const; 48 | 49 | virtual bool IsExpandX () const; 50 | 51 | virtual bool IsExpandY () const; 52 | 53 | protected: 54 | 55 | virtual void PerformSizeUpdate (const AbstractView* source, const AbstractView* target, int width, int height); 56 | 57 | virtual Response Draw (AbstractWindow* context); 58 | 59 | private: 60 | 61 | void InitializeViewport2D (); 62 | 63 | GLuint vao_; 64 | 65 | RefPtr inner_; 66 | 67 | OrthoCamera camera_; 68 | 69 | GridFloor* gridfloor_; 70 | 71 | static const float camera_factor; 72 | }; 73 | 74 | } 75 | 76 | #endif /* _BLENDINT_GUI_VIEWPORT2D_HPP_ */ 77 | -------------------------------------------------------------------------------- /include/blendint/gui/widget-shadow.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | /** 32 | * @brief Soft shadow for widgets 33 | * 34 | * @ingroup blendint_gui_widgets 35 | */ 36 | class WidgetShadow: public AbstractShadow 37 | { 38 | public: 39 | 40 | WidgetShadow (const Size& size = Size(100, 100), 41 | int round_type = RoundNone, 42 | float round_radius = 5.f); 43 | 44 | virtual ~WidgetShadow (); 45 | 46 | virtual void Draw (int x, 47 | int y, 48 | const float* color_ptr = Color(Palette::Black).data(), 49 | short gamma = 0, 50 | float rotate = 0.f, 51 | float scale_x = 1.f, 52 | float scale_y = 1.f) const; 53 | 54 | void Draw (int x, int y, int mask_x, int mask_y, const float* color_ptr = 55 | Color(Palette::Black).data(), 56 | short gamma = 0); 57 | 58 | protected: 59 | 60 | virtual void PerformSizeUpdate (int width, int height); 61 | 62 | virtual void PerformRoundTypeUpdate (int type); 63 | 64 | virtual void PerformRoundRadiusUpdate (float radius); 65 | 66 | private: 67 | 68 | void InitializeWidgetShadowOnce (); 69 | 70 | GLuint vao_; 71 | 72 | GLBuffer vertex_buffer_; 73 | 74 | GLBuffer element_buffer_; 75 | 76 | }; 77 | 78 | } 79 | -------------------------------------------------------------------------------- /include/blendint/opengl/gl-framebuffer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | namespace BlendInt { 34 | 35 | /** 36 | * @brief C++ wrapper to GL Framebuffer object 37 | * 38 | * Usage of this class: 39 | * 40 | * @ingroup opengl 41 | */ 42 | class GLFramebuffer 43 | { 44 | public: 45 | 46 | GLFramebuffer (); 47 | 48 | ~GLFramebuffer (); 49 | 50 | inline void generate () 51 | { 52 | if(m_id != 0) clear(); 53 | glGenFramebuffers (1, &m_id); 54 | } 55 | 56 | inline void bind () const 57 | { 58 | glBindFramebuffer(GL_FRAMEBUFFER, m_id); 59 | } 60 | 61 | void Attach (const GLTexture2D& tex, GLenum attachment = GL_COLOR_ATTACHMENT0); 62 | 63 | void Attach (const GLRenderbuffer& renderbuffer, GLenum attachment = GL_COLOR_ATTACHMENT0); 64 | 65 | inline void clear () 66 | { 67 | glDeleteFramebuffers(1, &m_id); 68 | m_id = 0; 69 | } 70 | 71 | GLuint id () const {return m_id;} 72 | 73 | static inline void reset () 74 | { 75 | glBindFramebuffer(GL_FRAMEBUFFER, 0); 76 | } 77 | 78 | static bool CheckStatus (); 79 | 80 | private: 81 | 82 | GLuint m_id; 83 | 84 | }; 85 | 86 | } 87 | -------------------------------------------------------------------------------- /include/blendint/opengl/gl-renderbuffer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | /** 31 | * @brief Renderbuffer object wrapper 32 | * 33 | * @ingroup opengl 34 | */ 35 | class GLRenderbuffer 36 | { 37 | public: 38 | 39 | GLRenderbuffer (); 40 | 41 | ~GLRenderbuffer (); 42 | 43 | void Generate (); 44 | 45 | void Bind (); 46 | 47 | void SetStorage (GLenum internalformat, GLsizei width, GLsizei height); 48 | 49 | static void Reset (); 50 | 51 | void Clear (); 52 | 53 | GLuint id () const {return m_id;} 54 | 55 | private: 56 | 57 | GLuint m_id; 58 | }; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /include/blendint/opengl/gl-vertexarrays.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | template 33 | class GLVertexArrays: public Object 34 | { 35 | public: 36 | 37 | GLVertexArrays () 38 | : Object() 39 | { 40 | memset(ids_, 0, SIZE); 41 | } 42 | 43 | virtual ~GLVertexArrays () 44 | { 45 | glDeleteVertexArrays (SIZE, ids_); 46 | } 47 | 48 | inline void generate () 49 | { 50 | if(ids_[0] != 0) clear(); 51 | glGenVertexArrays(SIZE, ids_); 52 | } 53 | 54 | inline void clear () 55 | { 56 | glDeleteBuffers(SIZE, ids_); 57 | memset(ids_, 0, SIZE); 58 | } 59 | 60 | inline GLuint id (int index = 0) const 61 | {return ids_[index];} 62 | 63 | inline void bind (int index = 0) const 64 | { 65 | glBindVertexArray (ids_[index]); 66 | } 67 | 68 | static inline void reset () 69 | { 70 | glBindVertexArray (0); 71 | } 72 | 73 | private: 74 | 75 | GLuint ids_[SIZE]; 76 | }; 77 | 78 | } 79 | -------------------------------------------------------------------------------- /include/blendint/opengl/opengl.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | /** 25 | * @brief Global header to include OpenGL header files in different OS 26 | */ 27 | 28 | #pragma once 29 | 30 | // TODO: add gl headers in Windows 31 | 32 | #include 33 | 34 | #ifdef __UNIX__ 35 | #ifdef __APPLE__ 36 | #include 37 | #include 38 | #else 39 | #include 40 | #include 41 | //#include 42 | #endif 43 | #endif // __UNIX__ 44 | -------------------------------------------------------------------------------- /lib/core/color.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | Color operator + (const Color& orig, short shade) 31 | { 32 | Color color; 33 | color.set_red(orig.r() + shade / 255.f); 34 | color.set_green(orig.g() + shade / 255.f); 35 | color.set_blue(orig.b() + shade / 255.f); 36 | color.set_alpha(orig.a()); 37 | 38 | return color; 39 | } 40 | 41 | Color operator + (const Color& color1, const Color& color2) 42 | { 43 | Color color; 44 | color.set_red(color1.r() + color2.r()); 45 | color.set_green(color1.g() + color2.g()); 46 | color.set_blue(color1.b() + color2.b()); 47 | color.set_alpha(color1.a() + color2.a()); 48 | 49 | return color; 50 | } 51 | 52 | extern bool operator == (const Color& src, const Color& dst) 53 | { 54 | return memcmp(src.data(), dst.data(), sizeof(float) * 4) == 0; 55 | } 56 | 57 | extern bool operator != (const Color& src, const Color& dst) 58 | { 59 | return memcmp(src.data(), dst.data(), sizeof(float) * 4) != 0; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /lib/core/image.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | OIIO_NAMESPACE_USING 26 | 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | Image::Image () 32 | : m_width(0), m_height(0), m_channels(0) 33 | { 34 | 35 | } 36 | 37 | Image::~Image() 38 | { 39 | 40 | } 41 | 42 | bool Image::Read (const char* filename) 43 | { 44 | ImageInput *in = ImageInput::open (filename); 45 | 46 | if (! in) 47 | return false; 48 | 49 | const ImageSpec &spec = in->spec(); 50 | 51 | m_width = spec.width; 52 | m_height = spec.height; 53 | m_channels = spec.nchannels; 54 | m_pixels.resize (m_width * m_height * m_channels); 55 | in->read_image (TypeDesc::UINT8, &m_pixels[0]); 56 | in->close (); 57 | 58 | delete in; 59 | 60 | return true; 61 | } 62 | 63 | bool Image::Read (const String& filename) 64 | { 65 | ImageInput *in = ImageInput::open (ConvertFromString(filename)); 66 | 67 | if (! in) 68 | return false; 69 | 70 | const ImageSpec &spec = in->spec(); 71 | 72 | m_width = spec.width; 73 | m_height = spec.height; 74 | m_channels = spec.nchannels; 75 | m_pixels.resize (m_width * m_height * m_channels); 76 | in->read_image (TypeDesc::UINT8, &m_pixels[0]); 77 | in->close (); 78 | 79 | delete in; 80 | 81 | return true; 82 | } 83 | 84 | void Image::Clear () 85 | { 86 | m_pixels.clear(); 87 | m_channels = 0; 88 | m_width = 0; 89 | m_height = 0; 90 | } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /lib/font/fc-pattern.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /lib/gui/abstract-camera.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | AbstractCamera::AbstractCamera () 32 | : Object() 33 | { 34 | } 35 | 36 | AbstractCamera::~AbstractCamera () 37 | { 38 | } 39 | 40 | void AbstractCamera::LookAt (const glm::vec3& pos, 41 | const glm::vec3& center, 42 | const glm::vec3& up) 43 | { 44 | if (pos == center) { 45 | DBG_PRINT_MSG("ERROR: %s", "position and center are the same"); 46 | return; 47 | } 48 | 49 | position_ = pos; 50 | center_ = center; 51 | up_ = up; 52 | 53 | local_z_ = position_ - center_; 54 | local_x_ = glm::cross(up_, local_z_); 55 | local_y_ = glm::cross(local_z_, local_x_); 56 | 57 | local_x_ = glm::normalize(local_x_); 58 | local_y_ = glm::normalize(local_y_); 59 | local_z_ = glm::normalize(local_z_); 60 | 61 | view_ = glm::lookAt(position_, center_, up_); 62 | } 63 | 64 | void AbstractCamera::Orbit (float dx, float dy) 65 | { 66 | // Nothing in base class 67 | } 68 | 69 | void AbstractCamera::Pan (float dx, float dy) 70 | { 71 | // Nothing in base class 72 | } 73 | 74 | void AbstractCamera::Zoom (float fac) 75 | { 76 | // Nothing in base class 77 | } 78 | 79 | } 80 | 81 | -------------------------------------------------------------------------------- /lib/gui/abstract-icon.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | namespace BlendInt { 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /lib/gui/abstract-item-view.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | namespace BlendInt { 27 | 28 | AbstractItemView::AbstractItemView () 29 | : AbstractScrollable() 30 | { 31 | 32 | } 33 | 34 | AbstractItemView::~AbstractItemView () 35 | { 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /lib/gui/abstract-layout.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | namespace BlendInt { 27 | 28 | AbstractLayout::AbstractLayout () 29 | : AbstractWidget() 30 | { 31 | 32 | } 33 | 34 | AbstractLayout::AbstractLayout (int width, int height) 35 | : AbstractWidget(width, height) 36 | { 37 | 38 | } 39 | 40 | AbstractLayout::AbstractLayout (int width, int height, const Margin& margin) 41 | : AbstractWidget(width, height), margin_(margin) 42 | { 43 | 44 | } 45 | 46 | AbstractLayout::~AbstractLayout () 47 | { 48 | } 49 | 50 | void AbstractLayout::SetMargin (const Margin& margin) 51 | { 52 | if (margin_ == margin) return; 53 | 54 | PerformMarginUpdate(margin); 55 | } 56 | 57 | Response BlendInt::AbstractLayout::Draw (AbstractWindow* context) 58 | { 59 | return subview_count() ? Ignore : Finish; 60 | } 61 | 62 | void AbstractLayout::PerformMarginUpdate (const Margin& margin) 63 | { 64 | margin_ = margin; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /lib/gui/abstract-menu-item.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | namespace BlendInt { 27 | 28 | AbstractMenuItem::AbstractMenuItem() 29 | { 30 | } 31 | 32 | AbstractMenuItem::~AbstractMenuItem() 33 | { 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /lib/gui/abstract-primitive.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | namespace BlendInt { 27 | 28 | AbstractPrimitive::AbstractPrimitive () 29 | : Object() 30 | { 31 | } 32 | 33 | AbstractPrimitive::~AbstractPrimitive () 34 | { 35 | } 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /lib/gui/abstract-scrollable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | namespace BlendInt { 27 | 28 | AbstractScrollable::AbstractScrollable() 29 | : AbstractRoundWidget() 30 | { 31 | } 32 | 33 | AbstractScrollable::AbstractScrollable(int width, int height) 34 | : AbstractRoundWidget (width, height) 35 | { 36 | } 37 | 38 | AbstractScrollable::~AbstractScrollable () 39 | { 40 | } 41 | 42 | Point AbstractScrollable::GetOffset() const 43 | { 44 | return offset_; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /lib/gui/font-selector.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | namespace BlendInt { 27 | 28 | FontSelector::FontSelector() 29 | : AbstractDialog() 30 | { 31 | 32 | } 33 | 34 | FontSelector::~FontSelector() 35 | { 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /lib/gui/free-camera.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | namespace BlendInt { 35 | 36 | FreeCamera::FreeCamera () 37 | { 38 | set_position(5.0, 5.0, 5.0); 39 | set_center(0.0, 0.0, 0.0); 40 | set_up(0.0, 0.0, 1.0); 41 | } 42 | 43 | FreeCamera::~FreeCamera () 44 | { 45 | } 46 | 47 | void FreeCamera::Update () 48 | { 49 | //set_view(glm::lookAt(position(), center(), up())); 50 | 51 | /* 52 | glm::mat4 R = glm::yawPitchRoll(yaw(), pitch(), roll()); 53 | 54 | // set_position(position() + m_translation); 55 | // m_translation = glm::vec3(0); 56 | 57 | set_n(glm::vec3(R * glm::vec4(0, 0, 1, 0))); 58 | //glm::vec3 center = position() + look(); 59 | //set_center(position() + look()); 60 | set_v(glm::vec3(R * glm::vec4(0, 1, 0, 0))); 61 | set_u(glm::cross(n(), v())); 62 | 63 | set_view(glm::lookAt(position(), center(), up())); 64 | 65 | SetPerspective (45.0f, 1.0f*5/4, 66 | 0.1f, 10.0f); 67 | */ 68 | 69 | /* 70 | glm::mat4 view = glm::lookAt(glm::vec3(5.0, 5.0, 5.0), glm::vec3(0.0, 0.0, 0.0), glm::vec3(0.0, 1.0, 0.0)); 71 | glm::mat4 projection = glm::perspective(45.0f, 1.0f*5/4, 0.1f, 10.0f); 72 | set_view(view); 73 | set_projection(projection); 74 | */ 75 | } 76 | 77 | } 78 | 79 | -------------------------------------------------------------------------------- /lib/gui/ortho-camera.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace BlendInt { 31 | 32 | OrthoCamera::OrthoCamera() 33 | : AbstractCamera(), 34 | left_(0.f), 35 | right_(100.f), 36 | bottom_(0.f), 37 | top_(100.f), 38 | near_(100.f), 39 | far_(-100.f) 40 | { 41 | } 42 | 43 | OrthoCamera::~OrthoCamera() 44 | { 45 | } 46 | 47 | void OrthoCamera::SetOrtho (float left, float right, float bottom, 48 | float top, float near, float far) 49 | { 50 | left_ = left; 51 | right_ = right; 52 | bottom_ = bottom; 53 | top_ = top; 54 | near_ = near; 55 | far_ = far; 56 | 57 | set_projection(glm::ortho(left_, right_, bottom_, top_, near_, far_)); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /lib/gui/separator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | Separator::Separator (bool expandx, bool expandy) 31 | : AbstractWidget(), 32 | expand_x_(expandx), 33 | expand_y_(expandy), 34 | preferred_size_(10, 10) 35 | { 36 | set_size(10, 10); 37 | } 38 | 39 | Separator::~Separator () 40 | { 41 | } 42 | 43 | Size Separator::GetPreferredSize() const 44 | { 45 | return preferred_size_; 46 | } 47 | 48 | void Separator::SetExpandX (bool expand) 49 | { 50 | expand_x_ = expand; 51 | // TODO: call superview widget to update layout 52 | } 53 | 54 | void Separator::SetExpandY (bool expand) 55 | { 56 | expand_y_ = expand; 57 | // TODO: call superview widget to update layout 58 | } 59 | 60 | void Separator::SetExpand (bool expand_x, bool expand_y) 61 | { 62 | expand_x_ = expand_x; 63 | expand_y_ = expand_y; 64 | // TODO: call superview widget to update layout 65 | } 66 | 67 | bool Separator::IsExpandX() const 68 | { 69 | return expand_x_; 70 | } 71 | 72 | bool Separator::IsExpandY() const 73 | { 74 | return expand_y_; 75 | } 76 | 77 | Response Separator::PerformMousePress (AbstractWindow* context) 78 | { 79 | return Ignore; 80 | } 81 | 82 | Response Separator::PerformMouseRelease (AbstractWindow* context) 83 | { 84 | return Ignore; 85 | } 86 | 87 | bool Separator::PreDraw(AbstractWindow* context) 88 | { 89 | return true; 90 | } 91 | 92 | Response Separator::Draw(AbstractWindow* context) 93 | { 94 | return Ignore; 95 | } 96 | 97 | void Separator::PostDraw(AbstractWindow* context) 98 | { 99 | return; 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /lib/gui/tree-view.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free software: 6 | * you can redistribute it and/or modify it under the terms of the GNU 7 | * Lesser General Public License as published by the Free Software 8 | * Foundation, either version 3 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is distributed in 12 | * the hope that it will be useful, but WITHOUT ANY WARRANTY; without 13 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | namespace BlendInt { 27 | 28 | TreeView::TreeView() 29 | : AbstractItemView() 30 | { 31 | 32 | } 33 | 34 | TreeView::~TreeView () 35 | { 36 | } 37 | 38 | ModelIndex TreeView::GetIndexAt (const Point& point) const 39 | { 40 | return ModelIndex(); 41 | } 42 | 43 | Response TreeView::Draw (AbstractWindow* context) 44 | { 45 | return Ignore; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /lib/opengl/gl-renderbuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | GLRenderbuffer::GLRenderbuffer () 32 | : m_id(0) 33 | { 34 | 35 | } 36 | 37 | GLRenderbuffer::~GLRenderbuffer () 38 | { 39 | glDeleteRenderbuffers(1, &m_id); 40 | } 41 | 42 | void GLRenderbuffer::Generate () 43 | { 44 | if(!m_id) { 45 | Clear(); 46 | } 47 | 48 | glGenRenderbuffers(1, &m_id); 49 | } 50 | 51 | void GLRenderbuffer::Bind() 52 | { 53 | if(m_id) { 54 | glBindRenderbuffer(GL_RENDERBUFFER, m_id); 55 | } else { 56 | std::cerr << "The render buffer is not generated! call Generate() first." << std::endl; 57 | } 58 | } 59 | 60 | void GLRenderbuffer::Reset() 61 | { 62 | glBindRenderbuffer(GL_RENDERBUFFER, 0); 63 | } 64 | 65 | void GLRenderbuffer::SetStorage (GLenum internalformat, GLsizei width, 66 | GLsizei height) 67 | { 68 | GLint buffer = 0; 69 | glGetIntegerv(GL_RENDERBUFFER_BINDING, &buffer); 70 | 71 | if(m_id != static_cast(buffer)) { 72 | std::cerr << "The current element array buffer binding is not the one to be set data, call Bind() first!" << std::endl; 73 | return; 74 | } 75 | 76 | glRenderbufferStorage(GL_RENDERBUFFER, internalformat, width, height); 77 | } 78 | 79 | void GLRenderbuffer::Clear () 80 | { 81 | if(glIsRenderbuffer(m_id)) { 82 | glDeleteRenderbuffers(1, &m_id); 83 | } 84 | 85 | m_id = 0; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /lib/opengl/glarraybuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace BlendInt { 29 | 30 | GLArrayBuffer::GLArrayBuffer() 31 | : Object(), id_(0) 32 | { 33 | } 34 | 35 | GLArrayBuffer::~GLArrayBuffer() 36 | { 37 | glDeleteBuffers(1, &id_); 38 | } 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /lib/opengl/glelementarraybuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of BlendInt (a Blender-like Interface Library in 3 | * OpenGL). 4 | * 5 | * BlendInt (a Blender-like Interface Library in OpenGL) is free 6 | * software: you can redistribute it and/or modify it under the terms 7 | * of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation, either version 3 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * BlendInt (a Blender-like Interface Library in OpenGL) is 12 | * distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with BlendInt. If not, see 19 | * . 20 | * 21 | * Contributor(s): Freeman Zhang 22 | */ 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | namespace BlendInt { 30 | 31 | GLElementArrayBuffer::GLElementArrayBuffer() 32 | : Object(), id_(0) 33 | { 34 | 35 | } 36 | 37 | GLElementArrayBuffer::~GLElementArrayBuffer () 38 | { 39 | glDeleteBuffers(1, &id_); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /lib/pkgconfig/blendint.pc.in: -------------------------------------------------------------------------------- 1 | # pkg-config for BlendInt 2 | 3 | prefix=@CMAKE_INSTALL_PREFIX@ 4 | exec_prefix=${prefix} 5 | libdir=${exec_prefix}/lib@LIB_SUFFIX@ 6 | includedir=${prefix}/include 7 | 8 | Name: BlendInt 9 | Description: A lightweight C++ GUI toolkit for building cross-platform application with Blender-like style 10 | Version: @BLENDINT_VERSION_FULL@ 11 | URL: https://github.com/zhanggyb/BlendInt 12 | # Requires: glib-2.0 = 1.3.1 13 | # Conflicts: foobar <= 4.5 14 | Libs: -L${libdir} -L@Boost_LIBRARY_DIRS@ -l@BLENDINT_LIB_NAME@ -l@BOOST_FILESYSTEM_LIB_NAME@ -l@BOOST_SYSTEM_LIB_NAME@ 15 | Libs.private: -lm 16 | Cflags: -I${includedir} -I${includedir}/@BLENDINT_LIB_NAME@ -I@FREETYPE_INCLUDE_DIRS@ 17 | 18 | --------------------------------------------------------------------------------