diff anagram/vaclgui/multiline.hpp @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/anagram/vaclgui/multiline.hpp	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,57 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * multiline.hpp
+ */
+
+#ifndef MULTILINE_HPP
+#define MULTILINE_HPP
+
+#include <ipainhdr.hpp>
+#include <istattxt.hpp>
+
+#include "agstring.h"
+#include "base.h"
+
+class MultiLineText
+  : public IStaticText
+  , public IPaintHandler
+{
+private:
+  int nLines;
+  AgString textString;
+  ISize margin;
+  int vTab;
+
+public:
+  MultiLineText(IWindow *owner,
+                IRectangle r = IRectangle(),
+                IStaticText::Style s = IStaticText::classDefaultStyle)
+    : IStaticText(nextChildId(), owner, owner, r, s)
+    , nLines(0)
+    , margin(8,8)
+    , vTab(0)
+  {
+    IPaintHandler::handleEventsFor(this);
+  }
+  ~MultiLineText() {
+    IPaintHandler::stopHandlingEventsFor(this);
+  }
+  MultiLineText &setTextString(AgString s);
+
+  // otherwise the compiler complains that this is hidden
+  virtual IStaticText &setText(const IResourceId &ir) {
+    return IStaticText::setText(ir);
+  }
+
+  virtual MultiLineText &setText(const char *s);
+  Boolean paintWindow(IPaintEvent &event);
+  ISize calcMinimumSize() const;
+  MultiLineText &setMargin(ISize s) { margin = s; return *this; }
+  MultiLineText &setMargin(int w, int h) { margin = ISize(w,h); return *this; }
+  MultiLineText &setVTab(int v) { vTab = v; return *this; }
+};
+
+#endif /* MULTILINE_HPP */