1 | <HTML> |
---|
2 | <HEAD> |
---|
3 | <TITLE>G - Migrating Code from FLTK 1.0.x</TITLE> |
---|
4 | </HEAD> |
---|
5 | <BODY> |
---|
6 | |
---|
7 | <H1 ALIGN="RIGHT"><A NAME="migration">G - Migrating Code from FLTK 1.0.x</A></H1> |
---|
8 | |
---|
9 | <P>This appendix describes the differences between the FLTK |
---|
10 | 1.0.x and FLTK 1.1.x functions and classes.</P> |
---|
11 | |
---|
12 | <H2>Color Values</H2> |
---|
13 | |
---|
14 | <P>Color values are now stored in a 32-bit unsigned integer |
---|
15 | instead of the unsigned character in 1.0.x. This allows for the |
---|
16 | specification of 24-bit RGB values or 8-bit FLTK color indices. |
---|
17 | |
---|
18 | <P><TT>FL_BLACK</TT> and <TT>FL_WHITE</TT> now remain black and |
---|
19 | white, even if the base color of the gray ramp is changed using |
---|
20 | <A HREF="Fl.html#Fl.background"><TT>Fl::background()</TT></A>. |
---|
21 | <TT>FL_DARK3</TT> and <TT>FL_LIGHT3</TT> can be used instead to |
---|
22 | draw a very dark or a very bright background hue.</P> |
---|
23 | |
---|
24 | <P>Widgets use the new color symbols <TT>FL_FORGROUND_COLOR</TT>, |
---|
25 | <TT>FL_BACKGROUND_COLOR</TT>, <TT>FL_BACKGROUND2_COLOR</TT>, |
---|
26 | <TT>FL_INACTIVE_COLOR</TT>, and <TT>FL_SELECTION_COLOR</TT>. |
---|
27 | More details can be found in the chapter |
---|
28 | <A HREF="enumerations.html#colors">Enumerations</A>.</P> |
---|
29 | |
---|
30 | <H2>Cut and Paste Support</H2> |
---|
31 | |
---|
32 | <P>The FLTK clipboard is now broken into two parts - a local |
---|
33 | selection value and a cut-and-paste value. This allows FLTK to |
---|
34 | support things like highlighting and replacing text that was |
---|
35 | previously cut or copied, which makes FLTK applications behave |
---|
36 | like traditional GUI applications. |
---|
37 | |
---|
38 | <H2>File Chooser</H2> |
---|
39 | |
---|
40 | <P>The file chooser in FLTK 1.1.x is significantly different |
---|
41 | than the one supplied with FLTK 1.0.x. Any code that directly |
---|
42 | references the old <TT>FCB</TT> class or members will need |
---|
43 | to be ported to the new <A |
---|
44 | HREF="Fl_File_Chooser.html"><TT>Fl_File_Chooser</TT></A> |
---|
45 | class.</P> |
---|
46 | |
---|
47 | <H2>Function Names</H2> |
---|
48 | |
---|
49 | <P>Some function names have changed from FLTK 1.0.x to 1.1.x in |
---|
50 | order to avoid name space collisions. You can still use the old |
---|
51 | function names by defining the <CODE>FLTK_1_0_COMPAT</CODE> |
---|
52 | symbol on the command-line when you compile |
---|
53 | (<CODE>-DFLTK_1_0_COMPAT</CODE>) or in your source, e.g.: |
---|
54 | |
---|
55 | <UL><PRE> |
---|
56 | #define FLTK_1_0_COMPAT |
---|
57 | #include <FL/Fl.H> |
---|
58 | #include <FL/Enumerations.H> |
---|
59 | #include <FL/filename.H> |
---|
60 | </PRE></UL> |
---|
61 | |
---|
62 | <P>The following table shows the old and new function names:</P> |
---|
63 | |
---|
64 | <CENTER><TABLE WIDTH="80%" BORDER="1"> |
---|
65 | <TR> |
---|
66 | <TH>Old 1.0.x Name</TH> |
---|
67 | <TH>New 1.1.x Name</TH> |
---|
68 | </TR> |
---|
69 | <TR> |
---|
70 | <TD>contrast()</TD> |
---|
71 | <TD>fl_contrast()</TD> |
---|
72 | </TR> |
---|
73 | <TR> |
---|
74 | <TD>down()</TD> |
---|
75 | <TD>fl_down()</TD> |
---|
76 | </TR> |
---|
77 | <TR> |
---|
78 | <TD>filename_absolute()</TD> |
---|
79 | <TD>fl_filename_absolute()</TD> |
---|
80 | </TR> |
---|
81 | <TR> |
---|
82 | <TD>filename_expand()</TD> |
---|
83 | <TD>fl_filename_expand()</TD> |
---|
84 | </TR> |
---|
85 | <TR> |
---|
86 | <TD>filename_ext()</TD> |
---|
87 | <TD>fl_filename_ext()</TD> |
---|
88 | </TR> |
---|
89 | <TR> |
---|
90 | <TD>filename_isdir()</TD> |
---|
91 | <TD>fl_filename_isdir()</TD> |
---|
92 | </TR> |
---|
93 | <TR> |
---|
94 | <TD>filename_list()</TD> |
---|
95 | <TD>fl_filename_list()</TD> |
---|
96 | </TR> |
---|
97 | <TR> |
---|
98 | <TD>filename_match()</TD> |
---|
99 | <TD>fl_filename_match()</TD> |
---|
100 | </TR> |
---|
101 | <TR> |
---|
102 | <TD>filename_name()</TD> |
---|
103 | <TD>fl_filename_name()</TD> |
---|
104 | </TR> |
---|
105 | <TR> |
---|
106 | <TD>filename_relative()</TD> |
---|
107 | <TD>fl_filename_relative()</TD> |
---|
108 | </TR> |
---|
109 | <TR> |
---|
110 | <TD>filename_setext()</TD> |
---|
111 | <TD>fl_filename_setext()</TD> |
---|
112 | </TR> |
---|
113 | <TR> |
---|
114 | <TD>frame()</TD> |
---|
115 | <TD>fl_frame()</TD> |
---|
116 | </TR> |
---|
117 | <TR> |
---|
118 | <TD>inactive()</TD> |
---|
119 | <TD>fl_inactive()</TD> |
---|
120 | </TR> |
---|
121 | <TR> |
---|
122 | <TD>numericsort()</TD> |
---|
123 | <TD>fl_numericsort()</TD> |
---|
124 | </TR> |
---|
125 | </TABLE></CENTER> |
---|
126 | |
---|
127 | <H2>Image Support</H2> |
---|
128 | |
---|
129 | <P>Image support in FLTK has been significantly revamped in |
---|
130 | 1.1.x. The <A HREF="Fl_Image.html"><TT>Fl_Image</TT></A> class |
---|
131 | is now a proper base class, with the core image drawing |
---|
132 | functionality in the <A |
---|
133 | HREF="Fl_Bitmap.html"><TT>Fl_Bitmap</TT></A>, <A |
---|
134 | HREF="Fl_Pixmap.html"><TT>Fl_Pixmap</TT></A>, and <A |
---|
135 | HREF="Fl_RGB_Image.html"><TT>Fl_RGB_Image</TT></A> classes. |
---|
136 | |
---|
137 | <P>BMP, GIF, JPEG, PNG, XBM, and XPM image files can now be |
---|
138 | loaded using the appropriate image classes, and the <A |
---|
139 | HREF="Fl_Shared_Image.html"><TT>Fl_Shared_Image</TT></A> class |
---|
140 | can be used to cache images in memory. |
---|
141 | |
---|
142 | <P>Image labels are no longer provided as an add-on label type. |
---|
143 | If you use the old <TT>label()</TT> methods on an image, the |
---|
144 | widget's <TT>image()</TT> method is called to set the image |
---|
145 | as the label. |
---|
146 | |
---|
147 | <P>Image labels in menu items must still use the old labeltype |
---|
148 | mechanism to preserve source compatibility. |
---|
149 | |
---|
150 | <H2>Keyboard Navigation</H2> |
---|
151 | |
---|
152 | <P>FLTK 1.1.x now supports keyboard navigation and control with |
---|
153 | all widgets. To restore the old FLTK 1.0.x behavior so that only |
---|
154 | text widgets get keyboard focus, call the <A |
---|
155 | HREF="Fl.html#Fl.visible_focus"><CODE>Fl::visible_focus()</CODE></A> |
---|
156 | method to disable it: |
---|
157 | |
---|
158 | <UL><PRE> |
---|
159 | Fl::visible_focus(0); |
---|
160 | </PRE></UL> |
---|
161 | |
---|
162 | </BODY> |
---|
163 | </HTML> |
---|