2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2008-11-25 18:27:41 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-11-25 18:27:41 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup editorui
|
2011-02-21 07:25:24 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2021-02-09 09:42:58 +11:00
|
|
|
/* Required for #eIconSizes which can't be forward declared if this file is included in C++. */
|
|
|
|
|
#include "DNA_ID_enums.h"
|
2021-02-08 15:09:49 -06:00
|
|
|
|
2020-03-02 15:09:10 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-09-30 11:51:13 +10:00
|
|
|
struct Collection;
|
2015-01-07 12:31:25 +01:00
|
|
|
struct ID;
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
struct PointerRNA;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct PreviewImage;
|
|
|
|
|
struct Scene;
|
|
|
|
|
struct bContext;
|
2008-11-25 18:27:41 +00:00
|
|
|
|
|
|
|
|
typedef struct IconFile {
|
|
|
|
|
struct IconFile *next, *prev;
|
2012-05-12 20:39:39 +00:00
|
|
|
char filename[256]; /* FILE_MAXFILE size */
|
2008-11-25 18:27:41 +00:00
|
|
|
int index;
|
|
|
|
|
} IconFile;
|
|
|
|
|
|
|
|
|
|
#define ICON_DEFAULT_HEIGHT 16
|
2012-05-12 20:39:39 +00:00
|
|
|
#define ICON_DEFAULT_WIDTH 16
|
2011-06-05 14:00:06 +00:00
|
|
|
|
2018-06-10 16:42:19 +02:00
|
|
|
#define ICON_DEFAULT_HEIGHT_TOOLBAR 32
|
2018-04-25 21:01:36 +02:00
|
|
|
|
2011-09-25 12:33:51 +00:00
|
|
|
#define ICON_DEFAULT_HEIGHT_SCALE ((int)(UI_UNIT_Y * 0.8f))
|
|
|
|
|
#define ICON_DEFAULT_WIDTH_SCALE ((int)(UI_UNIT_X * 0.8f))
|
2011-06-05 14:00:06 +00:00
|
|
|
|
2015-05-11 16:29:12 +02:00
|
|
|
#define PREVIEW_DEFAULT_HEIGHT 128
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2020-03-14 11:05:09 -07:00
|
|
|
typedef enum eAlertIcon {
|
|
|
|
|
ALERT_ICON_WARNING = 0,
|
|
|
|
|
ALERT_ICON_QUESTION = 1,
|
|
|
|
|
ALERT_ICON_ERROR = 2,
|
|
|
|
|
ALERT_ICON_INFO = 3,
|
|
|
|
|
ALERT_ICON_BLENDER = 4,
|
|
|
|
|
ALERT_ICON_MAX,
|
|
|
|
|
} eAlertIcon;
|
|
|
|
|
|
2020-09-18 10:24:14 +10:00
|
|
|
struct ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon);
|
2020-03-14 11:05:09 -07:00
|
|
|
|
2008-11-25 18:27:41 +00:00
|
|
|
/*
|
2012-03-03 16:31:46 +00:00
|
|
|
* Resizable Icons for Blender
|
|
|
|
|
*/
|
2018-07-24 12:43:21 +02:00
|
|
|
void UI_icons_init(void);
|
2019-05-09 15:53:44 +02:00
|
|
|
void UI_icons_reload_internal_textures(void);
|
2019-05-09 19:19:52 +02:00
|
|
|
|
2008-11-25 19:23:54 +00:00
|
|
|
int UI_icon_get_width(int icon_id);
|
|
|
|
|
int UI_icon_get_height(int icon_id);
|
2019-05-09 17:37:26 +02:00
|
|
|
bool UI_icon_get_theme_color(int icon_id, unsigned char color[4]);
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2020-09-18 10:24:14 +10:00
|
|
|
void UI_icon_render_id(const struct bContext *C,
|
2015-01-12 14:44:54 +01:00
|
|
|
struct Scene *scene,
|
|
|
|
|
struct ID *id,
|
2021-01-02 15:29:01 +01:00
|
|
|
const enum eIconSizes size,
|
2015-01-12 14:44:54 +01:00
|
|
|
const bool use_job);
|
2020-09-18 10:24:14 +10:00
|
|
|
int UI_icon_preview_to_render_size(enum eIconSizes size);
|
2015-01-07 12:31:25 +01:00
|
|
|
|
2008-11-25 19:23:54 +00:00
|
|
|
void UI_icon_draw(float x, float y, int icon_id);
|
2017-02-22 16:02:43 +01:00
|
|
|
void UI_icon_draw_alpha(float x, float y, int icon_id, float alpha);
|
2019-05-09 19:19:52 +02:00
|
|
|
void UI_icon_draw_preview(float x, float y, int icon_id, float aspect, float alpha, int size);
|
|
|
|
|
|
|
|
|
|
void UI_icon_draw_ex(float x,
|
|
|
|
|
float y,
|
|
|
|
|
int icon_id,
|
|
|
|
|
float aspect,
|
|
|
|
|
float alpha,
|
|
|
|
|
float desaturate,
|
2019-08-06 04:20:17 +10:00
|
|
|
const uchar mono_color[4],
|
2019-05-09 17:37:26 +02:00
|
|
|
const bool mono_border);
|
2019-05-09 19:19:52 +02:00
|
|
|
|
2010-12-03 12:30:59 +00:00
|
|
|
void UI_icons_free(void);
|
2008-11-25 19:23:54 +00:00
|
|
|
void UI_icons_free_drawinfo(void *drawinfo);
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2018-03-31 19:32:28 +02:00
|
|
|
void UI_icon_draw_cache_begin(void);
|
|
|
|
|
void UI_icon_draw_cache_end(void);
|
|
|
|
|
|
2008-11-25 19:23:54 +00:00
|
|
|
struct ListBase *UI_iconfile_list(void);
|
2010-11-19 02:14:18 +00:00
|
|
|
int UI_iconfile_get_index(const char *filename);
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2013-01-22 11:18:41 +00:00
|
|
|
struct PreviewImage *UI_icon_to_preview(int icon_id);
|
|
|
|
|
|
2021-07-13 18:05:16 +02:00
|
|
|
int UI_icon_from_rnaptr(const struct bContext *C,
|
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
|
int rnaicon,
|
|
|
|
|
const bool big);
|
2020-09-18 10:24:14 +10:00
|
|
|
int UI_icon_from_idcode(const int idcode);
|
|
|
|
|
int UI_icon_from_library(const struct ID *id);
|
|
|
|
|
int UI_icon_from_object_mode(const int mode);
|
|
|
|
|
int UI_icon_color_from_collection(const struct Collection *collection);
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2020-03-02 15:09:10 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|