24 #ifndef GODLEYTABLEWINDOW_H 25 #define GODLEYTABLEWINDOW_H 44 template <minsky::ButtonW
idgetEnums::RowCol rowCol>
59 void drawButton(cairo_t*,
const std::string& label,
60 double r,
double g,
double b,
int idx);
74 class GodleyTableEditor;
123 void draw(cairo_t* cairo);
130 void mouseUp(
double x,
double y);
134 void keyPress(
int keySym,
const std::string& utf8);
178 void undo(
int changes);
203 int colX(
double x)
const;
205 int rowY(
double y)
const;
222 draw(surface->cairo());
245 #include "godleyTableWindow.cd" double leftTableOffset
offset of the table within the window
int rowY(double y) const
row at y in unzoomed coordinates
ClickType clickType(double x, double y) const
static constexpr double pulldownHot
space for ▼ in stackVar cells minimum column width (for eg empty columns)
void update()
update canvas godleyIcon, and any related godley icons. Can throw
void importStockVarByCol(const std::string &name, int c)
void navigateDown()
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col ...
void adjustWidgets()
ensure button widgets are synced with current table data
bool drawButtons
whether to draw row/column buttons
bool hasScrollBars() const override
return whether this window has scrollbars (needed for MacOSX).
std::set< string > matchingTableColumnsByCol(int c)
void mouseMove(double x, double y)
std::deque< GodleyTable > history
GodleyIcon & godleyIcon()
void draw(cairo_t *cairo)
static constexpr double minColumnWidth
void mouseMoveB1(double x, double y)
mouse motion with button 1 pressed
double zoomFactor
zoom the display
void addStockVar(double x)
add/delete rows/columns at x,y
void highlightCell(cairo_t *cairo, unsigned row, unsigned col)
void deleteStockVar(double x)
bool selectedCellInTable() const
void deleteStockVarByCol(int c)
void mouseUp(float x, float y) override
int srcRow
src cell in the event of a move
void addStockVarByCol(int c)
std::set< string > matchingTableColumns(double x)
return list of matching table columns for column at x
double rowHeight
computed height of each row
int colXZoomed(double x) const
void undo(int changes)
restore to state changes ago
std::vector< ButtonWidget< row > > rowWidgets
void highlightColumn(cairo_t *cairo, unsigned col)
std::size_t maxHistory
maximum no. of history states to save
void mouseDown(float x, float y) override
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky's state cha...
void deleteFlowByRow(int r)
std::vector< double > colLeftMargin
computed positions of the table columns
void importStockVar(const std::string &name, double x)
void zoom(double, double, double z) override
void requestRedrawCanvas() override
GodleyTableWindow(GodleyIcon &g)
int colX(double x) const
column at x in unzoomed coordinates
void checkCell00()
check if cell (0,0) is selected, and deselect if so handle delete or backspace. Cell assumed selected...
bool button1
mouse button pressed
void navigateUp()
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col ...
GodleyIcon & m_godleyIcon
Godley icon that owns this.
CLASSDESC_ACCESS(GodleyTableEditor)
bool redraw(int, int, int width, int height) override
virtual void requestRedrawCanvas()
int rowYZoomed(double y) const
void mouseMove(float x, float y) override
void keyPress(int keySym, const std::string &utf8)
void mouseUp(double x, double y)
CLASSDESC_ACCESS(GodleyTableWindow)
bool keyPress(const EventInterface::KeyPressArgs &args) override
handle key press over current itemFocus,
int selectedRow
which cell is active, none initially
void highlightRow(cairo_t *cairo, unsigned row)
unsigned scrollRowStart
starting row/col number of the scrolling region
ClickType clickTypeZoomed(double x, double y) const
returns the clickType in zoomed coordinates
void navigateLeft()
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col ...
int motionCol
current cell under mouse motion
void deleteFlow(double y)
double zoomFactor() const override
void navigateRight()
move selected cell right, left, up or down, moving to next line and wrapping if at end of row or col ...
std::string swapAssetClass(double x, double y)
GodleyTableEditor(GodleyIcon &g)
unsigned insertIdx
location of insertion pointer in selected cell, as well as other end of selection (if mouse-swiped) ...
std::vector< ButtonWidget< col > > colWidgets
const GodleyIcon & godleyIcon() const
int textIdx(double x) const
std::string moveAssetClass(double x, double y)
static constexpr double columnButtonsOffset
void mouseDown(double x, double y)
event handling