18#define CELL_RIGHT_PADDING (2.0f * UI_SCALE_FAC)
61 const int scroll_offset_y,
68 const int row_pair_height = drawer.
row_height * 2;
69 const int row_top_y = region->winy - drawer.
top_row_height - scroll_offset_y % row_pair_height;
70 for (
const int i :
IndexRange(region->winy / row_pair_height + 1)) {
72 int x_right = region->winx;
73 int y_top = row_top_y - i * row_pair_height - drawer.
row_height;
76 y_bottom = std::min(y_bottom, region->winy - drawer.
top_row_height);
91 const int scroll_offset_x,
110 const int column_width = drawer.
column_width(column_index);
111 line_x += column_width;
122 const int scroll_offset_y,
124 int *r_max_visible_rows)
126 *r_first_row = -scroll_offset_y / drawer.
row_height;
127 *r_max_visible_rows = region->winy / drawer.
row_height + 1;
141 int first_row, max_visible_rows;
142 get_visible_rows(drawer, region, scroll_offset_y, &first_row, &max_visible_rows);
143 for (
const int row_index :
IndexRange(first_row, max_visible_rows)) {
148 params.block = left_column_block;
166 const int scroll_offset_x)
180 const int column_width = drawer.
column_width(column_index);
181 const int right_x = left_x + column_width;
184 params.block = first_row_block;
203 const int scroll_offset_x,
204 const int scroll_offset_y)
216 int first_row, max_visible_rows;
217 get_visible_rows(drawer, region, scroll_offset_y, &first_row, &max_visible_rows);
221 const int column_width = drawer.
column_width(column_index);
222 const int right_x = left_x + column_width;
225 for (
const int row_index :
IndexRange(first_row, max_visible_rows)) {
231 params.block = cells_block;
252 const int row_amount)
254 int column_width_sum = 0;
272 View2D *v2d = ®ion->v2d;
273 const int scroll_offset_y = v2d->
cur.
ymax;
274 const int scroll_offset_x = v2d->
cur.
xmin;
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
void GPU_scissor(int x, int y, int width, int height)
void GPU_scissor_get(int coords[4])
uiBlock * UI_block_begin(const bContext *C, ARegion *region, std::string name, eUIEmbossType emboss)
void UI_block_draw(const bContext *C, uiBlock *block)
void UI_block_end(const bContext *C, uiBlock *block)
void UI_ThemeClearColor(int colorid)
void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom)
void UI_view2d_totRect_set(View2D *v2d, int width, int height)
virtual void draw_top_row_cell(int column_index, const CellDrawParams ¶ms) const
virtual int column_width(int column_index) const
virtual ~SpreadsheetDrawer()
virtual void draw_left_column_cell(int row_index, const CellDrawParams ¶ms) const
virtual void draw_content_cell(int row_index, int column_index, const CellDrawParams ¶ms) const
static void draw_index_column_background(const uint pos, const ARegion *region, const SpreadsheetDrawer &drawer)
static void draw_left_column_content(const int scroll_offset_y, const bContext *C, ARegion *region, const SpreadsheetDrawer &drawer)
static void get_visible_rows(const SpreadsheetDrawer &drawer, const ARegion *region, const int scroll_offset_y, int *r_first_row, int *r_max_visible_rows)
void draw_spreadsheet_in_region(const bContext *C, ARegion *region, const SpreadsheetDrawer &drawer)
static void update_view2d_tot_rect(const SpreadsheetDrawer &drawer, ARegion *region, const int row_amount)
static void draw_top_row_content(const bContext *C, ARegion *region, const SpreadsheetDrawer &drawer, const int scroll_offset_x)
static void draw_alternating_row_overlay(const uint pos, const int scroll_offset_y, const ARegion *region, const SpreadsheetDrawer &drawer)
static void draw_cell_contents(const bContext *C, ARegion *region, const SpreadsheetDrawer &drawer, const int scroll_offset_x, const int scroll_offset_y)
static void draw_separator_lines(const uint pos, const int scroll_offset_x, const ARegion *region, const SpreadsheetDrawer &drawer)
static void draw_top_row_background(const uint pos, const ARegion *region, const SpreadsheetDrawer &drawer)
#define CELL_RIGHT_PADDING