From e3a393dd52f61962167e7e83e1a0204282c3634e Mon Sep 17 00:00:00 2001
From: Bill Currie <bill@taniwha.org>
Date: Fri, 13 Feb 2004 02:52:14 +0000
Subject: [PATCH] add Pic and CenterPic views

---
 ruamoko/gui/Makefile.am     |  2 +-
 ruamoko/gui/Pic.r           | 33 +++++++++++++++++++++++++++++++++
 ruamoko/include/Makefile.am |  2 +-
 ruamoko/include/gui/Pic.h   | 18 ++++++++++++++++++
 4 files changed, 53 insertions(+), 2 deletions(-)
 create mode 100644 ruamoko/gui/Pic.r
 create mode 100644 ruamoko/include/gui/Pic.h

diff --git a/ruamoko/gui/Makefile.am b/ruamoko/gui/Makefile.am
index 4ca3e86d0..c461c4054 100644
--- a/ruamoko/gui/Makefile.am
+++ b/ruamoko/gui/Makefile.am
@@ -27,7 +27,7 @@ EXTRA_LIBRARIES= $(gui_libs)
 	$(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $<
 
 libgui_a_SOURCES= \
-	Group.r InputLine.r Point.r Rect.r Size.r Slider.r Text.r View.r
+	Group.r InputLine.r Pic.r Point.r Rect.r Size.r Slider.r Text.r View.r
 libgui_a_AR=	$(PAK) -cf
 
 CLEANFILES=	*.qfo *.o
diff --git a/ruamoko/gui/Pic.r b/ruamoko/gui/Pic.r
new file mode 100644
index 000000000..a8fe2822e
--- /dev/null
+++ b/ruamoko/gui/Pic.r
@@ -0,0 +1,33 @@
+#include "draw.h"
+#include "string.h"
+#include "gui/Pic.h"
+
+@implementation Pic
+-(id)init
+{
+	pic_name = str_new ();
+	return self;
+}
+
+-(void)dealloc
+{
+	str_free (pic_name);
+}
+
+-(void)setPic:(string)pic
+{
+	str_copy (pic_name, pic);
+}
+
+-(void)draw
+{
+	Draw_Pic (xabs, yabs, Draw_CachePic (pic_name, 1));
+}
+@end
+
+@implementation CenterPic
+-(void)draw
+{
+	Draw_CenterPic (xabs, yabs, Draw_CachePic (pic_name, 1));
+}
+@end
diff --git a/ruamoko/include/Makefile.am b/ruamoko/include/Makefile.am
index f462ed4e2..a7e63d9ce 100644
--- a/ruamoko/include/Makefile.am
+++ b/ruamoko/include/Makefile.am
@@ -10,5 +10,5 @@ nobase_include_HEADERS= \
 	cbuf.h cmd.h cvar.h file.h gib.h hash.h plist.h \
 	Object.h AutoreleasePool.h Array.h Entity.h List.h ListNode.h Stack.h \
 	\
-	gui/Group.h gui/InputLine.h gui/Point.h gui/Rect.h gui/Size.h \
+	gui/Group.h gui/InputLine.h gui/Pic.h gui/Point.h gui/Rect.h gui/Size.h \
 	gui/Slider.h gui/Text.h gui/View.h
diff --git a/ruamoko/include/gui/Pic.h b/ruamoko/include/gui/Pic.h
new file mode 100644
index 000000000..d50aed866
--- /dev/null
+++ b/ruamoko/include/gui/Pic.h
@@ -0,0 +1,18 @@
+#ifndef __ruamoko_gui_Pic_h
+#define __ruamoko_gui_Pic_h
+
+#include "gui/View.h"
+
+@interface Pic : View
+{
+	string pic_name;
+}
+-(void)setPic:(string)pic;
+-(void)draw;
+@end
+
+@interface CenterPic : Pic
+-(void)draw;
+@end
+
+#endif//__ruamoko_gui_Pic_h