aswang  1.0
Pen.cpp
Go to the documentation of this file.
00001 /*
00002         Copyright 2003 Joseph Alvis
00003 
00004     This file is part of Aswang.
00005 
00006     Aswang is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU Lesser General Public License as published by
00008     the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 
00011     Aswang is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public License
00017     along with Aswang.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 #include "pen.h"
00021 
00022 using namespace aswang;
00023 
00024 void Pen::Delete() {
00025         if(hp!=NULL) {
00026                 DeleteObject(hp);
00027                 hp=NULL;
00028         }
00029 }
00030 
00031 void Pen::Create(int style,int width,COLORREF cf) {
00032         Delete();
00033         hp=CreatePen(style,width,cf);
00034 }
00035 
00036 const Pen &Pen::operator = (HPEN nhp) {
00037         Delete();
00038         hp=nhp;
00039         return *this;
00040 }
00041 
00042 const Pen &Pen::operator = (COLORREF cf) {
00043         Create(cf);
00044         return *this;
00045 }
00046 
00047 LOGPEN Pen::GetObjectInfo() {
00048         LOGPEN lpen;
00049         memset(&lpen,0,sizeof(lpen));
00050         if(hp!=NULL)
00051                 GetObject(hp,sizeof(lpen),&lpen);
00052         return lpen;
00053 }
00054 
00055 unsigned int Pen::GetStyle() {
00056         LOGPEN lpen=GetObjectInfo();
00057         return lpen.lopnStyle;
00058 }
00059 
00060 POINT Pen::GetWidth() {
00061         LOGPEN lpen=GetObjectInfo();
00062         return lpen.lopnWidth;
00063 }
00064 
00065 COLORREF Pen::GetColor() {
00066         LOGPEN lpen=GetObjectInfo();
00067         return lpen.lopnColor;
00068 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines