Laxkit
0.0.7.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
lax
interfaces
imageinterface.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) 2004-2013 by Tom Lechner
22
//
23
#ifndef _LAX_IMAGEINTERFACE_H
24
#define _LAX_IMAGEINTERFACE_H
25
26
#include <lax/interfaces/aninterface.h>
27
#include <lax/interfaces/somedata.h>
28
#include <lax/imageinfo.h>
29
#include <lax/laximages.h>
30
#include <lax/screencolor.h>
31
32
33
34
namespace
LaxInterfaces {
35
36
37
//--------------------------------- ImageData -------------------------------
38
class
ImageData
:
public
Laxkit::ImageInfo
,
virtual
public
SomeData
39
{
40
public
:
41
char
previewflag
;
42
Laxkit::LaxImage
*image;
43
44
virtual
const
char
*whattype() {
return
"ImageData"
; }
45
ImageData
(
const
char
*nfilename=NULL,
const
char
*npreview=NULL,
46
int
maxpx=0,
int
maxpy=0,
char
delpreview=0);
47
virtual
~
ImageData
();
48
ImageData
&operator=(
ImageData
&i);
49
virtual
SomeData
*
duplicate
(
SomeData
*dup);
50
51
virtual
void
Flip
(
int
horiz);
52
virtual
int
SetImage
(
Laxkit::LaxImage
*newimage);
53
virtual
void
SetDescription
(
const
char
*ndesc);
54
virtual
int
UsePreview
(
const
char
*npreview,
int
maxpx=0,
int
maxpy=0,
char
del=0);
55
virtual
int
LoadImage
(
const
char
*fname,
const
char
*npreview=NULL,
int
maxpx=0,
int
maxpy=0,
char
del=0,
char
fit=0);
56
57
virtual
void
dump_out
(FILE *f,
int
indent,
int
what,
Laxkit::anObject
*context);
58
virtual
void
dump_in_atts
(
LaxFiles::Attribute
*att,
int
flag,
Laxkit::anObject
*context);
59
};
60
61
//--------------------------------- ImageInterface -------------------------------
62
63
#define IMAGEI_POPUP_INFO 1
64
65
class
ImageInterface
:
public
anInterface
66
{
67
protected
:
68
int
mode,mousedragged;
69
flatpoint
leftp;
70
int
mx,my,lx,ly;
71
int
max_preview_x, max_preview_y;
72
ImageData
*data;
73
ObjectContext
*ioc;
74
75
virtual
void
runImageDialog
();
76
Laxkit::ShortcutHandler
*sc;
77
virtual
int
PerformAction(
int
action);
78
public
:
79
unsigned
int
controlcolor;
80
int
showdecs;
81
char
showfile;
82
ImageInterface
(
int
nid,
Laxkit::Displayer
*ndp,
int
nstyle=IMAGEI_POPUP_INFO);
83
virtual
~
ImageInterface
();
84
virtual
const
char
*IconId() {
return
"Image"
; }
85
virtual
const
char
*Name();
86
virtual
const
char
*whattype() {
return
"ImageInterface"
; }
87
virtual
const
char
*whatdatatype() {
return
"ImageData"
; }
88
virtual
Laxkit::ShortcutHandler
*GetShortcuts();
89
virtual
int
Event
(
const
Laxkit::EventData
*data,
const
char
*mes);
90
virtual
anInterface
*
duplicate
(
anInterface
*dup);
91
virtual
void
deletedata
();
92
virtual
int
InterfaceOn
();
93
virtual
int
InterfaceOff
();
94
virtual
void
Clear
(
SomeData
*d);
95
virtual
ObjectContext
*Context() {
return
ioc; }
96
virtual
int
UseThis
(
Laxkit::anObject
*nobj,
unsigned
int
mask=0);
97
virtual
int
UseThisObject
(
ObjectContext
*oc);
98
virtual
int
DrawData
(
Laxkit::anObject
*ndata,
Laxkit::anObject
*a1=NULL,
Laxkit::anObject
*a2=NULL,
int
info=0);
99
virtual
int
LBDown
(
int
x,
int
y,
unsigned
int
state,
int
count,
const
Laxkit::LaxMouse
*d);
100
virtual
int
LBUp
(
int
x,
int
y,
unsigned
int
state,
const
Laxkit::LaxMouse
*d);
101
virtual
int
MouseMove(
int
x,
int
y,
unsigned
int
state,
const
Laxkit::LaxMouse
*d);
102
virtual
int
CharInput(
unsigned
int
ch,
const
char
*buffer,
int
len,
unsigned
int
state,
const
Laxkit::LaxKeyboard
*d);
103
virtual
int
Refresh
();
104
105
virtual
ImageData
*
newData
();
106
};
107
108
109
}
// namespace LaxInterfaces
110
111
#endif
112
Mon Feb 17 2014 11:52:56, Laxkit