<commit_before>#include "cssysdef.h"
#include "awsprefs.h"
#include "awscomp.h"
#include "awsslot.h"


awsComponent::awsComponent():children(NULL)
{
}

awsComponent::~awsComponent()
{
   /// Let go our references to any children if we have them.
   if (children)
   {
      void *item = children->GetFirstItem();

      while(item)
      {
         awsComponent *cmp = (awsComponent *)item;

         cmp->DecRef();

         item = children->GetNextItem();
      }

      delete children;
   }
}
    
    
/**
 *  This function is normally called automatically by the window manager.  You may call it manually if you wish, but
 * there's little reason to do so.  
 **************************************************************************************************************/
bool 
awsComponent::Setup(iAws *_wmgr, awsComponentNode *settings)
{
  if (!wmgr) return false;

  wmgr = _wmgr;
  
  if (settings) 
  {
  
   iAwsPrefs *pm=WindowManager()->GetPrefMgr();
   iString *id_str=NULL;
  
   pm->GetRect(settings, "Frame", frame);
   pm->GetString(settings, "Id", id_str);

   if (id_str!=NULL) id = pm->NameToId(id_str->GetData());

   // Children are automatically filled in by the windowmanager.
   
  }

  return true;

}

void
awsComponent::Invalidate()
{
  WindowManager()->Mark(frame);
}

void 
awsComponent::Invalidate(csRect area)
{
  WindowManager()->Mark(area);
}

bool 
awsComponent::HandleEvent()
{
  return false;
}

bool 
awsComponent::Overlaps(csRect &r)
{
  return frame.Intersects(r);
}

void 
awsComponent::AddChild(awsComponent *child, bool owner=true)
{
   // Only grab a reference if we are not the owner.
   if (owner==false)
     child->IncRef();

   // Create a new child list if the current one does not exist.
   if (children==NULL)
     children = new csDLinkList();
   
   children->AddItem(child);
   
   // Modify the child's rectangle to be inside and relative to the parent's rectangle.
   child->frame.Move(frame.xmin, frame.ymin);
}

void 
awsComponent::RemoveChild(awsComponent *child)
{
   if (children)
     children->RemoveItem(child);
}

awsComponent *
awsComponent::GetFirstChild()
{
   if (children)
     return (awsComponent *)children->GetFirstItem();

   return NULL;
}

    
awsComponent *
awsComponent::GetNextChild()
{
   if (children)
    return (awsComponent *)children->GetNextItem();

  return NULL;
}
    


/////////////////////////////////////  awsComponentFactory ////////////////////////////////////////////////////////

/**
  *  A factory is simply a class that knows how to build your component.  Although components aren't required to have
  * a factory, they will not be able to be instantiated through the template functions and window definitions if they
  * don't.  In any case, a factory is remarkably simple to build.  All you need to do is to inherit from 
  * awsComponentFactory and call register with the window manager and the named type of the component.  That's it.
  */
awsComponentFactory::awsComponentFactory(iAws *wmgr)
{
   // This is where you call register, only you must do it in the derived factory.  Like this:
   // Register(wmgr, "Radio Button");
}

awsComponentFactory::~awsComponentFactory()
{
   // Do nothing.
}

void
awsComponentFactory::Register(iAws *wmgr, char *name)
{
    wmgr->RegisterComponentFactory(this, name);
}



<commit_msg>Fixed the OTHER silly definition error in awscomp.cpp.  I'm still confused as to how it disappeared on one side.<commit_after>#include "cssysdef.h"
#include "awsprefs.h"
#include "awscomp.h"
#include "awsslot.h"


awsComponent::awsComponent():children(NULL)
{
}

awsComponent::~awsComponent()
{
   /// Let go our references to any children if we have them.
   if (children)
   {
      void *item = children->GetFirstItem();

      while(item)
      {
         awsComponent *cmp = (awsComponent *)item;

         cmp->DecRef();

         item = children->GetNextItem();
      }

      delete children;
   }
}
    
    
/**
 *  This function is normally called automatically by the window manager.  You may call it manually if you wish, but
 * there's little reason to do so.  
 **************************************************************************************************************/
bool 
awsComponent::Setup(iAws *_wmgr, awsComponentNode *settings)
{
  if (!wmgr) return false;

  wmgr = _wmgr;
  
  if (settings) 
  {
  
   iAwsPrefs *pm=WindowManager()->GetPrefMgr();
   iString *id_str=NULL;
  
   pm->GetRect(settings, "Frame", frame);
   pm->GetString(settings, "Id", id_str);

   if (id_str!=NULL) id = pm->NameToId(id_str->GetData());

   // Children are automatically filled in by the windowmanager.
   
  }

  return true;

}

void
awsComponent::Invalidate()
{
  WindowManager()->Mark(frame);
}

void 
awsComponent::Invalidate(csRect area)
{
  WindowManager()->Mark(area);
}

bool 
awsComponent::HandleEvent()
{
  return false;
}

bool 
awsComponent::Overlaps(csRect &r)
{
  return frame.Intersects(r);
}

void 
awsComponent::AddChild(awsComponent *child, bool owner)
{
   // Only grab a reference if we are not the owner.
   if (owner==false)
     child->IncRef();

   // Create a new child list if the current one does not exist.
   if (children==NULL)
     children = new csDLinkList();
   
   children->AddItem(child);
   
   // Modify the child's rectangle to be inside and relative to the parent's rectangle.
   child->frame.Move(frame.xmin, frame.ymin);
}

void 
awsComponent::RemoveChild(awsComponent *child)
{
   if (children)
     children->RemoveItem(child);
}

awsComponent *
awsComponent::GetFirstChild()
{
   if (children)
     return (awsComponent *)children->GetFirstItem();

   return NULL;
}

    
awsComponent *
awsComponent::GetNextChild()
{
   if (children)
    return (awsComponent *)children->GetNextItem();

  return NULL;
}
    


/////////////////////////////////////  awsComponentFactory ////////////////////////////////////////////////////////

/**
  *  A factory is simply a class that knows how to build your component.  Although components aren't required to have
  * a factory, they will not be able to be instantiated through the template functions and window definitions if they
  * don't.  In any case, a factory is remarkably simple to build.  All you need to do is to inherit from 
  * awsComponentFactory and call register with the window manager and the named type of the component.  That's it.
  */
awsComponentFactory::awsComponentFactory(iAws *wmgr)
{
   // This is where you call register, only you must do it in the derived factory.  Like this:
   // Register(wmgr, "Radio Button");
}

awsComponentFactory::~awsComponentFactory()
{
   // Do nothing.
}

void
awsComponentFactory::Register(iAws *wmgr, char *name)
{
    wmgr->RegisterComponentFactory(this, name);
}




{'fraction_non_alphanumeric': 0.16642011834319526, 'fraction_numerical': 0.0, 'mean_word_length': 3.191568505889647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2324000', 'n_tokens_mistral': 2034, 'n_tokens_neox': 1976, 'n_words': 612}