Graphite  Version 3
An experimental 3D geometry processing program
icon_repository.h
Go to the documentation of this file.
1 /*
2  * GXML/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 #ifndef H_SKIN_IMGUI_ICON_REPOSITORY_H
38 #define H_SKIN_IMGUI_ICON_REPOSITORY_H
39 
41 #include <geogram_gfx/third_party/imgui/imgui.h>
42 #include <geogram_gfx/basic/GL.h>
43 
44 #include <map>
45 #include <set>
46 #include <string>
47 
52 namespace OGF {
53 
54 //___________________________________________________________________________
55 
59  class SKIN_IMGUI_API IconRepository {
60  public:
61 
66 
71 
80  void bind_icon(const std::string& icon_name, GLuint gl_texture);
81 
92  ImTextureID resolve_icon(
93  const std::string& icon_name, bool mipmap=false
94  ) const;
95 
96  private:
97  typedef union {
98  ImTextureID im_texture_id;
99  GLuint gl_texture_id;
100  } Icon;
101 
102  std::map<std::string, Icon> icons_;
103 
105  mutable std::set<std::string> not_found_;
106  };
107 
108 //___________________________________________________________________________
109 
110 }
111 
112 #endif
113 
Some utility functions for OpenGL graphics.
Keeps the correspondence between names and cached icons.
ImTextureID resolve_icon(const std::string &icon_name, bool mipmap=false) const
Finds an icon by name.
IconRepository()
IconRepository constructor.
~IconRepository()
IconRepository destructor.
void bind_icon(const std::string &icon_name, GLuint gl_texture)
Attaches an icon to a given name.
Global Graphite namespace.
Definition: common.h:76
Definitions common to all include files in the skin_imgui library.