Skip to content

Commit

Permalink
add Fl_Grid
Browse files Browse the repository at this point in the history
  • Loading branch information
MoAlyousef committed Oct 17, 2023
1 parent b8f41b8 commit 3a84735
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0)
set(CFLTK_PROJECT_VERSION 1.4.14)
set(CFLTK_PROJECT_VERSION 1.4.15)

project(cfltk
HOMEPAGE_URL https://github.com/MoAlyousef/cfltk
Expand Down
41 changes: 41 additions & 0 deletions include/cfl_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,47 @@ int Fl_Flex_margins(const Fl_Flex *self, int *x1, int *y1, int *x2, int *y2);

GROUP_DECLARE(Fl_Flex)

WIDGET_DECLARE(Fl_Grid)

void Fl_Grid_set_layout(Fl_Grid *self, int rows, int cols, int margin, int gap);

void Fl_Grid_layout(Fl_Grid *self);

void Fl_Grid_clear_layout(Fl_Grid *self);

void Fl_Grid_set_need_layout(Fl_Grid *self, int set);

int Fl_Grid_need_layout(const Fl_Grid *self);

void Fl_Grid_set_margin(Fl_Grid *self, int left, int top, int right, int bottom);

void Fl_Grid_set_gap(Fl_Grid *self, int row_gap, int col_gap);

void *Fl_Grid_set_widget(Fl_Grid *self, Fl_Widget *wi, int row, int col, unsigned short align);

void *Fl_Grid_set_widget_ext(Fl_Grid *self, Fl_Widget *wi, int row, int col, int rowspan,
int colspan, unsigned short align);

void Fl_Grid_set_col_width(Fl_Grid *self, int col, int value);

void Fl_Grid_set_col_weight(Fl_Grid *self, int col, int value);

void Fl_Grid_set_col_gap(Fl_Grid *self, int col, int value);

void Fl_Grid_set_row_height(Fl_Grid *self, int row, int value);

void Fl_Grid_set_row_weight(Fl_Grid *self, int row, int value);

void Fl_Grid_set_row_gap(Fl_Grid *self, int row, int value);

void Fl_Grid_show_grid(Fl_Grid *self, int set);

void Fl_Grid_show_grid_with_color(Fl_Grid *self, int set, unsigned int col);

void Fl_Grid_debug(Fl_Grid *self, int level);

GROUP_DECLARE(Fl_Grid)

#ifdef __cplusplus
}
#endif
Expand Down
81 changes: 81 additions & 0 deletions src/cfl_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <FL/Fl.H>
#include <FL/Fl_Color_Chooser.H>
#include <FL/Fl_Flex.H>
#include <FL/Fl_Grid.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Image.H>
#include <FL/Fl_Pack.H>
Expand Down Expand Up @@ -217,3 +218,83 @@ int Fl_Flex_margins(const Fl_Flex *self, int *x1, int *y1, int *x2, int *y2) {
}

GROUP_DEFINE(Fl_Flex)

WIDGET_CLASS(Fl_Grid)

WIDGET_DEFINE(Fl_Grid)

void Fl_Grid_set_layout(Fl_Grid *self, int rows, int cols, int margin, int gap) {
LOCK(self->layout(rows, cols, margin, gap));
}

void Fl_Grid_layout(Fl_Grid *self) {
LOCK(self->layout());
}

void Fl_Grid_clear_layout(Fl_Grid *self) {
LOCK(self->clear_layout());
}

void Fl_Grid_set_need_layout(Fl_Grid *self, int set) {
LOCK(self->need_layout(set));
}

int Fl_Grid_need_layout(const Fl_Grid *self) {
LOCK(auto ret = self->need_layout());
return ret;
}

void Fl_Grid_set_margin(Fl_Grid *self, int left, int top, int right, int bottom) {
LOCK(self->margin(left, top, right, bottom));
}

void Fl_Grid_set_gap(Fl_Grid *self, int row_gap, int col_gap) {
LOCK(self->gap(row_gap, col_gap));
}

void *Fl_Grid_set_widget(Fl_Grid *self, Fl_Widget *wi, int row, int col, unsigned short align) {
LOCK(self->widget(wi, row, col, align));
}

void *Fl_Grid_set_widget_ext(Fl_Grid *self, Fl_Widget *wi, int row, int col, int rowspan,
int colspan, unsigned short align) {
LOCK(self->widget(wi, row, col, rowspan, colspan, align));
}

void Fl_Grid_set_col_width(Fl_Grid *self, int col, int value) {
LOCK(self->col_width(col, value));
}

void Fl_Grid_set_col_weight(Fl_Grid *self, int col, int value) {
LOCK(self->col_weight(col, value));
}

void Fl_Grid_set_col_gap(Fl_Grid *self, int col, int value) {
LOCK(self->col_gap(col, value));
}

void Fl_Grid_set_row_height(Fl_Grid *self, int row, int value) {
LOCK(self->row_height(row, value));
}

void Fl_Grid_set_row_weight(Fl_Grid *self, int row, int value) {
LOCK(self->row_weight(row, value));
}

void Fl_Grid_set_row_gap(Fl_Grid *self, int row, int value) {
LOCK(self->row_gap(row, value));
}

void Fl_Grid_show_grid(Fl_Grid *self, int set) {
LOCK(self->show_grid(set));
}

void Fl_Grid_show_grid_with_color(Fl_Grid *self, int set, unsigned int col) {
LOCK(self->show_grid(set, (Fl_Color)col));
}

void Fl_Grid_debug(Fl_Grid *self, int level) {
LOCK(self->debug(level));
}

GROUP_DEFINE(Fl_Grid)

0 comments on commit 3a84735

Please sign in to comment.