Enviado em 02/06/2020 - 22:02h
Conheci a FLTK após minha enorme decepção com a wxWidgets.#include <FL/Fl_Window.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Table_Row.H>
class Grid_Class: public Fl_Table_Row { // Aqui foi criado uma Classe, não queria fazer isso!
protected:
void draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0);
public:
Grid_Class(int x, int y, int w, int h, const char *l=0): Fl_Table_Row(x,y,w,h,l) { end(); }
~Grid_Class() {}
};
// Quero também essa função no main, pois não quero uma função pra isso!
void Grid_Class::draw_cell(TableContext context, int R, int C, int X, int Y, int W, int H) {
static char s[40];
sprintf(s, "%d/%d", R, C);
switch(context) {
case CONTEXT_STARTPAGE:
fl_font(FL_SCREEN, 12);
return;
case CONTEXT_ROW_HEADER:
case CONTEXT_COL_HEADER:
fl_push_clip(X, Y, W, H);
fl_draw_box(FL_FLAT_BOX, X, Y, W, H, 219);
fl_color(FL_WHITE);
fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
fl_pop_clip();
return;
case CONTEXT_CELL:
fl_push_clip(X, Y, W, H);
// BG COLOR
fl_color(row_selected(R) ? selection_color(): FL_WHITE);
fl_rectf(X, Y, W, H);
// TEXT
fl_color(219);
fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
// BORDER
fl_color(FL_LIGHT2);
fl_rect(X, Y, W, H);
fl_pop_clip();
return;
default:
return;
}
}
int main() {
Fl_Window FrmMain(325, 150);
Grid_Class table1(0, 0, 325, 150);
table1.color((Fl_Color)53);
table1.selection_color(53);
table1.rows(5);
table1.cols(4);
table1.col_header(1);
table1.end();
FrmMain.show();
return(Fl::run());
}
tux-gpt - Assistente de IA para o Terminal
Instalação e configuração do Chrony
Programa IRPF - Guia de Instalação e Resolução de alguns Problemas
O Que Fazer Após Instalar Ubuntu 25.04
O Que Fazer Após Instalar Fedora 42
Debian 12 -- Errata - Correções de segurança
Instalando o Pi-Hole versão v5.18.4 depois do lançamento da versão v6.0
Alguém poderia me ajudar a escolher peças pra montar um desktop? (24)
Copiar Layout do Teclado para aplicar em outra Distribuição (3)