Author: matt
Date: 2010-04-04 13:10:42 -0700 (Sun, 04 Apr 2010)
New Revision: 7421
Log:
Ported Fl_Label
Modified:
branches/branch-3.0/fltk3/Fl_File_Icon.H
branches/branch-3.0/fltk3/Fl_Image.H
branches/branch-3.0/fltk3/Widget.h
branches/branch-3.0/fltk3/run.h
branches/branch-3.0/src/Fl_Choice.cxx
branches/branch-3.0/src/Fl_File_Icon.cxx
branches/branch-3.0/src/Fl_Image.cxx
branches/branch-3.0/src/Fl_Menu.cxx
branches/branch-3.0/src/Fl_Multi_Label.cxx
branches/branch-3.0/src/fl_engraved_label.cxx
branches/branch-3.0/src/fl_labeltype.cxx
Modified: branches/branch-3.0/fltk3/Fl_File_Icon.H
===================================================================
--- branches/branch-3.0/fltk3/Fl_File_Icon.H 2010-04-04 20:03:55 UTC (rev
7420)
+++ branches/branch-3.0/fltk3/Fl_File_Icon.H 2010-04-04 20:10:42 UTC (rev
7421)
@@ -124,7 +124,7 @@
void label(fltk3::Widget *w);
- static void labeltype(const Fl_Label *o, int x, int y, int w, int h,
fltk3::Align a);
+ static void labeltype(const fltk3::Label *o, int x, int y, int w, int h,
fltk3::Align a);
void load(const char *f);
int load_fti(const char *fti);
int load_image(const char *i);
Modified: branches/branch-3.0/fltk3/Fl_Image.H
===================================================================
--- branches/branch-3.0/fltk3/Fl_Image.H 2010-04-04 20:03:55 UTC (rev
7420)
+++ branches/branch-3.0/fltk3/Fl_Image.H 2010-04-04 20:10:42 UTC (rev
7421)
@@ -38,7 +38,7 @@
struct MenuItem;
}
-struct Fl_Label;
+struct fltk3::Label;
/**
Fl_Image is the base class used for caching and
@@ -92,8 +92,8 @@
void data(const char * const *p, int c) {data_ = p; count_ = c;}
void draw_empty(int X, int Y);
- static void labeltype(const Fl_Label *lo, int lx, int ly, int lw, int lh,
fltk3::Align la);
- static void measure(const Fl_Label *lo, int &lw, int &lh);
+ static void labeltype(const fltk3::Label *lo, int lx, int ly, int lw, int
lh, fltk3::Align la);
+ static void measure(const fltk3::Label *lo, int &lw, int &lh);
public:
Modified: branches/branch-3.0/fltk3/Widget.h
===================================================================
--- branches/branch-3.0/fltk3/Widget.h 2010-04-04 20:03:55 UTC (rev 7420)
+++ branches/branch-3.0/fltk3/Widget.h 2010-04-04 20:10:42 UTC (rev 7421)
@@ -26,7 +26,7 @@
//
/* \file
- fltk3::Widget, Fl_Label classes . */
+ fltk3::Widget, fltk3::Label classes . */
#ifndef Fltk3_Widget_H
#define Fltk3_Widget_H
@@ -35,7 +35,7 @@
#include "Wrapper.h"
class Fl_Image;
-class Fl_Widget;
+class Fl_Widget; // needed by the fltk1 wrapper
namespace fltk3 {
@@ -51,17 +51,12 @@
typedef void (Callback0)(Widget*);
/** Callback type definition passing the widget and a long data value */
typedef void (Callback1)(Widget*, long);
-
-} // namespace fltk3
-/** This struct stores all information for a text or mixed graphics label.
-
- \todo For FLTK 1.3, the Fl_Label type will become a widget by itself. That
way
- we will be avoiding a lot of code duplication by handling labels in
- a similar fashion to widgets containing text. We also provide an easy
- interface for very complex labels, containing html or vector
graphics.
+/*
+ This struct is depreciated in FLTK3. It will be replaced by the FLTK2
+ Style system.
*/
-struct FL_EXPORT Fl_Label {
+struct FL_EXPORT Label {
/** label text */
const char* value;
/** optional image for an active label */
@@ -84,8 +79,6 @@
void measure(int &w, int &h) const ;
};
-namespace fltk3 {
-
/** fltk3::Widget is the base class for all widgets in FLTK.
You can't create one of these because the constructor is not public.
@@ -106,7 +99,7 @@
Callback* callback_;
void* user_data_;
int x_,y_,w_,h_;
- Fl_Label label_;
+ fltk3::Label label_;
unsigned int flags_;
Fl_Color color_;
Fl_Color color2_;
Modified: branches/branch-3.0/fltk3/run.h
===================================================================
--- branches/branch-3.0/fltk3/run.h 2010-04-04 20:03:55 UTC (rev 7420)
+++ branches/branch-3.0/fltk3/run.h 2010-04-04 20:10:42 UTC (rev 7421)
@@ -49,10 +49,10 @@
namespace fltk3 {
class Window;
class Widget;
+ struct Label;
}
class Fl_Image;
-struct Fl_Label;
/** \defgroup callback_functions Callback function typedefs
@@ -71,10 +71,10 @@
@{ */
/** signature of some label drawing functions passed as parameters */
-typedef void (Fl_Label_Draw_F)(const Fl_Label *label, int x, int y, int w, int
h, fltk3::Align align);
+typedef void (Fl_Label_Draw_F)(const fltk3::Label *label, int x, int y, int w,
int h, fltk3::Align align);
/** signature of some label measurement functions passed as parameters */
-typedef void (Fl_Label_Measure_F)(const Fl_Label *label, int &width, int
&height);
+typedef void (Fl_Label_Measure_F)(const fltk3::Label *label, int &width, int
&height);
/** signature of some box drawing functions passed as parameters */
typedef void (Fl_Box_Draw_F)(int x, int y, int w, int h, Fl_Color color);
Modified: branches/branch-3.0/src/Fl_Choice.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Choice.cxx 2010-04-04 20:03:55 UTC (rev
7420)
+++ branches/branch-3.0/src/Fl_Choice.cxx 2010-04-04 20:10:42 UTC (rev
7421)
@@ -90,7 +90,7 @@
fl_push_clip(xx, yy, ww, hh);
if ( fltk3::scheme()) {
- Fl_Label l;
+ fltk3::Label l;
l.value = m.text;
l.image = 0;
l.deimage = 0;
Modified: branches/branch-3.0/src/Fl_File_Icon.cxx
===================================================================
--- branches/branch-3.0/src/Fl_File_Icon.cxx 2010-04-04 20:03:55 UTC (rev
7420)
+++ branches/branch-3.0/src/Fl_File_Icon.cxx 2010-04-04 20:10:42 UTC (rev
7421)
@@ -469,7 +469,7 @@
\param[in] a label alignment [not used]
*/
void
-Fl_File_Icon::labeltype(const Fl_Label *o, // I - Label data
+Fl_File_Icon::labeltype(const fltk3::Label *o, // I - Label data
int x, // I - X position of label
int y, // I - Y position of label
int w, // I - Width of label
@@ -485,7 +485,7 @@
if (icon) icon->draw(x, y, w, h, (Fl_Color)(o->color));
}
-void fl_icon_label(const Fl_Label *o,int x,int y,int w,int h,fltk3::Align a)
+void fl_icon_label(const fltk3::Label *o,int x,int y,int w,int h,fltk3::Align
a)
{
Fl_File_Icon::labeltype(o, x, y, w, h, a);
}
Modified: branches/branch-3.0/src/Fl_Image.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Image.cxx 2010-04-04 20:03:55 UTC (rev
7420)
+++ branches/branch-3.0/src/Fl_Image.cxx 2010-04-04 20:10:42 UTC (rev
7421)
@@ -132,7 +132,7 @@
}
void
-Fl_Image::labeltype(const Fl_Label *lo, // I - Label
+Fl_Image::labeltype(const fltk3::Label *lo, // I - Label
int lx, // I - X position
int ly, // I - Y position
int lw, // I - Width of label
@@ -157,7 +157,7 @@
}
void
-Fl_Image::measure(const Fl_Label *lo, // I - Label
+Fl_Image::measure(const fltk3::Label *lo, // I - Label
int &lw, // O - Width of image
int &lh) { // O - Height of image
Fl_Image *img; // Image pointer
Modified: branches/branch-3.0/src/Fl_Menu.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Menu.cxx 2010-04-04 20:03:55 UTC (rev 7420)
+++ branches/branch-3.0/src/Fl_Menu.cxx 2010-04-04 20:10:42 UTC (rev 7421)
@@ -129,7 +129,7 @@
Optionally, can get height if hp is not NULL.
*/
int fltk3::MenuItem::measure(int* hp, const fltk3::Menu_* m) const {
- Fl_Label l;
+ fltk3::Label l;
l.value = text;
l.image = 0;
l.deimage = 0;
@@ -148,7 +148,7 @@
/** Draws the menu item in bounding box x,y,w,h, optionally selects the item.
*/
void fltk3::MenuItem::draw(int x, int y, int w, int h, const fltk3::Menu_* m,
int selected) const {
- Fl_Label l;
+ fltk3::Label l;
l.value = text;
l.image = 0;
l.deimage = 0;
Modified: branches/branch-3.0/src/Fl_Multi_Label.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Multi_Label.cxx 2010-04-04 20:03:55 UTC (rev
7420)
+++ branches/branch-3.0/src/Fl_Multi_Label.cxx 2010-04-04 20:10:42 UTC (rev
7421)
@@ -34,10 +34,10 @@
#include <fltk3/Fl_Multi_Label.H>
void fl_multi_labeltype(
- const Fl_Label* o, int x, int y, int w, int h, fltk3::Align a)
+ const fltk3::Label* o, int x, int y, int w, int h, fltk3::Align a)
{
Fl_Multi_Label* b = (Fl_Multi_Label*)(o->value);
- Fl_Label local = *o;
+ fltk3::Label local = *o;
local.value = b->labela;
local.type = b->typea;
int W = w; int H = h; local.measure(W, H);
@@ -53,9 +53,9 @@
}
// measurement is only correct for left-to-right appending...
-void fl_multi_measure(const Fl_Label* o, int& w, int& h) {
+void fl_multi_measure(const fltk3::Label* o, int& w, int& h) {
Fl_Multi_Label* b = (Fl_Multi_Label*)(o->value);
- Fl_Label local = *o;
+ fltk3::Label local = *o;
local.value = b->labela;
local.type = b->typea;
local.measure(w,h);
Modified: branches/branch-3.0/src/fl_engraved_label.cxx
===================================================================
--- branches/branch-3.0/src/fl_engraved_label.cxx 2010-04-04 20:03:55 UTC
(rev 7420)
+++ branches/branch-3.0/src/fl_engraved_label.cxx 2010-04-04 20:10:42 UTC
(rev 7421)
@@ -34,7 +34,7 @@
// data[] is dx, dy, color triples
static void innards(
- const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align align,
+ const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align,
int data[][3], int n)
{
fltk3::Align a1 = align;
@@ -49,14 +49,14 @@
}
void fl_shadow_label(
- const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align align)
+ const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
{
static int data[2][3] = {{2,2,FL_DARK3},{0,0,0}};
innards(o, X, Y, W, H, align, data, 2);
}
void fl_engraved_label(
- const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align align)
+ const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
{
static int data[7][3] = {
{1,0,FL_LIGHT3},{1,1,FL_LIGHT3},{0,1,FL_LIGHT3},
@@ -66,7 +66,7 @@
}
void fl_embossed_label(
- const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align align)
+ const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
{
static int data[7][3] = {
{-1,0,FL_LIGHT3},{-1,-1,FL_LIGHT3},{0,-1,FL_LIGHT3},
Modified: branches/branch-3.0/src/fl_labeltype.cxx
===================================================================
--- branches/branch-3.0/src/fl_labeltype.cxx 2010-04-04 20:03:55 UTC (rev
7420)
+++ branches/branch-3.0/src/fl_labeltype.cxx 2010-04-04 20:10:42 UTC (rev
7421)
@@ -35,19 +35,19 @@
#include <fltk3/draw.h>
#include <fltk3/Fl_Image.H>
-extern void fl_shadow_label(const Fl_Label*,int,int,int,int,fltk3::Align);
-extern void fl_engraved_label(const Fl_Label*,int,int,int,int,fltk3::Align);
-extern void fl_embossed_label(const Fl_Label*,int,int,int,int,fltk3::Align);
-extern void fl_icon_label(const Fl_Label*,int,int,int,int,fltk3::Align);
+extern void fl_shadow_label(const fltk3::Label*,int,int,int,int,fltk3::Align);
+extern void fl_engraved_label(const
fltk3::Label*,int,int,int,int,fltk3::Align);
+extern void fl_embossed_label(const
fltk3::Label*,int,int,int,int,fltk3::Align);
+extern void fl_icon_label(const fltk3::Label*,int,int,int,int,fltk3::Align);
-extern void fl_multi_measure(const Fl_Label* o, int& w, int& h);
-extern void fl_multi_labeltype(const Fl_Label* o, int x, int y, int w, int h,
fltk3::Align a);
+extern void fl_multi_measure(const fltk3::Label* o, int& w, int& h);
+extern void fl_multi_labeltype(const fltk3::Label* o, int x, int y, int w, int
h, fltk3::Align a);
-void fl_no_label(const Fl_Label*,int,int,int,int,fltk3::Align) {}
+void fl_no_label(const fltk3::Label*,int,int,int,int,fltk3::Align) {}
void
-fl_normal_label(const Fl_Label* o, int X, int Y, int W, int H, fltk3::Align
align)
+fl_normal_label(const fltk3::Label* o, int X, int Y, int W, int H,
fltk3::Align align)
{
fl_font(o->font, o->size);
fl_color((Fl_Color)o->color);
@@ -55,7 +55,7 @@
}
void
-fl_normal_measure(const Fl_Label* o, int& W, int& H) {
+fl_normal_measure(const fltk3::Label* o, int& W, int& H) {
fl_font(o->font, o->size);
fl_measure(o->value, W, H);
if (o->image) {
@@ -98,7 +98,7 @@
////////////////////////////////////////////////////////////////
/** Draws a label with arbitrary alignment in an arbitrary box. */
-void Fl_Label::draw(int X, int Y, int W, int H, fltk3::Align align) const {
+void fltk3::Label::draw(int X, int Y, int W, int H, fltk3::Align align) const {
if (!value && !image) return;
table[type](this, X, Y, W, H, align);
}
@@ -107,7 +107,7 @@
\param[in,out] W, H : this is the requested size for the label text plus
image;
on return, this will contain the size needed to fit the label
*/
-void Fl_Label::measure(int& W, int& H) const {
+void fltk3::Label::measure(int& W, int& H) const {
if (!value && !image) {
W = H = 0;
return;
@@ -141,7 +141,7 @@
*/
void fltk3::Widget::draw_label(int X, int Y, int W, int H, fltk3::Align a)
const {
if (flags()&SHORTCUT_LABEL) fl_draw_shortcut = 1;
- Fl_Label l1 = label_;
+ fltk3::Label l1 = label_;
if (!active_r()) {
l1.color = fl_inactive((Fl_Color)l1.color);
if (l1.deimage) l1.image = l1.deimage;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit