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 00046 public: 00047 awsEmbeddedComponent() { } 00048 virtual ~awsEmbeddedComponent() { } 00049 00050 public: 00052 virtual iAwsComponent *GetComponent () 00053 { return this; } 00054 00056 virtual bool RegisterSlot (iAwsSlot *slot, unsigned long signal) 00057 { return comp->RegisterSlot (slot, signal); } 00058 00060 virtual bool UnregisterSlot (iAwsSlot *slot, unsigned long signal) 00061 { return comp->UnregisterSlot (slot, signal); } 00062 00064 virtual void Broadcast (unsigned long signal) 00065 { comp->Broadcast (signal); } 00066 00067 public: 00069 virtual void Initialize (iAwsComponent *component) 00070 { 00071 comp = component; 00072 } 00073 00091 virtual bool Create (iAws *m, iAwsComponent *parent, 00092 iAwsComponentNode *settings) 00093 { 00094 return comp->Create(m, parent, settings); 00095 } 00096 00098 virtual bool Setup (iAws *wmgr, iAwsComponentNode *settings) 00099 { return comp->Setup (wmgr, settings); } 00100 00105 virtual bool HandleEvent(iEvent& Event) 00106 { 00107 return comp->HandleEvent(Event); 00108 } 00109 00114 virtual bool GetProperty (const char *name, void **parm) 00115 { return comp->GetProperty (name, parm); } 00116 00121 virtual bool SetProperty (const char *name, void *parm) 00122 { return comp->SetProperty (name, parm); } 00123 00125 virtual bool Execute (const char *action, iAwsParmList* parmlist) 00126 { return comp->Execute (action, parmlist); } 00127 00129 virtual void SetFlag (unsigned int flag) 00130 { comp->SetFlag (flag); } 00131 00133 virtual void ClearFlag (unsigned int flag) 00134 { comp->ClearFlag (flag); } 00135 00137 virtual unsigned int Flags () 00138 { return comp->Flags (); } 00139 00141 virtual void Invalidate () 00142 { comp->Invalidate (); } 00143 00145 virtual void Invalidate (csRect area) 00146 { comp->Invalidate (area); } 00147 00149 virtual csRect Frame () 00150 { return comp->Frame (); } 00151 00153 virtual csRect ClientFrame () 00154 { return comp->ClientFrame (); } 00155 00160 virtual const char *Type () 00161 { return comp->Type (); } 00162 00164 virtual bool Overlaps (csRect &r) 00165 { return comp->Overlaps (r); } 00166 00168 virtual bool isHidden () 00169 { return comp->isHidden (); } 00170 00172 virtual void Hide () 00173 { comp->Hide (); } 00174 00176 virtual void Show () 00177 { comp->Show (); } 00178 00180 virtual void Move (int delta_x, int delta_y) 00181 { comp->Move (delta_x, delta_y); } 00182 00184 virtual void MoveTo (int x, int y) 00185 { comp->MoveTo (x, y); } 00186 00188 virtual void Resize (int width, int height) 00189 { comp->Resize (width, height); } 00190 00192 virtual void ResizeTo (csRect newFrame) 00193 { comp->ResizeTo (newFrame); } 00194 00196 virtual unsigned long GetID () 00197 { return comp->GetID (); } 00198 00203 virtual void SetID (unsigned long id) 00204 { comp->SetID (id); } 00205 00206 virtual iAwsComponent* FindChild (const char* name) 00207 { return comp->FindChild (name); } 00208 00209 virtual iAwsComponent* DoFindChild (unsigned int id) 00210 { return comp->DoFindChild (id); } 00211 00212 virtual bool IsMaximized() 00213 { return comp->IsMaximized(); } 00214 00215 virtual void Maximize() 00216 { comp->Maximize(); } 00217 00218 virtual void UnMaximize() 00219 { comp->UnMaximize(); } 00220 00222 virtual void LayoutChildren () 00223 { comp->LayoutChildren (); } 00224 00225 virtual void AddToLayout (iAwsComponent *cmp, iAwsComponentNode* settings) 00226 { comp->AddToLayout (cmp, settings); } 00227 00229 virtual void SetFocusable (bool focusable) 00230 { comp->SetFocusable (focusable); } 00231 00233 virtual bool Focusable () 00234 { return comp->Focusable (); } 00235 00237 virtual bool isFocused () 00238 { return comp->isFocused (); } 00239 00241 virtual void SetFocus () 00242 { comp->SetFocus (); } 00243 00245 virtual void UnsetFocus () 00246 { comp->UnsetFocus (); } 00247 00249 virtual bool AddToTabOrder (iAwsComponent *cmp) 00250 { return comp->AddToTabOrder (cmp); } 00251 00253 virtual iAwsComponent *TabNext (iAwsComponent *cmp) 00254 { return comp->TabNext (cmp); } 00255 00257 virtual iAwsComponent *TabPrev (iAwsComponent *cmp) 00258 { return comp->TabPrev (cmp); } 00259 00261 virtual int GetTabLength () 00262 { return comp->GetTabLength (); } 00263 00265 virtual iAwsComponent *GetTabComponent (int index) 00266 { return comp->GetTabComponent (index); } 00267 00269 virtual iAwsComponent *GetFirstFocusableChild (iAwsComponent *comp) 00270 { return comp->GetFirstFocusableChild (comp); } 00271 00273 virtual void AddChild(iAwsComponent* child) 00274 { comp->AddChild(child); } 00275 00277 virtual void RemoveChild(iAwsComponent *child) 00278 { comp->RemoveChild(child); } 00279 00281 virtual int GetChildCount() 00282 { return comp->GetChildCount(); } 00283 00285 virtual iAwsComponent *GetTopChild() 00286 { return comp->GetTopChild(); } 00287 00289 virtual bool HasChildren() 00290 { return comp->HasChildren(); } 00291 00292 virtual iAwsComponent *ChildAt(int x, int y) 00293 { return comp->ChildAt(x,y); } 00294 00300 iAws *WindowManager() 00301 { return comp->Window()->WindowManager(); } 00302 00304 iAwsComponent *Window() 00305 { return comp->Window(); } 00306 00308 iAwsComponent *Parent() 00309 { return comp->Parent(); } 00310 00312 virtual void SetParent(iAwsComponent *parent) 00313 { comp->SetParent(parent); } 00314 00316 virtual iAwsComponent *ComponentAbove() 00317 { return comp->ComponentAbove(); } 00318 00320 virtual iAwsComponent *ComponentBelow() 00321 { return comp->ComponentBelow(); } 00322 00324 virtual void SetComponentAbove(iAwsComponent *cmp) 00325 { comp->SetComponentAbove(cmp); } 00326 00328 virtual void SetComponentBelow(iAwsComponent *cmp) 00329 { comp->SetComponentBelow(cmp); } 00330 00332 virtual void Raise() 00333 { comp->Raise (); } 00334 00336 virtual void Lower() 00337 { comp->Lower (); } 00338 00340 virtual void SetRedrawTag(unsigned int tag) 00341 { comp->SetRedrawTag (tag); } 00342 00344 virtual unsigned int RedrawTag() 00345 { return comp->RedrawTag (); } 00346 00348 virtual void OnDraw(csRect clip) 00349 { comp->OnDraw (clip); } 00350 00352 virtual bool OnMouseDown(int button, int x, int y) 00353 { return comp->OnMouseDown (button, x, y); } 00354 00356 virtual bool OnMouseUp(int button, int x, int y) 00357 { return comp->OnMouseUp (button, x, y); } 00358 00360 virtual bool OnMouseMove(int button, int x, int y) 00361 { return comp->OnMouseMove (button, x, y); } 00362 00364 virtual bool OnMouseClick(int button, int x, int y) 00365 { return comp->OnMouseClick (button, x, y); } 00366 00368 virtual bool OnMouseDoubleClick(int button, int x, int y) 00369 { return comp->OnMouseDoubleClick (button, x, y); } 00370 00372 virtual bool OnMouseExit() 00373 { return comp->OnMouseExit (); } 00374 00376 virtual bool OnMouseEnter() 00377 { return comp->OnMouseEnter (); } 00378 00380 virtual bool OnKeyboard (const csKeyEventData& eventData) 00381 { return comp->OnKeyboard (eventData); } 00382 00384 virtual bool OnLostFocus() 00385 { return comp->OnLostFocus (); } 00386 00388 virtual bool OnGainFocus() 00389 { return comp->OnGainFocus (); } 00390 00392 virtual iAwsLayoutManager *Layout() 00393 { return comp->Layout ();} 00394 00396 virtual void SetLayout(iAwsLayoutManager *layoutMgr) 00397 { comp->SetLayout(layoutMgr); } 00398 00400 virtual csRect getPreferredSize() 00401 { return comp->getPreferredSize (); } 00402 00404 virtual void setPreferredSize (const csRect& size) 00405 { comp->setPreferredSize(size); } 00406 00408 virtual void clearPreferredSize () 00409 { comp->clearPreferredSize(); } 00410 00412 virtual csRect getMinimumSize() 00413 { return comp->getMinimumSize (); } 00414 00416 virtual csRect getInsets() 00417 { return comp->getInsets (); } 00418 00420 virtual bool isDeaf() 00421 { return comp->isDeaf (); } 00422 00424 virtual void SetDeaf (bool isDeaf) 00425 { comp->SetDeaf (isDeaf); } 00426 00428 virtual bool OnFrame() 00429 { return comp->OnFrame ();} 00430 00432 virtual void OnAdded() 00433 { comp->OnAdded ();} 00434 00436 virtual void OnResized() 00437 { comp->OnResized ();} 00438 00440 virtual void OnChildMoved() 00441 { comp->OnChildMoved(); } 00442 00444 virtual void OnRaise() 00445 { comp->OnRaise(); } 00446 00448 virtual void OnLower() 00449 { comp->OnLower(); } 00450 00452 virtual void OnChildHide() 00453 { comp->OnChildHide(); } 00454 00456 virtual void OnChildShow() 00457 { comp->OnChildShow(); } 00458 00460 virtual void Unlink() 00461 { comp->Unlink(); } 00462 00464 void LinkBelow (iAwsComponent *c) 00465 { comp->LinkBelow(c); } 00466 00468 void LinkAbove (iAwsComponent *c) 00469 { comp->LinkAbove(c); } 00470 00472 virtual void SetTopChild(iAwsComponent* child) 00473 { comp->SetTopChild(child); } 00474 00476 virtual void OnSetFocus() 00477 { comp->OnSetFocus(); } 00478 00480 virtual void OnUnsetFocus() 00481 { comp->OnUnsetFocus(); } 00482 }; 00483 00487 class awsEmbeddedComponentFactory : public iAwsComponentFactory 00488 { 00489 protected: 00490 iAws *wmgr; 00491 00492 public: 00497 awsEmbeddedComponentFactory(iAws *_wmgr) 00498 { 00499 wmgr = _wmgr; 00500 } 00501 00503 virtual ~awsEmbeddedComponentFactory() 00504 { 00505 } 00506 00508 iAws *WindowManager() { return wmgr; } 00509 00511 virtual void Register(const char *type) 00512 { 00513 wmgr->RegisterComponentFactory(this, type); 00514 } 00515 00517 virtual void RegisterConstant(const char *name, int value) 00518 { 00519 wmgr->GetPrefMgr()->RegisterConstant(name, value); 00520 } 00521 }; 00522 00523 #endif // __CS_AWS_EMBEDDED_COMPONENT_H__ 00524
Generated for Crystal Space by doxygen 1.2.18