## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# iaws/awsecomp.h

    00001 /**************************************************************************
    00002     Copyright (C) 2001 by Christopher Nelson
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public
    00015     License along with this library; if not, write to the Free
    00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00017 *****************************************************************************/
    00018
    00019 #ifndef __CS_AWS_EMBEDDED_COMPONENT_H__
    00020 #define __CS_AWS_EMBEDDED_COMPONENT_H__
    00021
    00022 #include "csutil/ref.h"
    00023 #include "iaws/aws.h"
    00024 #include "iaws/awsparm.h"
    00025 #include "iutil/event.h"
    00026 #include "iaws/awsdefs.h"
    00027 #include "csutil/event.h"
    00028
    00042 class awsEmbeddedComponent : public iAwsComponent
    00043 {
    00044   csRef<iAwsComponent> comp;
    00045   iAws *aws_manager;
    00046
    00047 public:
    00048   awsEmbeddedComponent(iAws *mgr) : aws_manager (mgr) { }
    00049   virtual ~awsEmbeddedComponent()
    00050   {
    00051     comp->WindowManager()->ComponentDestroyed( this );
    00052   }
    00053
    00054 public:
    00056   virtual iAwsComponent *GetComponent ()
    00057   { return this; }
    00058
    00059   iAws *GetManager ()
    00060   { return aws_manager; }
    00061
    00063   virtual bool RegisterSlot (iAwsSlot *slot, unsigned long signal)
    00064   { return comp->RegisterSlot (slot, signal); }
    00065
    00067   virtual bool UnregisterSlot (iAwsSlot *slot, unsigned long signal)
    00068   { return comp->UnregisterSlot (slot, signal); }
    00069
    00071   virtual void Broadcast (uint32 signal)
    00072   { comp->Broadcast (signal); }
    00073
    00074 public:
    00076   virtual void Initialize (iAwsComponent *component)
    00077   {
    00078     comp = component;
    00079   }
    00080
    00098   virtual bool Create (iAws *m, iAwsComponent *parent,
    00099         iAwsComponentNode *settings)
    00100   {
    00101     return comp->Create(m, parent, settings);
    00102   }
    00103
    00105   virtual bool Setup (iAws *wmgr, iAwsComponentNode *settings)
    00106   { return comp->Setup (wmgr, settings); }
    00107
    00112   virtual bool HandleEvent(iEvent& Event)
    00113   {
    00114     return comp->HandleEvent(Event);
    00115   }
    00116
    00121   virtual bool GetProperty (const char *name, intptr_t *parm)
    00122   { return comp->GetProperty (name, parm); }
    00123
    00124 #ifndef AWS_VOIDP_IS_ERROR
    00125
    00131   AWS_VOIDP_IS_WARNING
    00132   virtual bool GetProperty(const char* name, void **parm)
    00133   { return comp->GetProperty (name, (intptr_t*)parm); }
    00134 #endif
    00135
    00140   virtual bool SetProperty (const char *name, intptr_t parm)
    00141   { return comp->SetProperty (name, parm); }
    00142
    00143 #ifndef AWS_VOIDP_IS_ERROR
    00144
    00150   AWS_VOIDP_IS_WARNING
    00151   virtual bool SetProperty(const char* name, void *parm)
    00152   { return comp->SetProperty (name, (intptr_t)parm); }
    00153 #endif
    00154
    00156   virtual bool Execute (const char *action, iAwsParmList* parmlist)
    00157   { return comp->Execute (action, parmlist); }
    00158
    00160   virtual void SetFlag (unsigned int flag)
    00161   { comp->SetFlag (flag); }
    00162
    00164   virtual void ClearFlag (unsigned int flag)
    00165   { comp->ClearFlag (flag); }
    00166
    00168   virtual unsigned int Flags ()
    00169   { return comp->Flags (); }
    00170
    00172   virtual void Invalidate ()
    00173   { comp->Invalidate (); }
    00174
    00176   virtual void Invalidate (csRect area)
    00177   { comp->Invalidate (area); }
    00178
    00180   virtual csRect Frame ()
    00181   { return comp->Frame (); }
    00182
    00184   virtual csRect ClientFrame ()
    00185   { return comp->ClientFrame (); }
    00186
    00191   virtual const char *Type ()
    00192   { return comp->Type (); }
    00193
    00195   virtual bool Overlaps (csRect &r)
    00196   { return comp->Overlaps (r); }
    00197
    00199   virtual bool isHidden ()
    00200   { return comp->isHidden (); }
    00201
    00203   virtual void Hide ()
    00204   { comp->Hide (); }
    00205
    00207   virtual void Show ()
    00208   { comp->Show (); }
    00209
    00211   virtual void Move (int delta_x, int delta_y)
    00212   { comp->Move (delta_x, delta_y); }
    00213
    00215   virtual void MoveTo (int x, int y)
    00216   { comp->MoveTo (x, y); }
    00217
    00219   virtual void Resize (int width, int height)
    00220   { comp->Resize (width, height); }
    00221
    00223   virtual void ResizeTo (csRect newFrame)
    00224   { comp->ResizeTo (newFrame); }
    00225
    00227   virtual unsigned long GetID ()
    00228   { return comp->GetID (); }
    00229
    00234   virtual void SetID (unsigned long id)
    00235   { comp->SetID (id); }
    00236
    00237   virtual iAwsComponent* FindChild (const char* name)
    00238   { return comp->FindChild (name); }
    00239
    00240   virtual iAwsComponent* DoFindChild (unsigned int id)
    00241   { return comp->DoFindChild (id); }
    00242
    00243   virtual bool IsMaximized()
    00244   { return comp->IsMaximized(); }
    00245
    00246   virtual void Maximize()
    00247   { comp->Maximize(); }
    00248
    00249   virtual void UnMaximize()
    00250   { comp->UnMaximize(); }
    00251
    00253   virtual void LayoutChildren ()
    00254   { comp->LayoutChildren (); }
    00255
    00256   virtual void AddToLayout (iAwsComponent *cmp, iAwsComponentNode* settings)
    00257   { comp->AddToLayout (cmp, settings); }
    00258
    00260   virtual void SetFocusable (bool focusable)
    00261   { comp->SetFocusable (focusable); }
    00262
    00264   virtual bool Focusable ()
    00265   { return comp->Focusable (); }
    00266
    00268   virtual bool isFocused ()
    00269   { return comp->isFocused (); }
    00270
    00272   virtual void SetFocus ()
    00273   { comp->SetFocus (); }
    00274
    00276   virtual void UnsetFocus ()
    00277   { comp->UnsetFocus (); }
    00278
    00280   virtual bool AddToTabOrder (iAwsComponent *cmp)
    00281   { return comp->AddToTabOrder (cmp); }
    00282
    00284   virtual iAwsComponent *TabNext (iAwsComponent *cmp)
    00285   { return comp->TabNext (cmp); }
    00286
    00288   virtual iAwsComponent *TabPrev (iAwsComponent *cmp)
    00289   { return comp->TabPrev (cmp); }
    00290
    00292   virtual int GetTabLength ()
    00293   { return comp->GetTabLength (); }
    00294
    00296   virtual iAwsComponent *GetTabComponent (int index)
    00297   { return comp->GetTabComponent (index); }
    00298
    00300   virtual iAwsComponent *GetFirstFocusableChild (iAwsComponent *comp)
    00301   { return comp->GetFirstFocusableChild (comp); }
    00302
    00304   virtual void AddChild(iAwsComponent* child)
    00305   { comp->AddChild(child); }
    00306
    00308   virtual void RemoveChild(iAwsComponent *child)
    00309   { comp->RemoveChild(child); }
    00310
    00312   virtual int GetChildCount()
    00313   { return comp->GetChildCount(); }
    00314
    00316   virtual iAwsComponent *GetTopChild()
    00317   { return comp->GetTopChild(); }
    00318
    00320   virtual bool HasChildren()
    00321   { return comp->HasChildren(); }
    00322
    00323   virtual iAwsComponent *ChildAt(int x, int y)
    00324   { return comp->ChildAt(x,y); }
    00325
    00331   iAws *WindowManager()
    00332   { return comp->Window()->WindowManager(); }
    00333
    00335   iAwsComponent *Window()
    00336   { return comp->Window(); }
    00337
    00339   iAwsComponent *Parent()
    00340   { return comp->Parent(); }
    00341
    00343   virtual void SetParent(iAwsComponent *parent)
    00344   { comp->SetParent(parent); }
    00345
    00347   virtual iAwsComponent *ComponentAbove()
    00348   { return comp->ComponentAbove(); }
    00349
    00351   virtual iAwsComponent *ComponentBelow()
    00352   { return comp->ComponentBelow(); }
    00353
    00355   virtual void SetComponentAbove(iAwsComponent *cmp)
    00356   { comp->SetComponentAbove(cmp); }
    00357
    00359   virtual void SetComponentBelow(iAwsComponent *cmp)
    00360   { comp->SetComponentBelow(cmp); }
    00361
    00363   virtual void Raise()
    00364   { comp->Raise (); }
    00365
    00367   virtual void Lower()
    00368   { comp->Lower (); }
    00369
    00371   virtual void SetRedrawTag(unsigned int tag)
    00372   { comp->SetRedrawTag (tag); }
    00373
    00375   virtual unsigned int RedrawTag()
    00376   { return comp->RedrawTag (); }
    00377
    00379   virtual void OnDraw(csRect clip)
    00380   { comp->OnDraw (clip); }
    00381
    00383   virtual bool OnMouseDown(int button, int x, int y)
    00384   { return comp->OnMouseDown (button, x, y); }
    00385
    00387   virtual bool OnMouseUp(int button, int x, int y)
    00388   { return comp->OnMouseUp (button, x, y); }
    00389
    00391   virtual bool OnMouseMove(int button, int x, int y)
    00392   { return comp->OnMouseMove (button, x, y); }
    00393
    00395   virtual bool OnMouseClick(int button, int x, int y)
    00396   { return comp->OnMouseClick (button, x, y); }
    00397
    00399   virtual bool OnMouseDoubleClick(int button, int x, int y)
    00400   { return comp->OnMouseDoubleClick (button, x, y); }
    00401
    00403   virtual bool OnMouseExit()
    00404   { return comp->OnMouseExit (); }
    00405
    00407   virtual bool OnMouseEnter()
    00408   { return comp->OnMouseEnter (); }
    00409
    00411   virtual bool OnKeyboard (const csKeyEventData& eventData)
    00412   { return comp->OnKeyboard (eventData); }
    00413
    00415   virtual bool OnLostFocus()
    00416   { return comp->OnLostFocus (); }
    00417
    00419   virtual bool OnGainFocus()
    00420   { return comp->OnGainFocus (); }
    00421
    00423   virtual iAwsLayoutManager *Layout()
    00424   { return comp->Layout ();}
    00425
    00427   virtual void SetLayout(iAwsLayoutManager *layoutMgr)
    00428   { comp->SetLayout(layoutMgr); }
    00429
    00431   virtual csRect getPreferredSize()
    00432   { return comp->getPreferredSize (); }
    00433
    00435   virtual void setPreferredSize (const csRect& size)
    00436   { comp->setPreferredSize(size); }
    00437
    00439   virtual void clearPreferredSize ()
    00440   { comp->clearPreferredSize(); }
    00441
    00443   virtual csRect getMinimumSize()
    00444   { return comp->getMinimumSize (); }
    00445
    00447   virtual csRect getInsets()
    00448   { return comp->getInsets (); }
    00449
    00451   virtual bool isDeaf()
    00452   { return comp->isDeaf (); }
    00453
    00455   virtual void SetDeaf (bool isDeaf)
    00456   { comp->SetDeaf (isDeaf); }
    00457
    00459   virtual bool OnFrame()
    00460   { return comp->OnFrame ();}
    00461
    00463   virtual void OnAdded()
    00464   { comp->OnAdded ();}
    00465
    00467   virtual void OnResized()
    00468   { comp->OnResized ();}
    00469
    00471   virtual void OnChildMoved()
    00472   { comp->OnChildMoved(); }
    00473
    00475   virtual void OnRaise()
    00476   { comp->OnRaise(); }
    00477
    00479   virtual void OnLower()
    00480   { comp->OnLower(); }
    00481
    00483   virtual void OnChildHide()
    00484   { comp->OnChildHide(); }
    00485
    00487   virtual void OnChildShow()
    00488   { comp->OnChildShow(); }
    00489
    00491   virtual void Unlink()
    00492   { comp->Unlink(); }
    00493
    00495   void LinkBelow (iAwsComponent *c)
    00496   { comp->LinkBelow(c); }
    00497
    00499   void LinkAbove (iAwsComponent *c)
    00500   { comp->LinkAbove(c); }
    00501
    00503   virtual void SetTopChild(iAwsComponent* child)
    00504   { comp->SetTopChild(child); }
    00505
    00507   virtual void OnSetFocus()
    00508   { comp->OnSetFocus(); }
    00509
    00511   virtual void OnUnsetFocus()
    00512   { comp->OnUnsetFocus(); }
    00513
    00515   virtual void MarkToDelete()
    00516   { comp->MarkToDelete(); }
    00517
    00519   virtual bool GetMarkToDelete()
    00520   { return comp->GetMarkToDelete(); }
    00521 };
    00522
    00526 class awsEmbeddedComponentFactory : public iAwsComponentFactory
    00527 {
    00528 protected:
    00529   iAws *wmgr;
    00530
    00531 public:
    00536   awsEmbeddedComponentFactory(iAws *_wmgr)
    00537   {
    00538     wmgr = _wmgr;
    00539   }
    00540
    00542   virtual ~awsEmbeddedComponentFactory()
    00543   {
    00544   }
    00545
    00547   iAws *WindowManager() { return wmgr; }
    00548
    00550   virtual void Register(const char *type)
    00551   {
    00552     wmgr->RegisterComponentFactory(this, type);
    00553   }
    00554
    00556   virtual void RegisterConstant(const char *name, int value)
    00557   {
    00558     wmgr->GetPrefMgr()->RegisterConstant(name, value);
    00559   }
    00560 };
    00561
    00562 #endif // __CS_AWS_EMBEDDED_COMPONENT_H__
    00563