
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());
}
IA Turbina o Desktop Linux enquanto distros renovam forças
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
IA chega ao desktop e impulsiona produtividade no mundo Linux
Como instalar o repositório do DBeaver no Ubuntu
Como instalar o Plex Media Server no Ubuntu
Digitando underscore com "shift" + "barra de espaços"
Como ativar a lixeira e recuperar aquivos deletados em um servidor Linux
Como mudar o nome de dispositivos Bluetooth via linha de comando
O programa assinador digital (5)
Assinador JNLP do Site Portal da Nota Fiscal Eletrônica (5)









