Blender V4.3
interface_style.cc File Reference
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h"
#include "BLI_listbase.h"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_global.hh"
#include "BLF_api.hh"
#include "UI_interface.hh"
#include "interface_intern.hh"

Go to the source code of this file.

Functions

static void fontstyle_set_ex (const uiFontStyle *fs, const float dpi_fac)
 
static uiStyleui_style_new (ListBase *styles, const char *name, short uifont_id)
 
static uiFontuifont_to_blfont (int id)
 
void UI_fontstyle_draw_ex (const uiFontStyle *fs, const rcti *rect, const char *str, const size_t str_len, const uchar col[4], const uiFontStyleDraw_Params *fs_params, int *r_xofs, int *r_yofs, ResultBLF *r_info)
 
void UI_fontstyle_draw (const uiFontStyle *fs, const rcti *rect, const char *str, const size_t str_len, const uchar col[4], const uiFontStyleDraw_Params *fs_params)
 
void UI_fontstyle_draw_rotated (const uiFontStyle *fs, const rcti *rect, const char *str, const uchar col[4])
 
void UI_fontstyle_draw_simple (const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4])
 
void UI_fontstyle_draw_simple_backdrop (const uiFontStyle *fs, float x, float y, const blender::StringRef str, const float col_fg[4], const float col_bg[4])
 
const uiStyleUI_style_get ()
 
const uiStyleUI_style_get_dpi ()
 
int UI_fontstyle_string_width (const uiFontStyle *fs, const char *str)
 
int UI_fontstyle_string_width_with_block_aspect (const uiFontStyle *fs, const char *str, const float aspect)
 
int UI_fontstyle_height_max (const uiFontStyle *fs)
 
void uiStyleInit ()
 
void UI_fontstyle_set (const uiFontStyle *fs)
 

Function Documentation

◆ fontstyle_set_ex()

static void fontstyle_set_ex ( const uiFontStyle * fs,
const float dpi_fac )
static

◆ UI_fontstyle_draw()

void UI_fontstyle_draw ( const uiFontStyle * fs,
const rcti * rect,
const char * str,
const size_t str_len,
const uchar col[4],
const uiFontStyleDraw_Params * fs_params )

◆ UI_fontstyle_draw_ex()

◆ UI_fontstyle_draw_rotated()

◆ UI_fontstyle_draw_simple()

void UI_fontstyle_draw_simple ( const uiFontStyle * fs,
float x,
float y,
const char * str,
const uchar col[4] )

◆ UI_fontstyle_draw_simple_backdrop()

◆ UI_fontstyle_height_max()

int UI_fontstyle_height_max ( const uiFontStyle * fs)

Definition at line 360 of file interface_style.cc.

References BLF_height_max(), UI_fontstyle_set(), and uiFontStyle::uifont_id.

Referenced by text_size_get().

◆ UI_fontstyle_set()

◆ UI_fontstyle_string_width()

int UI_fontstyle_string_width ( const uiFontStyle * fs,
const char * str )

◆ UI_fontstyle_string_width_with_block_aspect()

int UI_fontstyle_string_width_with_block_aspect ( const uiFontStyle * fs,
const char * str,
const float aspect )

◆ UI_style_get()

◆ UI_style_get_dpi()

const uiStyle * UI_style_get_dpi ( )

Read a style (with the current DPI applied).

Definition at line 317 of file interface_style.cc.

References uiStyle::boxspace, uiStyle::buttonspacex, uiStyle::buttonspacey, uiStyle::columnspace, uiStyle::grouplabel, uiStyle::panelouter, uiStyle::panelspace, uiStyle::paneltitle, uiFontStyle::shadx, uiFontStyle::shady, uiStyle::templatespace, uiStyle::tooltip, UI_SCALE_FAC, UI_style_get(), and uiStyle::widget.

Referenced by blender::ed::space_node::add_panel_items_recursive(), blender::ed::asset::shelf::add_tab_button(), button_section_bounds_calc(), colorband_tools_fn(), blender::ed::space_node::draw_tree_path(), ed_panel_draw(), ED_region_header_layout(), ED_region_image_metadata_draw(), ED_region_info_draw_multiline(), ED_region_property_search(), ED_time_scrub_channel_search_draw(), blender::ed::spreadsheet::get_index_column_width(), blender::ed::asset::shelf::main_region_padding_y(), menu_add_shortcut(), menu_change_shortcut(), menu_items_from_ui_create(), blender::ed::space_node::node_update_basis_buttons(), blender::ed::space_node::node_update_basis_socket(), blender::ui::padded_item_height(), blender::ed::asset::shelf::region_layout(), blender::ui::region_views_find_drop_target_at(), blender::ed::spreadsheet::spreadsheet_footer_region_draw(), template_ID_tabs(), text_size_get(), UI_block_draw(), ui_litem_layout_panel_body(), ui_litem_layout_panel_header(), ui_offset_panel_block(), UI_pie_menu_begin(), ui_popover_create_block(), ui_popover_panel_create(), ui_popup_menu_create_block(), uiItemsAlertBox(), blender::ed::outliner::unused_message_popup_width_compute(), wm_block_about_create(), wm_block_create_redo(), wm_block_dialog_create(), wm_block_insert_unicode_create(), wm_block_splash_create(), and wm_operator_ui_create().

◆ ui_style_new()

static uiStyle * ui_style_new ( ListBase * styles,
const char * name,
short uifont_id )
static

This is a complete set of layout rules, the 'state' of the Layout Engine. Multiple styles are possible, defined via C or Python. Styles get a name, and will typically get activated per region type, like Header, or Listview or Toolbar. Properties of Style definitions are:

  • default column properties, internal spacing, aligning, min/max width
  • button alignment rules (for groups)
  • label placement rules
  • internal labeling or external labeling default
  • default minimum widths for buttons/labels (in amount of characters)
  • font types, styles and relative sizes for Panel titles, labels, etc.

Definition at line 57 of file interface_style.cc.

References BLI_addtail(), uiStyle::boxspace, uiStyle::buttonspacex, uiStyle::buttonspacey, uiFontStyle::character_weight, uiStyle::columnspace, uiStyle::grouplabel, uiStyle::name, uiStyle::panelouter, uiStyle::panelspace, uiStyle::paneltitle, uiStyle::panelzoom, uiFontStyle::points, uiFontStyle::shadow, uiFontStyle::shadowalpha, uiFontStyle::shadowcolor, uiFontStyle::shadx, uiFontStyle::shady, STRNCPY, uiStyle::templatespace, uiStyle::tooltip, UI_DEFAULT_TEXT_POINTS, UI_DEFAULT_TITLE_POINTS, UI_DEFAULT_TOOLTIP_POINTS, uiFontStyle::uifont_id, and uiStyle::widget.

Referenced by uiStyleInit().

◆ uifont_to_blfont()

static uiFont * uifont_to_blfont ( int id)
static

Definition at line 111 of file interface_style.cc.

Referenced by fontstyle_set_ex().

◆ uiStyleInit()