16 #define CELL_RIGHT_PADDING (2.0f * UI_DPI_FAC)
59 const int scroll_offset_y,
66 const int row_pair_height = drawer.
row_height * 2;
67 const int row_top_y = region->
winy - drawer.
top_row_height - scroll_offset_y % row_pair_height;
68 for (
const int i :
IndexRange(region->
winy / row_pair_height + 1)) {
70 int x_right = region->
winx;
71 int y_top = row_top_y - i * row_pair_height - drawer.
row_height;
89 const int scroll_offset_x,
108 const int column_width = drawer.
column_width(column_index);
109 line_x += column_width;
120 const int scroll_offset_y,
122 int *r_max_visible_rows)
124 *r_first_row = -scroll_offset_y / drawer.
row_height;
139 int first_row, max_visible_rows;
140 get_visible_rows(drawer, region, scroll_offset_y, &first_row, &max_visible_rows);
141 for (
const int row_index :
IndexRange(first_row, max_visible_rows)) {
146 params.block = left_column_block;
164 const int scroll_offset_x)
178 const int column_width = drawer.
column_width(column_index);
179 const int right_x = left_x + column_width;
182 params.block = first_row_block;
201 const int scroll_offset_x,
202 const int scroll_offset_y)
214 int first_row, max_visible_rows;
215 get_visible_rows(drawer, region, scroll_offset_y, &first_row, &max_visible_rows);
219 const int column_width = drawer.
column_width(column_index);
220 const int right_x = left_x + column_width;
223 for (
const int row_index :
IndexRange(first_row, max_visible_rows)) {
229 params.block = cells_block;
250 const int row_amount)
252 int column_width_sum = 0;
271 const int scroll_offset_y = v2d->
cur.
ymax;
272 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_2D_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])
void UI_block_end(const struct bContext *C, uiBlock *block)
void UI_block_draw(const struct bContext *C, struct uiBlock *block)
uiBlock * UI_block_begin(const struct bContext *C, struct ARegion *region, const char *name, eUIEmbossType emboss)
void UI_ThemeClearColor(int colorid)
void UI_view2d_totRect_set(struct View2D *v2d, int width, int height)
void UI_view2d_scrollers_draw(struct View2D *v2d, const struct rcti *mask_custom)
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