Laxkit
0.0.7.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
lax
interfaces
captioninterface.h
1
//
2
//
3
// The Laxkit, a windowing toolkit
4
// Please consult http://laxkit.sourceforge.net about where to send any
5
// correspondence about this software.
6
//
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
// Library General Public License for more details.
16
//
17
// You should have received a copy of the GNU Library General Public
18
// License along with this library; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
//
21
// Copyright (C) 2013 by Tom Lechner
22
//
23
#ifndef _LAX_CAPTIONINTERFACE_H
24
#define _LAX_CAPTIONINTERFACE_H
25
26
#include <lax/interfaces/aninterface.h>
27
#include <lax/interfaces/somedata.h>
28
#include <lax/laximages.h>
29
30
31
32
namespace
LaxInterfaces {
33
34
//--------------------------------- CaptionData -------------------------------
35
class
CaptionData
:
public
SomeData
36
{
37
public
:
38
int
state;
//1 if lengths found
39
40
char
*fontname, *fontstyle, *fontfile;
41
double
fontsize
;
42
Laxkit::LaxFont
*
font
;
43
double
red,green,blue,alpha;
//[0..1]
44
double
xcentering
,
ycentering
;
//around origin
45
46
Laxkit::PtrStack<char>
lines;
47
Laxkit::NumStack<double>
linelengths;
48
49
virtual
const
char
*whattype() {
return
"CaptionData"
; }
50
CaptionData
(
const
char
*ntext,
const
char
*nfontname,
const
char
*nfontstyle,
int
fsize,
double
xcenter,
double
ycenter);
51
virtual
~
CaptionData
();
52
virtual
int
SetText
(
const
char
*newtext);
53
virtual
double
XCenter(
double
xcenter);
54
virtual
double
XCenter() {
return
xcentering
; }
55
virtual
double
YCenter(
double
ycenter);
56
virtual
double
YCenter() {
return
ycentering
; }
57
virtual
void
FindBBox
();
58
59
virtual
int
CharLen(
int
line);
60
virtual
int
ComputeLineLen
(
int
line);
61
virtual
int
DeleteChar(
int
line,
int
pos,
int
after,
int
*newline,
int
*newpos);
62
virtual
int
InsertChar(
unsigned
int
ch,
int
line,
int
pos,
int
*newline,
int
*newpos);
63
64
virtual
void
dump_out
(FILE *f,
int
indent,
int
what,
Laxkit::anObject
*context);
65
virtual
void
dump_in_atts
(
LaxFiles::Attribute
*att,
int
flag,
Laxkit::anObject
*context);
66
};
67
68
//--------------------------------- CaptionInterface -------------------------------
69
class
CaptionInterface
:
public
anInterface
70
{
71
protected
:
72
int
mode
,mousedragged;
73
flatpoint
leftp;
74
int
mx,my,lx,ly;
75
int
caretline,caretpos;
76
public
:
77
int
showdecs;
78
CaptionData
*data;
79
ObjectContext
*coc;
80
81
CaptionInterface
(
int
nid,
Laxkit::Displayer
*ndp,
const
char
*newtext);
82
virtual
~
CaptionInterface
();
83
virtual
anInterface
*
duplicate
(
anInterface
*dup);
84
virtual
const
char
*IconId() {
return
"Caption"
; }
85
virtual
const
char
*Name();
86
virtual
const
char
*whattype() {
return
"CaptionInterface"
; }
87
virtual
const
char
*whatdatatype() {
return
"CaptionData"
; }
88
virtual
void
deletedata
();
89
virtual
ObjectContext *Context();
90
virtual
int
LBDown
(
int
x,
int
y,
unsigned
int
state,
int
count,
const
Laxkit::LaxMouse
*d);
91
virtual
int
LBUp
(
int
x,
int
y,
unsigned
int
state,
const
Laxkit::LaxMouse
*d);
92
virtual
int
MouseMove(
int
x,
int
y,
unsigned
int
state,
const
Laxkit::LaxMouse
*d);
93
virtual
int
CharInput(
unsigned
int
ch,
const
char
*buffer,
int
len,
unsigned
int
state,
const
Laxkit::LaxKeyboard
*d);
94
virtual
int
KeyUp(
unsigned
int
ch,
unsigned
int
state,
const
Laxkit::LaxKeyboard
*d);
95
virtual
int
Refresh
();
96
virtual
int
DrawData
(
Laxkit::anObject
*ndata,
Laxkit::anObject
*a1=NULL,
Laxkit::anObject
*a2=NULL,
int
info=0);
97
virtual
int
UseThis
(
Laxkit::anObject
*nobj,
unsigned
int
mask=0);
98
virtual
CaptionData *
newData
();
99
virtual
int
InterfaceOn
();
100
virtual
int
InterfaceOff
();
101
virtual
void
Clear
(SomeData *d);
102
};
103
104
105
}
// namespace LaxInterfaces
106
107
#endif
108
Mon Feb 17 2014 11:52:56, Laxkit