00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#ifndef _uprop_hpp_
00026
#define _uprop_hpp_
00027
00028
#include <ubit/unumber.hpp>
00029
00030
00038 class UProp:
public UBrick {
00039
friend class UBox;
00040
public:
00041 UProp(u_modes b_modes = 0) :
UBrick(b_modes) {}
00043
00044 virtual class UProp*
propCast() {
return this;}
00046
00047
00048
00049
00050
virtual void onChange(UCall&);
00052
00053
virtual void changed(
bool update_now);
00061
00062
00063
00064
virtual void update() = 0;
00066
00067
virtual void putProp(
class UContext*,
class UCtrl*) = 0;
00069 };
00070
00071
00072
00073
00078 class UScale :
public UIntgBase,
public UProp {
00079
public:
00080
UScale(
int value = 0);
00081
UScale(
const UIntgBase& value);
00082
00083
friend UScale& uscale(
int val = 0) {
return *
new UScale(val);}
00084 friend UScale& uscale(
const UIntgBase& val) {
return *
new UScale(val);}
00086
00087
00088
00089
float getXScale() const;
00090
float getYScale() const;
00091
void getXYScale(
float& xscale,
float& yscale) const;
00092
00093 static
float getXScale(
int lscale);
00094 static
float getYScale(
int lscale);
00095 static
void getXYScale(
int lscale,
float& xscale,
float& yscale);
00096
00097
00098
00099 virtual
void changed(
bool update_now);
00100 virtual
void update();
00101 virtual
void putProp(class UContext*, class UCtrl*);
00102 };
00103
00104
00105
00106
00110 class
UAlpha : public
UProp {
00111
float value;
00112
public:
00113
UAlpha(
float value = 1.0);
00114 friend UAlpha& ualpha(
float val = 1.0) {
return *
new UAlpha(val);}
00116
00117 float get()
const {
return value;}
00119
00120
void set(
float value);
00121
void set(
float value,
bool update_now);
00123
00124
virtual void update();
00125
virtual void putProp(
class UContext*,
class UCtrl*);
00126 };
00127
00128
00129
00130
00134 class UBackground :
public UProp {
00135
const class UColor *bgcolor;
00136
const class UIma *bgima;
00137
const class UHalign *halign;
00138
const class UValign *valign;
00139
public:
00140
UBackground();
00141
UBackground(
const UIma& bgima);
00142
UBackground(
const UColor& bgcolor);
00143
00144
friend UBackground& ubackground(
const UColor& bgcolor);
00145
friend UBackground& ubackground(
const UIma& bgima);
00146
00147
00148
00149
void set(
const UColor& bgcolor);
00151
00152
void set(
const UIma& bgima);
00156
void set(
const UIma& bgima,
const UColor& bgcolor);
00161
void setLayout(
const UHalign&,
const UValign&);
00165
const class UColor* getColor()
const {
return bgcolor;}
00166
const class UIma* getIma()
const {
return bgima;}
00167
const class UHalign* getHalign()
const {
return halign;}
00168
const class UValign* getValign()
const {
return valign;}
00169
00170
virtual void update();
00171
virtual void putProp(
class UContext*,
class UCtrl*);
00172 };
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00201 class UPos :
public UProp {
00202
public:
00203
UPos();
00204
UPos(
const UPos&);
00205
UPos(u_pos x, u_pos y);
00206
00207
friend UPos& upos(
const UPos& p) {
return *
new UPos(p);}
00208
friend UPos& upos(u_pos x, u_pos y) {
return *
new UPos(x, y);}
00209
00210
virtual ~
UPos() {
destructs();}
00211
00212
UPos& operator=(
const UPos&);
00213
void set(
const UPos&,
bool update =
true);
00214
00215
void set(u_pos x, u_pos y,
bool update =
true);
00216
void setX(u_pos x);
00217
void setY(u_pos y);
00218
00219 u_pos getX()
const {
return x;}
00220 u_pos getY()
const {
return y;}
00221
00222
virtual void addingTo(
class ULink *selflink,
UGroup *parent);
00223
virtual void removingFrom(
class ULink *selflink,
UGroup *parent);
00225
00226
virtual void update();
00227
virtual void putProp(
class UContext*,
class UCtrl*);
00228
private:
00229 u_pos x, y;
00230 };
00231
00232
00233
00234
00244 class UWidth :
public UProp {
00245
public:
00246
static const u_dim AUTO_RESIZE, KEEP_SIZE;
00247
00248
UWidth(u_dim value = 0);
00249
UWidth(
const UWidth&);
00250
friend UWidth& uwidth(u_dim value = 0);
00251
00252 u_dim get()
const {
return value;}
00253
void set(u_dim);
00254
00255
UWidth& operator=(u_dim _val) {set(_val);
return *
this;}
00256
UWidth& operator=(
const UWidth& _val) {set(_val.
get());
return *
this;}
00257
00258
virtual void update();
00259
virtual void putProp(
class UContext*,
class UCtrl*);
00260
private:
00261 u_dim value;
00262 };
00263
00264
00268 class UHeight :
public UProp {
00269
public:
00270
static const u_dim AUTO_RESIZE, KEEP_SIZE;
00271
00272
UHeight(u_dim value = 0);
00273
UHeight(
const UHeight&);
00274
friend UHeight& uheight(u_dim value = 0);
00275
00276 u_dim get()
const {
return value;}
00277
void set(u_dim);
00278
00279
UHeight& operator=(u_dim _val) {set(_val);
return *
this;}
00280
UHeight& operator=(
const UHeight& _val) {set(_val.
get());
return *
this;}
00281
00282
virtual void update();
00283
virtual void putProp(
class UContext*,
class UCtrl*);
00284
private:
00285 u_dim value;
00286 };
00287
00288
00289
00290
00294 class UOrient :
public UProp {
00295
public:
00296
enum {VERTICAL, HORIZONTAL, INHERIT};
00297
static UOrient vertical, horizontal, inherit;
00298
00299
UOrient(
char value = VERTICAL, u_modes = 0);
00300
UOrient(
const UOrient&);
00301
friend UOrient& uorient(
const UOrient&);
00302
00303
void set(
const UOrient&);
00304
char get()
const {
return value;}
00305
00306
virtual void update();
00307
virtual void putProp(
class UContext*,
class UCtrl*);
00308
private:
00309
char value;
00310 };
00311
00312
00313
00314
00320 class UValign :
public UProp {
00321
char value;
00322
public:
00323
enum {TOP, BOTTOM, FLEX, CENTER};
00324
static UValign top, bottom, flex, center;
00325
00326
UValign(
char value = TOP, u_modes = 0);
00327
UValign(
const UValign&);
00328
friend UValign& uvalign(
const UValign&);
00329
00330
friend UValign& utop() {
return UValign::top;}
00331
friend UValign& ubottom() {
return UValign::bottom;}
00332
friend UValign& uvcenter() {
return UValign::center;}
00333
friend UValign& uvflex() {
return UValign::flex;}
00334
00335
char get()
const {
return value;}
00336
void set(
const UValign&);
00337
00338
virtual void update();
00339
virtual void putProp(
class UContext*,
class UCtrl*);
00340 };
00341
00342
00343
00344
00350 class UHalign :
public UProp {
00351
char value;
00352
public:
00353
enum {LEFT, RIGHT, FLEX, CENTER};
00354
static UHalign left, right, flex, center;
00355
00356
UHalign(
char value = LEFT, u_modes = 0);
00357
UHalign(
const UHalign&);
00358
friend UHalign& uhalign(
const UHalign&);
00359
00360
friend UHalign& uleft() {
return UHalign::left;}
00361
friend UHalign& uright() {
return UHalign::right;}
00362
friend UHalign& uhcenter() {
return UHalign::center;}
00363
friend UHalign& uhflex() {
return UHalign::flex;}
00364
00365
char get()
const {
return value;}
00366
void set(
const UHalign&);
00367
00368
virtual void update();
00369
virtual void putProp(
class UContext*,
class UCtrl*);
00370 };
00371
00372
00373
00374
00377 class UVspacing :
public UProp {
00378
public:
00379
UVspacing(
int = 0);
00380
friend UVspacing& uvspacing(
int);
00381
00382
int get()
const {
return value;}
00383
void set(
int);
00384
UVspacing& operator=(
int i) {set(i);
return *
this;}
00385
00386
virtual void update();
00387
virtual void putProp(
class UContext*,
class UCtrl*);
00388
private:
00389
int value;
00390 };
00391
00392
00393
00396 class UHspacing :
public UProp {
00397
public:
00398
UHspacing(
int = 0);
00399
friend UHspacing& uhspacing(
int);
00400
00401
int get()
const {
return value;}
00402
void set(
int);
00403
UHspacing& operator=(
int i) {set(i);
return *
this;}
00404
00405
virtual void update();
00406
virtual void putProp(
class UContext*,
class UCtrl*);
00407
private:
00408
int value;
00409 };
00410
00411
00412
00413
00416 class UVmargin :
public UProp {
00417
public:
00418
UVmargin(
int = 0);
00419
friend UVmargin& uvmargin(
int);
00420
00421
int get()
const {
return value;}
00422
void set(
int);
00423
UVmargin& operator=(
int i) {set(i);
return *
this;}
00424
00425
virtual void update();
00426
virtual void putProp(
class UContext*,
class UCtrl*);
00427
private:
00428
int value;
00429 };
00430
00431
00432
00435 class UHmargin :
public UProp {
00436
public:
00437
UHmargin(
int = 0);
00438
friend UHmargin& uhmargin(
int);
00439
00440
int get()
const {
return value;}
00441
void set(
int);
00442
UHmargin& operator=(
int i) {set(i);
return *
this;}
00443
00444
virtual void update();
00445
virtual void putProp(
class UContext*,
class UCtrl*);
00446
private:
00447
int value;
00448 };
00449
00450
00451
00452
00453
00454
00455
class UTip:
public UProp {
00456 uptr<UStr> value;
00457
public:
00458
00459 UTip(
const char* value);
00461
00462 UTip(
UStr& value);
00469
friend UTip& utip(
const char* _value) {
return *(
new UTip(_value));}
00470
friend UTip& utip(
UStr& _value) {
return *(
new UTip(_value));}
00472
00473
virtual void set(
const UStr& value);
00474
virtual const UStr& get()
const {
return *value;}
00475
00476
virtual void update();
00477
virtual void putProp(
class UContext*,
class UCtrl*) {}
00478 };
00479
00480
00481
00482
00483
00484
00485
class UTitle:
public UProp {
00486 uptr<UStr> value;
00487
00488
public:
00489 UTitle(
const char* value);
00490 UTitle(
const UStr& value);
00492
00493 UTitle(
UStr& value);
00500
friend UTitle& utitle(
const char* _value) {
return *
new UTitle(_value);}
00501
friend UTitle& utitle(
const UStr& _value) {
return *
new UTitle(_value);}
00502
friend UTitle& utitle(
UStr& _value) {
return *
new UTitle(_value);}
00504
00505
virtual void set(
const UStr& value);
00506
virtual const UStr& get()
const {
return *value;}
00507
00508
virtual void update();
00509
virtual void putProp(
class UContext*,
class UCtrl*) {}
00510 };
00511
00512
00513
00514
00515
00516
00517
class UComment:
public UProp {
00518
char *value;
00519
00520
public:
00521 UComment(
const char* = null);
00522
friend UComment& ucomment(
const char *s);
00523
00524
const char* get()
const {
return value;}
00525
void set(
const char*);
00526
00527
virtual void update();
00528
virtual void putProp(
class UContext*,
class UCtrl*);
00529 };
00530
00531
00532
00533
00537 class UFlagdef :
public UProp {
00538
public:
00539
UFlagdef();
00540
UFlagdef(
const UFlag&);
00541
00542
friend UFlagdef& uflagdef() {
return *
new UFlagdef();}
00543
friend UFlagdef& uflagdef(
const class UFlag& f) {
return *
new UFlagdef(f);}
00544
00545
virtual void set(
const UFlag&);
00546
virtual void clear();
00547
00548
const UFlag* getFlag()
const {
return flag;}
00549
00550
virtual void update();
00551
virtual void putProp(UContext*,
class UCtrl*);
00552
00553
protected:
00554
const class UFlag* flag;
00555 };
00556
00557
00558
00559
00560
class UPropdef :
public UFlagdef {
00561
public:
00562 UPropdef();
00563 UPropdef(
const UFlag&);
00564 UPropdef(
const UFlag&,
UProp&);
00565 UPropdef(
const UFlag&,
UProp*);
00566
friend UPropdef& upropdef(
const class UFlag& f,
UProp&);
00567
friend UPropdef& upropdef(
const class UFlag& f,
UProp*);
00568
00569
virtual void set(
const UFlag&);
00570
virtual void set(
UProp&);
00571
virtual void set(
UProp*);
00572
virtual void set(
const UFlag&,
UProp&);
00573
virtual void set(
const UFlag&,
UProp*);
00574
virtual void clear();
00575
00576
UProp* getProp()
const {
return prop;}
00577
virtual void putProp(UContext*,
class UCtrl*);
00578
00579
private:
00580 uptr<UProp> prop;
00581 };
00582
00583
00584
00585
class UPropval :
public UProp {
00586
public:
00587 UPropval(
const UFlag&);
00588
friend UPropval& upropval(
const class UFlag& f);
00589
00590
const UFlag* getFlag()
const {
return flag;}
00591
00592
virtual void update();
00593
virtual void putProp(UContext*,
class UCtrl*);
00594
00595
private:
00596
const class UFlag* flag;
00597 };
00598
00599
#endif
00600
00601