差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
fltk:widget-basic-valuators [2025/06/02 16:02] – Add links to class reference documents freemikan | fltk:widget-basic-valuators [2025/06/06 07:29] (現在) – [バリュエーター] Fix typo freemikan | ||
---|---|---|---|
行 2: | 行 2: | ||
[[fltk: | [[fltk: | ||
+ | バリュエーターは、 実数値入力装置と訳されます。 | ||
+ | その名の通り、ユーザーが浮動小数点数の値を入力を支援するために利用されます。 | ||
+ | Fl_Valuatorクラスをベースクラスとして、様々な形態の派生クラスが提供されています。 | ||
+ | ボタンもそうでしたが、このような多様なバリュエーターを提供するのはFLTKの一つの特徴と言えるでしょう。 | ||
- | ===== Fl_Valuatorクラス ===== | + | リファレンスページに各種バリュエーターを実際にプログラムに配置したときのサンプル画像が掲載されています。 |
- | {{ https:// | + | |
+ | [[https:// | ||
- | ==== Fl_Counterクラス ==== | + | 普段使いのGUIアプリケーションではあまり見慣れないものもありますが、初めてでも説明なしになんとなく使い方がわかる直感的なデザインになっています。 |
- | {{ https:// | + | |
- | ==== Fl_Dialクラス ==== | + | ===== Fl_Valuator |
- | {{ https:// | + | [[https:// |
+ | Fl_Valuatorクラスは抽象クラスではありませんが、コンストラクタがprotectedであるために、ユーザーが直接インスタンスオブジェクトを作成することはできません。 | ||
+ | より用途が特化された派生クラスに継承されることで共通の性質を提供するためのベースクラスとして存在しています。 | ||
- | ==== Fl_Rollerクラス ==== | ||
- | {{ https:// | ||
+ | ==== Fl_Counter クラス ==== | ||
+ | [[https:// | ||
- | ==== Fl_Sliderクラス ==== | + | [{{ :fltk: |
- | {{ https://www.fltk.org/ | + | |
+ | <code cpp> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
- | === Fl_Scrollbarクラス === | + | int main(int argc, char **argv) { |
- | {{ https:// | + | auto window |
+ | auto counter1 | ||
+ | auto counter2 | ||
+ | auto counter3 = new Fl_Counter{50, 190, 300, 70, "Label 3 is placed on the bottom" | ||
+ | |||
+ | counter1-> | ||
+ | counter1-> | ||
+ | |||
+ | counter2-> | ||
+ | counter2-> | ||
+ | counter2-> | ||
+ | counter3-> | ||
+ | counter3-> | ||
+ | counter3-> | ||
+ | counter3-> | ||
+ | | ||
+ | window-> | ||
+ | window-> | ||
+ | return Fl::run(); | ||
+ | } | ||
+ | </ | ||
- | === Fl_Value_Sliderクラス === | + | |
- | {{ https:// | + | ==== Fl_Dial クラス ==== |
+ | [[https:// | ||
+ | |||
+ | [{{ : | ||
+ | |||
+ | <code cpp> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | int main(int argc, char **argv) { | ||
+ | auto window = new Fl_Window{400, | ||
+ | auto dial1 = new Fl_Dial{90, 30, 100, 100, "Right eye" | ||
+ | auto dial2 = new Fl_Dial{210, | ||
+ | auto dial3 = new Fl_Dial{120, | ||
+ | |||
+ | dial3-> | ||
+ | dial3-> | ||
+ | |||
+ | window-> | ||
+ | window-> | ||
+ | return Fl:: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Fl_Roller クラス ==== | ||
+ | [[https:// | ||
+ | |||
+ | [{{ : | ||
+ | |||
+ | <code cpp> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | void roller_callback(Fl_Widget *w, void *data) { | ||
+ | if (auto roller = dynamic_cast< | ||
+ | if (auto output = static_cast< | ||
+ | output-> | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | int main(int argc, char **argv) { | ||
+ | auto window = new Fl_Window{400, | ||
+ | auto roller1 = new Fl_Roller{50, | ||
+ | auto roller2 = new Fl_Roller{120, | ||
+ | auto roller3 = new Fl_Roller{200, | ||
+ | |||
+ | roller3-> | ||
+ | roller3-> | ||
+ | roller3-> | ||
+ | |||
+ | auto output1 = new Fl_Output{250, | ||
+ | auto output2 = new Fl_Output{250, | ||
+ | auto output3 = new Fl_Output{250, | ||
+ | |||
+ | roller1-> | ||
+ | roller2-> | ||
+ | roller3-> | ||
+ | |||
+ | window-> | ||
+ | window-> | ||
+ | return Fl:: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Fl_Slider クラス ==== | ||
+ | [[https:// | ||
+ | |||
+ | [{{ : | ||
+ | |||
+ | <code cpp> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | void slider_callback(Fl_Widget *w, void *data) { | ||
+ | if (auto slider = dynamic_cast< | ||
+ | if (auto output = static_cast< | ||
+ | output-> | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | int main(int argc, char **argv) { | ||
+ | auto window = new Fl_Window{400, | ||
+ | auto slider1 = new Fl_Slider{50, | ||
+ | auto slider2 = new Fl_Slider{120, | ||
+ | auto slider3 = new Fl_Slider{200, | ||
+ | |||
+ | slider2-> | ||
+ | |||
+ | slider3-> | ||
+ | slider3-> | ||
+ | slider3-> | ||
+ | |||
+ | auto output1 = new Fl_Output{250, | ||
+ | auto output2 = new Fl_Output{250, | ||
+ | auto output3 = new Fl_Output{250, | ||
+ | |||
+ | slider1-> | ||
+ | slider2-> | ||
+ | slider3-> | ||
+ | |||
+ | window-> | ||
+ | window-> | ||
+ | return Fl:: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | === Fl_Scrollbar クラス === | ||
+ | [[https:// | ||
+ | |||
+ | [{{ : | ||
+ | |||
+ | <code cpp> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | void scrollbar_callback(Fl_Widget *w, void *data) { | ||
+ | if (auto scrollbar = dynamic_cast< | ||
+ | if (auto output = static_cast< | ||
+ | output-> | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | int main(int argc, char **argv) { | ||
+ | auto window = new Fl_Window{400, | ||
+ | auto scrollbar1 = new Fl_Scrollbar{50, | ||
+ | auto scrollbar2 = new Fl_Scrollbar{120, | ||
+ | auto scrollbar3 = new Fl_Scrollbar{200, | ||
+ | |||
+ | scrollbar2-> | ||
+ | scrollbar2-> | ||
+ | |||
+ | scrollbar3-> | ||
+ | scrollbar3-> | ||
+ | scrollbar3-> | ||
+ | |||
+ | auto output1 = new Fl_Output{250, | ||
+ | auto output2 = new Fl_Output{250, | ||
+ | auto output3 = new Fl_Output{250, | ||
+ | |||
+ | scrollbar1-> | ||
+ | scrollbar2-> | ||
+ | scrollbar3-> | ||
+ | |||
+ | window-> | ||
+ | window-> | ||
+ | return Fl:: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | === Fl_Value_Slider クラス === | ||
+ | [[https:// | ||
+ | |||
+ | [{{ : | ||
+ | |||
+ | <code cpp> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | void slider_callback(Fl_Widget *w, void *data) { | ||
+ | if (auto slider = dynamic_cast< | ||
+ | if (auto output = static_cast< | ||
+ | output-> | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | int main(int argc, char **argv) { | ||
+ | auto window = new Fl_Window{400, | ||
+ | auto slider1 = new Fl_Value_Slider{50, | ||
+ | auto slider2 = new Fl_Value_Slider{120, | ||
+ | auto slider3 = new Fl_Value_Slider{200, | ||
+ | |||
+ | slider2-> | ||
+ | slider2-> | ||
+ | |||
+ | slider3-> | ||
+ | slider3-> | ||
+ | slider3-> | ||
+ | |||
+ | auto output1 = new Fl_Output{250, | ||
+ | auto output2 = new Fl_Output{250, | ||
+ | auto output3 = new Fl_Output{250, | ||
+ | |||
+ | slider1-> | ||
+ | slider2-> | ||
+ | slider3-> | ||
+ | |||
+ | window-> | ||
+ | window-> | ||
+ | return Fl:: | ||
+ | } | ||
+ | </ | ||
===== リファレンス文書へのリンク ===== | ===== リファレンス文書へのリンク ===== | ||
+ | * [[https:// | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// |