now MSW stuff is complete

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1998-05-20 14:21:00 +00:00
parent 2bda0e1738
commit bbf1f0e5cf
118 changed files with 9265 additions and 0 deletions

BIN
samples/ownerdrw/bell.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

View 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

View 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

View 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

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

View 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);
}

View 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

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B