summaryrefslogtreecommitdiff
path: root/common/basewnd.h
diff options
context:
space:
mode:
authorleo2001-01-07 15:46:20 +0000
committerleo2001-01-07 15:46:20 +0000
commitd88eaa6475871ee4427620ba7c61a8a2c89395c8 (patch)
treed4383792991d90f674f081a59a46c6ab7f476f22 /common/basewnd.h
parent8ca5cc51bcdcb00cead46a655a646cc8c8e85b7d (diff)
Base top-level window class
git-svn-id: http://svn.leocad.org/trunk@223 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/basewnd.h')
-rw-r--r--common/basewnd.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/common/basewnd.h b/common/basewnd.h
new file mode 100644
index 0000000..a767f68
--- /dev/null
+++ b/common/basewnd.h
@@ -0,0 +1,75 @@
+#ifndef _BASEWND_H_
+#define _BASEWND_H_
+
+#include <string.h>
+#include <gtk/gtk.h>
+typedef GtkWidget* BaseWndXID;
+typedef struct
+{
+ GtkWidget* widget;
+ GtkAccelGroup* accel;
+} BaseMenuItem;
+
+// =============================================================================
+// Message Box constants
+
+#define LC_OK 1
+#define LC_CANCEL 2
+#define LC_ABORT 3
+#define LC_RETRY 4
+#define LC_IGNORE 5
+#define LC_YES 6
+#define LC_NO 7
+
+#define LC_MB_OK 0x000
+#define LC_MB_OKCANCEL 0x001
+//#define LC_MB_ABORTRETRYIGNORE 0x002
+#define LC_MB_YESNOCANCEL 0x003
+#define LC_MB_YESNO 0x004
+//#define LC_MB_RETRYCANCEL 0x005
+
+#define LC_MB_ICONERROR 0x010
+#define LC_MB_ICONQUESTION 0x020
+#define LC_MB_ICONWARNING 0x040
+#define LC_MB_ICONINFORMATION 0x080
+
+#define LC_MB_TYPEMASK 0x00F
+#define LC_MB_ICONMASK 0x0F0
+
+// =============================================================================
+
+class BaseWnd
+{
+ public:
+ BaseWnd (BaseWnd *parent, int menu_count);
+ virtual ~BaseWnd ();
+
+ int MessageBox (const char* text, const char* caption="LeoCAD", int flags=LC_MB_OK|LC_MB_ICONINFORMATION);
+ void BeginWait ();
+ void EndWait ();
+ void SetTitle (const char *title);
+
+ void ShowMenuItem (int id, bool show);
+ void EnableMenuItem (int id, bool enable);
+ void CheckMenuItem (int id, bool check);
+ void SetMenuItemText (int id, const char *text);
+
+ BaseWndXID GetXID () const
+ { return m_pXID; }
+
+ // FIXME: remove
+ operator GtkWidget* () const
+ { return m_pXID; }
+
+ BaseMenuItem* GetMenuItem (int id) const
+ { return &m_pMenuItems[id]; }
+ void SetMenuItem (int id, BaseMenuItem* item)
+ { memcpy (&m_pMenuItems[id], item, sizeof (BaseMenuItem)); }
+
+ protected:
+ BaseWnd* m_pParent;
+ BaseWndXID m_pXID;
+ BaseMenuItem* m_pMenuItems;
+};
+
+#endif // _BASEWND_H_