]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxMiniFrame
authorRobert Roebling <robert@roebling.de>
Fri, 4 Dec 1998 07:43:56 +0000 (07:43 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 4 Dec 1998 07:43:56 +0000 (07:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

42 files changed:
include/wx/gtk/frame.h
include/wx/gtk/minifram.h [new file with mode: 0644]
include/wx/gtk/notebook.h
include/wx/gtk1/frame.h
include/wx/gtk1/minifram.h [new file with mode: 0644]
include/wx/gtk1/notebook.h
samples/minifram/Makefile [new file with mode: 0644]
samples/minifram/Makefile.in [new file with mode: 0644]
samples/minifram/bitmaps/copy.bmp [new file with mode: 0644]
samples/minifram/bitmaps/copy.xpm [new file with mode: 0644]
samples/minifram/bitmaps/cut.bmp [new file with mode: 0644]
samples/minifram/bitmaps/cut.xpm [new file with mode: 0644]
samples/minifram/bitmaps/help.bmp [new file with mode: 0644]
samples/minifram/bitmaps/help.xpm [new file with mode: 0644]
samples/minifram/bitmaps/new.bmp [new file with mode: 0644]
samples/minifram/bitmaps/new.xpm [new file with mode: 0644]
samples/minifram/bitmaps/open.bmp [new file with mode: 0644]
samples/minifram/bitmaps/open.xpm [new file with mode: 0644]
samples/minifram/bitmaps/page.bmp [new file with mode: 0644]
samples/minifram/bitmaps/paste.bmp [new file with mode: 0644]
samples/minifram/bitmaps/preview.bmp [new file with mode: 0644]
samples/minifram/bitmaps/preview.xpm [new file with mode: 0644]
samples/minifram/bitmaps/print.bmp [new file with mode: 0644]
samples/minifram/bitmaps/print.xpm [new file with mode: 0644]
samples/minifram/bitmaps/save.bmp [new file with mode: 0644]
samples/minifram/bitmaps/save.xpm [new file with mode: 0644]
samples/minifram/makefile.b32 [new file with mode: 0644]
samples/minifram/makefile.dos [new file with mode: 0644]
samples/minifram/makefile.g95 [new file with mode: 0644]
samples/minifram/makefile.nt [new file with mode: 0644]
samples/minifram/makefile.unx [new file with mode: 0644]
samples/minifram/mondrian.ico [new file with mode: 0644]
samples/minifram/mondrian.xpm [new file with mode: 0644]
samples/minifram/test.cpp [new file with mode: 0644]
samples/minifram/test.def [new file with mode: 0644]
samples/minifram/test.h [new file with mode: 0644]
samples/minifram/test.rc [new file with mode: 0644]
src/gtk.inc
src/gtk/frame.cpp
src/gtk/minifram.cpp [new file with mode: 0644]
src/gtk1/frame.cpp
src/gtk1/minifram.cpp [new file with mode: 0644]

index c87f59f47ceeb42d6b9dfc3c987c6dd4bccef537..3c235d2171a861540bd3deea2e016ae981c7e3e9 100644 (file)
@@ -99,7 +99,7 @@ public:
   void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
   void OnSize( wxSizeEvent &event );
   void OnCloseWindow( wxCloseEvent& event );
-  void OnIdle(wxIdleEvent& event);
+  void OnIdle(wxIdleEvent& event );
 
   // implementation
   
@@ -113,6 +113,7 @@ public:
   wxToolBar    *m_frameToolBar;
   wxString      m_title;
   wxIcon        m_icon;
+  int           m_miniEdge,m_miniTitle;
 
   DECLARE_EVENT_TABLE()
 };
diff --git a/include/wx/gtk/minifram.h b/include/wx/gtk/minifram.h
new file mode 100644 (file)
index 0000000..9f1ebaa
--- /dev/null
@@ -0,0 +1,69 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        minifram.h
+// Purpose:     wxMiniFrame class
+// Author:      Robert Roebling
+// RCS-ID:      $Id$
+// Copyright:   (c) Robert Roebling
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __GTKMINIFRAMEH__
+#define __GTKMINIFRAMEH__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/frame.h"
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class wxMiniFrame;
+
+//-----------------------------------------------------------------------------
+// wxMiniFrame
+//-----------------------------------------------------------------------------
+
+class wxMiniFrame: public wxFrame 
+{
+  DECLARE_DYNAMIC_CLASS(wxMiniFrame)
+
+public:
+  inline wxMiniFrame(void) {}
+  inline wxMiniFrame(wxWindow *parent,
+           wxWindowID id,
+           const wxString& title,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ,
+           const wxString& name = wxFrameNameStr)
+  {
+      Create(parent, id, title, pos, size, style, name);
+  }
+  bool Create(wxWindow *parent,
+           wxWindowID id,
+           const wxString& title,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ,
+           const wxString& name = wxFrameNameStr);
+          
+  // implementation       
+          
+  bool   m_isDragging;
+  int    m_oldX,m_oldY;
+  int    m_diffX,m_diffY;
+  
+  void DrawFrame( int x, int y );
+  void OnPaint( wxPaintEvent &event );
+  void OnMouse( wxMouseEvent &event );
+
+  DECLARE_EVENT_TABLE()
+};
+
+#endif
+  //  __GTKMINIFRAMEH__
index 8cfa171f7e677c823ffafda6cec08362e9ce9f30..d61603dd8fdaa9c32926e784f21bbd8085072ab5 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Robert Roebling
 // Modified by:
 // RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart and Markus Holzem
+// Copyright:   (c) Julian Smart and Robert Roebling
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
index c87f59f47ceeb42d6b9dfc3c987c6dd4bccef537..3c235d2171a861540bd3deea2e016ae981c7e3e9 100644 (file)
@@ -99,7 +99,7 @@ public:
   void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
   void OnSize( wxSizeEvent &event );
   void OnCloseWindow( wxCloseEvent& event );
-  void OnIdle(wxIdleEvent& event);
+  void OnIdle(wxIdleEvent& event );
 
   // implementation
   
@@ -113,6 +113,7 @@ public:
   wxToolBar    *m_frameToolBar;
   wxString      m_title;
   wxIcon        m_icon;
+  int           m_miniEdge,m_miniTitle;
 
   DECLARE_EVENT_TABLE()
 };
diff --git a/include/wx/gtk1/minifram.h b/include/wx/gtk1/minifram.h
new file mode 100644 (file)
index 0000000..9f1ebaa
--- /dev/null
@@ -0,0 +1,69 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        minifram.h
+// Purpose:     wxMiniFrame class
+// Author:      Robert Roebling
+// RCS-ID:      $Id$
+// Copyright:   (c) Robert Roebling
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __GTKMINIFRAMEH__
+#define __GTKMINIFRAMEH__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/frame.h"
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class wxMiniFrame;
+
+//-----------------------------------------------------------------------------
+// wxMiniFrame
+//-----------------------------------------------------------------------------
+
+class wxMiniFrame: public wxFrame 
+{
+  DECLARE_DYNAMIC_CLASS(wxMiniFrame)
+
+public:
+  inline wxMiniFrame(void) {}
+  inline wxMiniFrame(wxWindow *parent,
+           wxWindowID id,
+           const wxString& title,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ,
+           const wxString& name = wxFrameNameStr)
+  {
+      Create(parent, id, title, pos, size, style, name);
+  }
+  bool Create(wxWindow *parent,
+           wxWindowID id,
+           const wxString& title,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ,
+           const wxString& name = wxFrameNameStr);
+          
+  // implementation       
+          
+  bool   m_isDragging;
+  int    m_oldX,m_oldY;
+  int    m_diffX,m_diffY;
+  
+  void DrawFrame( int x, int y );
+  void OnPaint( wxPaintEvent &event );
+  void OnMouse( wxMouseEvent &event );
+
+  DECLARE_EVENT_TABLE()
+};
+
+#endif
+  //  __GTKMINIFRAMEH__
index 8cfa171f7e677c823ffafda6cec08362e9ce9f30..d61603dd8fdaa9c32926e784f21bbd8085072ab5 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Robert Roebling
 // Modified by:
 // RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart and Markus Holzem
+// Copyright:   (c) Julian Smart and Robert Roebling
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
diff --git a/samples/minifram/Makefile b/samples/minifram/Makefile
new file mode 100644 (file)
index 0000000..bccce53
--- /dev/null
@@ -0,0 +1 @@
+include ../../setup/general/makeapp
diff --git a/samples/minifram/Makefile.in b/samples/minifram/Makefile.in
new file mode 100644 (file)
index 0000000..9e9b1b6
--- /dev/null
@@ -0,0 +1,26 @@
+# WXXT base directory
+WXBASEDIR=@WXBASEDIR@
+
+# set the OS type for compilation
+OS=@OS@
+# compile a library only
+RULE=bin
+
+# define library name
+BIN_TARGET=toolbar
+# define library sources
+BIN_SRC=\
+test.cpp
+
+#define library objects
+BIN_OBJ=\
+test.o
+
+# additional things needed to link
+BIN_LINK=
+
+# additional things needed to compile
+ADD_COMPILE=
+
+# include the definitions now
+include ../../../template.mak
diff --git a/samples/minifram/bitmaps/copy.bmp b/samples/minifram/bitmaps/copy.bmp
new file mode 100644 (file)
index 0000000..4551a06
Binary files /dev/null and b/samples/minifram/bitmaps/copy.bmp differ
diff --git a/samples/minifram/bitmaps/copy.xpm b/samples/minifram/bitmaps/copy.xpm
new file mode 100644 (file)
index 0000000..47565c1
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char *copy_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+"  c None",
+". c Black",
+"X c Gray100",
+"o c #000080",
+/* pixels */
+"                ",
+" ......         ",
+" .XXXX..        ",
+" .XXXX.X.       ",
+" .X..X.oooooo   ",
+" .XXXXXoXXXXoo  ",
+" .X....oXXXXoXo ",
+" .XXXXXoX..Xoooo",
+" .X....oXXXXXXXo",
+" .XXXXXoX.....Xo",
+" ......oXXXXXXXo",
+"       oX.....Xo",
+"       oXXXXXXXo",
+"       ooooooooo",
+"                "
+};
diff --git a/samples/minifram/bitmaps/cut.bmp b/samples/minifram/bitmaps/cut.bmp
new file mode 100644 (file)
index 0000000..1555433
Binary files /dev/null and b/samples/minifram/bitmaps/cut.bmp differ
diff --git a/samples/minifram/bitmaps/cut.xpm b/samples/minifram/bitmaps/cut.xpm
new file mode 100644 (file)
index 0000000..bfe7e95
--- /dev/null
@@ -0,0 +1,24 @@
+/* XPM */
+static char *cut_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+"  c None",
+". c Black",
+"X c #000080",
+/* pixels */
+"                ",
+"     .   .      ",
+"     .   .      ",
+"     .   .      ",
+"     .. ..      ",
+"      . .       ",
+"      ...       ",
+"       .        ",
+"      X.X       ",
+"      X XXX     ",
+"    XXX X  X    ",
+"   X  X X  X    ",
+"   X  X X  X    ",
+"   X  X  XX     ",
+"    XX          "
+};
diff --git a/samples/minifram/bitmaps/help.bmp b/samples/minifram/bitmaps/help.bmp
new file mode 100644 (file)
index 0000000..2d9e692
Binary files /dev/null and b/samples/minifram/bitmaps/help.bmp differ
diff --git a/samples/minifram/bitmaps/help.xpm b/samples/minifram/bitmaps/help.xpm
new file mode 100644 (file)
index 0000000..50fdb41
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char *help_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+"  c None",
+". c Black",
+"X c Blue",
+"o c #000080",
+/* pixels */
+"                ",
+"     ......     ",
+"    .XXXXX..    ",
+"   .XX...oX..   ",
+"   .X..  .X..   ",
+"   .X.. .XX..   ",
+"    .. .XX..    ",
+"      .XX..     ",
+"      .X..      ",
+"      .X..      ",
+"      .o..      ",
+"       ..       ",
+"      .XX..     ",
+"      .XX..     ",
+"       ...      "
+};
diff --git a/samples/minifram/bitmaps/new.bmp b/samples/minifram/bitmaps/new.bmp
new file mode 100644 (file)
index 0000000..d66feb2
Binary files /dev/null and b/samples/minifram/bitmaps/new.bmp differ
diff --git a/samples/minifram/bitmaps/new.xpm b/samples/minifram/bitmaps/new.xpm
new file mode 100644 (file)
index 0000000..754d2d2
--- /dev/null
@@ -0,0 +1,24 @@
+/* XPM */
+static char *new_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+"  c None",
+". c Black",
+"X c Gray100",
+/* pixels */
+"                ",
+"   ........     ",
+"   .XXXXXX..    ",
+"   .XXXXXX.X.   ",
+"   .XXXXXX....  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   .XXXXXXXXX.  ",
+"   ...........  ",
+"                "
+};
diff --git a/samples/minifram/bitmaps/open.bmp b/samples/minifram/bitmaps/open.bmp
new file mode 100644 (file)
index 0000000..bbf93fe
Binary files /dev/null and b/samples/minifram/bitmaps/open.bmp differ
diff --git a/samples/minifram/bitmaps/open.xpm b/samples/minifram/bitmaps/open.xpm
new file mode 100644 (file)
index 0000000..54748e9
--- /dev/null
@@ -0,0 +1,26 @@
+/* XPM */
+static char *open_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+"  c None",
+". c Black",
+"X c Yellow",
+"o c Gray100",
+"O c #bfbf00",
+/* pixels */
+"                ",
+"          ...   ",
+"         .   . .",
+"              ..",
+"  ...        ...",
+" .XoX.......    ",
+" .oXoXoXoXo.    ",
+" .XoXoXoXoX.    ",
+" .oXoX..........",
+" .XoX.OOOOOOOOO.",
+" .oo.OOOOOOOOO. ",
+" .X.OOOOOOOOO.  ",
+" ..OOOOOOOOO.   ",
+" ...........    ",
+"                "
+};
diff --git a/samples/minifram/bitmaps/page.bmp b/samples/minifram/bitmaps/page.bmp
new file mode 100644 (file)
index 0000000..3dbd4b0
Binary files /dev/null and b/samples/minifram/bitmaps/page.bmp differ
diff --git a/samples/minifram/bitmaps/paste.bmp b/samples/minifram/bitmaps/paste.bmp
new file mode 100644 (file)
index 0000000..564f514
Binary files /dev/null and b/samples/minifram/bitmaps/paste.bmp differ
diff --git a/samples/minifram/bitmaps/preview.bmp b/samples/minifram/bitmaps/preview.bmp
new file mode 100644 (file)
index 0000000..da1f4db
Binary files /dev/null and b/samples/minifram/bitmaps/preview.bmp differ
diff --git a/samples/minifram/bitmaps/preview.xpm b/samples/minifram/bitmaps/preview.xpm
new file mode 100644 (file)
index 0000000..0dfdca4
--- /dev/null
@@ -0,0 +1,26 @@
+/* XPM */
+static char *preview_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+"  c Black",
+". c None",
+"X c Gray100",
+"o c #808080",
+"O c Cyan",
+/* pixels */
+"         .......",
+" XXXXXXX  ......",
+" XXXXXXX . .....",
+" XXXXXXX    ....",
+" XXXXXXXXXX ....",
+" XXXXXXX    ....",
+" XXXXXX o..o ...",
+" XXXXX oOO.oo ..",
+" XXXXX .O..o. ..",
+" XXXXX ....o. ..",
+" XXXXX o..Ooo ..",
+" XXXXXX o..o o..",
+" XXXXXXX    o  .",
+" XXXXXXXXXX .   ",
+"            ..  "
+};
diff --git a/samples/minifram/bitmaps/print.bmp b/samples/minifram/bitmaps/print.bmp
new file mode 100644 (file)
index 0000000..00319b5
Binary files /dev/null and b/samples/minifram/bitmaps/print.bmp differ
diff --git a/samples/minifram/bitmaps/print.xpm b/samples/minifram/bitmaps/print.xpm
new file mode 100644 (file)
index 0000000..3c2e2be
--- /dev/null
@@ -0,0 +1,26 @@
+/* XPM */
+static char *print_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+"  c None",
+". c Black",
+"X c Gray100",
+"o c #808000",
+"O c Yellow",
+/* pixels */
+"                ",
+"     .........  ",
+"    .XXXXXXXX.  ",
+"    .X.....X.   ",
+"   .XXXXXXXX.   ",
+"   .X.....X.... ",
+"  .XXXXXXXX. . .",
+" .......... . ..",
+".          . . .",
+".............  .",
+".      ooo  . . ",
+".      OOO  ... ",
+"............. . ",
+" .         . .  ",
+"  ...........   "
+};
diff --git a/samples/minifram/bitmaps/save.bmp b/samples/minifram/bitmaps/save.bmp
new file mode 100644 (file)
index 0000000..56dd10b
Binary files /dev/null and b/samples/minifram/bitmaps/save.bmp differ
diff --git a/samples/minifram/bitmaps/save.xpm b/samples/minifram/bitmaps/save.xpm
new file mode 100644 (file)
index 0000000..01b18f9
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char *save_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+"  c None",
+". c Black",
+"X c #808000",
+"o c #808080",
+/* pixels */
+"                ",
+" .............. ",
+" .X.        . . ",
+" .X.        ... ",
+" .X.        .X. ",
+" .X.        .X. ",
+" .X.        .X. ",
+" .X.        .X. ",
+" .XX........oX. ",
+" .XXXXXXXXXXXX. ",
+" .XX.........X. ",
+" .XX......  .X. ",
+" .XX......  .X. ",
+" .XX......  .X. ",
+"  ............. "
+};
diff --git a/samples/minifram/makefile.b32 b/samples/minifram/makefile.b32
new file mode 100644 (file)
index 0000000..9f32c97
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# File:                makefile.b32
+# Author:      Patrick Halke
+# Created:     1995
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds 32bit buttonbar example.
+
+# WXWIN and BCCDIR are set by parent make
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makeb32.env
+
+WXLIBDIR = $(WXDIR)\lib
+WXLIB = $(WXLIBDIR)\wx32.lib
+LIBS=$(WXLIB) cw32 import32
+
+TARGET=test
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+OBJECTS = test.obj
+
+$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+c0w32.obj $(OBJECTS)
+$(TARGET)
+nul
+$(LIBS)
+$(TARGET).def
+$(TARGET).res
+!
+
+.$(SRCSUFF).obj:
+       bcc32 $(CPPFLAGS) -c {$< }
+
+.c.obj:
+       bcc32 $(CPPFLAGS) -P- -c {$< }
+
+test.obj:      test.$(SRCSUFF) test.h
+
+$(TARGET).res :      $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
+    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
+
diff --git a/samples/minifram/makefile.dos b/samples/minifram/makefile.dos
new file mode 100644 (file)
index 0000000..98f93ab
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds wxToolbar sample
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+!include $(WXDIR)\src\makemsc.env
+
+BBARDIR = $(WXDIR)\samples\toolbar
+
+INC = /I$(WXDIR)\include\base /I$(WXDIR)\include\msw
+
+THISDIR = $(BBARDIR)
+
+!ifndef FINAL
+FINAL=0
+!endif
+
+# Default is to output RTF for WinHelp
+!ifndef WINHELP
+WINHELP=-winhelp
+!endif
+
+# Set this to nothing if using MS C++ 7
+ZOPTION=/Z7
+
+!if "$(FINAL)" == "0"
+CPPFLAGS=/AL /Gt8 /W3 /Zi $(ZOPTION) /G2sw /Od /YuWX_PREC.H $(INC) /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch
+CFLAGS=/AL /Gt8 /W3 /Zi $(ZOPTION) /G2sw /Od $(INC) /Dwx_msw
+LINKFLAGS=/NOD /CO /SEG:512 /ONERROR:NOEXE
+!else
+CPPFLAGS=/AL /Gt8 /W3 /G2sw /Os /YuWX_PREC.H $(INC) /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch
+CFLAGS=/AL /Gt8 /W3 /Zi $(ZOPTION) /G2sw /Od $(INC) /Dwx_msw
+LINKFLAGS=/NOD /SEG:512 /ONERROR:NOEXE
+!endif
+
+OBJECTS = test.obj
+
+all:    test.exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos clean
+        cd $(THISDIR)
+
+test.exe:      $(WXDIR)\src\msw\dummy.obj $(WXLIB) test.obj test.def test.res
+        link $(LINKFLAGS) @<<
+$(WXDIR)\src\msw\dummy.obj test.obj,
+test,
+NUL,
+$(LIBS),
+test.def
+;
+<<
+        rc -30 -K test.res
+
+test.obj:      test.h test.$(SRCSUFF)
+        cl @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+test.res :      test.rc $(WXDIR)\include\msw\wx.rc
+    rc -r /dFAFA_LIB /i$(WXDIR)\contrib\fafa /i$(WXDIR)\include\msw test
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
+
diff --git a/samples/minifram/makefile.g95 b/samples/minifram/makefile.g95
new file mode 100644 (file)
index 0000000..a16ac0f
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for Buttonbar example (UNIX).
+# Change the WXDIR directory, and CPPFLAGS and LDFLAGS, for your system.
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+TESTOBJECTS = $(OBJDIR)/test.$(OBJSUFF) $(OBJDIR)/test_resources.$(OBJSUFF)
+TESTPROGRAM = test$(GUISUFFIX)
+
+all:   $(OBJDIR) $(TESTPROGRAM)
+
+demo:  $(TESTPROGRAM)
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+$(OBJDIR)/test.$(OBJSUFF):             test.h test.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF)
+
+$(TESTPROGRAM): $(TESTOBJECTS) $(WXLIB)
+       $(CC) $(LDFLAGS) -o test$(GUISUFFIX)$(EXESUFF) $(TESTOBJECTS) $(LDLIBS)
+
+$(OBJDIR)/test_resources.o:  test.rc
+       $(RESCOMP) -i test.rc -o $(OBJDIR)/test_resources.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) test$(GUISUFFIX).exe $(TESTOBJECTS) core *.res *.rsc
+
diff --git a/samples/minifram/makefile.nt b/samples/minifram/makefile.nt
new file mode 100644 (file)
index 0000000..64f2260
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds buttnbar example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\samples\toolbar
+PROGRAM=test
+OBJECTS = $(PROGRAM).obj
+
+$(PROGRAM):    $(PROGRAM).exe
+
+all:    wx $(PROGRAM).exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt clean
+        cd $(THISDIR)
+
+$(PROGRAM).exe:      $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
+       $(link) @<<
+-out:$(PROGRAM).exe
+$(LINKFLAGS)
+$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
+$(LIBS)
+<<
+
+
+$(PROGRAM).obj:      $(PROGRAM).h $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res :      $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
+    $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
+
+
+clean:
+        -erase *.obj
+        -erase *.sbr
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.pdb
diff --git a/samples/minifram/makefile.unx b/samples/minifram/makefile.unx
new file mode 100644 (file)
index 0000000..0b249d4
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1998
+# Updated:     
+# Copyright:   (c) 1998 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for toolbar example (UNIX).
+
+PROGRAM=test
+
+OBJECTS=$(PROGRAM).o
+
+include ../../src/makeprog.env
+
+
diff --git a/samples/minifram/mondrian.ico b/samples/minifram/mondrian.ico
new file mode 100644 (file)
index 0000000..2310c5d
Binary files /dev/null and b/samples/minifram/mondrian.ico differ
diff --git a/samples/minifram/mondrian.xpm b/samples/minifram/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};
diff --git a/samples/minifram/test.cpp b/samples/minifram/test.cpp
new file mode 100644 (file)
index 0000000..55efd8e
--- /dev/null
@@ -0,0 +1,147 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        test.cpp
+// Purpose:     wxMiniFrame sample
+// Author:      Robert Roebling
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart and Robert Roebling
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "wx/toolbar.h"
+#include "test.h"
+
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#include "mondrian.xpm"
+#include "bitmaps/new.xpm"
+#include "bitmaps/open.xpm"
+#include "bitmaps/save.xpm"
+#include "bitmaps/copy.xpm"
+#include "bitmaps/cut.xpm"
+// #include "bitmaps/paste.xpm"
+#include "bitmaps/print.xpm"
+#include "bitmaps/preview.xpm"
+#include "bitmaps/help.xpm"
+#endif
+
+IMPLEMENT_APP(MyApp)
+
+
+// The `main program' equivalent, creating the windows and returning the
+// main frame
+bool MyApp::OnInit(void)
+{
+  // Create the main frame window
+  MyFrame* frame = new MyFrame((wxFrame *) NULL, -1, (const wxString) "wxMiniFrame sample",
+     wxPoint(100, 100), wxSize(200, 42));
+
+#ifdef __WXMSW__
+  frame->SetIcon(wxIcon("mondrian"));
+#else
+  frame->SetIcon( wxIcon(mondrian_xpm) );
+#endif
+
+  // Create the toolbar
+  frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT, ID_TOOLBAR);
+
+  InitToolbar(frame->GetToolBar());
+
+  frame->Show(TRUE);
+  SetTopWindow(frame);
+
+  return TRUE;
+}
+
+bool MyApp::InitToolbar(wxToolBar* toolBar)
+{
+  toolBar->SetMargins(5, 5);
+
+  // Set up toolbar
+  wxBitmap* toolBarBitmaps[8];
+
+#ifdef __WXMSW__
+  toolBarBitmaps[0] = new wxBitmap("icon1");
+  toolBarBitmaps[1] = new wxBitmap("icon2");
+  toolBarBitmaps[2] = new wxBitmap("icon3");
+  toolBarBitmaps[3] = new wxBitmap("icon4");
+  toolBarBitmaps[4] = new wxBitmap("icon5");
+  toolBarBitmaps[5] = new wxBitmap("icon6");
+  toolBarBitmaps[6] = new wxBitmap("icon7");
+  toolBarBitmaps[7] = new wxBitmap("icon8");
+#else
+  toolBarBitmaps[0] = new wxBitmap( new_xpm );
+  toolBarBitmaps[1] = new wxBitmap( open_xpm );
+  toolBarBitmaps[2] = new wxBitmap( save_xpm );
+  toolBarBitmaps[3] = new wxBitmap( copy_xpm );
+  toolBarBitmaps[4] = new wxBitmap( cut_xpm );
+//  toolBarBitmaps[5] = new wxBitmap( paste_xpm );
+  toolBarBitmaps[5] = new wxBitmap( preview_xpm );
+  toolBarBitmaps[6] = new wxBitmap( print_xpm );
+  toolBarBitmaps[7] = new wxBitmap( help_xpm );
+#endif
+
+#ifdef __WXMSW__
+  int width = 24;
+#else
+  int width = 16;
+#endif
+  int currentX = 5;
+
+  toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New file");
+  currentX += width + 5;
+  toolBar->AddTool(wxID_OPEN, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open file");
+  currentX += width + 5;
+  toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Save file");
+  currentX += width + 5;
+  toolBar->AddSeparator();
+  toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Copy");
+  currentX += width + 5;
+  toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Cut");
+  currentX += width + 5;
+  toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste");
+  currentX += width + 5;
+  toolBar->AddSeparator();
+  toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Print");
+  currentX += width + 5;
+  toolBar->AddSeparator();
+  toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help");
+
+  toolBar->Realize();
+
+  // Can delete the bitmaps since they're reference counted
+  int i;
+  for (i = 0; i < 8; i++)
+    delete toolBarBitmaps[i];
+
+  return TRUE;
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxMiniFrame)
+    EVT_CLOSE(MyFrame::OnCloseWindow)
+END_EVENT_TABLE()
+
+// Define my frame constructor
+MyFrame::MyFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
+        const wxSize& size ) :
+  wxMiniFrame(parent, id, title, pos, size )
+{
+}
+
+// - must delete all frames except for the main one.
+void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
+{
+  Destroy();
+}
+
diff --git a/samples/minifram/test.def b/samples/minifram/test.def
new file mode 100644 (file)
index 0000000..897b9da
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         ToolTest
+DESCRIPTION  'wxToolBar Sample'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     1024
+STACKSIZE    8192
diff --git a/samples/minifram/test.h b/samples/minifram/test.h
new file mode 100644 (file)
index 0000000..db0f7dc
--- /dev/null
@@ -0,0 +1,35 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        test.h
+// Purpose:     wxToolBar sample
+// Author:      Julian Smart
+// Modified by:
+// Created:     23/07/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart and Robert Roebling
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/minifram.h"
+
+// Define a new application
+class MyApp: public wxApp
+{
+  public:
+    bool OnInit(void);
+    bool InitToolbar(wxToolBar* toolBar);
+};
+
+// Define a new frame
+class MyFrame: public wxMiniFrame
+{
+public:
+    MyFrame(wxFrame *parent, wxWindowID id = -1, const wxString& title = "wxToolBar Sample",
+        const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize );
+
+    void OnCloseWindow(wxCloseEvent& event);
+    
+DECLARE_EVENT_TABLE()
+};
+
+#define ID_TOOLBAR  500
+
diff --git a/samples/minifram/test.rc b/samples/minifram/test.rc
new file mode 100644 (file)
index 0000000..6c9086d
--- /dev/null
@@ -0,0 +1,13 @@
+mondrian ICON "mondrian.ico"
+#include "wx/msw/wx.rc"
+
+icon1 BITMAP "bitmaps/new.bmp"
+icon2 BITMAP "bitmaps/open.bmp"
+icon3 BITMAP "bitmaps/save.bmp"
+icon4 BITMAP "bitmaps/copy.bmp"
+icon5 BITMAP "bitmaps/cut.bmp"
+icon6 BITMAP "bitmaps/paste.bmp"
+icon7 BITMAP "bitmaps/print.bmp"
+
+icon8 BITMAP "bitmaps/help.bmp"
+
index c68b58eae47a5f9b4545243a0ba025ce396db563..ce2f89c1813d21f139d41e4d40396e4ee2082d56 100644 (file)
@@ -95,6 +95,7 @@ LIB_CPP_SRC=\
  gtk/listbox.cpp \
  gtk/mdi.cpp \
  gtk/menu.cpp \
+ gtk/minifram.cpp \
  gtk/notebook.cpp \
  gtk/palette.cpp \
  gtk/pen.cpp \
index bfbbda8e3017cb63ed4503111264aaa7b498060b..a80ffe0666e9ba3deee2c14c4aa5f424dabc0b17 100644 (file)
@@ -108,6 +108,8 @@ wxFrame::wxFrame()
     m_frameStatusBar = (wxStatusBar *) NULL;
     m_frameToolBar = (wxToolBar *) NULL;
     m_sizeSet = FALSE;
+    m_miniEdge = 0;
+    m_miniTitle = 0;
 }
 
 wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
@@ -118,6 +120,8 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
     m_frameStatusBar = (wxStatusBar *) NULL;
     m_frameToolBar = (wxToolBar *) NULL;
     m_sizeSet = FALSE;
+    m_miniEdge = 0;
+    m_miniTitle = 0;
     Create( parent, id, title, pos, size, style, name );
 }
 
@@ -213,7 +217,7 @@ bool wxFrame::Destroy()
 
 wxPoint wxFrame::GetClientAreaOrigin() const
 {
-    wxPoint pt(0, 0);
+    wxPoint pt( m_miniEdge, m_miniEdge + m_miniTitle );
     if (m_frameMenuBar)
     {
         int h = 0;
@@ -325,6 +329,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
             m_frameToolBar->GetSize( (int *) NULL, &y );
             (*height) -= y;
         }
+        (*height) -= m_miniEdge*2 + m_miniTitle;
+    }
+    if (width)
+    {
+        (*width) -= m_miniEdge*2;
     }
 }
 
@@ -341,7 +350,7 @@ void wxFrame::SetClientSize( int const width, int const height )
         m_frameToolBar->GetSize( (int *) NULL, &y );
         h += y;
     }
-    wxWindow::SetClientSize( width, h );
+    wxWindow::SetClientSize( width + m_miniEdge*2, h  + m_miniEdge*2 + m_miniTitle );
 }
 
 void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
@@ -365,39 +374,57 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
 
     gtk_widget_set_usize( m_widget, m_width, m_height );
     
-    // This emulates the new wxMSW behaviour
+    // this emulates the new wxMSW behaviour of placing all
+    // frame-subwindows (menu, toolbar..) on one native window
+        // OK, this hurts in the eye, but I don't want to call SetSize()
+        // because I don't want to call any non-native functions here.
     
     if (m_frameMenuBar)
     {
-        m_frameMenuBar->m_x = 1;  
-        m_frameMenuBar->m_y = 1;
-        m_frameMenuBar->m_width = m_width-2;
-        m_frameMenuBar->m_height = wxMENU_HEIGHT-2;
-        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, 1, 1 );
-        gtk_widget_set_usize( m_frameMenuBar->m_widget, m_width-2, wxMENU_HEIGHT-2 );
+        int xx = 1 + m_miniEdge;
+       int yy = 1 + m_miniEdge + m_miniTitle;
+       int ww = m_width - 2  - 2*m_miniEdge;
+       int hh = wxMENU_HEIGHT-2;
+        m_frameMenuBar->m_x = xx;
+        m_frameMenuBar->m_y = yy;
+        m_frameMenuBar->m_width = ww;
+        m_frameMenuBar->m_height = hh;
+       
+        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
+        gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
     }
 
     if (m_frameToolBar)
     {
-        int y = 0;
-        if (m_frameMenuBar) y = wxMENU_HEIGHT;
-        int h = m_frameToolBar->m_height;
+        int xx = 1 + m_miniEdge;
+       int yy = m_miniEdge + m_miniTitle;
+        if (m_frameMenuBar) yy += wxMENU_HEIGHT;
+       int ww = m_width -2 - 2*m_miniEdge;
+        int hh = m_frameToolBar->m_height;
     
-        m_frameToolBar->m_x = 2;  
-        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, 2, y );
-        gtk_widget_set_usize( m_frameToolBar->m_widget, m_width-3, h );
+        m_frameToolBar->m_x = xx;  
+        m_frameToolBar->m_y = yy;
+        m_frameToolBar->m_height = hh;
+        m_frameToolBar->m_width = ww;
+       
+        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy );
+        gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
     }
   
     if (m_frameStatusBar)
     {
-        // OK, this hurts in the eye, but I don't want to call SetSize()
-        // because I don't want to call any non-native functions here.
-        m_frameStatusBar->m_x = 0;  
-        m_frameStatusBar->m_y = m_height-wxSTATUS_HEIGHT;
-        m_frameStatusBar->m_width = m_width;
-        m_frameStatusBar->m_height = wxSTATUS_HEIGHT;
-        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, 0, m_height-wxSTATUS_HEIGHT );
-        gtk_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT );
+        int xx = 0 + m_miniEdge;
+       int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
+       int ww = m_width - 2*m_miniEdge;
+       int hh = wxSTATUS_HEIGHT;
+       
+        m_frameStatusBar->m_x = xx;
+        m_frameStatusBar->m_y = yy;
+        m_frameStatusBar->m_width = ww;
+        m_frameStatusBar->m_height = hh;
+       
+        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
+        gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
     }
     
     m_sizeSet = TRUE;
@@ -606,3 +633,4 @@ void wxFrame::SetIcon( const wxIcon &icon )
   
     gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
 }
+
diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp
new file mode 100644 (file)
index 0000000..d2e750c
--- /dev/null
@@ -0,0 +1,153 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        minifram.cpp
+// Purpose:
+// Author:      Robert Roebling
+// Id:          $Id$
+// Copyright:   (c) 1998 Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "minifram.h"
+#endif
+
+#include "wx/minifram.h"
+#include "wx/dcscreen.h"
+
+//-----------------------------------------------------------------------------
+// "clicked"
+//-----------------------------------------------------------------------------
+
+static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxMiniFrame *mf )
+{
+    mf->Close();
+}
+
+//-----------------------------------------------------------------------------
+// wxMiniFrame
+//-----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(wxMiniFrame,wxFrame)
+    EVT_PAINT(wxMiniFrame::OnPaint)
+    EVT_MOUSE_EVENTS(wxMiniFrame::OnMouse)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame,wxFrame)
+
+bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
+      const wxPoint &pos, const wxSize &size,
+      long style, const wxString &name )
+{
+    style = style | wxSIMPLE_BORDER;
+    
+    m_miniEdge = 3;
+    m_miniTitle = 13;
+    m_isDragging = FALSE;
+    m_oldX = -1;
+    m_oldY = -1;
+    m_diffX = 0;
+    m_diffY = 0;
+    
+    wxFrame::Create( parent, id, title, pos, size, style, name );
+
+    GtkWidget *close_button = gtk_button_new_with_label( "x" );
+    
+    gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), close_button, 4, 4 );
+    gtk_widget_set_usize( close_button, 12, 11 );
+    
+    gtk_widget_show( close_button );
+    
+    gtk_signal_connect( GTK_OBJECT(close_button), "clicked",
+      GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
+    
+    return TRUE;
+}
+
+void wxMiniFrame::OnPaint( wxPaintEvent &WXUNUSED(event) )
+{
+    if (m_miniTitle == 0) return;
+    if (m_title.IsEmpty()) return;
+  
+    wxPaintDC dc(this);
+  
+    dc.SetBrush( *wxTRANSPARENT_BRUSH );
+    dc.DrawRectangle( 0, 0, m_width, m_height );
+  
+    dc.SetPen( *wxWHITE_PEN );
+    dc.DrawLine( 1, 1, m_width-2, 1 );
+    dc.DrawLine( 1, 1, 1, m_height-2 );
+  
+    dc.SetPen( *wxMEDIUM_GREY_PEN );
+    dc.DrawLine( 1, m_height-1, m_width-2, m_height-1 );
+    dc.DrawLine( m_width-1, 1, m_width-1, m_height-2 );
+  
+    dc.SetBrush( *wxBLUE_BRUSH );
+    dc.SetPen( *wxTRANSPARENT_PEN );
+    dc.DrawRectangle( m_miniEdge, m_miniEdge, m_width - 2*m_miniEdge, m_miniTitle );
+  
+    dc.SetTextForeground( *wxWHITE );
+    dc.SetFont( *wxSMALL_FONT );
+    dc.DrawText( m_title, 14 + m_miniEdge, 1 + m_miniEdge );
+}
+
+void wxMiniFrame::DrawFrame( int x, int y )
+{
+    int org_x = 0;    
+    int org_y = 0;
+    gdk_window_get_origin( m_wxwindow->window, &org_x, &org_y );
+    x += org_x;
+    y += org_y;
+
+    wxScreenDC dc;
+    dc.SetLogicalFunction( wxXOR );
+  
+    dc.DrawRectangle( x, y, m_width, m_height );
+}
+
+void wxMiniFrame::OnMouse( wxMouseEvent &event )
+{
+    int x = event.GetX();
+    int y = event.GetY();
+
+    if (event.LeftDown())
+    {
+        CaptureMouse();
+        m_diffX = x;
+        m_diffY = y;
+        DrawFrame( 0, 0 );
+        m_oldX = 0;
+        m_oldY = 0;
+        m_isDragging = TRUE;
+        return;
+    }
+
+    if (event.Dragging() && m_isDragging)
+    {
+        DrawFrame( m_oldX, m_oldY );
+        m_oldX = x - m_diffX;
+        m_oldY = y - m_diffY;
+        DrawFrame( m_oldX, m_oldY );
+        return;
+    } 
+  
+    if (event.LeftUp() && m_isDragging)
+    {
+       m_isDragging = FALSE;
+       DrawFrame( m_oldX, m_oldY );
+       ReleaseMouse();
+    
+       int org_x = 0;    
+       int org_y = 0;
+       gdk_window_get_origin( m_wxwindow->window, &org_x, &org_y );
+       x += org_x - m_diffX;
+       y += org_y - m_diffY;
+       m_x = x;
+       m_y = y;
+       gtk_widget_set_uposition( m_widget, x, y );
+
+       return;
+    }
+  
+    event.Skip();
+}
+
index bfbbda8e3017cb63ed4503111264aaa7b498060b..a80ffe0666e9ba3deee2c14c4aa5f424dabc0b17 100644 (file)
@@ -108,6 +108,8 @@ wxFrame::wxFrame()
     m_frameStatusBar = (wxStatusBar *) NULL;
     m_frameToolBar = (wxToolBar *) NULL;
     m_sizeSet = FALSE;
+    m_miniEdge = 0;
+    m_miniTitle = 0;
 }
 
 wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
@@ -118,6 +120,8 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
     m_frameStatusBar = (wxStatusBar *) NULL;
     m_frameToolBar = (wxToolBar *) NULL;
     m_sizeSet = FALSE;
+    m_miniEdge = 0;
+    m_miniTitle = 0;
     Create( parent, id, title, pos, size, style, name );
 }
 
@@ -213,7 +217,7 @@ bool wxFrame::Destroy()
 
 wxPoint wxFrame::GetClientAreaOrigin() const
 {
-    wxPoint pt(0, 0);
+    wxPoint pt( m_miniEdge, m_miniEdge + m_miniTitle );
     if (m_frameMenuBar)
     {
         int h = 0;
@@ -325,6 +329,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
             m_frameToolBar->GetSize( (int *) NULL, &y );
             (*height) -= y;
         }
+        (*height) -= m_miniEdge*2 + m_miniTitle;
+    }
+    if (width)
+    {
+        (*width) -= m_miniEdge*2;
     }
 }
 
@@ -341,7 +350,7 @@ void wxFrame::SetClientSize( int const width, int const height )
         m_frameToolBar->GetSize( (int *) NULL, &y );
         h += y;
     }
-    wxWindow::SetClientSize( width, h );
+    wxWindow::SetClientSize( width + m_miniEdge*2, h  + m_miniEdge*2 + m_miniTitle );
 }
 
 void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
@@ -365,39 +374,57 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
 
     gtk_widget_set_usize( m_widget, m_width, m_height );
     
-    // This emulates the new wxMSW behaviour
+    // this emulates the new wxMSW behaviour of placing all
+    // frame-subwindows (menu, toolbar..) on one native window
+        // OK, this hurts in the eye, but I don't want to call SetSize()
+        // because I don't want to call any non-native functions here.
     
     if (m_frameMenuBar)
     {
-        m_frameMenuBar->m_x = 1;  
-        m_frameMenuBar->m_y = 1;
-        m_frameMenuBar->m_width = m_width-2;
-        m_frameMenuBar->m_height = wxMENU_HEIGHT-2;
-        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, 1, 1 );
-        gtk_widget_set_usize( m_frameMenuBar->m_widget, m_width-2, wxMENU_HEIGHT-2 );
+        int xx = 1 + m_miniEdge;
+       int yy = 1 + m_miniEdge + m_miniTitle;
+       int ww = m_width - 2  - 2*m_miniEdge;
+       int hh = wxMENU_HEIGHT-2;
+        m_frameMenuBar->m_x = xx;
+        m_frameMenuBar->m_y = yy;
+        m_frameMenuBar->m_width = ww;
+        m_frameMenuBar->m_height = hh;
+       
+        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
+        gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
     }
 
     if (m_frameToolBar)
     {
-        int y = 0;
-        if (m_frameMenuBar) y = wxMENU_HEIGHT;
-        int h = m_frameToolBar->m_height;
+        int xx = 1 + m_miniEdge;
+       int yy = m_miniEdge + m_miniTitle;
+        if (m_frameMenuBar) yy += wxMENU_HEIGHT;
+       int ww = m_width -2 - 2*m_miniEdge;
+        int hh = m_frameToolBar->m_height;
     
-        m_frameToolBar->m_x = 2;  
-        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, 2, y );
-        gtk_widget_set_usize( m_frameToolBar->m_widget, m_width-3, h );
+        m_frameToolBar->m_x = xx;  
+        m_frameToolBar->m_y = yy;
+        m_frameToolBar->m_height = hh;
+        m_frameToolBar->m_width = ww;
+       
+        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy );
+        gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
     }
   
     if (m_frameStatusBar)
     {
-        // OK, this hurts in the eye, but I don't want to call SetSize()
-        // because I don't want to call any non-native functions here.
-        m_frameStatusBar->m_x = 0;  
-        m_frameStatusBar->m_y = m_height-wxSTATUS_HEIGHT;
-        m_frameStatusBar->m_width = m_width;
-        m_frameStatusBar->m_height = wxSTATUS_HEIGHT;
-        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, 0, m_height-wxSTATUS_HEIGHT );
-        gtk_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT );
+        int xx = 0 + m_miniEdge;
+       int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
+       int ww = m_width - 2*m_miniEdge;
+       int hh = wxSTATUS_HEIGHT;
+       
+        m_frameStatusBar->m_x = xx;
+        m_frameStatusBar->m_y = yy;
+        m_frameStatusBar->m_width = ww;
+        m_frameStatusBar->m_height = hh;
+       
+        gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
+        gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
     }
     
     m_sizeSet = TRUE;
@@ -606,3 +633,4 @@ void wxFrame::SetIcon( const wxIcon &icon )
   
     gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
 }
+
diff --git a/src/gtk1/minifram.cpp b/src/gtk1/minifram.cpp
new file mode 100644 (file)
index 0000000..d2e750c
--- /dev/null
@@ -0,0 +1,153 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        minifram.cpp
+// Purpose:
+// Author:      Robert Roebling
+// Id:          $Id$
+// Copyright:   (c) 1998 Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "minifram.h"
+#endif
+
+#include "wx/minifram.h"
+#include "wx/dcscreen.h"
+
+//-----------------------------------------------------------------------------
+// "clicked"
+//-----------------------------------------------------------------------------
+
+static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxMiniFrame *mf )
+{
+    mf->Close();
+}
+
+//-----------------------------------------------------------------------------
+// wxMiniFrame
+//-----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(wxMiniFrame,wxFrame)
+    EVT_PAINT(wxMiniFrame::OnPaint)
+    EVT_MOUSE_EVENTS(wxMiniFrame::OnMouse)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame,wxFrame)
+
+bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
+      const wxPoint &pos, const wxSize &size,
+      long style, const wxString &name )
+{
+    style = style | wxSIMPLE_BORDER;
+    
+    m_miniEdge = 3;
+    m_miniTitle = 13;
+    m_isDragging = FALSE;
+    m_oldX = -1;
+    m_oldY = -1;
+    m_diffX = 0;
+    m_diffY = 0;
+    
+    wxFrame::Create( parent, id, title, pos, size, style, name );
+
+    GtkWidget *close_button = gtk_button_new_with_label( "x" );
+    
+    gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), close_button, 4, 4 );
+    gtk_widget_set_usize( close_button, 12, 11 );
+    
+    gtk_widget_show( close_button );
+    
+    gtk_signal_connect( GTK_OBJECT(close_button), "clicked",
+      GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
+    
+    return TRUE;
+}
+
+void wxMiniFrame::OnPaint( wxPaintEvent &WXUNUSED(event) )
+{
+    if (m_miniTitle == 0) return;
+    if (m_title.IsEmpty()) return;
+  
+    wxPaintDC dc(this);
+  
+    dc.SetBrush( *wxTRANSPARENT_BRUSH );
+    dc.DrawRectangle( 0, 0, m_width, m_height );
+  
+    dc.SetPen( *wxWHITE_PEN );
+    dc.DrawLine( 1, 1, m_width-2, 1 );
+    dc.DrawLine( 1, 1, 1, m_height-2 );
+  
+    dc.SetPen( *wxMEDIUM_GREY_PEN );
+    dc.DrawLine( 1, m_height-1, m_width-2, m_height-1 );
+    dc.DrawLine( m_width-1, 1, m_width-1, m_height-2 );
+  
+    dc.SetBrush( *wxBLUE_BRUSH );
+    dc.SetPen( *wxTRANSPARENT_PEN );
+    dc.DrawRectangle( m_miniEdge, m_miniEdge, m_width - 2*m_miniEdge, m_miniTitle );
+  
+    dc.SetTextForeground( *wxWHITE );
+    dc.SetFont( *wxSMALL_FONT );
+    dc.DrawText( m_title, 14 + m_miniEdge, 1 + m_miniEdge );
+}
+
+void wxMiniFrame::DrawFrame( int x, int y )
+{
+    int org_x = 0;    
+    int org_y = 0;
+    gdk_window_get_origin( m_wxwindow->window, &org_x, &org_y );
+    x += org_x;
+    y += org_y;
+
+    wxScreenDC dc;
+    dc.SetLogicalFunction( wxXOR );
+  
+    dc.DrawRectangle( x, y, m_width, m_height );
+}
+
+void wxMiniFrame::OnMouse( wxMouseEvent &event )
+{
+    int x = event.GetX();
+    int y = event.GetY();
+
+    if (event.LeftDown())
+    {
+        CaptureMouse();
+        m_diffX = x;
+        m_diffY = y;
+        DrawFrame( 0, 0 );
+        m_oldX = 0;
+        m_oldY = 0;
+        m_isDragging = TRUE;
+        return;
+    }
+
+    if (event.Dragging() && m_isDragging)
+    {
+        DrawFrame( m_oldX, m_oldY );
+        m_oldX = x - m_diffX;
+        m_oldY = y - m_diffY;
+        DrawFrame( m_oldX, m_oldY );
+        return;
+    } 
+  
+    if (event.LeftUp() && m_isDragging)
+    {
+       m_isDragging = FALSE;
+       DrawFrame( m_oldX, m_oldY );
+       ReleaseMouse();
+    
+       int org_x = 0;    
+       int org_y = 0;
+       gdk_window_get_origin( m_wxwindow->window, &org_x, &org_y );
+       x += org_x - m_diffX;
+       y += org_y - m_diffY;
+       m_x = x;
+       m_y = y;
+       gtk_widget_set_uposition( m_widget, x, y );
+
+       return;
+    }
+  
+    event.Skip();
+}
+