Added wxMiniFrame
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
@ -99,7 +99,7 @@ public:
|
|||||||
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
|
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
|
||||||
void OnSize( wxSizeEvent &event );
|
void OnSize( wxSizeEvent &event );
|
||||||
void OnCloseWindow( wxCloseEvent& event );
|
void OnCloseWindow( wxCloseEvent& event );
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
@ -113,6 +113,7 @@ public:
|
|||||||
wxToolBar *m_frameToolBar;
|
wxToolBar *m_frameToolBar;
|
||||||
wxString m_title;
|
wxString m_title;
|
||||||
wxIcon m_icon;
|
wxIcon m_icon;
|
||||||
|
int m_miniEdge,m_miniTitle;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
69
include/wx/gtk/minifram.h
Normal file
@ -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__
|
@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Robert Roebling
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public:
|
|||||||
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
|
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
|
||||||
void OnSize( wxSizeEvent &event );
|
void OnSize( wxSizeEvent &event );
|
||||||
void OnCloseWindow( wxCloseEvent& event );
|
void OnCloseWindow( wxCloseEvent& event );
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
@ -113,6 +113,7 @@ public:
|
|||||||
wxToolBar *m_frameToolBar;
|
wxToolBar *m_frameToolBar;
|
||||||
wxString m_title;
|
wxString m_title;
|
||||||
wxIcon m_icon;
|
wxIcon m_icon;
|
||||||
|
int m_miniEdge,m_miniTitle;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
69
include/wx/gtk1/minifram.h
Normal file
@ -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__
|
@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Robert Roebling
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
1
samples/minifram/Makefile
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ../../setup/general/makeapp
|
26
samples/minifram/Makefile.in
Normal file
@ -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
|
BIN
samples/minifram/bitmaps/copy.bmp
Normal file
After Width: | Height: | Size: 238 B |
25
samples/minifram/bitmaps/copy.xpm
Normal file
@ -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",
|
||||||
|
" "
|
||||||
|
};
|
BIN
samples/minifram/bitmaps/cut.bmp
Normal file
After Width: | Height: | Size: 238 B |
24
samples/minifram/bitmaps/cut.xpm
Normal file
@ -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 "
|
||||||
|
};
|
BIN
samples/minifram/bitmaps/help.bmp
Normal file
After Width: | Height: | Size: 238 B |
25
samples/minifram/bitmaps/help.xpm
Normal file
@ -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.. ",
|
||||||
|
" ... "
|
||||||
|
};
|
BIN
samples/minifram/bitmaps/new.bmp
Normal file
After Width: | Height: | Size: 238 B |
24
samples/minifram/bitmaps/new.xpm
Normal file
@ -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. ",
|
||||||
|
" ........... ",
|
||||||
|
" "
|
||||||
|
};
|
BIN
samples/minifram/bitmaps/open.bmp
Normal file
After Width: | Height: | Size: 238 B |
26
samples/minifram/bitmaps/open.xpm
Normal file
@ -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. ",
|
||||||
|
" ........... ",
|
||||||
|
" "
|
||||||
|
};
|
BIN
samples/minifram/bitmaps/page.bmp
Normal file
After Width: | Height: | Size: 714 B |
BIN
samples/minifram/bitmaps/paste.bmp
Normal file
After Width: | Height: | Size: 238 B |
BIN
samples/minifram/bitmaps/preview.bmp
Normal file
After Width: | Height: | Size: 238 B |
26
samples/minifram/bitmaps/preview.xpm
Normal file
@ -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 . ",
|
||||||
|
" .. "
|
||||||
|
};
|
BIN
samples/minifram/bitmaps/print.bmp
Normal file
After Width: | Height: | Size: 238 B |
26
samples/minifram/bitmaps/print.xpm
Normal file
@ -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 ... ",
|
||||||
|
"............. . ",
|
||||||
|
" . . . ",
|
||||||
|
" ........... "
|
||||||
|
};
|
BIN
samples/minifram/bitmaps/save.bmp
Normal file
After Width: | Height: | Size: 238 B |
25
samples/minifram/bitmaps/save.xpm
Normal file
@ -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. ",
|
||||||
|
" ............. "
|
||||||
|
};
|
63
samples/minifram/makefile.b32
Normal file
@ -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
|
||||||
|
|
87
samples/minifram/makefile.dos
Normal file
@ -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
|
||||||
|
|
40
samples/minifram/makefile.g95
Normal file
@ -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
|
||||||
|
|
62
samples/minifram/makefile.nt
Normal file
@ -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
|
18
samples/minifram/makefile.unx
Normal file
@ -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
|
||||||
|
|
||||||
|
|
BIN
samples/minifram/mondrian.ico
Normal file
After Width: | Height: | Size: 766 B |
44
samples/minifram/mondrian.xpm
Normal file
@ -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 ++++ ",
|
||||||
|
" "
|
||||||
|
};
|
147
samples/minifram/test.cpp
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
|
8
samples/minifram/test.def
Normal file
@ -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
|
35
samples/minifram/test.h
Normal file
@ -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
|
||||||
|
|
13
samples/minifram/test.rc
Normal file
@ -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"
|
||||||
|
|
@ -95,6 +95,7 @@ LIB_CPP_SRC=\
|
|||||||
gtk/listbox.cpp \
|
gtk/listbox.cpp \
|
||||||
gtk/mdi.cpp \
|
gtk/mdi.cpp \
|
||||||
gtk/menu.cpp \
|
gtk/menu.cpp \
|
||||||
|
gtk/minifram.cpp \
|
||||||
gtk/notebook.cpp \
|
gtk/notebook.cpp \
|
||||||
gtk/palette.cpp \
|
gtk/palette.cpp \
|
||||||
gtk/pen.cpp \
|
gtk/pen.cpp \
|
||||||
|
@ -108,6 +108,8 @@ wxFrame::wxFrame()
|
|||||||
m_frameStatusBar = (wxStatusBar *) NULL;
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
|
m_miniEdge = 0;
|
||||||
|
m_miniTitle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
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_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
|
m_miniEdge = 0;
|
||||||
|
m_miniTitle = 0;
|
||||||
Create( parent, id, title, pos, size, style, name );
|
Create( parent, id, title, pos, size, style, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +217,7 @@ bool wxFrame::Destroy()
|
|||||||
|
|
||||||
wxPoint wxFrame::GetClientAreaOrigin() const
|
wxPoint wxFrame::GetClientAreaOrigin() const
|
||||||
{
|
{
|
||||||
wxPoint pt(0, 0);
|
wxPoint pt( m_miniEdge, m_miniEdge + m_miniTitle );
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
int h = 0;
|
int h = 0;
|
||||||
@ -325,6 +329,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
|||||||
m_frameToolBar->GetSize( (int *) NULL, &y );
|
m_frameToolBar->GetSize( (int *) NULL, &y );
|
||||||
(*height) -= 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 );
|
m_frameToolBar->GetSize( (int *) NULL, &y );
|
||||||
h += 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 )
|
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 );
|
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)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
m_frameMenuBar->m_x = 1;
|
int xx = 1 + m_miniEdge;
|
||||||
m_frameMenuBar->m_y = 1;
|
int yy = 1 + m_miniEdge + m_miniTitle;
|
||||||
m_frameMenuBar->m_width = m_width-2;
|
int ww = m_width - 2 - 2*m_miniEdge;
|
||||||
m_frameMenuBar->m_height = wxMENU_HEIGHT-2;
|
int hh = wxMENU_HEIGHT-2;
|
||||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, 1, 1 );
|
m_frameMenuBar->m_x = xx;
|
||||||
gtk_widget_set_usize( m_frameMenuBar->m_widget, m_width-2, wxMENU_HEIGHT-2 );
|
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)
|
if (m_frameToolBar)
|
||||||
{
|
{
|
||||||
int y = 0;
|
int xx = 1 + m_miniEdge;
|
||||||
if (m_frameMenuBar) y = wxMENU_HEIGHT;
|
int yy = m_miniEdge + m_miniTitle;
|
||||||
int h = m_frameToolBar->m_height;
|
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;
|
m_frameToolBar->m_x = xx;
|
||||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, 2, y );
|
m_frameToolBar->m_y = yy;
|
||||||
gtk_widget_set_usize( m_frameToolBar->m_widget, m_width-3, h );
|
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)
|
if (m_frameStatusBar)
|
||||||
{
|
{
|
||||||
// OK, this hurts in the eye, but I don't want to call SetSize()
|
int xx = 0 + m_miniEdge;
|
||||||
// because I don't want to call any non-native functions here.
|
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
|
||||||
m_frameStatusBar->m_x = 0;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
m_frameStatusBar->m_y = m_height-wxSTATUS_HEIGHT;
|
int hh = wxSTATUS_HEIGHT;
|
||||||
m_frameStatusBar->m_width = m_width;
|
|
||||||
m_frameStatusBar->m_height = wxSTATUS_HEIGHT;
|
m_frameStatusBar->m_x = xx;
|
||||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, 0, m_height-wxSTATUS_HEIGHT );
|
m_frameStatusBar->m_y = yy;
|
||||||
gtk_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT );
|
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;
|
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 );
|
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
153
src/gtk/minifram.cpp
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
|
@ -108,6 +108,8 @@ wxFrame::wxFrame()
|
|||||||
m_frameStatusBar = (wxStatusBar *) NULL;
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
|
m_miniEdge = 0;
|
||||||
|
m_miniTitle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
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_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
|
m_miniEdge = 0;
|
||||||
|
m_miniTitle = 0;
|
||||||
Create( parent, id, title, pos, size, style, name );
|
Create( parent, id, title, pos, size, style, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +217,7 @@ bool wxFrame::Destroy()
|
|||||||
|
|
||||||
wxPoint wxFrame::GetClientAreaOrigin() const
|
wxPoint wxFrame::GetClientAreaOrigin() const
|
||||||
{
|
{
|
||||||
wxPoint pt(0, 0);
|
wxPoint pt( m_miniEdge, m_miniEdge + m_miniTitle );
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
int h = 0;
|
int h = 0;
|
||||||
@ -325,6 +329,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
|||||||
m_frameToolBar->GetSize( (int *) NULL, &y );
|
m_frameToolBar->GetSize( (int *) NULL, &y );
|
||||||
(*height) -= 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 );
|
m_frameToolBar->GetSize( (int *) NULL, &y );
|
||||||
h += 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 )
|
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 );
|
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)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
m_frameMenuBar->m_x = 1;
|
int xx = 1 + m_miniEdge;
|
||||||
m_frameMenuBar->m_y = 1;
|
int yy = 1 + m_miniEdge + m_miniTitle;
|
||||||
m_frameMenuBar->m_width = m_width-2;
|
int ww = m_width - 2 - 2*m_miniEdge;
|
||||||
m_frameMenuBar->m_height = wxMENU_HEIGHT-2;
|
int hh = wxMENU_HEIGHT-2;
|
||||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, 1, 1 );
|
m_frameMenuBar->m_x = xx;
|
||||||
gtk_widget_set_usize( m_frameMenuBar->m_widget, m_width-2, wxMENU_HEIGHT-2 );
|
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)
|
if (m_frameToolBar)
|
||||||
{
|
{
|
||||||
int y = 0;
|
int xx = 1 + m_miniEdge;
|
||||||
if (m_frameMenuBar) y = wxMENU_HEIGHT;
|
int yy = m_miniEdge + m_miniTitle;
|
||||||
int h = m_frameToolBar->m_height;
|
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;
|
m_frameToolBar->m_x = xx;
|
||||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, 2, y );
|
m_frameToolBar->m_y = yy;
|
||||||
gtk_widget_set_usize( m_frameToolBar->m_widget, m_width-3, h );
|
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)
|
if (m_frameStatusBar)
|
||||||
{
|
{
|
||||||
// OK, this hurts in the eye, but I don't want to call SetSize()
|
int xx = 0 + m_miniEdge;
|
||||||
// because I don't want to call any non-native functions here.
|
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
|
||||||
m_frameStatusBar->m_x = 0;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
m_frameStatusBar->m_y = m_height-wxSTATUS_HEIGHT;
|
int hh = wxSTATUS_HEIGHT;
|
||||||
m_frameStatusBar->m_width = m_width;
|
|
||||||
m_frameStatusBar->m_height = wxSTATUS_HEIGHT;
|
m_frameStatusBar->m_x = xx;
|
||||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, 0, m_height-wxSTATUS_HEIGHT );
|
m_frameStatusBar->m_y = yy;
|
||||||
gtk_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT );
|
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;
|
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 );
|
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
153
src/gtk1/minifram.cpp
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
|