<HTML>
<HEAD>
<TITLE>Source</TITLE></HEAD><BODY><H6><A href=main.html>Contents page</A></H6><P>
<H6><A href=Main.html>Index</A></H6><P>
<H1>Source</H1>
<HR>
  //////////////////////////////////////////////////////////////////////////////<PRE>
  // panel.cpp
  //
  // Jeffry A Worth
  // November 10, 1995
  //////////////////////////////////////////////////////////////////////////////<P>

  //////////////////////////////////////////////////////////////////////////////
  // INCLUDES
  #include &quot;aframe:include/panel.hpp&quot;<P>

  //////////////////////////////////////////////////////////////////////////////
  //<P>

  AFPanel::AFPanel()
  {
    m_text=NULL;
  }<P>

  AFPanel::~AFPanel()
  {
    DestroyObject();
  }<P>

  void AFPanel::DestroyObject()
  {
    AFGadget::DestroyObject();
    if(m_text) {
      delete m_text;
      m_text=NULL;
    }
  }<P>

  void AFPanel::Create(char *text, AFWindow* pwindow, AFRect *rect, ULONG id, int bevel)
  {
    WORD w,h;<P>

    // Create the gadget
    AFGadget::Create(pwindow,rect,id);<P>

    // Create string for the text
    if(text) {
      m_text = new char[strlen(text)+1];
      strcpy(m_text,text);
    }<P>

    if(bevel!=PANEL_NOBORDER) {
      // Fill in coordinates to draw border
      w=rect-&gt;Width()-1;
      h=rect-&gt;Height()-1;
      m_xyshine[0]=m_xyshine[2]=m_xyshine[3]=m_xyshine[5]=0;
      _xyshine[1]=h;
      _xyshine[4]=w;<P>

      _xyshadow[0]=1;
      m_xyshadow[1]=m_xyshadow[3]=h;
      _xyshadow[2]=m_xyshadow[4]=w;
      _xyshadow[5]=0;<P>

     // Fill in Border Structure
      _gborder.LeftEdge = m_gborder2.LeftEdge = 0;
      _gborder.TopEdge = m_gborder2.TopEdge = 0;
      if(bevel) {
          m_gborder.FrontPen = 2;
          m_gborder2.FrontPen = 1;
      } else {
          m_gborder.FrontPen = 1;
          m_gborder2.FrontPen = 2;
        }
      m_gborder.BackPen = m_gborder2.BackPen = 0;
      m_gborder.DrawMode = m_gborder2.DrawMode = JAM1;
      m_gborder.Count = m_gborder2.Count = 3;
      m_gborder.XY = m_xyshine;
      m_gborder2.XY = m_xyshadow; 
      m_gborder.NextBorder = &amp;m_gborder2;
      m_gborder2.NextBorder = NULL;
    }<P>

    // Fill IntuiText Structure
    m_IntuiText.FrontPen = 1;
    m_IntuiText.DrawMode = JAM1;
    m_IntuiText.LeftEdge = 5;
    m_IntuiText.TopEdge = 5;
    m_IntuiText.ITextFont = NULL;
    m_IntuiText.IText = (UBYTE*)m_text;
    m_IntuiText.NextText = NULL;<P>

    // Attach IntuiText Struct and Border Struct to gadget Struct
    m_pgadget-&gt;GadgetText = &amp;m_IntuiText;<P>

    if(bevel!=PANEL_NOBORDER)
      m_pgadget-&gt;GadgetRender = &amp;m_gborder;
    else
      m_pgadget-&gt;GadgetRender = NULL;<P>

    m_pgadget-&gt;Flags = GFLG_GADGHNONE;
  }
<HR>
