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 _ugroup_hpp_
00026
#define _ugroup_hpp_
00027
00028
#include <ubit/uargs.hpp>
00029
#include <ubit/uctrl.hpp>
00030
#include <ubit/ucall.hpp>
00031
00032
00036 class UListPos {
00037
friend class UGroup;
00038
class ULink* link;
00039
int pos;
00040
public:
00041
static UListPos none;
00042
UListPos();
00043
void reset();
00044
int getPos()
const;
00045 };
00046
00047
00060 class UGroup:
public UCtrl {
00061
public:
00062
static UStyle *
style;
00063
00064
UGroup(
const UArgs& a = UArgs::none);
00069 friend UGroup&
ugroup(
const UArgs& a = UArgs::none) {
return *
new UGroup(a);}
00075
virtual ~UGroup();
00081 virtual const UStyle&
getStyle(UContext*)
const {
return makeStyle();}
00088
static const UStyle&
makeStyle();
00098
00099
00100
00101
UGroup& addlist(
const UArgs&);
00112
virtual void add(
UBrick* child,
bool update =
true);
00113
virtual void add(
UBrick& child,
bool update =
true);
00114
virtual void add(ULink* child,
bool update =
true);
00115
virtual void add(ULink& child,
bool update =
true);
00126
virtual void addOnce(
UBrick* child,
bool update =
true);
00127
virtual void addOnce(
UBrick& child,
bool update =
true);
00132
virtual void insert(
int pos,
UBrick* child,
bool update =
true);
00133
virtual void insert(
int pos,
UBrick& child,
bool update =
true);
00134
virtual void insert(
int pos, ULink* child,
bool update =
true);
00135
virtual void insert(
int pos, ULink& child,
bool update =
true);
00149
virtual void remove(
UBrick* child,
00150
bool auto_delete =
true,
bool update =
true);
00151
virtual void remove(
UBrick& child,
00152
bool auto_delete =
true,
bool update =
true);
00179
virtual void remove(
int pos,
bool auto_delete =
true,
bool update =
true);
00188
virtual void removeAll(
bool auto_delete =
true,
bool update =
true);
00194
00195
00196
00197
virtual int getChildCount() const;
00200 virtual
UBrick** getChildren() const;
00201 virtual
UBrick** getChildren(
int& child_count) const;
00217 virtual
int getChildren(std::vector<
UBrick*>&) const;
00226
00227
00228 virtual
UBrick* getChild(
int pos) const;
00241 virtual
UBrick* getChild(
UListPos&) const;
00262 virtual
UBrick* getChild(
bool(predicate)(const
UBrick* child),
00263
UListPos& =
UListPos::none) const;
00264 virtual
UBrick* getChild(UListCall& predicate,
bool& status,
00265
UListPos& =
UListPos::none) const;
00283
00284
00285 virtual
int getChildPos(const
UBrick& obj,
int nth = 0) const;
00286 virtual
int getChildPos(const
UBrick* obj,
int nth = 0) const;
00294 virtual
int getChildPos(const
UBrick* obj,
UListPos&) const;
00300
00301
00302 virtual
UBrick** getAttrs() const;
00303 virtual
UBrick** getAttrs(
int& child_count) const;
00305
00306 virtual
int getAttrCount() const;
00308
00309 virtual
void addAttr(
UBrick* child,
bool update = true);
00310 virtual
void addAttr(
UBrick& child,
bool update = true);
00311 virtual
void addAttr(ULink& child,
bool update = true);
00313
00314 virtual
void insertAttr(
int pos,
UBrick* child,
bool update = true);
00315 virtual
void insertAttr(
int pos,
UBrick& child,
bool update = true);
00316 virtual
void insertAttr(
int pos, ULink& child,
bool update = true);
00318
00319 virtual
void removeAttr(
UBrick* child,
bool auto_delete = true,
00320
bool update = true);
00321 virtual
void removeAttr(
UBrick& child,
bool auto_delete = true,
00322
bool update = true);
00324
00325 virtual
void removeAllAttr(
bool auto_delete = true,
bool update = true);
00327
00328 virtual
UBrick* getAttrChild(
UListPos& from) const;
00329 virtual
UBrick* getAttrChild(
bool(predicate)(const
UBrick* child),
00330
UListPos& =
UListPos::none) const;
00331 virtual
UBrick* getAttrChild(UListCall& predicate,
bool& stat,
UListPos& from) const;
00333
00334
00335
00336 virtual
UBrick* getAnyChild(
UListPos& from) const;
00337 virtual
UBrick* getAnyChild(
bool(predicate)(const
UBrick*),
00338
UListPos& from =
UListPos::none) const;
00339 virtual UBrick* getAnyChild(UListCall& predc,
bool& stat,
00340
UListPos& from =
UListPos::none) const;
00342
00343
00344
00345
00346 virtual
UStr copyText(
bool recursive = true) const;
00347 virtual
void copyText(
UStr&,
bool recursive = true) const;
00358 virtual
int getViews(std::vector<
UView*>&) const;
00359
00360 virtual const UStr* getTextSeparator() const;
00365 virtual
void show(
bool = true);
00371 virtual
void hide() {
show(
false);}
00376
virtual void highlight(
bool state);
00381
virtual void update();
00382
virtual void update(
UUpdate upmode);
00394
virtual void close(
int status);
00406
static void closeWin(
class UEvent&,
int status);
00407
virtual void closeWin(
int status);
00416 friend UCall&
ucloseWin(
int status = 0)
00417 {
return ucall(status, &UGroup::closeWin);}
00423
00424
00425
00426
enum ChildListType {ATTR_LIST, ELEM_LIST};
00427
enum RemoveMode {REMOVE_FROM_PARENTS=-1, NO_DEL=
false, AUTO_DEL=
true};
00428
00429
virtual void addImpl(ChildListType,
UBrick* child,
class ULink* childlink,
00430
int pos,
bool update,
bool* should_update);
00431
00432
virtual void removeImpl(ChildListType,
UBrick* child,
00433
class ULink* prevlink, RemoveMode remove_mode,
00434
bool update,
bool* should_update);
00435
00436 ULink* getChildImpl(ChildListType,
const UBrick* child,
int nth,
00437
class ULink*& prevlink,
int* pos)
const;
00438 ULink* getChildImpl(ChildListType,
int pos,
class ULink*& prevlink)
const;
00439 ULink* getChildImpl(ChildListType,
UListPos& from)
const;
00440 ULink* getChildImpl(ChildListType, UListCall&,
bool& status,
UListPos& from)
const;
00449
virtual void fire(
class UEvent&,
const class UOn&)
const;
00451
00452
virtual void destructs();
00461
#ifndef NO_DOC
00462
00463
00464
friend class UBrick;
00465
friend class UWin;
00466
00467
virtual class UGroup* groupCast() {
return this;}
00468
00469
class ULink* getAttrLinks() const;
00470 class ULink* getChildLinks() const;
00472
00473
bool isBrowsingGroup() {
return (cmodes &
UMode::CAN_BROWSE_CHILDREN) != 0;}
00474
virtual UGroup* getBrowsingGroup() {
return (cmodes &
UMode::CAN_BROWSE_CHILDREN) ?
this : null;}
00476
00477
virtual void initView(ULink *selflink,
UView *ancestor_view);
00478
virtual void initChildViews(
UGroup*, ULink *childlink);
00479
virtual void updateView(
UEvent&,
UView*,
const UUpdate&);
00480
00481
protected:
00482
class UChain children;
00483
00484
virtual int getTextLength(
bool recursive)
const;
00485
virtual char* getTextData(
char *ptr,
bool recursive)
const;
00487
00488
virtual void deleteRelatedViews(
class UView* parview,
class ULink*);
00489
virtual void deleteRelatedViews2(
class UView* parview);
00490
00491
#endif
00492
};
00493
00494
00495
#endif
00496
00497