// panel.cpp // // Jeffry A Worth // November 10, 1995 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // INCLUDES #include "aframe:include/panel.hpp"
////////////////////////////////////////////////////////////////////////////// //
AFPanel::AFPanel() { m_text=NULL; }
AFPanel::~AFPanel() { DestroyObject(); }
void AFPanel::DestroyObject() { AFGadget::DestroyObject(); if(m_text) { delete m_text; m_text=NULL; } }
void AFPanel::Create(char *text, AFWindow* pwindow, AFRect *rect, ULONG id, int bevel) { WORD w,h;
// Create the gadget AFGadget::Create(pwindow,rect,id);
// Create string for the text if(text) { m_text = new char[strlen(text)+1]; strcpy(m_text,text); }
if(bevel!=PANEL_NOBORDER) { // Fill in coordinates to draw border w=rect->Width()-1; h=rect->Height()-1; m_xyshine[0]=m_xyshine[2]=m_xyshine[3]=m_xyshine[5]=0; _xyshine[1]=h; _xyshine[4]=w;
_xyshadow[0]=1; m_xyshadow[1]=m_xyshadow[3]=h; _xyshadow[2]=m_xyshadow[4]=w; _xyshadow[5]=0;
// 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 = &m_gborder2; m_gborder2.NextBorder = NULL; }
// 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;
// Attach IntuiText Struct and Border Struct to gadget Struct m_pgadget->GadgetText = &m_IntuiText;
if(bevel!=PANEL_NOBORDER) m_pgadget->GadgetRender = &m_gborder; else m_pgadget->GadgetRender = NULL;
m_pgadget->Flags = GFLG_GADGHNONE; }