差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
| fltk:widget-basic-texts [2025/05/30 13:50] – [テキスト] Set a link to fltk: page for FLTK logo freemikan | fltk:widget-basic-texts [2025/06/12 11:50] (現在) – [参照] Simplify freemikan | ||
|---|---|---|---|
| 行 2: | 行 2: | ||
| [[fltk: | [[fltk: | ||
| + | このページではテキストの入力をするためのウィジェットと、表示するためのウィジェットを紹介します。 | ||
| + | 最も基本となるのはFl_Inputクラスです。 | ||
| + | ボタンと同じように、そこからより特化された用途のウィジェットが派生クラスとして提供されています。 | ||
| + | しかし、Fl_Inputクラスをベースとしたウィジェット以外にもテキストの入力と表示に利用できるウィジェットがあるります。 | ||
| + | そこで、このページではFl_Inputクラスの派生クラスに限定しないでそれらを紹介したいと思います。 | ||
| - | ===== Fl_Inputクラス ===== | ||
| - | Fl_Inputクラス前後のクラス階層図 | + | ===== Fl_Inputクラス |
| + | <WRAP centeralign> | ||
| {{ https:// | {{ https:// | ||
| + | Fl_Inputクラス前後のクラス階層図 | ||
| + | </ | ||
| + | [{{ : | ||
| - | ===== Fl_Outputクラス ===== | + | <code cpp> |
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| - | Fl_Outputクラス前後のクラス階層図 | + | int main(int argc, char **argv) { |
| - | {{ https:// | + | auto window = new Fl_Window{400, 300, " |
| + | auto input1 = new Fl_Input{150, 85, 200, 30, "Your name" | ||
| + | auto input2 = new Fl_Input{150, | ||
| + | auto input3 = new Fl_Input{150, 185, 200, 30, " | ||
| + | window-> | ||
| + | window-> | ||
| + | return Fl:: | ||
| + | } | ||
| + | </ | ||
| - | ===== Fl_Multiline_Inputクラス | + | ==== Fl_Multiline_Inputクラス ==== |
| - | + | <WRAP centeralign> | |
| - | Fl_Multiline_Inputクラス前後のクラス階層図 | + | |
| {{ https:// | {{ https:// | ||
| + | Fl_Multiline_Inputクラス前後のクラス階層図 | ||
| + | </ | ||
| + | [{{ : | ||
| - | ===== Fl_Multiline_Outputクラス ===== | + | <code cpp> |
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| - | Fl_Multiline_Outputクラス前後のクラス階層図 | + | int main(int argc, char **argv) { |
| + | auto window = new Fl_Window{400, | ||
| + | auto input1 = new Fl_Multiline_Input{150, | ||
| + | auto input2 = new Fl_Multiline_Input{150, | ||
| + | auto input3 = new Fl_Multiline_Input{150, | ||
| + | |||
| + | window-> | ||
| + | window-> | ||
| + | return Fl:: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Fl_Outputクラス ==== | ||
| + | <WRAP centeralign> | ||
| + | {{ https:// | ||
| + | Fl_Inputクラス前後のクラス階層図 | ||
| + | </ | ||
| + | |||
| + | [{{ : | ||
| + | |||
| + | <code cpp> | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | int main(int argc, char **argv) { | ||
| + | auto window = new Fl_Window{400, | ||
| + | auto output1 = new Fl_Output{130, | ||
| + | auto output2 = new Fl_Output{130, | ||
| + | auto output3 = new Fl_Output{130, | ||
| + | |||
| + | output1-> | ||
| + | output2-> | ||
| + | output3-> | ||
| + | |||
| + | window-> | ||
| + | window-> | ||
| + | return Fl:: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | === Fl_Multiline_Outputクラス === | ||
| + | <WRAP centeralign> | ||
| {{ https:// | {{ https:// | ||
| + | Fl_Multiline_Outputクラス前後のクラス階層図 | ||
| + | </ | ||
| + | [{{ : | ||
| - | ===== Fl_Text_Displayクラス ===== | + | <code cpp> |
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| - | Fl_Text_Displayクラス前後のクラス階層図 | + | int main(int argc, char **argv) { |
| + | auto window = new Fl_Window{400, | ||
| + | auto output1 = new Fl_Multiline_Output{130, | ||
| + | auto output2 = new Fl_Multiline_Output{130, | ||
| + | auto output3 = new Fl_Multiline_Output{130, | ||
| + | |||
| + | output1-> | ||
| + | output2-> | ||
| + | output3-> | ||
| + | |||
| + | window-> | ||
| + | window-> | ||
| + | return Fl:: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Fl_Text_Displayクラス | ||
| + | <WRAP centeralign> | ||
| {{ https:// | {{ https:// | ||
| + | Fl_Text_Displayクラス前後のクラス階層図 | ||
| + | </ | ||
| + | [{{ : | ||
| - | ===== Fl_Text_Editorクラス ===== | + | <code cpp> |
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| - | Fl_Text_Editorクラス前後のクラス階層図 | + | int main(int argc, char **argv) { |
| + | auto window = new Fl_Window{400, | ||
| + | auto disp1 = new Fl_Text_Display{50, | ||
| + | auto disp2 = new Fl_Text_Display{50, | ||
| + | auto disp3 = new Fl_Text_Display{50, | ||
| + | |||
| + | auto buffer1 = new Fl_Text_Buffer; | ||
| + | auto buffer2 = new Fl_Text_Buffer; | ||
| + | auto buffer3 = new Fl_Text_Buffer; | ||
| + | disp1-> | ||
| + | disp2-> | ||
| + | disp3-> | ||
| + | |||
| + | disp1-> | ||
| + | disp2-> | ||
| + | |||
| + | disp3-> | ||
| + | disp3-> | ||
| + | disp3-> | ||
| + | disp3-> | ||
| + | disp3-> | ||
| + | |||
| + | window-> | ||
| + | window-> | ||
| + | return Fl:: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Fl_Text_Editorクラス | ||
| + | <WRAP centeralign> | ||
| {{ https:// | {{ https:// | ||
| + | Fl_Text_Displayクラス前後のクラス階層図 | ||
| + | </ | ||
| + | [{{ : | ||
| - | ===== Fl_Help_Viewクラス ===== | + | <code cpp> |
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | int main(int argc, char **argv) { | ||
| + | auto window = new Fl_Window{400, | ||
| + | auto editor1 = new Fl_Text_Editor{50, | ||
| + | auto editor2 = new Fl_Text_Editor{50, | ||
| + | auto editor3 = new Fl_Text_Editor{50, | ||
| + | |||
| + | auto buffer1 = new Fl_Text_Buffer; | ||
| + | auto buffer2 = new Fl_Text_Buffer; | ||
| + | auto buffer3 = new Fl_Text_Buffer; | ||
| + | editor1-> | ||
| + | editor2-> | ||
| + | editor3-> | ||
| + | | ||
| + | editor1-> | ||
| + | editor2-> | ||
| + | |||
| + | editor3-> | ||
| + | editor3-> | ||
| + | editor3-> | ||
| + | editor3-> | ||
| + | |||
| + | window-> | ||
| + | window-> | ||
| + | return Fl::run(); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Fl_Help_Viewクラス ===== | ||
| + | <WRAP centeralign> | ||
| + | {{ https:// | ||
| Fl_Help_Viewクラス前後のクラス階層図 | Fl_Help_Viewクラス前後のクラス階層図 | ||
| - | {{ https://www.fltk.org/doc-1.4/classFl__Help__View.png |}} | + | </ |
| + | |||
| + | [{{ :fltk: | ||
| + | |||
| + | <code cpp> | ||
| + | #include <FL/Fl.H> | ||
| + | #include <FL/Fl_Help_View.H> | ||
| + | #include <FL/Fl_Window.H> | ||
| + | |||
| + | #include < | ||
| + | #include < | ||
| + | using namespace std:: | ||
| + | |||
| + | int main(int argc, char **argv) { | ||
| + | auto window = new Fl_Window{400, | ||
| + | auto help_view1 = new Fl_Help_View{50, | ||
| + | auto help_view2 = new Fl_Help_View{50, | ||
| + | auto help_view3 = new Fl_Help_View{50, | ||
| + | |||
| + | help_view1-> | ||
| + | help_view2-> | ||
| + | help_view3-> | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | <body bgcolor="# | ||
| + | <p> | ||
| + | Hello, <font size=" | ||
| + | </ | ||
| + | < | ||
| + | <p> | ||
| + | Lorem <a href=" | ||
| + | Morbi id < | ||
| + | pretium, sit amet dapibus nisi sodales. Donec id dolor ut | ||
| + | metus suscipit iaculis eu interdum orci. Cras quis odio | ||
| + | ullamcorper velit mollis egestas vitae quis purus. Nam et | ||
| + | justo ipsum. Nam pellentesque maximus magna ut blandit. | ||
| + | Suspendisse aliquam nunc mauris, vitae lacinia mauris | ||
| + | tristique vitae. Donec nec malesuada lectus, nec ultrices | ||
| + | justo. | ||
| + | </ | ||
| + | </ | ||
| + | )"); | ||
| + | |||
| + | assert(help_view3-> | ||
| + | |||
| + | window-> | ||
| + | window-> | ||
| + | return Fl:: | ||
| + | } | ||
| + | </ | ||
| - | ===== 参照 | + | ===== リファレンス文書へのリンク |
| - | * [[https:// | + | * [[https:// |
| - | * [[https:// | + | * [[https:// |
| - | * [[https:// | + | * [[https:// |
| - | * [[https:// | + | * [[https:// |
| - | * [[https:// | + | * [[https:// |
| - | * [[https:// | + | * [[https:// |
| - | * [[https:// | + | * [[https:// |
