[C++] 15 FLTK:Fl_Radio_Round_Button

[M1 Mac, Big Sur 11.6.5, FLTK 1.3.8]

PyQt6アプリのGUI画面を移植しました。

Fl_Round_Buttonはラジオボタン機能を持っていないただの丸いボタンだったので、Fl_Radio_Round_Buttonに変更しました。

ガワだけというのもありますが、爆速な起動に改めて感動しました。こうじゃないとC++を扱う意味がありません。

FLTKのあまりの癖の強さにGTKへの移行を考えたのですが、メンバ関数名の余計な変更など向こうの方がやりたい放題でした。やっぱりこちらのお世話になります。

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Tooltip.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Radio_Round_Button.H>
#include <FL/Fl_Hor_Slider.H>
#include <FL/Fl_Multiline_Output.H>

int main(int argc, char **argv) {
    Fl_Window *window = new Fl_Window(100,100,360,220,"IMAGE INSPECTOR");
    window->color(fl_rgb_color(112,128,144));
    
    // File
    Fl_Box *file = new Fl_Box(15,15,35,16,"File");
    file->labelsize(14);
    file->labelcolor(fl_rgb_color(255,239,213));
    file->align(Fl_Align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT));

    Fl_Input *file_input = new Fl_Input(50,10,220,25,"");

    Fl_Group *radio_btns = new Fl_Group(50,40,90,70,"");{
        radio_btns->labelsize(12);
        // Inspect
        Fl_Radio_Round_Button *inspect = new Fl_Radio_Round_Button(50,40,90,20,"Inspect");
        inspect->labelcolor(fl_rgb_color(255,239,213));
        inspect->setonly();
        // Resize
        Fl_Radio_Round_Button *resize = new Fl_Radio_Round_Button(50,65,90,20,"Resize");
        resize->labelcolor(fl_rgb_color(255,239,213));
        // icns作成
        Fl_Radio_Round_Button *icns = new Fl_Radio_Round_Button(50,90,90,20,"icns作成");
        icns->labelcolor(fl_rgb_color(255,239,213));
    }
    radio_btns->end();

    Fl_Box *width_label = new Fl_Box(135,70,15,10,"W");
    width_label->labelsize(12);
    width_label->labelcolor(fl_rgb_color(255,239,213));
    width_label->align(Fl_Align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT));
    
    Fl_Input *width = new Fl_Input(155,65,45,20,"");

    Fl_Box *height_label = new Fl_Box(205,70,15,10,"H");
    height_label->labelcolor(fl_rgb_color(255,239,213));
    height_label->labelsize(12);
    height_label->align(Fl_Align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT));
    
    Fl_Input *height = new Fl_Input(220,65,45,20,"");

    Fl_Button *execution = new Fl_Button(290,10,50,30,"実行");
    execution->color(fl_rgb_color(112,128,144));
    execution->labelcolor(fl_rgb_color(255,239,213));
    execution->labelsize(14);

    Fl_Button *clear = new Fl_Button(290,50,50,30,"クリア");
    clear->color(fl_rgb_color(112,128,144));
    clear->labelcolor(fl_rgb_color(255,239,213));
    clear->labelsize(14);

    Fl_Multiline_Output *output = new Fl_Multiline_Output(50,115,240,100,"");

    window->end();
    window->show(argc, argv);
    return Fl::run();
}
Fl_Radio_Round_Button
Fl_Round_Buttonではグループ化できず