27struct __TBarDescrGdNode {
28 __TBarDescrGdNode(TGadget* gd,
bool ug): Gadget(gd),UseGlyph(ug){}
34__TBarDescrGdNode::~__TBarDescrGdNode()
39class TBarDescrGdArray:
public TIPtrArray<__TBarDescrGdNode*>{
41 TBarDescrGdArray(
int count):TIPtrArray<__TBarDescrGdNode*>(count){}
48static TGadget* CreateGadget(
int index,
int id,
bool& usecell)
205 Gadgets =
new TBarDescrGdArray(5);
220 Gadgets =
new TBarDescrGdArray(5);
223 CHECK(BarRes->IsOK());
229 CelArray =
new TCelArray(&BarRes->GetBitmap(),
231 TSize(BarRes->GetWidth(), BarRes->GetHeight()),
233 BarRes->GetBitmap().Height()/BarRes->GetHeight());
250 Gadgets =
new TBarDescrGdArray(5);
273 Gadgets =
new TBarDescrGdArray(5);
293 delete GadgetFunctor;
298 *GadgetFunctor = functor;
324 CelArray =
new TCelArray(&BarRes->GetBitmap(), BarRes->GetCount(),
325 TSize(BarRes->GetWidth(), BarRes->GetHeight()),
327 BarRes->GetBitmap().Height()/BarRes->GetHeight());
333static void CreateGadgets(TBarDescrGdArray* array,
const TGadgetFunctor& builder,
336 for (
int i=0,j=0; i < barRes->
GetCount(); i++) {
342 array->Add(
new __TBarDescrGdNode(gd,usecell));
354 if (BarRes && BarRes->IsOK()) {
356 CreateGadgets(Gadgets, *
GetBuilder(), BarRes);
358 int numRows = BarRes->GetBitmap().Height()/BarRes->GetHeight();
360 0, BarRes->GetCount(), 5, numRows);
363 for (
int i=0,j=0; i < (int)Gadgets->Size(); i++){
364 destWindow.
Insert(*(*Gadgets)[i]->Gadget);
365 if((*Gadgets)[i]->UseGlyph)
366 cellArray->
Add(*CelArray, j++);
378 if (BarRes && BarRes->IsOK()){
382 if(!srcBarDescr.Gadgets->Size())
383 CreateGadgets(srcBarDescr.Gadgets, *((
TBarDescr&)srcBarDescr).GetBuilder(),
397 if (srcBarDescr.GroupCount[g] > 0){
398 for (
int i=0; i < srcBarDescr.GroupCount[g]; i++){
399 __TBarDescrGdNode* node = (*srcBarDescr.Gadgets)[gdIndex1];
400 destWindow.
Insert(*node->Gadget);
402 cellArray.
Add(*srcBarDescr.CelArray, cellIndex1);
412 else if (srcBarDescr.GroupCount[g] == 0 && GroupCount[g] > 0) {
413 for (
int i=0; i < GroupCount[g]; i++){
414 __TBarDescrGdNode* node = (*Gadgets)[gdIndex2];
415 destWindow.
Insert(*node->Gadget);
417 cellArray.
Add(*CelArray, cellIndex2);
440 if (BarRes && BarRes->IsOK()){
450 if(GroupCount[g]!= 0){
451 for (
int i=0; i < GroupCount[g]; i++){
452 __TBarDescrGdNode* node = (*Gadgets)[gdIndex];
453 destWindow.
Insert(*node->Gadget);
455 cellArray.
Add(*CelArray, cellIndex);
503 int itemCount = BarRes->GetCount();
506 for (
int i = 0; i < itemCount;i++) {
507 if (BarRes->GetIds()[i] ==
uint16(-1)){
509 GroupCount[g++] = count;
524 GroupCount[g++] = count;
536#if OWL_PERSISTENT_STREAMS
558 is >> b.GroupCount[i];
572 os << b.GroupCount[i];
Class definition for TBarDescr.
#define TGadget_FUNCTOR(func)
Definition of a bitmap Cel array class.
Descriptor of Bar Implementation.
void SetBuilder(const TGadgetFunctor &functor)
bool ExtractGroups()
Scan bar looking for separators that signify group divisions return whether we found any at all.
virtual bool Restore(TGadgetWindow &destWindow)
Removes the gadgets in destWindow and then inserts these gadgets.
TGadgetFunctor * GetBuilder()
@ FileGroup
Index of the File gadget group count.
@ EditGroup
Index of the Edit gadget group count.
@ HelpGroup
Index of the Help gadget group count.
@ NumGroups
Total number of groups.
@ WindowGroup
Index of the Window gadget group count.
@ ObjectGroup
Index of the Object gadget group count.
@ ContainerGroup
Index of the Container gadget group count.
virtual bool Merge(const TBarDescr &sourceBarDescr, TGadgetWindow &destWindow)
Merges this gadgets and sourceBarDescr gadgets and inserts them into destWindow's gadgets.
virtual ~TBarDescr()
Destroys the TBarDescr object.
TBarDescr()
Default constructor for a TBarDescr object.
bool RemoveGadgets(TGadgetWindow &destWindow)
Removes all gadgets from destWindow.
virtual bool Create(TGadgetWindow &destWindow)
Inserts into destWindow's gadgets.
bool SetBitmap(TResId newResId, TModule *module)
Set new bitmap for use in gadgets.
int Height() const
Returns the height of this bitmap using GDI's GetObject.
TBtnBitmap is an enhanced version of TBitmap with the ability to update the face color of a bitmap to...
TCelArray is a horizontal array of cels (a unit of animation) created by slicing a portion of or an e...
TCelArray(TBitmap *bmp, int numCels, TSize celSize=TSize(), TPoint offset=TPoint(), int numRows=1, TAutoDelete=AutoDelete)
Constructs a TCelArray from a bitmap by slicing the bitmap into a horizontal array of cels of a speci...
int Add(const TBitmap &image)
Add new cel(s) to the CelArray - return index of new addition.
bool RemoveAll()
Removes all the cels from the array by calling Remove(-1).
static const TColor LtGray
Static TColor object with fixed Value set by RGB(192, 192, 192).
TGadget is the base class for the following derived gadget classes:
TGadget * NextGadget()
Returns the next gadget in the list of gadgets.
int GetId() const
Gets the ID for the gadget.
TGadget * FirstGadget() const
Returns the first gadget of the list.
Derived from TWindow, TGadgetWindow maintains a list of tiled gadgets for a window and lets you dynam...
void Insert(TGadget &, TPlacement=After, TGadget *sibling=nullptr) override
Inserts a gadget before or after a sibling gadget (TPlacement).
virtual void SetCelArray(TCelArray *sharedCels)
Sets a new Shared CelArray for this gadget window.
auto Remove(TGadget &) -> TGadget *override
Removes a gadget from the gadget window.
virtual TCelArray & GetCelArray(int minX=0, int minY=0)
Gets the Shared CelArray for this gadget window.
virtual void LayoutSession()
LayoutSession is typically called when a change occurs in the size of the margins or gadgets,...
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TPoint is a support class, derived from tagPOINT.
TSeparatorGadget is a simple class you can use to create a separator between gadgets.
The tagSIZE struct is defined as.
TSize()
Default constructor that does nothing.
void UpdateWindow()
Updates the client area of the specified window by immediately sending a WM_PAINT message.
virtual void Invalidate(bool erase=true)
Invalidates (mark for painting) the entire client area of a window.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Base class for writing streamable objects.
C++ Functor template implementation.
Base class TGadget and simple derived TSeparatorGadget.
#define IDG_FLATHANDLE
The ID for a flat bar handle.
Definition of TGadgetList, TGadgetWindow & TGadgetWindowFont A list holding gadgets,...
Definition of class TGlyphButton.
THandle GetHandle() const
Return the instance handle of the library module represented by the TModule obect.
Object Windows Library (OWLNext Core).
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
TFunctor3< TGadget *, int, int, bool & > TGadgetFunctor
owl::ipstream & operator>>(owl::ipstream &is, TColor &c)
Extract the color value from a persistent input stream.
auto InternStreamedResId_(TResId id) -> TResId
#define TYPESAFE_DOWNCAST(object, toClass)
Defines classes handling Windows resources.
Private helper for reading resource identifiers from persistent streams.
Definition of container classes used and made available by OWL.