now MSW stuff is complete
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
BIN
samples/joytest/chart.ico
Normal file
After Width: | Height: | Size: 766 B |
BIN
samples/joytest/gun.wav
Normal file
171
samples/joytest/joytest.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: joytest.cpp
|
||||
// Purpose: Joystick sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// 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/msw/wave.h>
|
||||
#include <wx/msw/joystick.h>
|
||||
|
||||
#include "joytest.h"
|
||||
|
||||
MyFrame *frame = NULL;
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
// For drawing lines in a canvas
|
||||
long xpos = -1;
|
||||
long ypos = -1;
|
||||
|
||||
int winNumber = 1;
|
||||
|
||||
// Initialise this in OnInit, not statically
|
||||
bool MyApp::OnInit(void)
|
||||
{
|
||||
wxJoystick stick(wxJOYSTICK1);
|
||||
if (!stick.IsOk())
|
||||
{
|
||||
wxMessageBox("No joystick detected!");
|
||||
return FALSE;
|
||||
}
|
||||
m_fire.Create("gun.wav");
|
||||
|
||||
m_maxX = stick.GetXMax();
|
||||
m_maxY = stick.GetYMax();
|
||||
|
||||
// Create the main frame window
|
||||
|
||||
frame = new MyFrame(NULL, "Joystick Demo", wxPoint(0, 0), wxSize(500, 400),
|
||||
wxDEFAULT_FRAME | wxHSCROLL | wxVSCROLL);
|
||||
|
||||
// Give it an icon (this is ignored in MDI mode: uses resources)
|
||||
#ifdef __WINDOWS__
|
||||
frame->SetIcon(wxIcon("joyicon"));
|
||||
#endif
|
||||
#ifdef __X__
|
||||
frame->SetIcon(wxIcon("joyicon.xbm"));
|
||||
#endif
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(JOYTEST_QUIT, "&Exit");
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(JOYTEST_ABOUT, "&About");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
frame->SetMenuBar(menu_bar);
|
||||
|
||||
frame->CreateStatusBar();
|
||||
|
||||
frame->Show(TRUE);
|
||||
|
||||
SetTopWindow(frame);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||
EVT_JOYSTICK_EVENTS(MyCanvas::OnJoystickEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define a constructor for my canvas
|
||||
MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
|
||||
wxScrolledWindow(parent, -1, pos, size, wxSUNKEN_BORDER)
|
||||
{
|
||||
wxJoystick joystick(wxJOYSTICK1);
|
||||
joystick.SetCapture(this);
|
||||
}
|
||||
|
||||
MyCanvas::~MyCanvas(void)
|
||||
{
|
||||
wxJoystick joystick(wxJOYSTICK1);
|
||||
joystick.ReleaseCapture();
|
||||
}
|
||||
|
||||
void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
|
||||
{
|
||||
wxClientDC dc(this);
|
||||
|
||||
wxPoint pt(event.GetPosition());
|
||||
|
||||
// Scale to canvas size
|
||||
int cw, ch;
|
||||
GetSize(&cw, &ch);
|
||||
|
||||
pt.x = (long) (((double)pt.x/(double)wxGetApp().m_maxX) * cw);
|
||||
pt.y = (long) (((double)pt.y/(double)wxGetApp().m_maxY) * ch);
|
||||
|
||||
if (xpos > -1 && ypos > -1 && event.IsMove() && event.ButtonIsDown())
|
||||
{
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
dc.DrawLine(xpos, ypos, pt.x, pt.y);
|
||||
}
|
||||
xpos = pt.x;
|
||||
ypos = pt.y;
|
||||
|
||||
char buf[100];
|
||||
if (event.ButtonDown())
|
||||
sprintf(buf, "Joystick (%ld, %ld) Fire!", pt.x, pt.y);
|
||||
else
|
||||
sprintf(buf, "Joystick (%ld, %ld)", pt.x, pt.y);
|
||||
frame->SetStatusText(buf);
|
||||
|
||||
if (event.ButtonDown() && wxGetApp().m_fire.IsOk())
|
||||
{
|
||||
wxGetApp().m_fire.Play();
|
||||
}
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(JOYTEST_QUIT, MyFrame::OnQuit)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyFrame::MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
const long style):
|
||||
wxFrame(parent, -1, title, pos, size, style)
|
||||
{
|
||||
canvas = new MyCanvas(this);
|
||||
}
|
||||
|
||||
MyFrame::~MyFrame(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& event)
|
||||
{
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::OnActivate(wxActivateEvent& event)
|
||||
{
|
||||
if (event.GetActive() && canvas)
|
||||
canvas->SetFocus();
|
||||
}
|
||||
|
||||
bool MyFrame::OnClose(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
8
samples/joytest/joytest.def
Normal file
@@ -0,0 +1,8 @@
|
||||
NAME Joytest
|
||||
DESCRIPTION 'Joystick Test Program'
|
||||
EXETYPE WINDOWS
|
||||
STUB 'WINSTUB.EXE'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
HEAPSIZE 6000
|
||||
STACKSIZE 48000
|
51
samples/joytest/joytest.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: joytest.cpp
|
||||
// Purpose: Joystick sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Define a new application
|
||||
class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit(void);
|
||||
|
||||
// Joystick max values
|
||||
int m_maxX;
|
||||
int m_maxY;
|
||||
|
||||
wxWave m_fire;
|
||||
};
|
||||
|
||||
DECLARE_APP(MyApp)
|
||||
|
||||
class MyCanvas: public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
MyCanvas(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
||||
~MyCanvas(void);
|
||||
void OnJoystickEvent(wxJoystickEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class MyFrame: public wxFrame
|
||||
{
|
||||
public:
|
||||
MyCanvas *canvas;
|
||||
MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
||||
~MyFrame(void);
|
||||
bool OnClose(void);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define JOYTEST_QUIT 1
|
||||
#define JOYTEST_ABOUT 2
|
BIN
samples/joytest/joytest.ico
Normal file
After Width: | Height: | Size: 766 B |
5
samples/joytest/joytest.rc
Normal file
@@ -0,0 +1,5 @@
|
||||
aaaa ICON "mondrian.ico"
|
||||
joyicon ICON "mondrian.ico"
|
||||
|
||||
#include "wx/msw/wx.rc"
|
||||
|
64
samples/joytest/makefile.b32
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.b32
|
||||
# Author: Patrick Halke
|
||||
# Created: 1995
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds 32bit MDI 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=joytest
|
||||
|
||||
!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 = joytest.obj
|
||||
|
||||
$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
|
||||
tlink32 $(LINKFLAGS) @&&!
|
||||
c0w32.obj $(OBJECTS)
|
||||
$(TARGET)
|
||||
nul
|
||||
$(LIBS)
|
||||
$(TARGET).def
|
||||
!
|
||||
brc32 -K $(TARGET).res
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc32 $(CPPFLAGS) -c {$< }
|
||||
|
||||
.c.obj:
|
||||
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||
|
||||
joytest.obj: joytest.$(SRCSUFF) joytest.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
|
||||
|
||||
|
75
samples/joytest/makefile.bcc
Normal file
@@ -0,0 +1,75 @@
|
||||
#
|
||||
# File: makefile.bcc
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds joytest example (DOS).
|
||||
|
||||
!if "$(BCCDIR)" == ""
|
||||
!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
|
||||
!endif
|
||||
|
||||
!if "$(WXWIN)" == ""
|
||||
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
|
||||
!endif
|
||||
|
||||
!ifndef FINAL
|
||||
FINAL=0
|
||||
!endif
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makebcc.env
|
||||
|
||||
THISDIR = $(WXDIR)\samples\joytest
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
LIBS=$(WXLIB) mathwl cwl import
|
||||
INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
|
||||
CFG=$(WXDIR)\src\wxwin.cfg
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||
OPT = -Od
|
||||
DEBUG_FLAGS= -v
|
||||
!else
|
||||
LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||
OPT = -O2
|
||||
DEBUG_FLAGS =
|
||||
!endif
|
||||
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||
|
||||
HEADERS = joytest.h
|
||||
SOURCES = joytest.$(SRCSUFF)
|
||||
OBJECTS = joytest.obj
|
||||
|
||||
joytest: joytest.exe
|
||||
|
||||
all: joytest.exe
|
||||
|
||||
joytest.exe: $(WXLIB) joytest.obj joytest.def joytest.res
|
||||
tlink $(LINKFLAGS) @&&!
|
||||
c0wl.obj joytest.obj
|
||||
joytest
|
||||
nul
|
||||
$(LIBS)
|
||||
joytest.def
|
||||
!
|
||||
rc -30 -K joytest.res
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc $(CPPFLAGS) -c {$< }
|
||||
|
||||
joytest.obj: joytest.$(SRCSUFF)
|
||||
|
||||
joytest.res : joytest.rc $(WXDIR)\include\msw\wx.rc
|
||||
rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa joytest
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.rws
|
63
samples/joytest/makefile.dos
Normal file
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# File: makefile.dos
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds joytest example (DOS).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
!include $(WXDIR)\src\makemsc.env
|
||||
|
||||
THISDIR = $(WXDIR)\samples\joytest
|
||||
INC=/I$(WXDIR)\include
|
||||
|
||||
HEADERS = joytest.h
|
||||
SOURCES = joytest.$(SRCSUFF)
|
||||
OBJECTS = joytest.obj
|
||||
|
||||
all: joytest.exe
|
||||
|
||||
wx:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.dos
|
||||
cd $(THISDIR)
|
||||
|
||||
wxclean:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.dos clean
|
||||
cd $(THISDIR)
|
||||
|
||||
|
||||
joytest.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) joytest.obj joytest.def joytest.res
|
||||
link $(LINKFLAGS) @<<
|
||||
$(WXDIR)\src\msw\dummy.obj joytest.obj,
|
||||
joytest,
|
||||
NUL,
|
||||
$(LIBS),
|
||||
joytest.def
|
||||
;
|
||||
<<
|
||||
rc -K joytest.res
|
||||
|
||||
joytest.obj: joytest.h joytest.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
joytest.res : joytest.rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
rc -r /i$(WXDIR)\include joytest
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
35
samples/joytest/makefile.g95
Normal file
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for joytest example (UNIX).
|
||||
|
||||
WXDIR = ../..
|
||||
|
||||
# All common UNIX compiler flags and options are now in
|
||||
# this central makefile.
|
||||
include $(WXDIR)/src/makeg95.env
|
||||
|
||||
OBJECTS = $(OBJDIR)/joytest.$(OBJSUFF) $(OBJDIR)/joytest_resources.$(OBJSUFF)
|
||||
|
||||
all: $(OBJDIR) joytest$(GUISUFFIX)
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
joytest$(GUISUFFIX): $(OBJECTS) $(WXLIB)
|
||||
$(CC) $(LDFLAGS) -o joytest$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/joytest.$(OBJSUFF): joytest.$(SRCSUFF) joytest.h
|
||||
$(CC) -c $(CPPFLAGS) -o $@ joytest.$(SRCSUFF)
|
||||
|
||||
$(OBJDIR)/joytest_resources.o: joytest.rc
|
||||
$(RESCOMP) -i joytest.rc -o $(OBJDIR)/joytest_resources.o $(RESFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) joytest$(GUISUFFIX).exe core *.res *.rsc
|
63
samples/joytest/makefile.nt
Normal file
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds joytest example (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
WXUSINGDLL=0
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
THISDIR = $(WXDIR)\samples\joytest
|
||||
PROGRAM=joytest
|
||||
|
||||
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).$(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 *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
37
samples/joytest/makefile.sc
Normal file
@@ -0,0 +1,37 @@
|
||||
; Last change: JS 12 Apr 98 10:45 am
|
||||
# Symantec C++ makefile for joytest example
|
||||
# NOTE that peripheral libraries are now dealt in main wxWindows makefile.
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makesc.env
|
||||
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
INCDIR = $(WXDIR)\include
|
||||
MSWINC = $(INCDIR)\msw
|
||||
BASEINC = $(INCDIR)\base
|
||||
|
||||
CC=sc
|
||||
RC=rc
|
||||
CFLAGS = -o -ml -W -Dwx_msw
|
||||
LDFLAGS = -ml -W
|
||||
|
||||
INCLUDE=$(BASEINC);$(MSWINC)
|
||||
|
||||
LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
*$(CC) -c $(CFLAGS) -I$(INCLUDE) $<
|
||||
|
||||
.rc.res:
|
||||
*$(RC) -r -I$(INCLUDE) $<
|
||||
|
||||
joytest.exe: joytest.obj joytest.def joytest.res
|
||||
*$(CC) $(LDFLAGS) -o$@ joytest.obj joytest.def $(LIBS)
|
||||
*$(RC) -k joytest.res
|
||||
|
||||
clean:
|
||||
-del *.obj
|
||||
-del *.exe
|
||||
-del *.res
|
||||
-del *.map
|
||||
-del *.rws
|
55
samples/joytest/makefile.unx
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for joytest example (UNIX).
|
||||
|
||||
WXDIR = ../..
|
||||
|
||||
# All common UNIX compiler flags and options are now in
|
||||
# this central makefile.
|
||||
include $(WXDIR)/src/make.env
|
||||
|
||||
OBJECTS = $(OBJDIR)/joytest.$(OBJSUFF)
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
all: $(OBJDIR) joytest$(GUISUFFIX)
|
||||
|
||||
wx:
|
||||
# cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx
|
||||
motif:
|
||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
||||
|
||||
xview:
|
||||
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
|
||||
|
||||
hp:
|
||||
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \
|
||||
XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
joytest$(GUISUFFIX): $(OBJDIR)/joytest.$(OBJSUFF) $(WXLIB)
|
||||
$(CC) $(LDFLAGS) -o joytest$(GUISUFFIX) $(OBJDIR)/joytest.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/joytest.$(OBJSUFF): joytest.$(SRCSUFF) joytest.h
|
||||
$(CC) -c $(CPPFLAGS) -o $@ joytest.$(SRCSUFF)
|
||||
|
||||
clean_motif:
|
||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
|
||||
|
||||
clean_ol:
|
||||
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
|
||||
|
||||
clean_hp:
|
||||
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
|
||||
|
||||
cleanany:
|
||||
rm -f $(OBJECTS) joytest$(GUISUFFIX) core
|
43
samples/joytest/makefile.wat
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Makefile for WATCOM
|
||||
#
|
||||
# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
|
||||
# 8 Nov 1994
|
||||
#
|
||||
|
||||
WXDIR = ..\..
|
||||
|
||||
!include $(WXDIR)\src\makewat.env
|
||||
|
||||
WXLIB = $(WXDIR)\lib
|
||||
NAME = joytest
|
||||
LNK = $(name).lnk
|
||||
OBJS = $(name).obj
|
||||
|
||||
all: $(name).exe
|
||||
|
||||
$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
|
||||
wlink @$(LNK)
|
||||
$(BINDCOMMAND) $(name).res
|
||||
|
||||
$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc
|
||||
$(RC) $(RESFLAGS1) $(name).rc
|
||||
|
||||
$(LNK) : makefile.wat
|
||||
%create $(LNK)
|
||||
@%append $(LNK) debug all
|
||||
@%append $(LNK) system $(LINKOPTION)
|
||||
@%append $(LNK) $(MINDATA)
|
||||
@%append $(LNK) $(MAXDATA)
|
||||
@%append $(LNK) $(STACK)
|
||||
@%append $(LNK) name $(name)
|
||||
@%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
|
||||
@for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
|
||||
@for %i in ($(OBJS)) do @%append $(LNK) file %i
|
||||
|
||||
thing: .SYMBOLIC
|
||||
echo $(WATLIBDIR)
|
||||
|
||||
clean: .SYMBOLIC
|
||||
-erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex
|
||||
|
BIN
samples/joytest/mondrian.ico
Normal file
After Width: | Height: | Size: 766 B |
71
samples/mfc/makefile.b32
Normal file
@@ -0,0 +1,71 @@
|
||||
#
|
||||
# File: makefile.bcc
|
||||
# Author: Andre Beltman
|
||||
# Created: 1995
|
||||
# Updated:
|
||||
# Copyright: (c) 1995, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds mfc example (DOS).
|
||||
|
||||
# WXWIN and BCCDIR are set by parent make
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makeb32.env
|
||||
|
||||
WXLIBDIR = $(WXDIR)\lib
|
||||
WXINC = $(WXDIR)\include\msw
|
||||
WXBASESRC = $(WXDIR)\src\base
|
||||
WXBASEINC = $(WXDIR)\include\base
|
||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||
FAFALIB = $(WXLIBDIR)\fafa.lib
|
||||
ITSYLIB = $(WXLIBDIR)\itsy.lib
|
||||
XPMLIB = $(WXLIBDIR)\xpm.lib
|
||||
DIBLIB = $(WXLIBDIR)\dib.lib
|
||||
GAUGELIB = $(WXLIBDIR)\gauge.lib
|
||||
WXTREELIB = $(WXLIBDIR)\wxtree.lib
|
||||
RCPARSERLIB = $(WXLIBDIR)\rcparser.lib
|
||||
PROLOGLIB = $(WXLIBDIR)\prologio.lib
|
||||
LIBS=$(WXLIB) cw32 import32 ctl3d32 $(FAFALIB) $(ITSYLIB) $(DIBLIB)\
|
||||
$(XPMLIB) $(PROLOGLIB) $(RCPARSERLIB) $(GAUGELIB) $(WXTREELIB)
|
||||
|
||||
TARGET=hello
|
||||
|
||||
!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 = hello.obj
|
||||
|
||||
$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
|
||||
tlink32 $(LINKFLAGS) @&&!
|
||||
c0w32.obj $(OBJECTS)
|
||||
$(TARGET)
|
||||
nul
|
||||
$(LIBS)
|
||||
$(TARGET).def
|
||||
!
|
||||
brc32 -K $(TARGET).res
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc32 $(CPPFLAGS) -c {$< }
|
||||
|
||||
.c.obj:
|
||||
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||
|
||||
hello.obj: hello.$(SRCSUFF)
|
||||
|
||||
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\msw\wx.rc
|
||||
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa $(TARGET)
|
||||
|
||||
clean:
|
||||
-erase *.obj *.exe *.res *.map *.rws
|
||||
|
76
samples/mfc/makefile.bcc
Normal file
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# File: makefile.bcc
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds mfc example (DOS).
|
||||
|
||||
!if "$(BCCDIR)" == ""
|
||||
!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
|
||||
!endif
|
||||
|
||||
!if "$(WXWIN)" == ""
|
||||
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
|
||||
!endif
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makebcc.env
|
||||
|
||||
THISDIR = $(WXDIR)\samples\mfc
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
|
||||
LIBS=$(WXLIB) mathwl cwl import
|
||||
INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
|
||||
CFG=$(WXDIR)\src\wxwin.cfg
|
||||
|
||||
!ifndef FINAL
|
||||
FINAL=0
|
||||
!endif
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||
OPT = -Od
|
||||
DEBUG_FLAGS= -v
|
||||
!else
|
||||
LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||
OPT = -O2
|
||||
DEBUG_FLAGS =
|
||||
!endif
|
||||
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||
|
||||
HEADERS = hello.h
|
||||
SOURCES = hello.$(SRCSUFF)
|
||||
OBJECTS = hello.obj
|
||||
|
||||
hello: hello.exe
|
||||
|
||||
all: hello.exe
|
||||
|
||||
hello.exe: $(WXLIB) hello.obj hello.def hello.res
|
||||
tlink $(LINKFLAGS) @&&!
|
||||
c0wl.obj hello.obj
|
||||
hello
|
||||
nul
|
||||
$(LIBS)
|
||||
hello.def
|
||||
!
|
||||
rc -30 -K hello.res
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc $(CPPFLAGS) -c {$< }
|
||||
|
||||
hello.obj: hello.$(SRCSUFF)
|
||||
|
||||
hello.res : hello.rc $(WXDIR)\include\msw\wx.rc
|
||||
rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa hello
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.rws
|
89
samples/mfc/makefile.dos
Normal file
@@ -0,0 +1,89 @@
|
||||
#
|
||||
# File: makefile.dos
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds MFC compatibility example (DOS).
|
||||
# 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
|
||||
|
||||
THISDIR = $(WXDIR)\samples\mfc
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
MFCINC = c:\msvc\mfc\include
|
||||
LIBS=lafxcwD $(WXLIB) oldnames libw llibcew commdlg ddeml shell mmsystem # mfcoleui compobj storage ole2 ole2disp
|
||||
#LIBS=lafxcwD llibcew libw commdlg shell
|
||||
INC=-I$(MFCINC) -I$(WXDIR)\include\base -I$(WXDIR)\include\msw
|
||||
DUMMY=$(WXDIR)\src\msw\dummy.obj
|
||||
|
||||
# Set this to nothing if using MS C++ 7
|
||||
ZOPTION=/Z7
|
||||
|
||||
!ifndef FINAL
|
||||
FINAL=0
|
||||
!endif
|
||||
|
||||
PRECOMP = # /YuWX_PREC.H /Fp$(WXDIR)\src\msw\wx.pch
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
CPPFLAGS=/D_DEBUG /AL /W3 /Zi $(ZOPTION) /G2sw /Od $(INC) $(PRECOMP) /Dwx_msw
|
||||
#CPPFLAGS=/AL /Zp /GA /G2 /Gyf /Od /W3 $(INC) /D_DEBUG
|
||||
LINKFLAGS=/NOD /CO /NOE /ONERROR:NOEXE /SEG:256 /STACK:12000
|
||||
!else
|
||||
CPPFLAGS=/AL /W3 /G2sw $(INC) /Ox $(PRECOMP) /Dwx_msw
|
||||
LINKFLAGS=/NOD /NOE /ONERROR:NOEXE /SEG:256
|
||||
!endif
|
||||
|
||||
HEADERS = hello.h
|
||||
SOURCES = hello.$(SRCSUFF)
|
||||
OBJECTS = hello.obj
|
||||
|
||||
hello: hello.exe
|
||||
|
||||
all: wx hello.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)
|
||||
|
||||
|
||||
hello.exe: $(DUMMY) $(WXLIB) hello.obj hello.def hello.res
|
||||
link $(LINKFLAGS) @<<
|
||||
$(DUMMY) hello.obj,
|
||||
hello,
|
||||
NUL,
|
||||
$(LIBS),
|
||||
hello.def
|
||||
;
|
||||
<<
|
||||
rc -31 -K hello.res
|
||||
|
||||
hello.obj: hello.h hello.$(SRCSUFF) $(DUMMY)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
hello.res : hello.rc $(WXDIR)\include\msw\wx.rc
|
||||
rc -r /i$(MFCINC) /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa hello
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.sbr
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.pdb
|
66
samples/mfc/makefile.nt
Normal file
@@ -0,0 +1,66 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds MFC/wxWin example (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
EXTRALIBS=# mfc42.lib
|
||||
EXTRAINC=-Ig:\DevStudio\mfc\include
|
||||
EXTRAFLAGS=/D_AFXDLL
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
THISDIR = $(WXDIR)\samples\mfc
|
||||
PROGRAM=mfctest
|
||||
|
||||
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
|
||||
|
47
samples/mfc/makefile.wat
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# Makefile for WATCOM
|
||||
#
|
||||
# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
|
||||
# 8 Nov 1994
|
||||
#
|
||||
|
||||
WXDIR = ..\..
|
||||
|
||||
!include $(WXDIR)\src\makewat.env
|
||||
|
||||
WXLIB = $(WXDIR)\lib
|
||||
NAME = hello
|
||||
LNK = $(name).lnk
|
||||
OBJS = $(name).obj
|
||||
|
||||
# Required for multi-threaded MFC apps
|
||||
EXTRACPPFLAGS = -bm -oaxt-zp4-ei-xs-zo-w3-bm-bt=nt -d_WINDOWS -d_MBCS
|
||||
refmain = _wstart2_
|
||||
|
||||
|
||||
PRECOMP=
|
||||
|
||||
all: $(name).exe
|
||||
|
||||
$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
|
||||
wlink @$(LNK)
|
||||
$(BINDCOMMAND) -d_MBCS $(name).res
|
||||
|
||||
$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc
|
||||
$(RC) $(RESFLAGS1) $(name).rc
|
||||
|
||||
$(LNK) : makefile.wat
|
||||
%create $(LNK)
|
||||
@%append $(LNK) debug all
|
||||
@%append $(LNK) system $(LINKOPTION)
|
||||
@%append $(LNK) $(MINDATA)
|
||||
@%append $(LNK) $(MAXDATA)
|
||||
@%append $(LNK) $(STACK)
|
||||
@%append $(LNK) name $(name)
|
||||
@%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
|
||||
@for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
|
||||
@for %i in ($(OBJS)) do @%append $(LNK) file %i
|
||||
|
||||
clean: .SYMBOLIC
|
||||
-erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex
|
||||
|
408
samples/mfc/mfctest.cpp
Normal file
@@ -0,0 +1,408 @@
|
||||
// hello.cpp : Defines the class behaviors for the application.
|
||||
// Hello is a simple program which consists of a main window
|
||||
// and an "About" dialog which can be invoked by a menu choice.
|
||||
// It is intended to serve as a starting-point for new
|
||||
// applications.
|
||||
//
|
||||
// This is a part of the Microsoft Foundation Classes C++ library.
|
||||
// Copyright (C) 1992 Microsoft Corporation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This source code is only intended as a supplement to the
|
||||
// Microsoft Foundation Classes Reference and Microsoft
|
||||
// WinHelp documentation provided with the library.
|
||||
// See these sources for detailed information regarding the
|
||||
// Microsoft Foundation Classes product.
|
||||
|
||||
// *** MODIFIED BY JULIAN SMART TO DEMONSTRATE CO-EXISTANCE WITH wxWINDOWS ***
|
||||
//
|
||||
// This sample pops up an initial wxWindows frame, with a menu item
|
||||
// that allows a new MFC window to be created. Note that CDummyWindow
|
||||
// is a class that allows a wxWindows window to be seen as a CWnd
|
||||
// for the purposes of specifying a valid main window to the
|
||||
// MFC initialisation.
|
||||
//
|
||||
// You can easily modify this code so that an MFC window pops up
|
||||
// initially as the main frame, and allows wxWindows frames to be
|
||||
// created subsequently:
|
||||
//
|
||||
// (1) Make MyApp::OnInit return NULL, not create a window.
|
||||
// (2) Restore the MFC code to create a window in InitInstance, and remove
|
||||
// creation of CDummyWindow.
|
||||
//
|
||||
// IMPORTANT NOTE: to compile this sample, you must first edit
|
||||
// wx/src/msw/wx_main.cc, set NOWINMAIN to 1, and remake wxWindows
|
||||
// (it only needs to recompile wx_main.cc).
|
||||
// This eliminates the duplicate WinMain function which MFC implements.
|
||||
|
||||
// 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
|
||||
|
||||
#ifdef new
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "mfctest.h"
|
||||
|
||||
#include "wx/wx.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// theApp:
|
||||
// Just creating this application object runs the whole application.
|
||||
//
|
||||
CTheApp theApp;
|
||||
|
||||
// wxWindows elements
|
||||
|
||||
// Define a new application type
|
||||
class MyApp: public wxApp
|
||||
{ public:
|
||||
bool OnInit(void);
|
||||
wxFrame *CreateFrame(void);
|
||||
};
|
||||
|
||||
DECLARE_APP(MyApp)
|
||||
|
||||
class MyCanvas: public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class MyChild: public wxFrame
|
||||
{
|
||||
public:
|
||||
MyCanvas *canvas;
|
||||
MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
||||
~MyChild(void);
|
||||
Bool OnClose(void);
|
||||
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnNew(wxCommandEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// For drawing lines in a canvas
|
||||
long xpos = -1;
|
||||
long ypos = -1;
|
||||
|
||||
// Initialise this in OnInit, not statically
|
||||
wxPen *red_pen;
|
||||
wxFont *small_font;
|
||||
|
||||
// ID for the menu quit command
|
||||
#define HELLO_QUIT 1
|
||||
#define HELLO_NEW 2
|
||||
|
||||
DECLARE_APP(MyApp)
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CMainWindow constructor:
|
||||
// Create the window with the appropriate style, size, menu, etc.
|
||||
//
|
||||
CMainWindow::CMainWindow()
|
||||
{
|
||||
LoadAccelTable( "MainAccelTable" );
|
||||
Create( NULL, "Hello Foundation Application",
|
||||
WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" );
|
||||
}
|
||||
|
||||
// OnPaint:
|
||||
// This routine draws the string "Hello, Windows!" in the center of the
|
||||
// client area. It is called whenever Windows sends a WM_PAINT message.
|
||||
// Note that creating a CPaintDC automatically does a BeginPaint and
|
||||
// an EndPaint call is done when it is destroyed at the end of this
|
||||
// function. CPaintDC's constructor needs the window (this).
|
||||
//
|
||||
void CMainWindow::OnPaint()
|
||||
{
|
||||
CString s = "Hello, Windows!";
|
||||
CPaintDC dc( this );
|
||||
CRect rect;
|
||||
|
||||
GetClientRect( rect );
|
||||
dc.SetTextAlign( TA_BASELINE | TA_CENTER );
|
||||
dc.SetTextColor( ::GetSysColor( COLOR_WINDOWTEXT ) );
|
||||
dc.SetBkMode(TRANSPARENT);
|
||||
dc.TextOut( ( rect.right / 2 ), ( rect.bottom / 2 ),
|
||||
s, s.GetLength() );
|
||||
}
|
||||
|
||||
// OnAbout:
|
||||
// This member function is called when a WM_COMMAND message with an
|
||||
// IDM_ABOUT code is received by the CMainWindow class object. The
|
||||
// message map below is responsible for this routing.
|
||||
//
|
||||
// We create a ClDialog object using the "AboutBox" resource (see
|
||||
// hello.rc), and invoke it.
|
||||
//
|
||||
void CMainWindow::OnAbout()
|
||||
{
|
||||
CDialog about( "AboutBox", this );
|
||||
about.DoModal();
|
||||
}
|
||||
|
||||
void CMainWindow::OnTest()
|
||||
{
|
||||
wxMessageBox("This is a wxWindows message box.\nWe're about to create a new wxWindows frame.", "wxWindows", wxOK);
|
||||
wxGetApp().CreateFrame();
|
||||
}
|
||||
|
||||
// CMainWindow message map:
|
||||
// Associate messages with member functions.
|
||||
//
|
||||
// It is implied that the ON_WM_PAINT macro expects a member function
|
||||
// "void OnPaint()".
|
||||
//
|
||||
// It is implied that members connected with the ON_COMMAND macro
|
||||
// receive no arguments and are void of return type, e.g., "void OnAbout()".
|
||||
//
|
||||
BEGIN_MESSAGE_MAP( CMainWindow, CFrameWnd )
|
||||
//{{AFX_MSG_MAP( CMainWindow )
|
||||
ON_WM_PAINT()
|
||||
ON_COMMAND( IDM_ABOUT, OnAbout )
|
||||
ON_COMMAND( IDM_TEST, OnTest )
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTheApp
|
||||
|
||||
// InitInstance:
|
||||
// When any CTheApp object is created, this member function is automatically
|
||||
// called. Any data may be set up at this point.
|
||||
//
|
||||
// Also, the main window of the application should be created and shown here.
|
||||
// Return TRUE if the initialization is successful.
|
||||
//
|
||||
BOOL CTheApp::InitInstance()
|
||||
{
|
||||
TRACE( "HELLO WORLD\n" );
|
||||
|
||||
SetDialogBkColor(); // hook gray dialogs (was default in MFC V1)
|
||||
|
||||
wxEntry((WXHINSTANCE) m_hInstance, (WXHINSTANCE) m_hPrevInstance, m_lpCmdLine, m_nCmdShow, FALSE);
|
||||
|
||||
/*
|
||||
m_pMainWnd = new CMainWindow();
|
||||
m_pMainWnd->ShowWindow( m_nCmdShow );
|
||||
m_pMainWnd->UpdateWindow();
|
||||
*/
|
||||
|
||||
if (wxTheApp && wxTheApp->GetTopWindow())
|
||||
{
|
||||
m_pMainWnd = new CDummyWindow((HWND) wxTheApp->GetTopWindow()->GetHWND());
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CTheApp::ExitInstance()
|
||||
{
|
||||
wxApp::CleanUp();
|
||||
|
||||
return CWinApp::ExitInstance();
|
||||
}
|
||||
|
||||
// Override this to provide wxWindows message loop
|
||||
// compatibility
|
||||
|
||||
BOOL CTheApp::PreTranslateMessage(MSG *msg)
|
||||
{
|
||||
if (wxTheApp && wxTheApp->ProcessMessage((WXMSG*) msg))
|
||||
return TRUE;
|
||||
else
|
||||
return CWinApp::PreTranslateMessage(msg);
|
||||
}
|
||||
|
||||
BOOL CTheApp::OnIdle(LONG lCount)
|
||||
{
|
||||
if (wxTheApp)
|
||||
return wxTheApp->ProcessIdle();
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* wxWindows elements
|
||||
********************************************************************/
|
||||
|
||||
bool MyApp::OnInit(void)
|
||||
{
|
||||
// Don't exit app when the top level frame is deleted
|
||||
// SetExitOnFrameDelete(FALSE);
|
||||
|
||||
// Create a red pen
|
||||
red_pen = new wxPen("RED", 3, wxSOLID);
|
||||
|
||||
// Create a small font
|
||||
small_font = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL);
|
||||
|
||||
wxFrame* frame = CreateFrame();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxFrame *MyApp::CreateFrame(void)
|
||||
{
|
||||
MyChild *subframe = new MyChild(NULL, "Canvas Frame", wxPoint(10, 10), wxSize(300, 300),
|
||||
wxDEFAULT_FRAME);
|
||||
|
||||
subframe->SetTitle("wxWindows canvas frame");
|
||||
|
||||
// Give it a status line
|
||||
subframe->CreateStatusBar();
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(HELLO_NEW, "&New MFC Window");
|
||||
file_menu->Append(HELLO_QUIT, "&Close");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
subframe->SetMenuBar(menu_bar);
|
||||
|
||||
int width, height;
|
||||
subframe->GetClientSize(&width, &height);
|
||||
|
||||
MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height));
|
||||
wxCursor *cursor = new wxCursor(wxCURSOR_PENCIL);
|
||||
canvas->SetCursor(cursor);
|
||||
subframe->canvas = canvas;
|
||||
|
||||
// Give it scrollbars
|
||||
// canvas->SetScrollbars(20, 20, 50, 50, 4, 4);
|
||||
|
||||
subframe->Show(TRUE);
|
||||
// Return the main frame window
|
||||
return subframe;
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||
EVT_PAINT(MyCanvas::OnPaint)
|
||||
EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define a constructor for my canvas
|
||||
MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
|
||||
wxScrolledWindow(parent, -1, pos, size)
|
||||
{
|
||||
}
|
||||
|
||||
// Define the repainting behaviour
|
||||
void MyCanvas::OnPaint(wxPaintEvent& event)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
|
||||
dc.SetFont(small_font);
|
||||
dc.SetPen(wxGREEN_PEN);
|
||||
dc.DrawLine(0, 0, 200, 200);
|
||||
dc.DrawLine(200, 0, 0, 200);
|
||||
|
||||
dc.SetBrush(wxCYAN_BRUSH);
|
||||
dc.SetPen(wxRED_PEN);
|
||||
dc.DrawRectangle(100, 100, 100, 50);
|
||||
dc.DrawRoundedRectangle(150, 150, 100, 50, 20);
|
||||
|
||||
dc.DrawEllipse(250, 250, 100, 50);
|
||||
dc.DrawSpline(50, 200, 50, 100, 200, 10);
|
||||
dc.DrawLine(50, 230, 200, 230);
|
||||
dc.DrawText("This is a test string", 50, 230);
|
||||
}
|
||||
|
||||
// This implements a tiny doodling program! Drag the mouse using
|
||||
// the left button.
|
||||
void MyCanvas::OnMouseEvent(wxMouseEvent& event)
|
||||
{
|
||||
wxClientDC dc(this);
|
||||
dc.SetPen(wxBLACK_PEN);
|
||||
long x, y;
|
||||
event.Position(&x, &y);
|
||||
if (xpos > -1 && ypos > -1 && event.Dragging())
|
||||
{
|
||||
dc.DrawLine(xpos, ypos, x, y);
|
||||
}
|
||||
xpos = x;
|
||||
ypos = y;
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyChild, wxFrame)
|
||||
EVT_MENU(HELLO_QUIT, MyChild::OnQuit)
|
||||
EVT_MENU(HELLO_NEW, MyChild::OnNew)
|
||||
EVT_ACTIVATE(MyChild::OnActivate)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyChild::MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style):
|
||||
wxFrame(frame, -1, title, pos, size, style)
|
||||
{
|
||||
canvas = NULL;
|
||||
}
|
||||
|
||||
MyChild::~MyChild(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MyChild::OnQuit(wxCommandEvent& event)
|
||||
{
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyChild::OnNew(wxCommandEvent& event)
|
||||
{
|
||||
CMainWindow *mainWin = new CMainWindow();
|
||||
mainWin->ShowWindow( TRUE );
|
||||
mainWin->UpdateWindow();
|
||||
}
|
||||
|
||||
void MyChild::OnActivate(wxActivateEvent& event)
|
||||
{
|
||||
if (event.GetActive() && canvas)
|
||||
canvas->SetFocus();
|
||||
}
|
||||
|
||||
Bool MyChild::OnClose(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// Dummy MFC window for specifying a valid main window to MFC, using
|
||||
// a wxWindows HWND.
|
||||
CDummyWindow::CDummyWindow(HWND hWnd):CWnd()
|
||||
{
|
||||
Attach(hWnd);
|
||||
}
|
||||
|
||||
// Don't let the CWnd destructor delete the HWND
|
||||
CDummyWindow::~CDummyWindow(void)
|
||||
{
|
||||
Detach();
|
||||
}
|
||||
|
21
samples/mfc/mfctest.def
Normal file
@@ -0,0 +1,21 @@
|
||||
; hello.def : Declares the module parameters for the application.
|
||||
;
|
||||
; This is a part of the Microsoft Foundation Classes C++ library.
|
||||
; Copyright (C) 1992 Microsoft Corporation
|
||||
; All rights reserved.
|
||||
;
|
||||
; This source code is only intended as a supplement to the
|
||||
; Microsoft Foundation Classes Reference and Microsoft
|
||||
; WinHelp documentation provided with the library.
|
||||
; See these sources for detailed information regarding the
|
||||
; Microsoft Foundation Classes product.
|
||||
|
||||
NAME Hello
|
||||
DESCRIPTION 'Hello Microsoft Foundation Classes Windows Application'
|
||||
|
||||
EXETYPE WINDOWS
|
||||
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
|
||||
HEAPSIZE 1024
|
66
samples/mfc/mfctest.h
Normal file
@@ -0,0 +1,66 @@
|
||||
// hello.h : Declares the class interfaces for the application.
|
||||
// Hello is a simple program which consists of a main window
|
||||
// and an "About" dialog which can be invoked by a menu choice.
|
||||
// It is intended to serve as a starting-point for new
|
||||
// applications.
|
||||
//
|
||||
// This is a part of the Microsoft Foundation Classes C++ library.
|
||||
// Copyright (C) 1992 Microsoft Corporation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This source code is only intended as a supplement to the
|
||||
// Microsoft Foundation Classes Reference and Microsoft
|
||||
// WinHelp documentation provided with the library.
|
||||
// See these sources for detailed information regarding the
|
||||
// Microsoft Foundation Classes product.
|
||||
|
||||
#ifndef __MFCTEST_H__
|
||||
#define __MFCTEST_H__
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CMainWindow:
|
||||
// See hello.cpp for the code to the member functions and the message map.
|
||||
//
|
||||
class CMainWindow : public CFrameWnd
|
||||
{
|
||||
public:
|
||||
CMainWindow();
|
||||
|
||||
//{{AFX_MSG( CMainWindow )
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnAbout();
|
||||
afx_msg void OnTest();
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
// A dummy CWnd pointing to a wxWindow's HWND
|
||||
class CDummyWindow: public CWnd
|
||||
{
|
||||
public:
|
||||
CDummyWindow(HWND hWnd);
|
||||
~CDummyWindow(void);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CTheApp:
|
||||
// See hello.cpp for the code to the InitInstance member function.
|
||||
//
|
||||
class CTheApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
BOOL InitInstance();
|
||||
int ExitInstance();
|
||||
|
||||
// Override this to provide wxWindows message loop
|
||||
// compatibility
|
||||
BOOL PreTranslateMessage(MSG *msg);
|
||||
BOOL OnIdle(LONG lCount);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // __MFCTEST_H__
|
BIN
samples/mfc/mfctest.ico
Normal file
After Width: | Height: | Size: 766 B |
108
samples/mfc/mfctest.rc
Normal file
@@ -0,0 +1,108 @@
|
||||
//Microsoft App Studio generated resource script.
|
||||
//
|
||||
#include "wx/msw/wx.rc"
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
AFX_IDI_STD_FRAME ICON DISCARDABLE "MFCTEST.ICO"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
MAINMENU MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&Test wxWindows", IDM_TEST
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About Hello...\tF1", IDM_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
MAINACCELTABLE ACCELERATORS MOVEABLE PURE
|
||||
BEGIN
|
||||
VK_F1, IDM_ABOUT, VIRTKEY
|
||||
END
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
ABOUTBOX DIALOG DISCARDABLE 34, 22, 144, 75
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About Hello"
|
||||
FONT 8, "Helv"
|
||||
BEGIN
|
||||
CTEXT "Microsoft Windows",IDC_STATIC,0,5,144,8
|
||||
CTEXT "Microsoft Foundation Classes",IDC_STATIC,0,14,144,8
|
||||
CTEXT "Hello, Windows!",IDC_STATIC,0,23,144,8
|
||||
CTEXT "Version 2.0",IDC_STATIC,0,36,144,8
|
||||
DEFPUSHBUTTON "OK",IDOK,56,53,32,14,WS_GROUP
|
||||
END
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
18
samples/mfc/resource.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// App Studio generated include file.
|
||||
// Used by HELLO.RC
|
||||
//
|
||||
#define IDM_ABOUT 100
|
||||
#define IDM_TEST 101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#define _APS_NEXT_RESOURCE_VALUE 110
|
||||
#define _APS_NEXT_COMMAND_VALUE 32768
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 112
|
||||
#endif
|
||||
#endif
|
12
samples/mfc/stdafx.h
Normal file
@@ -0,0 +1,12 @@
|
||||
// This is a part of the Microsoft Foundation Classes C++ library.
|
||||
// Copyright (C) 1992 Microsoft Corporation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This source code is only intended as a supplement to the
|
||||
// Microsoft Foundation Classes Reference and Microsoft
|
||||
// WinHelp documentation provided with the library.
|
||||
// See these sources for detailed information regarding the
|
||||
// Microsoft Foundation Classes product.
|
||||
|
||||
|
||||
#include <afxwin.h>
|
BIN
samples/nativdlg/aiai.ico
Normal file
After Width: | Height: | Size: 766 B |
142
samples/nativdlg/dialog1.rc
Normal file
@@ -0,0 +1,142 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
|
||||
#ifndef __WIN32__
|
||||
#define __WIN32__
|
||||
#endif
|
||||
|
||||
#ifndef __WIN95__
|
||||
#define __WIN95__
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#define wxID_OK 5100
|
||||
#define wxID_CANCEL 5101
|
||||
#define wxID_APPLY 5102
|
||||
#define wxID_YES 5103
|
||||
#define wxID_NO 5104
|
||||
/* #include <wx/msw/gnuwin32/winresrc.h> */
|
||||
#else
|
||||
#include <wx/defs.h>
|
||||
/* #include <windows.h> */
|
||||
#endif
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#ifndef __MINGW32__
|
||||
#include <commctrl.h>
|
||||
#endif
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
// #include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.K.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
dialog1 DIALOG DISCARDABLE 0, 0, 271, 172
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Test Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",wxID_OK,214,7,50,14
|
||||
PUSHBUTTON "Cancel",wxID_CANCEL,214,24,50,14
|
||||
GROUPBOX "wxStaticBox",IDC_STATIC,7,7,198,158
|
||||
EDITTEXT IDC_EDIT1,64,23,125,14,ES_AUTOHSCROLL
|
||||
LTEXT "wxStaticText",IDC_STATIC,13,25,42,8
|
||||
CONTROL "wxCheckBox",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,14,47,57,10
|
||||
COMBOBOX IDC_COMBO1,83,46,48,30,CBS_DROPDOWN | CBS_SORT |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "wxRadioButton",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,
|
||||
141,47,64,10
|
||||
LISTBOX IDC_LIST1,14,69,86,40,LBS_SORT | LBS_NOINTEGRALHEIGHT |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
SCROLLBAR IDC_SCROLLBAR1,111,71,76,11
|
||||
CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
|
||||
TBS_NOTICKS | WS_TABSTOP,10,116,100,15
|
||||
CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS,111,90,
|
||||
10,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
dialog1, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 264
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 165
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.K.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
64
samples/nativdlg/makefile.b32
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.b32
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds 32bit nativdlg 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=nativdlg
|
||||
|
||||
!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 = nativdlg.obj
|
||||
|
||||
$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
|
||||
tlink32 $(LINKFLAGS) @&&!
|
||||
c0w32.obj $(OBJECTS)
|
||||
$(TARGET)
|
||||
nul
|
||||
$(LIBS)
|
||||
$(TARGET).def
|
||||
!
|
||||
brc32 -K $(TARGET).res
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc32 $(CPPFLAGS) -c {$< }
|
||||
|
||||
.c.obj:
|
||||
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||
|
||||
nativdlg.obj: nativdlg.$(SRCSUFF) nativdlg.h # dialog1.wxr
|
||||
|
||||
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
brc32 -r /D__WINDOWS__ /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.rws
|
||||
|
||||
|
74
samples/nativdlg/makefile.bcc
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
# File: makefile.bcc
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds resource example (DOS).
|
||||
|
||||
!if "$(BCCDIR)" == ""
|
||||
!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
|
||||
!endif
|
||||
|
||||
!if "$(WXWIN)" == ""
|
||||
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
|
||||
!endif
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
THISDIR = $(WXDIR)\samples\resource
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
|
||||
LIBS=$(WXLIB) mathwl cwl import
|
||||
INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
|
||||
CFG=$(WXDIR)\src\wxwin.cfg
|
||||
|
||||
!ifndef FINAL
|
||||
FINAL=0
|
||||
!endif
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||
OPT = -Od
|
||||
DEBUG_FLAGS= -v
|
||||
!else
|
||||
LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||
OPT = -O2
|
||||
DEBUG_FLAGS =
|
||||
!endif
|
||||
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||
|
||||
HEADERS = resource.h
|
||||
SOURCES = resource.cc
|
||||
OBJECTS = resource.obj
|
||||
|
||||
resource: resource.exe
|
||||
|
||||
all: resource.exe
|
||||
|
||||
resource.exe: $(WXLIB) resource.obj resource.def resource.res
|
||||
tlink $(LINKFLAGS) @&&!
|
||||
c0wl.obj resource.obj
|
||||
resource
|
||||
nul
|
||||
$(LIBS)
|
||||
resource.def
|
||||
!
|
||||
rc -30 -K resource.res
|
||||
|
||||
.cc.obj:
|
||||
bcc $(CPPFLAGS) -c {$< }
|
||||
|
||||
resource.obj: resource.cc
|
||||
|
||||
resource.res : resource.rc $(WXDIR)\include\msw\wx.rc
|
||||
rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa resource
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.rws
|
86
samples/nativdlg/makefile.dos
Normal file
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# File: makefile.dos
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds resource example (DOS).
|
||||
# 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
|
||||
|
||||
THISDIR = $(WXDIR)\samples\resource
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
LIBS=$(WXLIB) oldnames libw llibcew commdlg ddeml shell mmsystem
|
||||
INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
|
||||
DUMMY=$(WXDIR)\src\msw\dummy.obj
|
||||
|
||||
# Set this to nothing if using MS C++ 7
|
||||
ZOPTION=/Z7
|
||||
|
||||
!ifndef FINAL
|
||||
FINAL=0
|
||||
!endif
|
||||
|
||||
PRECOMP = /YuWX_PREC.H /Fp$(WXDIR)\src\msw\wx.pch
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
CPPFLAGS=/AL /W3 /Zi $(ZOPTION) /G2sw /Od $(INC) $(PRECOMP) /Dwx_msw
|
||||
LINKFLAGS=/NOD /CO /ONERROR:NOEXE /SEG:256
|
||||
!else
|
||||
CPPFLAGS=/AL /W3 /G2sw $(INC) /Ox $(PRECOMP) /Dwx_msw
|
||||
LINKFLAGS=/NOD /ONERROR:NOEXE /SEG:256
|
||||
!endif
|
||||
|
||||
HEADERS = resource.h
|
||||
SOURCES = resource.$(SRCSUFF)
|
||||
OBJECTS = resource.obj
|
||||
|
||||
resource: resource.exe
|
||||
|
||||
all: wx resource.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)
|
||||
|
||||
|
||||
resource.exe: $(DUMMY) $(WXLIB) resource.obj resource.def resource.res
|
||||
link $(LINKFLAGS) @<<
|
||||
$(DUMMY) resource.obj,
|
||||
resource,
|
||||
NUL,
|
||||
$(LIBS),
|
||||
resource.def
|
||||
;
|
||||
<<
|
||||
rc -31 -K resource.res
|
||||
|
||||
resource.obj: resource.h resource.$(SRCSUFF) dialog1.wxr $(DUMMY)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
resource.res : resource.rc $(WXDIR)\include\msw\wx.rc
|
||||
rc -r /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa resource
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
36
samples/nativdlg/makefile.g95
Normal file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# File: makefile.g95
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for nativdlg example (UNIX).
|
||||
|
||||
WXDIR = ../..
|
||||
|
||||
# All common UNIX compiler flags and options are now in
|
||||
# this central makefile.
|
||||
include $(WXDIR)/src/makeg95.env
|
||||
|
||||
OBJECTS=$(OBJDIR)/nativdlg.$(OBJSUFF) $(OBJDIR)/nativdlg_resources.$(OBJSUFF)
|
||||
|
||||
all: $(OBJDIR) nativdlg$(GUISUFFIX)
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
$(OBJDIR)/nativdlg.$(OBJSUFF): nativdlg.$(SRCSUFF) nativdlg.h
|
||||
$(CC) -c $(CPPFLAGS) -o $@ nativdlg.$(SRCSUFF)
|
||||
|
||||
nativdlg$(GUISUFFIX): $(OBJECTS) $(WXLIB)
|
||||
$(CC) $(LDFLAGS) -o nativdlg$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/nativdlg_resources.o: nativdlg.rc
|
||||
$(RESCOMP) -i nativdlg.rc -o $(OBJDIR)/nativdlg_resources.o $(RESFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) nativdlg$(GUISUFFIX).exe core *.rsc *.res
|
||||
|
63
samples/nativdlg/makefile.nt
Normal file
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds nativdlg 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\nativdlg
|
||||
PROGRAM=nativdlg
|
||||
|
||||
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 dialog1.rc
|
||||
$(rc) -r /i$(WXDIR)\include /D__WINDOWS__ -fo$@ $(PROGRAM).rc
|
||||
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.sbr
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.pdb
|
||||
|
35
samples/nativdlg/makefile.sc
Normal file
@@ -0,0 +1,35 @@
|
||||
# Symantec C++ makefile for hello example
|
||||
# NOTE that peripheral libraries are now dealt in main wxWindows makefile.
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
INCDIR = $(WXDIR)\include
|
||||
MSWINC = $(INCDIR)\msw
|
||||
BASEINC = $(INCDIR)\base
|
||||
|
||||
CC=sc
|
||||
RC=rc
|
||||
CFLAGS = -o -ml -W -Dwx_msw
|
||||
LDFLAGS = -ml -W
|
||||
|
||||
INCLUDE=$(BASEINC);$(MSWINC)
|
||||
|
||||
LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib
|
||||
|
||||
.cc.obj:
|
||||
*$(CC) -c $(CFLAGS) -I$(INCLUDE) $<
|
||||
|
||||
.rc.res:
|
||||
*$(RC) -r -I$(INCLUDE) $<
|
||||
|
||||
hello.exe: hello.obj hello.def hello.res
|
||||
*$(CC) $(LDFLAGS) -o$@ hello.obj hello.def $(LIBS)
|
||||
*$(RC) -k hello.res
|
||||
|
||||
clean:
|
||||
-del *.obj
|
||||
-del *.exe
|
||||
-del *.res
|
||||
-del *.map
|
||||
-del *.rws
|
||||
|
76
samples/nativdlg/makefile.unx
Normal file
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for resource example (UNIX).
|
||||
|
||||
WXDIR = ../..
|
||||
|
||||
# All common UNIX compiler flags and options are now in
|
||||
# this central makefile.
|
||||
include $(WXDIR)/src/make.env
|
||||
|
||||
OBJECTS=$(OBJDIR)/resource.$(OBJSUFF)
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
all: $(OBJDIR) resource$(GUISUFFIX)
|
||||
|
||||
wxmotif:
|
||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif
|
||||
|
||||
wxxview:
|
||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
|
||||
|
||||
wxhp:
|
||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp
|
||||
|
||||
# For SGI, include -lPW on your LDLIBS
|
||||
motif: wxmotif
|
||||
$(MAKE) -f makefile.unx all GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
||||
|
||||
xview: wxxview
|
||||
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' LDLIBS='$(XVIEWLDLIBS)'
|
||||
|
||||
hp: wxhp
|
||||
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC OPT='' DEBUG='$(DEBUG)' WARN='-w' \
|
||||
XINCLUDE='$(HPXINCLUDE)' \
|
||||
XLIB='$(HPXLIB)' \
|
||||
XVIEW_LINK='' \
|
||||
LDLIBS='$(HPLDLIBS)'
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
resource$(GUISUFFIX): $(OBJDIR)/resource.$(OBJSUFF) $(WXLIB)
|
||||
$(CC) $(LDFLAGS) -o resource$(GUISUFFIX) $(OBJDIR)/resource.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/resource.$(OBJSUFF): resource.$(SRCSUFF) resource.h
|
||||
$(CC) -c $(CPPFLAGS) -o $@ resource.$(SRCSUFF)
|
||||
|
||||
clean_motif:
|
||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
|
||||
|
||||
clean_ol:
|
||||
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
|
||||
|
||||
clean_hp:
|
||||
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
|
||||
|
||||
cleanany:
|
||||
rm -f $(OBJECTS) resource$(GUISUFFIX) core
|
||||
|
||||
wxclean_ol:
|
||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_ol
|
||||
|
||||
wxclean_motif:
|
||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_motif
|
||||
|
||||
wxclean_hp:
|
||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_hp
|
||||
|
38
samples/nativdlg/makefile.vms
Normal file
@@ -0,0 +1,38 @@
|
||||
#************************************************************************
|
||||
# Makefile for HELLO under VMS
|
||||
# by Stefan Hammes
|
||||
# (incomplete) update history:
|
||||
# 11.04.95
|
||||
#************************************************************************
|
||||
|
||||
#************************************************************************
|
||||
# Definition section
|
||||
# (cave: definitions and includes must begin with ',')
|
||||
#************************************************************************
|
||||
|
||||
APPOPTS =
|
||||
APPDEFS =
|
||||
APPINCS =
|
||||
|
||||
#************************************************************************
|
||||
# Module section
|
||||
#************************************************************************
|
||||
|
||||
# Name of main module
|
||||
MAIN = hello
|
||||
|
||||
# Object modules of the application.
|
||||
OBJS = hello.obj
|
||||
|
||||
.include [--.src]makevms.env
|
||||
|
||||
# main dependency
|
||||
$(MAIN).exe : $(MAIN).$(OBJ)
|
||||
$(LINK) $(LINKFLAGS) /exec=$(MAIN).exe $(MAIN).$(OBJ),$(WXLIB)/lib,$(OPTSFILE)/option
|
||||
- purge *.exe
|
||||
|
||||
#************************************************************************
|
||||
# Header file depedencies following
|
||||
#************************************************************************
|
||||
hello.obj : hello.cc hello.h
|
||||
|
42
samples/nativdlg/makefile.wat
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Makefile for WATCOM
|
||||
#
|
||||
# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
|
||||
# 8 Nov 1994
|
||||
#
|
||||
|
||||
WXDIR = ..\..
|
||||
|
||||
!include $(WXDIR)\src\makewat.env
|
||||
|
||||
WXLIB = $(WXDIR)\lib
|
||||
NAME = hello
|
||||
LNK = $(name).lnk
|
||||
OBJS = $(name).obj
|
||||
|
||||
PRECOMP=
|
||||
|
||||
all: $(name).exe
|
||||
|
||||
$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
|
||||
wlink @$(LNK)
|
||||
$(BINDCOMMAND) $(name).res
|
||||
|
||||
$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc
|
||||
$(RC) $(RESFLAGS1) $(name).rc
|
||||
|
||||
$(LNK) : makefile.wat
|
||||
%create $(LNK)
|
||||
@%append $(LNK) debug all
|
||||
@%append $(LNK) system $(LINKOPTION)
|
||||
@%append $(LNK) $(MINDATA)
|
||||
@%append $(LNK) $(MAXDATA)
|
||||
@%append $(LNK) $(STACK)
|
||||
@%append $(LNK) name $(name)
|
||||
@%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
|
||||
@for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
|
||||
@for %i in ($(OBJS)) do @%append $(LNK) file %i
|
||||
|
||||
clean: .SYMBOLIC
|
||||
-erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex
|
||||
|
130
samples/nativdlg/nativdlg.cpp
Normal file
@@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: nativdlg.cpp
|
||||
// Purpose: Native Windows dialog sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
// 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/resource.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include "nativdlg.h"
|
||||
#include "resource.h"
|
||||
|
||||
// Declare two frames
|
||||
MyFrame *frame = NULL;
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
// Testing of ressources
|
||||
MyApp::MyApp()
|
||||
{
|
||||
}
|
||||
|
||||
bool MyApp::OnInit(void)
|
||||
{
|
||||
// Create the main frame window
|
||||
frame = new MyFrame(NULL, -1, "wxWindows Native Dialog Sample", wxPoint(0, 0), wxSize(300, 250));
|
||||
|
||||
// Give it a status line
|
||||
frame->CreateStatusBar(2);
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(RESOURCE_TEST1, "&Dialog box test", "Test dialog box resource");
|
||||
file_menu->Append(RESOURCE_QUIT, "E&xit", "Quit program");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
frame->SetMenuBar(menu_bar);
|
||||
|
||||
// Make a panel
|
||||
frame->panel = new wxWindow(frame, -1, wxPoint(0, 0), wxSize(400, 400), 0, "MyMainFrame");
|
||||
frame->Show(TRUE);
|
||||
|
||||
// Return the main frame window
|
||||
SetTopWindow(frame);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit)
|
||||
EVT_MENU(RESOURCE_TEST1, MyFrame::OnTest1)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define my frame constructor
|
||||
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size):
|
||||
wxFrame(parent, id, title, pos, size)
|
||||
{
|
||||
panel = NULL;
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& event)
|
||||
{
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::OnTest1(wxCommandEvent& event)
|
||||
{
|
||||
MyDialog *dialog = new MyDialog;
|
||||
if (dialog->LoadNativeDialog(this, dialog1))
|
||||
{
|
||||
/*
|
||||
wxTextCtrl *text = (wxTextCtrl *)wxFindWindowByName("multitext3", dialog);
|
||||
if (text)
|
||||
text->SetValue("wxWindows resource demo");
|
||||
*/
|
||||
dialog->SetModal(TRUE);
|
||||
dialog->ShowModal();
|
||||
}
|
||||
dialog->Close(TRUE);
|
||||
}
|
||||
|
||||
bool MyFrame::OnClose(void)
|
||||
{
|
||||
Show(FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
||||
EVT_BUTTON(wxID_OK, MyDialog::OnOk)
|
||||
EVT_BUTTON(wxID_CANCEL, MyDialog::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
void MyDialog::OnOk(wxCommandEvent& event)
|
||||
{
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
|
||||
void MyDialog::OnCancel(wxCommandEvent& event)
|
||||
{
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
|
||||
|
9
samples/nativdlg/nativdlg.def
Normal file
@@ -0,0 +1,9 @@
|
||||
NAME Resource
|
||||
DESCRIPTION 'Resource'
|
||||
EXETYPE WINDOWS
|
||||
STUB 'WINSTUB.EXE'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
HEAPSIZE 1024
|
||||
STACKSIZE 16192
|
||||
|
47
samples/nativdlg/nativdlg.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: nativdlg.h
|
||||
// Purpose: Native Windows dialog sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// Define a new application
|
||||
class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
MyApp(void) ;
|
||||
bool OnInit(void);
|
||||
};
|
||||
|
||||
class MyFrame: public wxFrame
|
||||
{
|
||||
public:
|
||||
wxWindow *panel;
|
||||
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
bool OnClose(void);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnTest1(wxCommandEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class MyDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
void OnOk(wxCommandEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define RESOURCE_QUIT 4
|
||||
#define RESOURCE_TEST1 2
|
||||
|
4
samples/nativdlg/nativdlg.rc
Normal file
@@ -0,0 +1,4 @@
|
||||
#include "wx/msw/wx.rc"
|
||||
|
||||
#include "dialog1.rc"
|
||||
|
25
samples/nativdlg/resource.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by dialog1.rc
|
||||
//
|
||||
#define dialog1 101
|
||||
#define IDC_EDIT1 1000
|
||||
#define IDC_CHECK1 1001
|
||||
#define IDC_COMBO1 1003
|
||||
#define IDC_RADIO1 1005
|
||||
#define IDC_LIST1 1006
|
||||
#define IDC_SCROLLBAR1 1007
|
||||
#define IDC_SLIDER1 1008
|
||||
#define IDC_SPIN1 1009
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1010
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
BIN
samples/ownerdrw/bell.bmp
Normal file
After Width: | Height: | Size: 370 B |
64
samples/ownerdrw/makefile.b32
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.bcc
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds ownerdrw example (DOS).
|
||||
|
||||
# WXWIN and BCCDIR are set by parent make
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makeb32.env
|
||||
|
||||
WXLIBDIR = $(WXDIR)\lib
|
||||
WXINC = $(WXDIR)\include\msw
|
||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||
LIBS=$(WXLIB) cw32 import32
|
||||
|
||||
TARGET=ownerdrw
|
||||
|
||||
!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 = ownerdrw.obj
|
||||
|
||||
$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
|
||||
tlink32 $(LINKFLAGS) @&&!
|
||||
c0w32.obj $(OBJECTS)
|
||||
$(TARGET)
|
||||
nul
|
||||
$(LIBS)
|
||||
$(TARGET).def
|
||||
!
|
||||
brc32 -K $(TARGET).res
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc32 $(CPPFLAGS) -c {$< }
|
||||
|
||||
.c.obj:
|
||||
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||
|
||||
ownerdrw.obj: ownerdrw.$(SRCSUFF)
|
||||
|
||||
$(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
|
||||
|
65
samples/ownerdrw/makefile.dos
Normal file
@@ -0,0 +1,65 @@
|
||||
#
|
||||
# File: makefile.dos
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds ownerdrw example (DOS).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
!include $(WXDIR)\src\makemsc.env
|
||||
|
||||
THISDIR = $(WXDIR)\samples\ownerdrw
|
||||
|
||||
!ifndef FINAL
|
||||
FINAL=0
|
||||
!endif
|
||||
|
||||
HEADERS =
|
||||
SOURCES = ownerdrw.$(SRCSUFF)
|
||||
OBJECTS = ownerdrw.obj
|
||||
|
||||
all: ownerdrw.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)
|
||||
|
||||
ownerdrw.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) ownerdrw.obj ownerdrw.def ownerdrw.res
|
||||
link $(LINKFLAGS) @<<
|
||||
ownerdrw.obj $(WXDIR)\src\msw\dummy.obj,
|
||||
ownerdrw,
|
||||
NUL,
|
||||
$(LIBS),
|
||||
ownerdrw.def
|
||||
;
|
||||
<<
|
||||
rc -K ownerdrw.res
|
||||
|
||||
ownerdrw.obj: ownerdrw.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
ownerdrw.res : ownerdrw.rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
rc -r /i$(WXDIR)\include ownerdrw
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
37
samples/ownerdrw/makefile.g95
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for ownerdrw example (UNIX).
|
||||
|
||||
WXDIR = ../..
|
||||
|
||||
# All common UNIX compiler flags and options are now in
|
||||
# this central makefile.
|
||||
include $(WXDIR)/src/makeg95.env
|
||||
|
||||
OBJECTS = $(OBJDIR)/ownerdrw.$(OBJSUFF) $(OBJDIR)/ownerdrw_resources.$(OBJSUFF)
|
||||
|
||||
all: $(OBJDIR) ownerdrw$(GUISUFFIX)$(EXESUFF)
|
||||
|
||||
wx:
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
ownerdrw$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
|
||||
$(CC) $(LDFLAGS) -o ownerdrw$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/ownerdrw.$(OBJSUFF): ownerdrw.$(SRCSUFF)
|
||||
$(CC) -c $(CPPFLAGS) -o $@ ownerdrw.$(SRCSUFF)
|
||||
|
||||
$(OBJDIR)/ownerdrw_resources.o: ownerdrw.rc
|
||||
$(RESCOMP) -i ownerdrw.rc -o $(OBJDIR)/ownerdrw_resources.o $(RESFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) ownerdrw$(GUISUFFIX).exe core *.rsc *.res
|
64
samples/ownerdrw/makefile.nt
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds ownerdrw example (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
WXUSINGDLL=0
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
THISDIR = $(WXDIR)\samples\ownerdrw
|
||||
PROGRAM=ownerdrw
|
||||
|
||||
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).$(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 *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
BIN
samples/ownerdrw/mondrian.ico
Normal file
After Width: | Height: | Size: 766 B |
BIN
samples/ownerdrw/nosound.bmp
Normal file
After Width: | Height: | Size: 370 B |
293
samples/ownerdrw/ownerdrw.cpp
Normal file
@@ -0,0 +1,293 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ownerdrw.cpp
|
||||
// Purpose: Owner-draw sample, for Windows
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 13.11.97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// headers & declarations
|
||||
// ============================================================================
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/ownerdrw.h"
|
||||
#include "wx/menuitem.h"
|
||||
#include "wx/msw/checklst.h"
|
||||
|
||||
// Define a new application type
|
||||
class OwnerDrawnApp: public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit();
|
||||
};
|
||||
|
||||
// Define a new frame type
|
||||
class OwnerDrawnFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
// ctor & dtor
|
||||
OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
|
||||
~OwnerDrawnFrame();
|
||||
|
||||
// notifications
|
||||
void OnQuit (wxCommandEvent& event);
|
||||
void OnAbout (wxCommandEvent& event);
|
||||
void OnListboxSelect (wxCommandEvent& event);
|
||||
void OnCheckboxToggle (wxCommandEvent& event);
|
||||
void OnListboxDblClick (wxCommandEvent& event);
|
||||
bool OnClose () { return TRUE; }
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
void InitMenu();
|
||||
|
||||
wxCheckListBox *m_pListBox;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
Menu_Quit = 1,
|
||||
Menu_First = 100,
|
||||
Menu_Test1, Menu_Test2, Menu_Test3,
|
||||
Menu_Bitmap, Menu_Bitmap2,
|
||||
Menu_Submenu, Menu_Sub1, Menu_Sub2, Menu_Sub3,
|
||||
Control_First = 1000,
|
||||
Control_Listbox, Control_Listbox2,
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(OwnerDrawnFrame, wxFrame)
|
||||
EVT_MENU(Menu_Quit, OwnerDrawnFrame::OnQuit)
|
||||
EVT_LISTBOX(Control_Listbox, OwnerDrawnFrame::OnListboxSelect)
|
||||
EVT_CHECKLISTBOX(Control_Listbox, OwnerDrawnFrame::OnCheckboxToggle)
|
||||
EVT_COMMAND(Control_Listbox, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
|
||||
OwnerDrawnFrame::OnListboxDblClick)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_APP(OwnerDrawnApp);
|
||||
|
||||
// init our app: create windows
|
||||
bool OwnerDrawnApp::OnInit(void)
|
||||
{
|
||||
OwnerDrawnFrame *pFrame = new OwnerDrawnFrame(NULL, "wxWindows Ownerdraw Sample",
|
||||
50, 50, 450, 340);
|
||||
SetTopWindow(pFrame);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// create the menu bar for the main frame
|
||||
void OwnerDrawnFrame::InitMenu()
|
||||
{
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu,
|
||||
*sub_menu = new wxMenu;
|
||||
|
||||
// vars used for menu construction
|
||||
wxMenuItem *pItem;
|
||||
wxFont fontLarge(18, wxROMAN, wxNORMAL, wxBOLD, FALSE),
|
||||
fontUlined(12, wxDEFAULT, wxNORMAL, wxNORMAL, TRUE),
|
||||
fontItalic(12, wxMODERN, wxITALIC, wxBOLD, FALSE),
|
||||
// should be at least of the size of bitmaps
|
||||
fontBmp(14, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE);
|
||||
|
||||
// sorry for my artistic skills...
|
||||
wxBitmap bmpBell("bell"), bmpSound("sound"), bmpNoSound("nosound");
|
||||
|
||||
// construct submenu
|
||||
pItem = new wxMenuItem(sub_menu, Menu_Sub1, "Submenu &first", "large", TRUE);
|
||||
pItem->SetFont(fontLarge);
|
||||
sub_menu->Append(pItem);
|
||||
|
||||
pItem = new wxMenuItem(sub_menu, Menu_Sub2, "Submenu &second", "italic", TRUE);
|
||||
pItem->SetFont(fontItalic);
|
||||
sub_menu->Append(pItem);
|
||||
|
||||
pItem = new wxMenuItem(sub_menu, Menu_Sub3, "Submenu &third", "underlined", TRUE);
|
||||
pItem->SetFont(fontUlined);
|
||||
sub_menu->Append(pItem);
|
||||
|
||||
// construct menu
|
||||
pItem = new wxMenuItem(file_menu, Menu_Test1, "&Uncheckable", "red item");
|
||||
pItem->SetFont(*wxITALIC_FONT);
|
||||
pItem->SetTextColour(wxColor(255, 0, 0));
|
||||
pItem->SetMarginWidth(23);
|
||||
file_menu->Append(pItem);
|
||||
|
||||
pItem = new wxMenuItem(file_menu, Menu_Test2, "&Checkable", "checkable item", TRUE);
|
||||
pItem->SetFont(*wxSMALL_FONT);
|
||||
file_menu->Append(pItem);
|
||||
file_menu->Check(Menu_Test2, TRUE);
|
||||
|
||||
pItem = new wxMenuItem(file_menu, Menu_Test3, "&Disabled", "disabled item");
|
||||
pItem->SetFont(*wxNORMAL_FONT);
|
||||
file_menu->Append(pItem);
|
||||
file_menu->Enable(Menu_Test3, FALSE);
|
||||
|
||||
file_menu->AppendSeparator();
|
||||
|
||||
pItem = new wxMenuItem(file_menu, Menu_Bitmap, "&Bell", "check/uncheck me!", TRUE);
|
||||
pItem->SetFont(fontBmp);
|
||||
pItem->SetBitmaps(bmpBell);
|
||||
file_menu->Append(pItem);
|
||||
|
||||
pItem = new wxMenuItem(file_menu, Menu_Bitmap2, "So&und", "icon changes!", TRUE);
|
||||
pItem->SetFont(fontBmp);
|
||||
pItem->SetBitmaps(bmpSound, bmpNoSound);
|
||||
file_menu->Append(pItem);
|
||||
|
||||
file_menu->AppendSeparator();
|
||||
|
||||
pItem = new wxMenuItem(file_menu, Menu_Submenu, "&Sub menu", "", TRUE, sub_menu);
|
||||
pItem->SetFont(*wxSWISS_FONT);
|
||||
file_menu->Append(pItem);
|
||||
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(Menu_Quit, "&Quit", "Normal item");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
SetMenuBar(menu_bar);
|
||||
}
|
||||
|
||||
// main frame constructor
|
||||
OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
||||
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
|
||||
{
|
||||
// set the icon
|
||||
SetIcon(wxIcon("mondrian"));
|
||||
|
||||
// create the menu
|
||||
InitMenu();
|
||||
|
||||
// make a panel with some controls
|
||||
wxPanel *pPanel = new wxPanel(this, -1, wxPoint(0, 0),
|
||||
wxSize(400, 200), wxTAB_TRAVERSAL);
|
||||
|
||||
// check list box
|
||||
static const char* aszChoices[] = { "Hello", "world", "and",
|
||||
"goodbye", "cruel", "world",
|
||||
"-------", "owner-drawn", "listbox" };
|
||||
|
||||
wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
|
||||
uint ui;
|
||||
for ( ui = 0; ui < WXSIZEOF(aszChoices); ui++ )
|
||||
astrChoices[ui] = aszChoices[ui];
|
||||
|
||||
m_pListBox = new wxCheckListBox
|
||||
(
|
||||
pPanel, // parent
|
||||
Control_Listbox, // control id
|
||||
wxPoint(10, 10), // listbox poistion
|
||||
wxSize(200, 200), // listbox size
|
||||
WXSIZEOF(aszChoices), // number of strings
|
||||
astrChoices // array of strings
|
||||
);
|
||||
|
||||
delete [] astrChoices;
|
||||
|
||||
for ( ui = 0; ui < WXSIZEOF(aszChoices); ui += 2 ) {
|
||||
m_pListBox->GetItem(ui)->SetBackgroundColour(wxColor(200, 200, 200));
|
||||
}
|
||||
|
||||
m_pListBox->Check(2);
|
||||
|
||||
// normal (but owner-drawn) listbox
|
||||
static const char* aszColors[] = { "Red", "Blue", "Pink",
|
||||
"Green", "Yellow",
|
||||
"Black", "Violet" };
|
||||
struct { uint r, g, b; } aColors[] = { {255,0,0}, {0,0,255}, {255,128,192},
|
||||
{0,255,0}, {255,255,128},
|
||||
{0,0,0}, {128,0,255} };
|
||||
astrChoices = new wxString[WXSIZEOF(aszColors)];
|
||||
for ( ui = 0; ui < WXSIZEOF(aszColors); ui++ )
|
||||
astrChoices[ui] = aszColors[ui];
|
||||
|
||||
wxListBox *pListBox = new wxListBox
|
||||
(
|
||||
pPanel, // parent
|
||||
Control_Listbox2, // control id
|
||||
wxPoint(220, 10), // listbox poistion
|
||||
wxDefaultSize, // listbox size
|
||||
WXSIZEOF(aszColors), // number of strings
|
||||
astrChoices, // array of strings
|
||||
wxLB_OWNERDRAW, // owner-drawn
|
||||
wxDefaultValidator, //
|
||||
wxListBoxNameStr
|
||||
);
|
||||
|
||||
for ( ui = 0; ui < WXSIZEOF(aszColors); ui++ ) {
|
||||
pListBox->GetItem(ui)->SetTextColour(wxColor(aColors[ui].r,
|
||||
aColors[ui].g,
|
||||
aColors[ui].b));
|
||||
// yellow on white is horrible...
|
||||
if ( ui == 4 )
|
||||
pListBox->GetItem(ui)->SetBackgroundColour(wxColor(0, 0, 0));
|
||||
|
||||
}
|
||||
|
||||
// create the status line
|
||||
const int widths[] = { -1, 60 };
|
||||
CreateStatusBar(2);
|
||||
SetStatusWidths(2, widths);
|
||||
SetStatusText("no selection", 0);
|
||||
|
||||
Show(TRUE);
|
||||
}
|
||||
|
||||
OwnerDrawnFrame::~OwnerDrawnFrame()
|
||||
{
|
||||
}
|
||||
|
||||
void OwnerDrawnFrame::OnQuit(wxCommandEvent& event)
|
||||
{
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void OwnerDrawnFrame::OnAbout(wxCommandEvent& event)
|
||||
{
|
||||
wxMessageDialog dialog(this, "Demo of owner-drawn controls\n"
|
||||
"About wxOwnerDrawn", wxYES_NO | wxCANCEL);
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
|
||||
{
|
||||
wxString strSelection;
|
||||
uint nSel = event.GetSelection();
|
||||
strSelection.sprintf("item %d selected (%schecked)", nSel,
|
||||
m_pListBox->IsChecked(nSel) ? "" : "not ");
|
||||
SetStatusText(strSelection);
|
||||
}
|
||||
|
||||
void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& event)
|
||||
{
|
||||
wxString strSelection;
|
||||
strSelection.sprintf("item %d double clicked", m_pListBox->GetSelection());
|
||||
wxMessageDialog dialog(this, strSelection);
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event)
|
||||
{
|
||||
wxString strSelection;
|
||||
uint nItem = event.GetInt();
|
||||
strSelection.sprintf("item %d was %schecked", nItem,
|
||||
m_pListBox->IsChecked(nItem) ? "" : "un");
|
||||
SetStatusText(strSelection);
|
||||
}
|
8
samples/ownerdrw/ownerdrw.def
Normal file
@@ -0,0 +1,8 @@
|
||||
NAME OWNERDRW
|
||||
DESCRIPTION 'Owner-draw sample'
|
||||
EXETYPE WINDOWS
|
||||
STUB 'WINSTUB.EXE'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
HEAPSIZE 4048
|
||||
STACKSIZE 16000
|
6
samples/ownerdrw/ownerdrw.rc
Normal file
@@ -0,0 +1,6 @@
|
||||
mondrian ICON "mondrian.ico"
|
||||
bell BITMAP "bell.bmp"
|
||||
sound BITMAP "sound.bmp"
|
||||
nosound BITMAP "nosound.bmp"
|
||||
#include "wx/msw/wx.rc"
|
||||
|
BIN
samples/ownerdrw/sound.bmp
Normal file
After Width: | Height: | Size: 370 B |
BIN
samples/regtest/key1.ico
Normal file
After Width: | Height: | Size: 318 B |
BIN
samples/regtest/key2.ico
Normal file
After Width: | Height: | Size: 318 B |
BIN
samples/regtest/key3.ico
Normal file
After Width: | Height: | Size: 318 B |
37
samples/regtest/makefile.g95
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for regtest example (UNIX).
|
||||
|
||||
WXDIR = ../..
|
||||
|
||||
# All common UNIX compiler flags and options are now in
|
||||
# this central makefile.
|
||||
include $(WXDIR)/src/makeg95.env
|
||||
|
||||
OBJECTS = $(OBJDIR)/regtest.$(OBJSUFF) $(OBJDIR)/regtest_resources.$(OBJSUFF)
|
||||
|
||||
all: $(OBJDIR) regtest$(GUISUFFIX)$(EXESUFF)
|
||||
|
||||
wx:
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
regtest$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
|
||||
$(CC) $(LDFLAGS) -o regtest$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/regtest.$(OBJSUFF): regtest.$(SRCSUFF)
|
||||
$(CC) -c $(CPPFLAGS) -o $@ regtest.$(SRCSUFF)
|
||||
|
||||
$(OBJDIR)/regtest_resources.o: regtest.rc
|
||||
$(RESCOMP) -i regtest.rc -o $(OBJDIR)/regtest_resources.o $(RESFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) regtest$(GUISUFFIX).exe core *.rsc *.res
|
64
samples/regtest/makefile.nt
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds regtest example (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
WXUSINGDLL=0
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
THISDIR = $(WXDIR)\samples\regtest
|
||||
PROGRAM=regtest
|
||||
|
||||
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).$(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 *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
BIN
samples/regtest/registry.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
834
samples/regtest/regtest.cpp
Normal file
@@ -0,0 +1,834 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: registry.cpp
|
||||
// Purpose: wxRegKey class demo
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 03.04.98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/log.h"
|
||||
#include "wx/treectrl.h"
|
||||
#include "wx/msw/registry.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// application type
|
||||
// ----------------------------------------------------------------------------
|
||||
class RegApp : public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit(void);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// image list with registry icons
|
||||
// ----------------------------------------------------------------------------
|
||||
class RegImageList : public wxImageList
|
||||
{
|
||||
public:
|
||||
enum Icon
|
||||
{
|
||||
Root,
|
||||
ClosedKey,
|
||||
OpenedKey,
|
||||
TextValue,
|
||||
BinaryValue,
|
||||
};
|
||||
|
||||
RegImageList();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// our control
|
||||
// ----------------------------------------------------------------------------
|
||||
class RegTreeCtrl : public wxTreeCtrl
|
||||
{
|
||||
public:
|
||||
// ctor & dtor
|
||||
RegTreeCtrl(wxWindow *parent, wxWindowID id);
|
||||
virtual ~RegTreeCtrl();
|
||||
|
||||
// notifications
|
||||
void OnDeleteItem (wxTreeEvent& event);
|
||||
void OnItemExpanding(wxTreeEvent& event);
|
||||
void OnSelChanged (wxTreeEvent& event);
|
||||
|
||||
void OnRightClick (wxMouseEvent& event);
|
||||
void OnChar (wxKeyEvent& event);
|
||||
|
||||
// forwarded notifications (by the frame)
|
||||
void OnMenuTest();
|
||||
|
||||
// operations
|
||||
void DeleteSelected();
|
||||
void CreateNewKey(const wxString& strName);
|
||||
void CreateNewTextValue(const wxString& strName);
|
||||
void CreateNewBinaryValue(const wxString& strName);
|
||||
|
||||
// information
|
||||
bool IsKeySelected() const;
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
private:
|
||||
// array of children of the node
|
||||
struct TreeNode;
|
||||
WX_DEFINE_ARRAY(TreeNode *, TreeChildren);
|
||||
|
||||
// structure describing a registry key/value
|
||||
struct TreeNode
|
||||
{
|
||||
RegTreeCtrl *m_pTree; // must be !NULL
|
||||
TreeNode *m_pParent; // NULL only for the root node
|
||||
long m_id; // the id of the tree control item
|
||||
wxString m_strName; // name of the key/value
|
||||
TreeChildren m_aChildren; // array of subkeys/values
|
||||
bool m_bKey; // key or value?
|
||||
wxRegKey *m_pKey; // only may be !NULL if m_bKey == true
|
||||
long m_lDummy; // dummy subkey (to make expansion possible)
|
||||
|
||||
// ctor
|
||||
TreeNode() { m_lDummy = 0; }
|
||||
|
||||
// trivial accessors
|
||||
long Id() const { return m_id; }
|
||||
bool IsRoot() const { return m_pParent == NULL; }
|
||||
bool IsKey() const { return m_bKey; }
|
||||
TreeNode *Parent() const { return m_pParent; }
|
||||
|
||||
// notifications
|
||||
bool OnExpand();
|
||||
void OnCollapse();
|
||||
|
||||
// operations
|
||||
void Refresh() { OnCollapse(); OnExpand(); }
|
||||
void AddDummy();
|
||||
void DestroyChildren();
|
||||
const char *FullName() const;
|
||||
|
||||
// get the associated key: make sure the pointer is !NULL
|
||||
wxRegKey& Key() { if ( !m_pKey ) OnExpand(); return *m_pKey; }
|
||||
|
||||
// dtor deletes all children
|
||||
~TreeNode();
|
||||
};
|
||||
|
||||
wxMenu *m_pMenuPopup;
|
||||
TreeNode *m_pRoot;
|
||||
wxImageList *m_imageList;
|
||||
|
||||
TreeNode *GetNode(const wxTreeEvent& event)
|
||||
{ return (TreeNode *)GetItemData(event.m_item.m_itemId); }
|
||||
|
||||
public:
|
||||
// create a new node and insert it to the tree
|
||||
TreeNode *InsertNewTreeNode(TreeNode *pParent,
|
||||
const wxString& strName,
|
||||
int idImage = RegImageList::ClosedKey,
|
||||
const wxString *pstrValue = NULL);
|
||||
// add standard registry keys
|
||||
void AddStdKeys();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the main window of our application
|
||||
// ----------------------------------------------------------------------------
|
||||
class RegFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
// ctor & dtor
|
||||
RegFrame(wxFrame *parent, char *title, int x, int y, int w, int h);
|
||||
virtual ~RegFrame(void);
|
||||
|
||||
// callbacks
|
||||
void OnQuit (wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnTest (wxCommandEvent& event);
|
||||
|
||||
void OnExpand (wxCommandEvent& event);
|
||||
void OnCollapse(wxCommandEvent& event);
|
||||
void OnToggle (wxCommandEvent& event);
|
||||
|
||||
void OnDelete (wxCommandEvent& event);
|
||||
void OnNewKey (wxCommandEvent& event);
|
||||
void OnNewText (wxCommandEvent& event);
|
||||
void OnNewBinary(wxCommandEvent& event);
|
||||
|
||||
bool OnClose () { return TRUE; }
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
private:
|
||||
RegTreeCtrl *m_treeCtrl;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// various ids
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
enum
|
||||
{
|
||||
Menu_Quit = 100,
|
||||
Menu_About,
|
||||
Menu_Test,
|
||||
Menu_Expand,
|
||||
Menu_Collapse,
|
||||
Menu_Toggle,
|
||||
Menu_New,
|
||||
Menu_NewKey,
|
||||
Menu_NewText,
|
||||
Menu_NewBinary,
|
||||
Menu_Delete,
|
||||
|
||||
Ctrl_RegTree = 200,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(RegFrame, wxFrame)
|
||||
EVT_MENU(Menu_Test, RegFrame::OnTest)
|
||||
EVT_MENU(Menu_About, RegFrame::OnAbout)
|
||||
EVT_MENU(Menu_Quit, RegFrame::OnQuit)
|
||||
EVT_MENU(Menu_Expand, RegFrame::OnExpand)
|
||||
EVT_MENU(Menu_Collapse, RegFrame::OnCollapse)
|
||||
EVT_MENU(Menu_Toggle, RegFrame::OnToggle)
|
||||
EVT_MENU(Menu_Delete, RegFrame::OnDelete)
|
||||
EVT_MENU(Menu_NewKey, RegFrame::OnNewKey)
|
||||
EVT_MENU(Menu_NewText, RegFrame::OnNewText)
|
||||
EVT_MENU(Menu_NewBinary,RegFrame::OnNewBinary)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(RegTreeCtrl, wxTreeCtrl)
|
||||
EVT_TREE_DELETE_ITEM (Ctrl_RegTree, RegTreeCtrl::OnDeleteItem)
|
||||
EVT_TREE_ITEM_EXPANDING(Ctrl_RegTree, RegTreeCtrl::OnItemExpanding)
|
||||
EVT_TREE_SEL_CHANGED (Ctrl_RegTree, RegTreeCtrl::OnSelChanged)
|
||||
|
||||
EVT_CHAR (RegTreeCtrl::OnChar)
|
||||
EVT_RIGHT_DOWN(RegTreeCtrl::OnRightClick)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// create the "registry operations" menu
|
||||
wxMenu *CreateRegistryMenu()
|
||||
{
|
||||
wxMenu *pMenuNew = new wxMenu;
|
||||
pMenuNew->Append(Menu_NewKey, "&Key", "Create a new key");
|
||||
pMenuNew->AppendSeparator();
|
||||
pMenuNew->Append(Menu_NewText, "&Text value", "Create a new text value");
|
||||
pMenuNew->Append(Menu_NewBinary, "&Binary value", "Create a new binary value");
|
||||
|
||||
wxMenu *pMenuReg = new wxMenu;
|
||||
pMenuReg->Append(Menu_New, "&New", pMenuNew);
|
||||
pMenuReg->Append(Menu_Delete, "&Delete...", "Delete selected key/value");
|
||||
pMenuReg->AppendSeparator();
|
||||
pMenuReg->Append(Menu_Expand, "&Expand", "Expand current key");
|
||||
pMenuReg->Append(Menu_Collapse, "&Collapse", "Collapse current key");
|
||||
pMenuReg->Append(Menu_Toggle, "&Toggle", "Toggle current key");
|
||||
|
||||
return pMenuReg;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// application class
|
||||
// ----------------------------------------------------------------------------
|
||||
IMPLEMENT_APP(RegApp)
|
||||
|
||||
// `Main program' equivalent, creating windows and returning main app frame
|
||||
bool RegApp::OnInit()
|
||||
{
|
||||
// create the main frame window and show it
|
||||
RegFrame *frame = new RegFrame(NULL, "wxRegKey Test", 50, 50, 600, 350);
|
||||
frame->Show(true);
|
||||
|
||||
SetTopWindow(frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RegFrame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
RegFrame::RegFrame(wxFrame *parent, char *title, int x, int y, int w, int h)
|
||||
: wxFrame(parent, -1, title, wxPoint(x, y), wxSize(w, h))
|
||||
{
|
||||
// this reduces flicker effects
|
||||
SetBackgroundColour(wxColour(255, 255, 255));
|
||||
|
||||
// set the icon
|
||||
// ------------
|
||||
SetIcon(wxIcon("app_icon"));
|
||||
|
||||
// create menu
|
||||
// -----------
|
||||
wxMenu *pMenuFile = new wxMenu;
|
||||
pMenuFile->Append(Menu_Test, "Te&st", "Test key creation");
|
||||
pMenuFile->AppendSeparator();
|
||||
pMenuFile->Append(Menu_About, "&About...", "Show an extraordinarly beautiful dialog");
|
||||
pMenuFile->AppendSeparator();
|
||||
pMenuFile->Append(Menu_Quit, "E&xit", "Quit this program");
|
||||
|
||||
wxMenuBar *pMenu = new wxMenuBar;
|
||||
pMenu->Append(pMenuFile, "&File");
|
||||
pMenu->Append(CreateRegistryMenu(), "&Registry");
|
||||
SetMenuBar(pMenu);
|
||||
|
||||
// create child controls
|
||||
// ---------------------
|
||||
m_treeCtrl = new RegTreeCtrl(this, Ctrl_RegTree);
|
||||
|
||||
// create the status line
|
||||
// ----------------------
|
||||
int aWidths[2];
|
||||
aWidths[0] = 200;
|
||||
aWidths[1] = -1;
|
||||
CreateStatusBar(2);
|
||||
SetStatusWidths(2, aWidths);
|
||||
}
|
||||
|
||||
RegFrame::~RegFrame(void)
|
||||
{
|
||||
}
|
||||
|
||||
void RegFrame::OnQuit(wxCommandEvent& event)
|
||||
{
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void RegFrame::OnAbout(wxCommandEvent& event)
|
||||
{
|
||||
wxMessageDialog dialog(this, "wxRegistry sample\n(c) 1998 Vadim Zeitlin",
|
||||
"About wxRegistry", wxOK);
|
||||
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
void RegFrame::OnTest(wxCommandEvent& event)
|
||||
{
|
||||
m_treeCtrl->OnMenuTest();
|
||||
}
|
||||
|
||||
void RegFrame::OnExpand(wxCommandEvent& event)
|
||||
{
|
||||
m_treeCtrl->ExpandItem(m_treeCtrl->GetSelection(), wxTREE_EXPAND_EXPAND);
|
||||
}
|
||||
|
||||
void RegFrame::OnCollapse(wxCommandEvent& event)
|
||||
{
|
||||
m_treeCtrl->ExpandItem(m_treeCtrl->GetSelection(), wxTREE_EXPAND_COLLAPSE);
|
||||
}
|
||||
|
||||
void RegFrame::OnToggle(wxCommandEvent& event)
|
||||
{
|
||||
m_treeCtrl->ExpandItem(m_treeCtrl->GetSelection(), wxTREE_EXPAND_TOGGLE);
|
||||
}
|
||||
|
||||
void RegFrame::OnDelete(wxCommandEvent& event)
|
||||
{
|
||||
m_treeCtrl->DeleteSelected();
|
||||
}
|
||||
|
||||
void RegFrame::OnNewKey(wxCommandEvent& event)
|
||||
{
|
||||
if ( m_treeCtrl->IsKeySelected() ) {
|
||||
m_treeCtrl->CreateNewKey(
|
||||
wxGetTextFromUser("Enter the name of the new key"));
|
||||
}
|
||||
}
|
||||
|
||||
void RegFrame::OnNewText(wxCommandEvent& event)
|
||||
{
|
||||
if ( m_treeCtrl->IsKeySelected() ) {
|
||||
m_treeCtrl->CreateNewTextValue(
|
||||
wxGetTextFromUser("Enter the name for the new text value"));
|
||||
}
|
||||
}
|
||||
|
||||
void RegFrame::OnNewBinary(wxCommandEvent& event)
|
||||
{
|
||||
if ( m_treeCtrl->IsKeySelected() ) {
|
||||
m_treeCtrl->CreateNewBinaryValue(
|
||||
wxGetTextFromUser("Enter the name for the new binary value"));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RegImageList
|
||||
// ----------------------------------------------------------------------------
|
||||
RegImageList::RegImageList() : wxImageList(16, 16, TRUE)
|
||||
{
|
||||
// should be in sync with enum RegImageList::RegIcon
|
||||
static const char *aszIcons[] = { "key1","key2","key3","value1","value2" };
|
||||
wxString str = "icon_";
|
||||
for ( uint n = 0; n < WXSIZEOF(aszIcons); n++ ) {
|
||||
Add(wxIcon(str + aszIcons[n], wxBITMAP_TYPE_ICO_RESOURCE));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RegTreeCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// create a new tree item and insert it into the tree
|
||||
RegTreeCtrl::TreeNode *RegTreeCtrl::InsertNewTreeNode(TreeNode *pParent,
|
||||
const wxString& strName,
|
||||
int idImage,
|
||||
const wxString *pstrValue)
|
||||
{
|
||||
// create new item & insert it
|
||||
TreeNode *pNewNode = new TreeNode;
|
||||
pNewNode->m_pTree = this;
|
||||
pNewNode->m_pParent = pParent;
|
||||
pNewNode->m_strName = strName;
|
||||
pNewNode->m_bKey = pstrValue == NULL;
|
||||
pNewNode->m_pKey = NULL;
|
||||
pNewNode->m_id = InsertItem(pParent ? pParent->m_id : 0,
|
||||
pNewNode->IsKey() ? strName : *pstrValue,
|
||||
idImage);
|
||||
|
||||
wxASSERT_MSG( pNewNode->m_id, "can't create tree control item!");
|
||||
|
||||
// save the pointer in the item
|
||||
if ( !SetItemData(pNewNode->m_id, (long)pNewNode) ) {
|
||||
wxFAIL_MSG("can't store item's data in tree control!");
|
||||
}
|
||||
|
||||
// add it to the list of parent's children
|
||||
if ( pParent != NULL ) {
|
||||
pParent->m_aChildren.Add(pNewNode);
|
||||
}
|
||||
|
||||
// force the [+] button (@@@ not very elegant...)
|
||||
if ( pNewNode->IsKey() )
|
||||
pNewNode->AddDummy();
|
||||
|
||||
return pNewNode;
|
||||
}
|
||||
|
||||
RegTreeCtrl::RegTreeCtrl(wxWindow *parent, wxWindowID id)
|
||||
: wxTreeCtrl(parent, id, wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxSUNKEN_BORDER)
|
||||
{
|
||||
// create the image list
|
||||
// ---------------------
|
||||
m_imageList = new RegImageList;
|
||||
SetImageList(m_imageList, wxIMAGE_LIST_NORMAL);
|
||||
|
||||
// create root keys
|
||||
// ----------------
|
||||
m_pRoot = InsertNewTreeNode(NULL, "Registry Root", RegImageList::Root);
|
||||
|
||||
// create popup menu
|
||||
// -----------------
|
||||
m_pMenuPopup = CreateRegistryMenu();
|
||||
}
|
||||
|
||||
RegTreeCtrl::~RegTreeCtrl()
|
||||
{
|
||||
delete m_pMenuPopup;
|
||||
delete m_pRoot;
|
||||
delete m_imageList;
|
||||
}
|
||||
|
||||
void RegTreeCtrl::AddStdKeys()
|
||||
{
|
||||
for ( uint ui = 0; ui < wxRegKey::nStdKeys; ui++ ) {
|
||||
InsertNewTreeNode(m_pRoot, wxRegKey::GetStdKeyName(ui));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// notifications
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void RegTreeCtrl::OnRightClick(wxMouseEvent& event)
|
||||
{
|
||||
int iFlags;
|
||||
long lId = HitTest(wxPoint(event.GetX(), event.GetY()), iFlags);
|
||||
if ( iFlags & wxTREE_HITTEST_ONITEMLABEL ) {
|
||||
// popup menu only if an item was clicked
|
||||
wxASSERT( lId != 0 );
|
||||
SelectItem(lId);
|
||||
PopupMenu(m_pMenuPopup, event.GetX(), event.GetY());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RegTreeCtrl::OnDeleteItem(wxTreeEvent& event)
|
||||
{
|
||||
}
|
||||
|
||||
// test the key creation functions
|
||||
void RegTreeCtrl::OnMenuTest()
|
||||
{
|
||||
long lId = GetSelection();
|
||||
TreeNode *pNode = (TreeNode *)GetItemData(lId);
|
||||
|
||||
wxCHECK( pNode != NULL );
|
||||
|
||||
if ( pNode->IsRoot() ) {
|
||||
wxLogError("Can't create a subkey under the root key.");
|
||||
return;
|
||||
}
|
||||
if ( !pNode->IsKey() ) {
|
||||
wxLogError("Can't create a subkey under a value!");
|
||||
return;
|
||||
}
|
||||
|
||||
wxRegKey key1(pNode->Key(), "key1");
|
||||
if ( key1.Create() ) {
|
||||
wxRegKey key2a(key1, "key2a"), key2b(key1, "key2b");
|
||||
if ( key2a.Create() && key2b.Create() ) {
|
||||
// put some values under the newly created keys
|
||||
key1.SetValue("first_term", "10");
|
||||
key1.SetValue("second_term", "7");
|
||||
key2a = "this is the unnamed value";
|
||||
key2b.SetValue("sum", 17);
|
||||
|
||||
// refresh tree
|
||||
pNode->Refresh();
|
||||
wxLogStatus("Test keys successfully added.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
wxLogError("Creation of test keys failed.");
|
||||
}
|
||||
|
||||
void RegTreeCtrl::OnChar(wxKeyEvent& event)
|
||||
{
|
||||
if ( event.KeyCode() == WXK_DELETE )
|
||||
DeleteSelected();
|
||||
else
|
||||
wxTreeCtrl::OnChar(event);
|
||||
}
|
||||
|
||||
void RegTreeCtrl::OnSelChanged(wxTreeEvent& event)
|
||||
{
|
||||
wxFrame *pFrame = (wxFrame *)(wxWindow::GetParent());
|
||||
pFrame->SetStatusText(GetNode(event)->FullName(), 1);
|
||||
}
|
||||
|
||||
void RegTreeCtrl::OnItemExpanding(wxTreeEvent& event)
|
||||
{
|
||||
TreeNode *pNode = GetNode(event);
|
||||
bool bExpanding = event.m_code == wxTREE_EXPAND_EXPAND;
|
||||
|
||||
// expansion might take some time
|
||||
wxSetCursor(*wxHOURGLASS_CURSOR);
|
||||
wxLogStatus("Working...");
|
||||
wxYield(); // to give the status line a chance to refresh itself
|
||||
|
||||
if ( pNode->IsKey() ) {
|
||||
if ( bExpanding ) {
|
||||
// expanding: add subkeys/values
|
||||
if ( !pNode->OnExpand() )
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// collapsing: clean up
|
||||
pNode->OnCollapse();
|
||||
}
|
||||
|
||||
// change icon for non root key
|
||||
if ( !pNode->IsRoot() ) {
|
||||
int idIcon = bExpanding ? RegImageList::OpenedKey
|
||||
: RegImageList::ClosedKey;
|
||||
SetItemImage(pNode->Id(), idIcon, idIcon);
|
||||
}
|
||||
}
|
||||
|
||||
wxLogStatus("Ok");
|
||||
wxSetCursor(*wxSTANDARD_CURSOR);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// TreeNode implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
bool RegTreeCtrl::TreeNode::OnExpand()
|
||||
{
|
||||
// remove dummy item
|
||||
if ( m_lDummy != 0 )
|
||||
m_pTree->DeleteItem(m_lDummy);
|
||||
|
||||
if ( IsRoot() ) {
|
||||
// we're the root key
|
||||
m_pTree->AddStdKeys();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Parent()->IsRoot() ) {
|
||||
// we're a standard key
|
||||
m_pKey = new wxRegKey(m_strName);
|
||||
}
|
||||
else {
|
||||
// we're a normal key
|
||||
m_pKey = new wxRegKey(*(Parent()->m_pKey), m_strName);
|
||||
}
|
||||
|
||||
if ( !m_pKey->Open() ) {
|
||||
m_lDummy = 0;
|
||||
wxLogError("The key '%s' can't be opened.", FullName());
|
||||
return false;
|
||||
}
|
||||
|
||||
// enumeration variables
|
||||
long l;
|
||||
wxString str;
|
||||
bool bCont;
|
||||
|
||||
// enumerate all subkeys
|
||||
bCont = m_pKey->GetFirstKey(str, l);
|
||||
while ( bCont ) {
|
||||
m_pTree->InsertNewTreeNode(this, str, RegImageList::ClosedKey);
|
||||
bCont = m_pKey->GetNextKey(str, l);
|
||||
}
|
||||
|
||||
// enumerate all values
|
||||
bCont = m_pKey->GetFirstValue(str, l);
|
||||
while ( bCont ) {
|
||||
wxString strItem;
|
||||
if (str.IsEmpty())
|
||||
strItem = "<default>";
|
||||
else
|
||||
strItem = str;
|
||||
strItem += " = ";
|
||||
|
||||
// determine the appropriate icon
|
||||
RegImageList::Icon icon;
|
||||
switch ( m_pKey->GetValueType(str) ) {
|
||||
case wxRegKey::Type_String:
|
||||
case wxRegKey::Type_Expand_String:
|
||||
case wxRegKey::Type_Multi_String:
|
||||
{
|
||||
wxString strValue;
|
||||
icon = RegImageList::TextValue;
|
||||
m_pKey->QueryValue(str, strValue);
|
||||
strItem += strValue;
|
||||
}
|
||||
break;
|
||||
|
||||
case wxRegKey::Type_None:
|
||||
// @@ handle the error...
|
||||
icon = RegImageList::BinaryValue;
|
||||
break;
|
||||
|
||||
case wxRegKey::Type_Dword:
|
||||
{
|
||||
char szBuf[128];
|
||||
long l;
|
||||
m_pKey->QueryValue(str, &l);
|
||||
sprintf(szBuf, "%lx", l);
|
||||
strItem += szBuf;
|
||||
}
|
||||
|
||||
// fall through
|
||||
|
||||
default:
|
||||
icon = RegImageList::BinaryValue;
|
||||
}
|
||||
|
||||
m_pTree->InsertNewTreeNode(this, str, icon, &strItem);
|
||||
bCont = m_pKey->GetNextValue(str, l);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RegTreeCtrl::TreeNode::OnCollapse()
|
||||
{
|
||||
bool bHasChildren = !m_aChildren.IsEmpty();
|
||||
DestroyChildren();
|
||||
if ( bHasChildren )
|
||||
AddDummy();
|
||||
else
|
||||
m_lDummy = 0;
|
||||
|
||||
delete m_pKey;
|
||||
m_pKey = NULL;
|
||||
}
|
||||
|
||||
void RegTreeCtrl::TreeNode::AddDummy()
|
||||
{
|
||||
// insert dummy item forcing appearance of [+] button
|
||||
m_lDummy = m_pTree->InsertItem(Id(), "");
|
||||
}
|
||||
|
||||
void RegTreeCtrl::TreeNode::DestroyChildren()
|
||||
{
|
||||
// destroy all children
|
||||
uint nCount = m_aChildren.Count();
|
||||
for ( uint n = 0; n < nCount; n++ ) {
|
||||
long lId = m_aChildren[n]->Id();
|
||||
delete m_aChildren[n];
|
||||
m_pTree->DeleteItem(lId);
|
||||
}
|
||||
|
||||
m_aChildren.Empty();
|
||||
}
|
||||
|
||||
RegTreeCtrl::TreeNode::~TreeNode()
|
||||
{
|
||||
DestroyChildren();
|
||||
|
||||
delete m_pKey;
|
||||
}
|
||||
|
||||
const char *RegTreeCtrl::TreeNode::FullName() const
|
||||
{
|
||||
static wxString s_strName;
|
||||
|
||||
if ( IsRoot() ) {
|
||||
return "Registry Root";
|
||||
}
|
||||
else {
|
||||
// our own registry key might not (yet) exist or we might be a value,
|
||||
// so just use the parent's and concatenate
|
||||
s_strName = Parent()->FullName();
|
||||
s_strName << '\\' << m_strName;
|
||||
|
||||
return s_strName;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations on RegTreeCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void RegTreeCtrl::DeleteSelected()
|
||||
{
|
||||
long lCurrent = GetSelection(),
|
||||
lParent = GetParent(lCurrent);
|
||||
|
||||
if ( lParent == 0 ) {
|
||||
wxLogError("Can't delete root key.");
|
||||
return;
|
||||
}
|
||||
|
||||
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent),
|
||||
*pParent = (TreeNode *)GetItemData(lParent);
|
||||
|
||||
wxCHECK ( pCurrent && pParent );
|
||||
|
||||
if ( pParent->IsRoot() ) {
|
||||
wxLogError("Can't delete standard key.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( pCurrent->IsKey() ) {
|
||||
if ( wxMessageBox("Do you really want to delete this key?",
|
||||
"Confirmation",
|
||||
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// must close key before deleting it
|
||||
pCurrent->OnCollapse();
|
||||
|
||||
if ( pParent->Key().DeleteKey(pCurrent->m_strName) )
|
||||
pParent->Refresh();
|
||||
}
|
||||
else {
|
||||
if ( wxMessageBox("Do you really want to delete this value?",
|
||||
"Confirmation",
|
||||
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( pParent->Key().DeleteValue(pCurrent->m_strName) )
|
||||
pParent->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void RegTreeCtrl::CreateNewKey(const wxString& strName)
|
||||
{
|
||||
long lCurrent = GetSelection();
|
||||
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
|
||||
|
||||
wxCHECK( pCurrent != NULL );
|
||||
|
||||
wxASSERT( pCurrent->IsKey() ); // check must have been done before
|
||||
|
||||
if ( pCurrent->IsRoot() ) {
|
||||
wxLogError("Can't create a new key under the root key.");
|
||||
return;
|
||||
}
|
||||
|
||||
wxRegKey key(pCurrent->Key(), strName);
|
||||
if ( key.Create() )
|
||||
pCurrent->Refresh();
|
||||
}
|
||||
|
||||
void RegTreeCtrl::CreateNewTextValue(const wxString& strName)
|
||||
{
|
||||
long lCurrent = GetSelection();
|
||||
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
|
||||
|
||||
wxCHECK( pCurrent != NULL );
|
||||
|
||||
wxASSERT( pCurrent->IsKey() ); // check must have been done before
|
||||
|
||||
if ( pCurrent->IsRoot() ) {
|
||||
wxLogError("Can't create a new value under the root key.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( pCurrent->Key().SetValue(strName, "") )
|
||||
pCurrent->Refresh();
|
||||
}
|
||||
|
||||
void RegTreeCtrl::CreateNewBinaryValue(const wxString& strName)
|
||||
{
|
||||
long lCurrent = GetSelection();
|
||||
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
|
||||
|
||||
wxCHECK( pCurrent != NULL );
|
||||
|
||||
wxASSERT( pCurrent->IsKey() ); // check must have been done before
|
||||
|
||||
if ( pCurrent->IsRoot() ) {
|
||||
wxLogError("Can't create a new value under the root key.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( pCurrent->Key().SetValue(strName, 0) )
|
||||
pCurrent->Refresh();
|
||||
}
|
||||
|
||||
bool RegTreeCtrl::IsKeySelected() const
|
||||
{
|
||||
long lCurrent = GetSelection();
|
||||
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
|
||||
|
||||
wxCHECK_RET( pCurrent != NULL, false );
|
||||
|
||||
return pCurrent->IsKey();
|
||||
}
|
9
samples/regtest/regtest.rc
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "wx/msw/wx.rc"
|
||||
|
||||
app_icon ICON "registry.ico"
|
||||
icon_key1 ICON "key1.ico"
|
||||
icon_key2 ICON "key2.ico"
|
||||
icon_key3 ICON "key3.ico"
|
||||
icon_value1 ICON "value1.ico"
|
||||
icon_value2 ICON "value2.ico"
|
||||
|
BIN
samples/regtest/value1.ico
Normal file
After Width: | Height: | Size: 318 B |
BIN
samples/regtest/value2.ico
Normal file
After Width: | Height: | Size: 318 B |
64
samples/taskbar/makefile.b32
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.bcc
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds tab example
|
||||
|
||||
# WXWIN and BCCDIR are set by parent make
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makeb32.env
|
||||
|
||||
WXLIBDIR = $(WXDIR)\lib
|
||||
WXINC = $(WXDIR)\include\msw
|
||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||
|
||||
TARGET=tbtest
|
||||
|
||||
!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 = tbtest.obj
|
||||
|
||||
$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
|
||||
tlink32 $(LINKFLAGS) @&&!
|
||||
c0w32.obj $(OBJECTS)
|
||||
$(TARGET)
|
||||
nul
|
||||
$(LIBS)
|
||||
$(TARGET).def
|
||||
!
|
||||
brc32 -K $(TARGET).res
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc32 $(CPPFLAGS) -c {$< }
|
||||
|
||||
.c.obj:
|
||||
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||
|
||||
tbtest.obj: tbtest.$(SRCSUFF)
|
||||
|
||||
$(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
|
||||
|
73
samples/taskbar/makefile.bcc
Normal file
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# File: makefile.bcc
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds tbtest example (DOS).
|
||||
|
||||
!if "$(BCCDIR)" == ""
|
||||
!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
|
||||
!endif
|
||||
|
||||
!if "$(WXWIN)" == ""
|
||||
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
|
||||
!endif
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makebcc.env
|
||||
|
||||
THISDIR = $(WXDIR)\samples\taskbar
|
||||
WXLIB = $(WXDIR)\lib\wx.lib
|
||||
LIBS=$(WXLIB) mathwl cwl import
|
||||
INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
|
||||
CFG=$(WXDIR)\src\wxwin.cfg
|
||||
|
||||
!ifndef FINAL
|
||||
FINAL=0
|
||||
!endif
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||
OPT = -Od
|
||||
DEBUG_FLAGS= -v
|
||||
!else
|
||||
LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||
OPT = -O2
|
||||
DEBUG_FLAGS=
|
||||
!endif
|
||||
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||
|
||||
OBJECTS = tbtest.obj
|
||||
|
||||
tbtest: tbtest.exe
|
||||
|
||||
all: tbtest.exe
|
||||
|
||||
tbtest.exe: $(WXLIB) tbtest.obj tbtest.def tbtest.res
|
||||
tlink $(LINKFLAGS) @&&!
|
||||
c0wl.obj tbtest.obj
|
||||
tbtest
|
||||
nul
|
||||
$(LIBS)
|
||||
tbtest.def
|
||||
!
|
||||
rc -31 -K tbtest.res
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc $(CPPFLAGS) -c {$< }
|
||||
|
||||
tbtest.obj: tbtest.$(SRCSUFF)
|
||||
|
||||
tbtest.res : tbtest.rc $(WXDIR)\include\msw\wx.rc
|
||||
rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa tbtest
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.rws
|
65
samples/taskbar/makefile.dos
Normal file
@@ -0,0 +1,65 @@
|
||||
#
|
||||
# File: makefile.dos
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds taskbar example (DOS).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
!include $(WXDIR)\src\makemsc.env
|
||||
|
||||
THISDIR = $(WXDIR)\samples\taskbar
|
||||
|
||||
!ifndef FINAL
|
||||
FINAL=0
|
||||
!endif
|
||||
|
||||
HEADERS =
|
||||
SOURCES = tbtest.$(SRCSUFF)
|
||||
OBJECTS = tbtest.obj
|
||||
|
||||
all: tbtest.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)
|
||||
|
||||
tbtest.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) tbtest.obj tbtest.def tbtest.res
|
||||
link $(LINKFLAGS) @<<
|
||||
tbtest.obj $(WXDIR)\src\msw\dummy.obj,
|
||||
tbtest,
|
||||
NUL,
|
||||
$(LIBS),
|
||||
tbtest.def
|
||||
;
|
||||
<<
|
||||
rc -K tbtest.res
|
||||
|
||||
tbtest.obj: tbtest.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
tbtest.res : tbtest.rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
rc -r /i$(WXDIR)\include tbtest
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
37
samples/taskbar/makefile.g95
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for taskbar example
|
||||
|
||||
WXDIR = ../..
|
||||
|
||||
# All common UNIX compiler flags and options are now in
|
||||
# this central makefile.
|
||||
include $(WXDIR)/src/makeg95.env
|
||||
|
||||
OBJECTS = $(OBJDIR)/tbtest.$(OBJSUFF) $(OBJDIR)/tbtest_resources.$(OBJSUFF)
|
||||
|
||||
all: $(OBJDIR) tbtest$(GUISUFFIX)$(EXESUFF)
|
||||
|
||||
wx:
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
tbtest$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
|
||||
$(CC) $(LDFLAGS) -o tbtest$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/tbtest.$(OBJSUFF): tbtest.$(SRCSUFF)
|
||||
$(CC) -c $(CPPFLAGS) -o $@ tbtest.$(SRCSUFF)
|
||||
|
||||
$(OBJDIR)/tbtest_resources.o: tbtest.rc
|
||||
$(RESCOMP) -i tbtest.rc -o $(OBJDIR)/tbtest_resources.o $(RESFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) tbtest$(GUISUFFIX).exe core *.rsc *.res
|
64
samples/taskbar/makefile.nt
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds tab example (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
WXUSINGDLL=0
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
THISDIR = $(WXDIR)\samples\taskbar
|
||||
PROGRAM=tbtest
|
||||
|
||||
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).$(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 *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
BIN
samples/taskbar/mondrian.ico
Normal file
After Width: | Height: | Size: 766 B |
120
samples/taskbar/tbtest.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tbtest.cpp
|
||||
// Purpose: wxTaskBarIcon demo
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/msw/taskbar.h"
|
||||
#include "tbtest.h"
|
||||
|
||||
// Declare two frames
|
||||
MyDialog *dialog = NULL;
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
bool MyApp::OnInit(void)
|
||||
{
|
||||
wxIcon icon("mondrian_icon");
|
||||
|
||||
if (!m_taskBarIcon.SetIcon(icon, "wxTaskBarIcon Sample"))
|
||||
wxMessageBox("Could not set icon.");
|
||||
|
||||
// Create the main frame window
|
||||
dialog = new MyDialog(NULL, -1, "wxTaskBarIcon Test Dialog", wxPoint(-1, -1), wxSize(365, 290), wxDIALOG_MODELESS|wxDEFAULT_DIALOG_STYLE);
|
||||
|
||||
dialog->Show(TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
||||
EVT_BUTTON(wxID_OK, MyDialog::OnOK)
|
||||
EVT_BUTTON(wxID_EXIT, MyDialog::OnExit)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyDialog::MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, const long windowStyle):
|
||||
wxDialog(parent, id, title, pos, size, windowStyle)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
void MyDialog::OnOK(wxCommandEvent& event)
|
||||
{
|
||||
Show(FALSE);
|
||||
}
|
||||
|
||||
void MyDialog::OnExit(wxCommandEvent& event)
|
||||
{
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyDialog::OnCloseWindow(wxCloseEvent& event)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void MyDialog::Init(void)
|
||||
{
|
||||
int dialogWidth = 365;
|
||||
int dialogHeight = 290;
|
||||
|
||||
wxStaticText* stat = new wxStaticText(this, -1, "Press OK to hide me, Exit to quit.",
|
||||
wxPoint(10, 20));
|
||||
|
||||
wxStaticText* stat2 = new wxStaticText(this, -1, "Double-click on the taskbar icon to show me again.",
|
||||
wxPoint(10, 40));
|
||||
|
||||
wxButton *okButton = new wxButton(this, wxID_OK, "OK", wxPoint(100, 230), wxSize(80, 25));
|
||||
wxButton *exitButton = new wxButton(this, wxID_EXIT, "Exit", wxPoint(185, 230), wxSize(80, 25));
|
||||
okButton->SetDefault();
|
||||
this->Centre(wxBOTH);
|
||||
}
|
||||
|
||||
// Overridables
|
||||
void MyTaskBarIcon::OnMouseMove(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MyTaskBarIcon::OnLButtonDown(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MyTaskBarIcon::OnLButtonUp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MyTaskBarIcon::OnRButtonDown(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MyTaskBarIcon::OnRButtonUp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MyTaskBarIcon::OnLButtonDClick(void)
|
||||
{
|
||||
dialog->Show(TRUE);
|
||||
}
|
||||
|
||||
void MyTaskBarIcon::OnRButtonDClick(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
8
samples/taskbar/tbtest.def
Normal file
@@ -0,0 +1,8 @@
|
||||
NAME TBTest
|
||||
DESCRIPTION 'wxTaskBarIcon test'
|
||||
EXETYPE WINDOWS
|
||||
STUB 'WINSTUB.EXE'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
HEAPSIZE 1024
|
||||
STACKSIZE 16192
|
50
samples/taskbar/tbtest.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tbtest.h
|
||||
// Purpose: wxTaskBarIcon sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class MyTaskBarIcon: public wxTaskBarIcon
|
||||
{
|
||||
public:
|
||||
MyTaskBarIcon() {};
|
||||
|
||||
virtual void OnMouseMove(void);
|
||||
virtual void OnLButtonDown(void);
|
||||
virtual void OnLButtonUp(void);
|
||||
virtual void OnRButtonDown(void);
|
||||
virtual void OnRButtonUp(void);
|
||||
virtual void OnLButtonDClick(void);
|
||||
virtual void OnRButtonDClick(void);
|
||||
};
|
||||
|
||||
|
||||
// Define a new application
|
||||
class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit(void);
|
||||
protected:
|
||||
MyTaskBarIcon m_taskBarIcon;
|
||||
};
|
||||
|
||||
class MyDialog: public wxDialog
|
||||
{
|
||||
public:
|
||||
MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, const long windowStyle = wxDEFAULT_DIALOG_STYLE);
|
||||
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void Init(void);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
3
samples/taskbar/tbtest.rc
Normal file
@@ -0,0 +1,3 @@
|
||||
mondrian_icon ICON "mondrian.ico"
|
||||
#include "wx/msw/wx.rc"
|
||||
|