HYPER MIKAN BOX
検索
最近の変更
メディアマネージャー
サイトマップ
文書の表示
以前のリビジョン
バックリンク
ログイン
トレース:
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== バリュエーター ====== [[fltk:|{{:fltk:fltk_shadow.png?200|}}]] バリュエーターは、 実数値入力装置と訳されます。 その名の通り、ユーザーが浮動小数点数の値を入力を支援するために利用されます。 Fl_Valuatorクラスをベースクラスとして、様々な形態の派生クラスが提供されています。 ボタンもそうでしたが、このような多様なバリュエーターを提供するのはFLTKの一つの特徴と言えるでしょう。 リファレンスページに各種バリュエーターを実際にプログラムに配置したときのサンプル画像が掲載されています。 [[https://www.fltk.org/doc-1.4/classFl__Valuator.html#details|{{ https://www.fltk.org/doc-1.4/valuators.png |FLTKが提供する様々なバリュエーター}}]] 普段使いのGUIアプリケーションではあまり見慣れないものもありますが、初めてでも説明なしになんとなく使い方がわかる直感的なデザインになっています。 ===== Fl_Valuator クラス ===== [[https://www.fltk.org/doc-1.4/classFl__Valuator.html|{{ https://www.fltk.org/doc-1.4/classFl__Valuator.png |Fl_Valueatorクラスの階層図}}]] Fl_Valuatorクラスは抽象クラスではありませんが、コンストラクタがprotectedであるために、ユーザーが直接インスタンスオブジェクトを作成することはできません。 より用途が特化された派生クラスに継承されることで共通の性質を提供するためのベースクラスとして存在しています。 ==== Fl_Counter クラス ==== [[https://www.fltk.org/doc-1.4/classFl__Counter.html|{{ https://www.fltk.org/doc-1.4/classFl__Counter.png |Fl_Valueatorクラス前後の階層図}}]] [{{ :fltk:fltk_widget_demo_counter1.jpg |Fl_Counterクラスのウィジェットを使ったサンプルプログラム}}] <code cpp> #include <FL/Fl.H> #include <FL/Fl_Counter.H> #include <FL/Fl_Window.H> int main(int argc, char **argv) { auto window = new Fl_Window{400, 300, "Fl_Counter demo"}; auto counter1 = new Fl_Counter{50, 30, 300, 30, "Label 1 is placed on the bottom"}; auto counter2 = new Fl_Counter{50, 100, 300, 50, "Label 2 is placed on the bottom"}; auto counter3 = new Fl_Counter{50, 190, 300, 70, "Label 3 is placed on the bottom"}; counter1->range(-1, 1); counter1->step(0.01, 0.1); counter2->minimum(-99); counter2->maximum(99); counter2->step(1, 10); counter3->range(0, 1); counter3->precision(5); counter3->lstep(0.1); counter3->value(0.5); window->end(); window->show(argc, argv); return Fl::run(); } </code> ==== Fl_Dial クラス ==== [[https://www.fltk.org/doc-1.4/classFl__Dial.html|{{ https://www.fltk.org/doc-1.4/classFl__Dial.png |Fl_Dialクラス前後の階層図}}]] [{{ :fltk:fltk_widget_demo_dial1.jpg |Fl_Dialクラスのウィジェットを使ったサンプルプログラム}}] <code cpp> #include <FL/Fl.H> #include <FL/Fl_Dial.H> #include <FL/Fl_Window.H> int main(int argc, char **argv) { auto window = new Fl_Window{400, 300, "Fl_Dial demo"}; auto dial1 = new Fl_Dial{90, 30, 100, 100, "Right eye"}; auto dial2 = new Fl_Dial{210, 30, 100, 100, "Left eye"}; auto dial3 = new Fl_Dial{120, 180, 150, 50, "Mouse"}; dial3->type(FL_FILL_DIAL); dial3->angles(15, 345); window->end(); window->show(argc, argv); return Fl::run(); } </code> ==== Fl_Roller クラス ==== [[https://www.fltk.org/doc-1.4/classFl__Roller.html|{{ https://www.fltk.org/doc-1.4/classFl__Roller.png |Fl_Rollerクラス前後の階層図}}]] [{{ :fltk:fltk_widget_demo_roller1.jpg |Fl_Rollerクラスのウィジェットを使ったサンプルプログラム}}] <code cpp> #include <FL/Fl.H> #include <FL/Fl_Output.H> #include <FL/Fl_Roller.H> #include <FL/Fl_Window.H> void roller_callback(Fl_Widget *w, void *data) { if (auto roller = dynamic_cast<Fl_Roller *>(w)) { if (auto output = static_cast<Fl_Output *>(data)) { output->value(roller->value()); } } } int main(int argc, char **argv) { auto window = new Fl_Window{400, 300, "Fl_Roller demo"}; auto roller1 = new Fl_Roller{50, 50, 20, 100, "Roller 1"}; auto roller2 = new Fl_Roller{120, 50, 30, 200, "Roller 2"}; auto roller3 = new Fl_Roller{200, 50, 150, 30, "Roller 3"}; roller3->type(FL_HORIZONTAL); roller3->range(-123.0, 123.0); roller3->step(123.0, 1000); auto output1 = new Fl_Output{250, 130, 100, 30, "Value 1"}; auto output2 = new Fl_Output{250, 180, 100, 30, "Value 2"}; auto output3 = new Fl_Output{250, 230, 100, 30, "Value 3"}; roller1->callback(roller_callback, output1); roller2->callback(roller_callback, output2); roller3->callback(roller_callback, output3); window->end(); window->show(argc, argv); return Fl::run(); } </code> ==== Fl_Slider クラス ==== [[https://www.fltk.org/doc-1.4/classFl__Slider.html|{{ https://www.fltk.org/doc-1.4/classFl__Slider.png |Fl_Sliderクラス前後の階層図}}]] [{{ :fltk:fltk_widget_demo_slider1.jpg |Fl_Sliderクラスのウィジェットを使ったサンプルプログラム}}] <code cpp> #include <FL/Fl.H> #include <FL/Fl_Output.H> #include <FL/Fl_Slider.H> #include <FL/Fl_Window.H> void slider_callback(Fl_Widget *w, void *data) { if (auto slider = dynamic_cast<Fl_Slider *>(w)) { if (auto output = static_cast<Fl_Output *>(data)) { output->value(slider->value()); } } } int main(int argc, char **argv) { auto window = new Fl_Window{400, 300, "Fl_Slider demo"}; auto slider1 = new Fl_Slider{50, 50, 20, 100, "Slider 1"}; auto slider2 = new Fl_Slider{120, 50, 30, 200, "Slider 2"}; auto slider3 = new Fl_Slider{200, 50, 150, 30, "Slider 3"}; slider2->type(FL_VERT_NICE_SLIDER); slider3->type(FL_HORIZONTAL); slider3->range(-123.0, 123.0); slider3->step(123.0, 1000); auto output1 = new Fl_Output{250, 130, 100, 30, "Value 1"}; auto output2 = new Fl_Output{250, 180, 100, 30, "Value 2"}; auto output3 = new Fl_Output{250, 230, 100, 30, "Value 3"}; slider1->callback(slider_callback, output1); slider2->callback(slider_callback, output2); slider3->callback(slider_callback, output3); window->end(); window->show(argc, argv); return Fl::run(); } </code> === Fl_Scrollbar クラス === [[https://www.fltk.org/doc-1.4/classFl__Scrollbar.html|{{ https://www.fltk.org/doc-1.4/classFl__Scrollbar.png |Fl_Scrollbarクラス前後の階層図}}]] [{{ :fltk:fltk_widget_demo_scrollbar1.jpg |Fl_Scrollbarクラスのウィジェットを使ったサンプルプログラム}}] <code cpp> #include <FL/Fl.H> #include <FL/Fl_Output.H> #include <FL/Fl_Scrollbar.H> #include <FL/Fl_Window.H> void scrollbar_callback(Fl_Widget *w, void *data) { if (auto scrollbar = dynamic_cast<Fl_Scrollbar *>(w)) { if (auto output = static_cast<Fl_Output *>(data)) { output->value(scrollbar->value()); } } } int main(int argc, char **argv) { auto window = new Fl_Window{400, 300, "Fl_Scrollbar demo"}; auto scrollbar1 = new Fl_Scrollbar{50, 50, 20, 100, "Scrollbar 1"}; auto scrollbar2 = new Fl_Scrollbar{120, 50, 30, 200, "Scrollbar 2"}; auto scrollbar3 = new Fl_Scrollbar{200, 50, 150, 30, "Scrollbar 3"}; scrollbar2->type(FL_VERT_NICE_SLIDER); scrollbar2->range(-100, 100); scrollbar3->type(FL_HORIZONTAL); scrollbar3->range(-123.0, 123.0); scrollbar3->step(123.0, 1000); auto output1 = new Fl_Output{250, 130, 100, 30, "Value 1"}; auto output2 = new Fl_Output{250, 180, 100, 30, "Value 2"}; auto output3 = new Fl_Output{250, 230, 100, 30, "Value 3"}; scrollbar1->callback(scrollbar_callback, output1); scrollbar2->callback(scrollbar_callback, output2); scrollbar3->callback(scrollbar_callback, output3); window->end(); window->show(argc, argv); return Fl::run(); } </code> === Fl_Value_Slider クラス === [[https://www.fltk.org/doc-1.4/classFl__Value__Slider.html|{{ https://www.fltk.org/doc-1.4/classFl__Value__Slider.png |Fl_Value_Sliderクラス前後の階層図}}]] [{{ :fltk:fltk_widget_demo_value_slider1.jpg |Fl_Sliderクラスのウィジェットを使ったサンプルプログラム}}] <code cpp> #include <FL/Fl.H> #include <FL/Fl_Output.H> #include <FL/Fl_Value_Slider.H> #include <FL/Fl_Window.H> void slider_callback(Fl_Widget *w, void *data) { if (auto slider = dynamic_cast<Fl_Value_Slider *>(w)) { if (auto output = static_cast<Fl_Output *>(data)) { output->value(slider->value()); } } } int main(int argc, char **argv) { auto window = new Fl_Window{400, 300, "Fl_Value_Slider demo"}; auto slider1 = new Fl_Value_Slider{50, 50, 20, 100, "Value Slider 1"}; auto slider2 = new Fl_Value_Slider{120, 50, 30, 200, "Value Slider 2"}; auto slider3 = new Fl_Value_Slider{200, 50, 150, 30, "Value Slider 3"}; slider2->type(FL_VERT_NICE_SLIDER); slider2->range(-100, 100); slider3->type(FL_HORIZONTAL); slider3->range(-123.0, 123.0); slider3->step(123.0, 1000); auto output1 = new Fl_Output{250, 130, 100, 30, "Value 1"}; auto output2 = new Fl_Output{250, 180, 100, 30, "Value 2"}; auto output3 = new Fl_Output{250, 230, 100, 30, "Value 3"}; slider1->callback(slider_callback, output1); slider2->callback(slider_callback, output2); slider3->callback(slider_callback, output3); window->end(); window->show(argc, argv); return Fl::run(); } </code> ===== リファレンス文書へのリンク ===== * [[https://www.fltk.org/doc-1.4/classFl__Valuator.html|Fl_Valuatorクラス]] * [[https://www.fltk.org/doc-1.4/classFl__Counter.html|Fl_Counterクラス]] * [[https://www.fltk.org/doc-1.4/classFl__Dial.html|Fl_Dialクラス]] * [[https://www.fltk.org/doc-1.4/classFl__Roller.html|Fl_Rollerクラス]] * [[https://www.fltk.org/doc-1.4/classFl__Slider.html|Fl_Sliderクラス]] * [[https://www.fltk.org/doc-1.4/classFl__Scrollbar.html|Fl_Scrollbarクラス]] * [[https://www.fltk.org/doc-1.4/classFl__Value__Slider.html|Fl_Value_Sliderクラス]]
文書の先頭へ