]> git.saurik.com Git - wxWidgets.git/commitdiff
renamed grid sample
authorRon Lee <ron@debian.org>
Tue, 14 Mar 2000 19:09:12 +0000 (19:09 +0000)
committerRon Lee <ron@debian.org>
Tue, 14 Mar 2000 19:09:12 +0000 (19:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6710 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

17 files changed:
samples/grid/Makefile.in
samples/grid/grid.cpp [new file with mode: 0644]
samples/grid/grid.def [new file with mode: 0644]
samples/grid/grid.rc [new file with mode: 0644]
samples/grid/makefile.b32
samples/grid/makefile.bcc
samples/grid/makefile.dos
samples/grid/makefile.g95
samples/grid/makefile.sc [new file with mode: 0644]
samples/grid/makefile.sl [new file with mode: 0644]
samples/grid/makefile.twn [new file with mode: 0644]
samples/grid/makefile.unx
samples/grid/makefile.vc
samples/grid/makefile.wat
samples/grid/test.cpp [deleted file]
samples/grid/test.def [deleted file]
samples/grid/test.rc [deleted file]

index 5fb458727a9f625aaf4f4f8814fce76fc53e086f..756d62e45406777b0ab6c67e7a3ff75b5d4dc2aa 100644 (file)
@@ -1,13 +1,5 @@
-#
-# File:                makefile.unx
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-# Copyright:   (c) 1998 Julian Smart
-#
-# "%W% %G%"
-#
-# Makefile for toolbar example (UNIX).
+# Purpose: makefile for grid example (UNIX).
+# Created: 2000-03-15
 
 top_srcdir = @top_srcdir@/..
 top_builddir = ../..
@@ -15,9 +7,7 @@ program_dir = samples/grid
 
 PROGRAM=grid
 
-OBJECTS=test.o
-
+OBJECTS=$(PROGRAM).o
 
 include ../../src/makeprog.env
 
-
diff --git a/samples/grid/grid.cpp b/samples/grid/grid.cpp
new file mode 100644 (file)
index 0000000..ed7ad80
--- /dev/null
@@ -0,0 +1,324 @@
+/*
+ * File:       grid.cpp
+ * Purpose:    wxGrid test
+ * Author:     Julian Smart
+ * Created:    1995
+ * Updated:    
+ * Copyright:   (c) 1995, AIAI, University of Edinburgh
+ */
+
+static const char sccsid[] = "%W% %G%";
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#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/grid.h"
+#include "wx/colordlg.h"
+
+// Define a new application type
+class MyApp: public wxApp
+{ public:
+    bool OnInit(void);
+};
+
+
+// Define a new frame type
+class MyFrame: public wxFrame
+{ public:
+    wxGrid *grid;
+    MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
+
+    void ToggleEditable(wxCommandEvent& event);
+    void ToggleEditInPlace(wxCommandEvent& event);
+    void ToggleRowLabel(wxCommandEvent& event);
+    void ToggleColLabel(wxCommandEvent& event);
+    void ToggleDividers(wxCommandEvent& event);
+    void LeftCell(wxCommandEvent& event);
+    void CentreCell(wxCommandEvent& event);
+    void RightCell(wxCommandEvent& event);
+    void ColourLabelBackground(wxCommandEvent& event);
+    void ColourLabelText(wxCommandEvent& event);
+    void NormalLabelColouring(wxCommandEvent& event);
+    void ColourCellBackground(wxCommandEvent& event);
+    void ColourCellText(wxCommandEvent& event);
+    void NormalCellColouring(wxCommandEvent& event);
+    void Quit(wxCommandEvent& event);
+
+    void OnActivate(wxActivateEvent& event);
+
+DECLARE_EVENT_TABLE()
+};
+
+wxBitmap *cellBitmap1 = (wxBitmap *) NULL;
+wxBitmap *cellBitmap2 = (wxBitmap *) NULL;
+
+// ID for the menu quit command
+#define GRID_QUIT 1
+#define GRID_TOGGLE_EDITABLE 2
+#define GRID_TOGGLE_EDITINPLACE 22
+#define GRID_LEFT_CELL       3
+#define GRID_CENTRE_CELL     4
+#define GRID_RIGHT_CELL      5
+#define GRID_TOGGLE_ROW_LABEL 6
+#define GRID_TOGGLE_COL_LABEL 7
+#define GRID_COLOUR_LABEL_BACKGROUND 8
+#define GRID_COLOUR_LABEL_TEXT       9
+#define GRID_NORMAL_LABEL_COLOURING  10
+#define GRID_COLOUR_CELL_BACKGROUND 11
+#define GRID_COLOUR_CELL_TEXT       12
+#define GRID_NORMAL_CELL_COLOURING  13
+#define GRID_TOGGLE_DIVIDERS        14
+
+// Main proc
+
+IMPLEMENT_APP(MyApp)
+
+// `Main program' equivalent, creating windows and returning main app frame
+bool MyApp::OnInit(void)
+{
+#ifdef __WXMSW__
+  cellBitmap1 = new wxBitmap("bitmap1");
+  cellBitmap2 = new wxBitmap("bitmap2");
+#endif
+
+  // Create the main frame window
+  MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "wxGrid Sample", wxPoint(50, 50), wxSize(450, 300));
+  
+  // Give it an icon
+#ifdef __WXMSW__
+  frame->SetIcon(wxIcon("mondrian"));
+#endif
+
+  // Make a menubar
+  wxMenu *file_menu = new wxMenu;
+  file_menu->Append(GRID_QUIT, "E&xit");
+
+  wxMenu *settings_menu = new wxMenu;
+  settings_menu->Append(GRID_TOGGLE_EDITABLE, "&Toggle editable");
+  settings_menu->Append(GRID_TOGGLE_EDITINPLACE, "&Toggle edit in place");
+  settings_menu->Append(GRID_TOGGLE_ROW_LABEL, "Toggle ro&w label");
+  settings_menu->Append(GRID_TOGGLE_COL_LABEL, "Toggle co&l label");
+  settings_menu->Append(GRID_TOGGLE_DIVIDERS, "Toggle &dividers");
+  settings_menu->AppendSeparator();
+  settings_menu->Append(GRID_LEFT_CELL, "&Left cell alignment ");
+  settings_menu->Append(GRID_CENTRE_CELL, "&Centre cell alignment ");
+  settings_menu->Append(GRID_RIGHT_CELL, "&Right cell alignment ");
+  settings_menu->AppendSeparator();
+  settings_menu->Append(GRID_COLOUR_LABEL_BACKGROUND, "Choose a label &background colour");
+  settings_menu->Append(GRID_COLOUR_LABEL_TEXT, "Choose a label fore&ground colour");
+  settings_menu->Append(GRID_NORMAL_LABEL_COLOURING, "&Normal label colouring");
+  settings_menu->AppendSeparator();
+  settings_menu->Append(GRID_COLOUR_CELL_BACKGROUND, "Choo&se a cell &background colour");
+  settings_menu->Append(GRID_COLOUR_CELL_TEXT, "Choose &a cell foreground colour");
+  settings_menu->Append(GRID_NORMAL_CELL_COLOURING, "N&ormal cell colouring");
+
+  wxMenuBar *menu_bar = new wxMenuBar;
+  menu_bar->Append(file_menu, "&File");
+  menu_bar->Append(settings_menu, "&Settings");
+  frame->SetMenuBar(menu_bar);
+
+  // Make a grid
+  frame->grid = new wxGrid(frame, 0, 0, 400, 400);
+
+  frame->grid->CreateGrid(10, 8);
+  frame->grid->SetColumnWidth(3, 200);
+  frame->grid->SetRowHeight(4, 45);
+  frame->grid->SetCellValue("First cell", 0, 0);
+  frame->grid->SetCellValue("Another cell", 1, 1);
+  frame->grid->SetCellValue("Yet another cell", 2, 2);
+  frame->grid->SetCellTextFont(* wxTheFontList->FindOrCreateFont(10, wxROMAN, wxITALIC, wxNORMAL), 0, 0);
+  frame->grid->SetCellTextColour(*wxRED, 1, 1);
+  frame->grid->SetCellBackgroundColour(*wxCYAN, 2, 2);
+  if (cellBitmap1 && cellBitmap2)
+  {
+    frame->grid->SetCellAlignment(wxCENTRE, 5, 0);
+    frame->grid->SetCellAlignment(wxCENTRE, 6, 0);
+    frame->grid->SetCellBitmap(cellBitmap1, 5, 0);
+    frame->grid->SetCellBitmap(cellBitmap2, 6, 0);
+  }
+  
+  frame->grid->UpdateDimensions();
+  
+  // Show the frame
+  frame->Show(TRUE);
+
+  SetTopWindow(frame);
+  return TRUE;
+}
+
+// My frame constructor
+MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
+  wxFrame(frame, -1, title, pos, size)
+{
+  grid = (wxGrid*) NULL;
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+  EVT_MENU(GRID_TOGGLE_EDITABLE, MyFrame::ToggleEditable)
+  EVT_MENU(GRID_TOGGLE_EDITINPLACE, MyFrame::ToggleEditInPlace)
+  EVT_MENU(GRID_TOGGLE_ROW_LABEL, MyFrame::ToggleRowLabel)
+  EVT_MENU(GRID_TOGGLE_COL_LABEL, MyFrame::ToggleColLabel)
+  EVT_MENU(GRID_TOGGLE_DIVIDERS, MyFrame::ToggleDividers)
+  EVT_MENU(GRID_LEFT_CELL, MyFrame::LeftCell)
+  EVT_MENU(GRID_CENTRE_CELL, MyFrame::CentreCell)
+  EVT_MENU(GRID_RIGHT_CELL, MyFrame::RightCell)
+  EVT_MENU(GRID_COLOUR_LABEL_BACKGROUND, MyFrame::ColourLabelBackground)
+  EVT_MENU(GRID_COLOUR_LABEL_TEXT, MyFrame::ColourLabelText)
+  EVT_MENU(GRID_NORMAL_LABEL_COLOURING, MyFrame::NormalLabelColouring)
+  EVT_MENU(GRID_COLOUR_CELL_BACKGROUND, MyFrame::ColourCellBackground)
+  EVT_MENU(GRID_COLOUR_CELL_TEXT, MyFrame::ColourCellText)
+  EVT_MENU(GRID_NORMAL_CELL_COLOURING, MyFrame::NormalCellColouring)
+  EVT_MENU(GRID_QUIT, MyFrame::Quit)
+END_EVENT_TABLE()
+
+void MyFrame::ToggleEditable(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SetEditable(!grid->GetEditable());
+      grid->Refresh();
+}
+
+void MyFrame::ToggleEditInPlace(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SetEditInPlace(!grid->GetEditInPlace());
+      grid->Refresh();
+}
+
+void MyFrame::ToggleRowLabel(wxCommandEvent& WXUNUSED(event))
+{
+      if (grid->GetLabelSize(wxVERTICAL) > 0)
+        grid->SetLabelSize(wxVERTICAL, 0);
+      else
+        grid->SetLabelSize(wxVERTICAL, 40);
+      grid->Refresh();
+}
+
+void MyFrame::ToggleColLabel(wxCommandEvent& WXUNUSED(event))
+{
+      if (grid->GetLabelSize(wxHORIZONTAL) > 0)
+        grid->SetLabelSize(wxHORIZONTAL, 0);
+      else
+        grid->SetLabelSize(wxHORIZONTAL, 20);
+      grid->Refresh();
+}
+
+void MyFrame::ToggleDividers(wxCommandEvent& WXUNUSED(event))
+{
+      if (!grid->GetDividerPen().Ok())
+        grid->SetDividerPen(* wxThePenList->FindOrCreatePen("LIGHT GREY", 1, wxSOLID));
+      else
+        grid->SetDividerPen(wxNullPen);
+      grid->Refresh();
+}
+
+void MyFrame::LeftCell(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SetCellAlignment(wxLEFT);
+      grid->Refresh();
+}
+
+void MyFrame::CentreCell(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SetCellAlignment(wxCENTRE);
+      grid->Refresh();
+}
+
+void MyFrame::RightCell(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SetCellAlignment(wxRIGHT);
+      grid->Refresh();
+}
+
+void MyFrame::ColourLabelBackground(wxCommandEvent& WXUNUSED(event))
+{
+      wxColourData data;
+      data.SetChooseFull(TRUE);
+      wxColourDialog dialog(this, &data);
+      if (dialog.ShowModal() != wxID_CANCEL)
+      {
+        wxColourData retData = dialog.GetColourData();
+        wxColour col = retData.GetColour();
+        grid->SetLabelBackgroundColour(col);
+        grid->Refresh();
+      }
+}
+
+void MyFrame::ColourLabelText(wxCommandEvent& WXUNUSED(event))
+{
+      wxColourData data;
+      data.SetChooseFull(TRUE);
+      wxColourDialog dialog(this, &data);
+      if (dialog.ShowModal() != wxID_CANCEL)
+      {
+        wxColourData retData = dialog.GetColourData();
+        wxColour col = retData.GetColour();
+        grid->SetLabelTextColour(col);
+        grid->Refresh();
+      }
+}
+
+void MyFrame::NormalLabelColouring(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SetLabelBackgroundColour(*wxLIGHT_GREY);
+      grid->SetLabelTextColour(*wxBLACK);
+      grid->Refresh();
+}
+
+void MyFrame::ColourCellBackground(wxCommandEvent& WXUNUSED(event))
+{
+      wxColourData data;
+      data.SetChooseFull(TRUE);
+      wxColourDialog dialog(this, &data);
+      if (dialog.ShowModal() != wxID_CANCEL)
+      {
+        wxColourData retData = dialog.GetColourData();
+        wxColour col = retData.GetColour();
+        grid->SetCellBackgroundColour(col);
+        grid->Refresh();
+      }
+}
+
+void MyFrame::ColourCellText(wxCommandEvent& WXUNUSED(event))
+{
+      wxColourData data;
+      data.SetChooseFull(TRUE);
+      wxColourDialog dialog(this, &data);
+      if (dialog.ShowModal() != wxID_CANCEL)
+      {
+        wxColourData retData = dialog.GetColourData();
+        wxColour col = retData.GetColour();
+        grid->SetCellTextColour(col);
+        grid->Refresh();
+      }
+}
+
+void MyFrame::NormalCellColouring(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SetCellBackgroundColour(*wxWHITE);
+      grid->SetCellTextColour(*wxBLACK);
+      grid->Refresh();
+}
+
+void MyFrame::Quit(wxCommandEvent& WXUNUSED(event))
+{
+      this->Close(TRUE);
+}
+
+// Ensure that the grid's edit control always has the focus.
+void MyFrame::OnActivate(wxActivateEvent& event)
+{
+  if (grid) grid->OnActivate(event.GetActive());
+}
+
diff --git a/samples/grid/grid.def b/samples/grid/grid.def
new file mode 100644 (file)
index 0000000..3ff4e2c
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         Grid
+DESCRIPTION  'wxTableWindow Test'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     1024
+STACKSIZE    16192
diff --git a/samples/grid/grid.rc b/samples/grid/grid.rc
new file mode 100644 (file)
index 0000000..571ada1
--- /dev/null
@@ -0,0 +1,5 @@
+#include "wx/msw/wx.rc"
+
+bitmap1 BITMAP "bitmap1.bmp"
+bitmap2 BITMAP "bitmap2.bmp"
+
index 95ddc80d76f728d37352e263489f8c331912bab8..05eecd79595d1799402d79f6832176f3b5206f0f 100644 (file)
@@ -1,15 +1,9 @@
-#
-# File:                makefile.b32
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:
-#
-# Makefile : Builds sample for 32-bit BC++
+# Purpose: makefile for grid example (BC++ 32bit)
+# Created: 2000-03-15
 
 WXDIR = $(WXWIN)
 
-TARGET=test
+TARGET=grid
 OBJECTS = $(TARGET).obj
 
 !include $(WXDIR)\src\makeprog.b32
index 669f01905aefc544ba0a51607dfa612d1f849b50..37c91fe0af2124ec7dec015a1adb8885f6801609 100644 (file)
@@ -1,10 +1,5 @@
-#
-# File:                makefile.bcc
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Builds a BC++ 16-bit sample
+# Purpose: makefile for grid example (BC++ 16bit)
+# Created: 2000-03-15
 
 !if "$(WXWIN)" == ""
 !error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
@@ -12,7 +7,7 @@
 
 WXDIR = $(WXWIN)
 
-TARGET=test
+TARGET=grid
 OBJECTS=$(TARGET).obj
 
 !include $(WXDIR)\src\makeprog.bcc
index 13e3a4ce8eeef60898c11fc6c1f1a9e8f12374bd..6ebe4f8a5efe7fd11985b88339939ce5cf1f3452 100644 (file)
@@ -1,17 +1,10 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
+# Purpose: makefile for grid example (VC++ 1.5x)
+# Created: 2000-03-15
 
 WXDIR = $(WXWIN)
 
-TARGET=test
-OBJECTS = $(TARGET).obj
+TARGET=grid
+OBJECTS=$(TARGET).obj
 
 !include $(WXDIR)\src\makeprog.msc
 
index b4a920f047f4d2d08d871efbbb5cc0cf207b6327..ae8121341fcf6e89e281d0786b4a3c92e2ea83fa 100644 (file)
@@ -1,16 +1,10 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
+# Purpose: makefile for grid example (Cygwin/Mingw32)
+# Created: #03.01.00
 
 WXDIR = ../..
 
-TARGET=test
+TARGET=grid
 OBJECTS = $(TARGET).o
 
-include $(WXDIR)/src/makeprog.g95
+include $(WXDIR)\src\makeprog.g95
 
diff --git a/samples/grid/makefile.sc b/samples/grid/makefile.sc
new file mode 100644 (file)
index 0000000..200240c
--- /dev/null
@@ -0,0 +1,37 @@
+# Purpose: makefile for grid example (Symantec C++)
+# Created: 2000-03-15
+
+WXDIR = $(WXWIN)
+WXLIB = $(WXDIR)\lib\wx.lib
+INCDIR = $(WXDIR)\include
+INCLUDE=$(INCDIR)
+TARGET=grid
+
+include $(WXDIR)\src\makesc.env
+
+grid.exe: grid.obj $(DEFFILE) grid.res
+       *$(CC) $(LDFLAGS) -o$@ $** $(LIBS)
+    *$(RC) -k grid.res
+
+sc32.def:
+     echo EXETYPE NT > sc32.def
+     echo SUBSYSTEM WINDOWS >> sc32.def
+
+sc16.def:
+     echo NAME $(TARGET) > sc16.def
+     echo EXETYPE WINDOWS >> sc16.def
+     echo STUB         'WINSTUB.EXE' >> sc16.def
+     echo CODE         PRELOAD MOVEABLE DISCARDABLE >> sc16.def
+     echo DATA         PRELOAD MOVEABLE MULTIPLE >> sc16.def
+     echo HEAPSIZE     1024 >> sc16.def
+     echo STACKSIZE    8192 >> sc16.def
+
+clean:
+    -del *.obj
+       -del *.exe
+       -del *.res
+       -del *.map
+       -del *.rws
+    -del sc32.def
+    -del sc16.def
+
diff --git a/samples/grid/makefile.sl b/samples/grid/makefile.sl
new file mode 100644 (file)
index 0000000..d525163
--- /dev/null
@@ -0,0 +1,14 @@
+# Purpose: makefile for grid example (Salford C++)
+# Created: 2000-03-15
+
+PROGRAM = grid
+OBJECTS = $(PROGRAM).obj
+
+include ..\..\src\makeprog.sl
+
+all:        wx $(TARGET)
+
+wx:
+    cd $(WXDIR)\src\msw ^ mk32 -f makefile.sl all
+    cd $(WXDIR)\samples\grid
+
diff --git a/samples/grid/makefile.twn b/samples/grid/makefile.twn
new file mode 100644 (file)
index 0000000..6ceef03
--- /dev/null
@@ -0,0 +1,35 @@
+# Purpose: makefile for grid example (TWIN)
+# Created: 2000-03-15
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/maketwin.env
+
+OBJECTS = $(OBJDIR)/grid.$(OBJSUFF) $(OBJDIR)/grid.$(OBJSUFF)
+
+all:    $(OBJDIR) grid$(GUISUFFIX)$(EXESUFF)
+
+wx:
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+grid$(GUISUFFIX)$(EXESUFF):    $(OBJECTS) $(WXLIB)
+       $(CC) $(LDFLAGS) -o grid$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
+
+$(OBJDIR)/grid.$(OBJSUFF):     grid.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ grid.$(SRCSUFF)
+
+grid.c:  grid.rc
+       $(RESCOMP) $(RCINPUTSWITCH) grid.rc $(RCOUTPUTSWITCH) grid.c $(RESFLAGS)
+
+$(OBJDIR)/grid.$(OBJSUFF):     grid.c
+       $(CC) -c $(CPPFLAGS) -o $@ grid.c
+
+#$(OBJDIR)/grid.o:  grid.rc
+#      $(RESCOMP) $(RCINPUTSWITCH) grid.rc $(RCOUTPUTSWITCH) $(OBJDIR)/grid.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) grid$(GUISUFFIX).exe core *.rsc *.res
index 21cab3c677d139136e72901c8bdc808bb2a9b827..a80a6ec93e24c8fee339d7e8924f99b77ad8b357 100644 (file)
@@ -1,21 +1,9 @@
-#
-# File:                Makefile for samples
-# Author:      Robert Roebling
-# Created:     1999
-# Updated:     
-# Copyright:   (c) 1998 Robert Roebling
-#
-# This makefile requires a Unix version of wxWindows
-# to be installed on your system. This is most often
-# done typing "make install" when using the complete
-# sources of wxWindows or by installing the two
-# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
-# under Linux.
-#
+# Purpose: makefile for grid example (Unix)
+# Created: 2000-03-15
 
 CC = gcc
 
-PROGRAM = test
+PROGRAM = grid
 
 OBJECTS = $(PROGRAM).o
 
@@ -31,5 +19,5 @@ all:    $(PROGRAM)
 $(PROGRAM):    $(OBJECTS)
        $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
 
-clean: 
+clean:
        rm -f *.o $(PROGRAM)
index 4ada748edad53c6917114d10b0dcd373f6ba8648..3c88d2b8592510f353a74491cc1de99e8d27c472 100644 (file)
@@ -1,17 +1,10 @@
-#
-# File:                makefile.vc
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:   (c) Julian Smart
-#
-# Makefile : Builds sample (VC++, WIN32)
-# Use FINAL=1 argument to nmake to build final version with no debug info.
+# Purpose: makefile for grid example (VC++ 32bit)
+# Created: 2000-03-15
 
 # Set WXDIR for your system
 WXDIR = $(WXWIN)
 
-PROGRAM=test
+PROGRAM=grid
 OBJECTS = $(PROGRAM).obj
 
 !include $(WXDIR)\src\makeprog.vc
index 81a83e42a9fbbe144c5dfef0f52fae312124c84f..9d71a42089c22ce6f11517e70d88447347e6ddd9 100644 (file)
@@ -1,13 +1,9 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
+# Purpose: makefile for grid example (Watcom)
+# Created: 2000-03-15
 
 WXDIR = $(%WXWIN)
 
-PROGRAM = test
+PROGRAM = grid
 OBJECTS = $(PROGRAM).obj
 
 !include $(WXDIR)\src\makeprog.wat
diff --git a/samples/grid/test.cpp b/samples/grid/test.cpp
deleted file mode 100644 (file)
index 743ba4f..0000000
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * File:       test.cpp
- * Purpose:    wxGrid test
- * Author:     Julian Smart
- * Created:    1995
- * Updated:    
- * Copyright:   (c) 1995, AIAI, University of Edinburgh
- */
-
-static const char sccsid[] = "%W% %G%";
-
-#ifdef __GNUG__
-#pragma implementation
-#pragma interface
-#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/grid.h"
-#include "wx/colordlg.h"
-
-// Define a new application type
-class MyApp: public wxApp
-{ public:
-    bool OnInit(void);
-};
-
-
-// Define a new frame type
-class MyFrame: public wxFrame
-{ public:
-    wxGrid *grid;
-    MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
-
-    void ToggleEditable(wxCommandEvent& event);
-    void ToggleEditInPlace(wxCommandEvent& event);
-    void ToggleRowLabel(wxCommandEvent& event);
-    void ToggleColLabel(wxCommandEvent& event);
-    void ToggleDividers(wxCommandEvent& event);
-    void LeftCell(wxCommandEvent& event);
-    void CentreCell(wxCommandEvent& event);
-    void RightCell(wxCommandEvent& event);
-    void ColourLabelBackground(wxCommandEvent& event);
-    void ColourLabelText(wxCommandEvent& event);
-    void NormalLabelColouring(wxCommandEvent& event);
-    void ColourCellBackground(wxCommandEvent& event);
-    void ColourCellText(wxCommandEvent& event);
-    void NormalCellColouring(wxCommandEvent& event);
-    void Quit(wxCommandEvent& event);
-
-    void OnActivate(wxActivateEvent& event);
-
-DECLARE_EVENT_TABLE()
-};
-
-wxBitmap *cellBitmap1 = (wxBitmap *) NULL;
-wxBitmap *cellBitmap2 = (wxBitmap *) NULL;
-
-// ID for the menu quit command
-#define GRID_QUIT 1
-#define GRID_TOGGLE_EDITABLE 2
-#define GRID_TOGGLE_EDITINPLACE 22
-#define GRID_LEFT_CELL       3
-#define GRID_CENTRE_CELL     4
-#define GRID_RIGHT_CELL      5
-#define GRID_TOGGLE_ROW_LABEL 6
-#define GRID_TOGGLE_COL_LABEL 7
-#define GRID_COLOUR_LABEL_BACKGROUND 8
-#define GRID_COLOUR_LABEL_TEXT       9
-#define GRID_NORMAL_LABEL_COLOURING  10
-#define GRID_COLOUR_CELL_BACKGROUND 11
-#define GRID_COLOUR_CELL_TEXT       12
-#define GRID_NORMAL_CELL_COLOURING  13
-#define GRID_TOGGLE_DIVIDERS        14
-
-// Main proc
-
-IMPLEMENT_APP(MyApp)
-
-// `Main program' equivalent, creating windows and returning main app frame
-bool MyApp::OnInit(void)
-{
-#ifdef __WXMSW__
-  cellBitmap1 = new wxBitmap("bitmap1");
-  cellBitmap2 = new wxBitmap("bitmap2");
-#endif
-
-  // Create the main frame window
-  MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "wxGrid Sample", wxPoint(50, 50), wxSize(450, 300));
-  
-  // Give it an icon
-#ifdef __WXMSW__
-  frame->SetIcon(wxIcon("mondrian"));
-#endif
-
-  // Make a menubar
-  wxMenu *file_menu = new wxMenu;
-  file_menu->Append(GRID_QUIT, "E&xit");
-
-  wxMenu *settings_menu = new wxMenu;
-  settings_menu->Append(GRID_TOGGLE_EDITABLE, "&Toggle editable");
-  settings_menu->Append(GRID_TOGGLE_EDITINPLACE, "&Toggle edit in place");
-  settings_menu->Append(GRID_TOGGLE_ROW_LABEL, "Toggle ro&w label");
-  settings_menu->Append(GRID_TOGGLE_COL_LABEL, "Toggle co&l label");
-  settings_menu->Append(GRID_TOGGLE_DIVIDERS, "Toggle &dividers");
-  settings_menu->AppendSeparator();
-  settings_menu->Append(GRID_LEFT_CELL, "&Left cell alignment ");
-  settings_menu->Append(GRID_CENTRE_CELL, "&Centre cell alignment ");
-  settings_menu->Append(GRID_RIGHT_CELL, "&Right cell alignment ");
-  settings_menu->AppendSeparator();
-  settings_menu->Append(GRID_COLOUR_LABEL_BACKGROUND, "Choose a label &background colour");
-  settings_menu->Append(GRID_COLOUR_LABEL_TEXT, "Choose a label fore&ground colour");
-  settings_menu->Append(GRID_NORMAL_LABEL_COLOURING, "&Normal label colouring");
-  settings_menu->AppendSeparator();
-  settings_menu->Append(GRID_COLOUR_CELL_BACKGROUND, "Choo&se a cell &background colour");
-  settings_menu->Append(GRID_COLOUR_CELL_TEXT, "Choose &a cell foreground colour");
-  settings_menu->Append(GRID_NORMAL_CELL_COLOURING, "N&ormal cell colouring");
-
-  wxMenuBar *menu_bar = new wxMenuBar;
-  menu_bar->Append(file_menu, "&File");
-  menu_bar->Append(settings_menu, "&Settings");
-  frame->SetMenuBar(menu_bar);
-
-  // Make a grid
-  frame->grid = new wxGrid(frame, 0, 0, 400, 400);
-
-  frame->grid->CreateGrid(10, 8);
-  frame->grid->SetColumnWidth(3, 200);
-  frame->grid->SetRowHeight(4, 45);
-  frame->grid->SetCellValue("First cell", 0, 0);
-  frame->grid->SetCellValue("Another cell", 1, 1);
-  frame->grid->SetCellValue("Yet another cell", 2, 2);
-  frame->grid->SetCellTextFont(* wxTheFontList->FindOrCreateFont(10, wxROMAN, wxITALIC, wxNORMAL), 0, 0);
-  frame->grid->SetCellTextColour(*wxRED, 1, 1);
-  frame->grid->SetCellBackgroundColour(*wxCYAN, 2, 2);
-  if (cellBitmap1 && cellBitmap2)
-  {
-    frame->grid->SetCellAlignment(wxCENTRE, 5, 0);
-    frame->grid->SetCellAlignment(wxCENTRE, 6, 0);
-    frame->grid->SetCellBitmap(cellBitmap1, 5, 0);
-    frame->grid->SetCellBitmap(cellBitmap2, 6, 0);
-  }
-  
-  frame->grid->UpdateDimensions();
-  
-  // Show the frame
-  frame->Show(TRUE);
-
-  SetTopWindow(frame);
-  return TRUE;
-}
-
-// My frame constructor
-MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
-  wxFrame(frame, -1, title, pos, size)
-{
-  grid = (wxGrid*) NULL;
-}
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-  EVT_MENU(GRID_TOGGLE_EDITABLE, MyFrame::ToggleEditable)
-  EVT_MENU(GRID_TOGGLE_EDITINPLACE, MyFrame::ToggleEditInPlace)
-  EVT_MENU(GRID_TOGGLE_ROW_LABEL, MyFrame::ToggleRowLabel)
-  EVT_MENU(GRID_TOGGLE_COL_LABEL, MyFrame::ToggleColLabel)
-  EVT_MENU(GRID_TOGGLE_DIVIDERS, MyFrame::ToggleDividers)
-  EVT_MENU(GRID_LEFT_CELL, MyFrame::LeftCell)
-  EVT_MENU(GRID_CENTRE_CELL, MyFrame::CentreCell)
-  EVT_MENU(GRID_RIGHT_CELL, MyFrame::RightCell)
-  EVT_MENU(GRID_COLOUR_LABEL_BACKGROUND, MyFrame::ColourLabelBackground)
-  EVT_MENU(GRID_COLOUR_LABEL_TEXT, MyFrame::ColourLabelText)
-  EVT_MENU(GRID_NORMAL_LABEL_COLOURING, MyFrame::NormalLabelColouring)
-  EVT_MENU(GRID_COLOUR_CELL_BACKGROUND, MyFrame::ColourCellBackground)
-  EVT_MENU(GRID_COLOUR_CELL_TEXT, MyFrame::ColourCellText)
-  EVT_MENU(GRID_NORMAL_CELL_COLOURING, MyFrame::NormalCellColouring)
-  EVT_MENU(GRID_QUIT, MyFrame::Quit)
-END_EVENT_TABLE()
-
-void MyFrame::ToggleEditable(wxCommandEvent& WXUNUSED(event))
-{
-      grid->SetEditable(!grid->GetEditable());
-      grid->Refresh();
-}
-
-void MyFrame::ToggleEditInPlace(wxCommandEvent& WXUNUSED(event))
-{
-      grid->SetEditInPlace(!grid->GetEditInPlace());
-      grid->Refresh();
-}
-
-void MyFrame::ToggleRowLabel(wxCommandEvent& WXUNUSED(event))
-{
-      if (grid->GetLabelSize(wxVERTICAL) > 0)
-        grid->SetLabelSize(wxVERTICAL, 0);
-      else
-        grid->SetLabelSize(wxVERTICAL, 40);
-      grid->Refresh();
-}
-
-void MyFrame::ToggleColLabel(wxCommandEvent& WXUNUSED(event))
-{
-      if (grid->GetLabelSize(wxHORIZONTAL) > 0)
-        grid->SetLabelSize(wxHORIZONTAL, 0);
-      else
-        grid->SetLabelSize(wxHORIZONTAL, 20);
-      grid->Refresh();
-}
-
-void MyFrame::ToggleDividers(wxCommandEvent& WXUNUSED(event))
-{
-      if (!grid->GetDividerPen().Ok())
-        grid->SetDividerPen(* wxThePenList->FindOrCreatePen("LIGHT GREY", 1, wxSOLID));
-      else
-        grid->SetDividerPen(wxNullPen);
-      grid->Refresh();
-}
-
-void MyFrame::LeftCell(wxCommandEvent& WXUNUSED(event))
-{
-      grid->SetCellAlignment(wxLEFT);
-      grid->Refresh();
-}
-
-void MyFrame::CentreCell(wxCommandEvent& WXUNUSED(event))
-{
-      grid->SetCellAlignment(wxCENTRE);
-      grid->Refresh();
-}
-
-void MyFrame::RightCell(wxCommandEvent& WXUNUSED(event))
-{
-      grid->SetCellAlignment(wxRIGHT);
-      grid->Refresh();
-}
-
-void MyFrame::ColourLabelBackground(wxCommandEvent& WXUNUSED(event))
-{
-      wxColourData data;
-      data.SetChooseFull(TRUE);
-      wxColourDialog dialog(this, &data);
-      if (dialog.ShowModal() != wxID_CANCEL)
-      {
-        wxColourData retData = dialog.GetColourData();
-        wxColour col = retData.GetColour();
-        grid->SetLabelBackgroundColour(col);
-        grid->Refresh();
-      }
-}
-
-void MyFrame::ColourLabelText(wxCommandEvent& WXUNUSED(event))
-{
-      wxColourData data;
-      data.SetChooseFull(TRUE);
-      wxColourDialog dialog(this, &data);
-      if (dialog.ShowModal() != wxID_CANCEL)
-      {
-        wxColourData retData = dialog.GetColourData();
-        wxColour col = retData.GetColour();
-        grid->SetLabelTextColour(col);
-        grid->Refresh();
-      }
-}
-
-void MyFrame::NormalLabelColouring(wxCommandEvent& WXUNUSED(event))
-{
-      grid->SetLabelBackgroundColour(*wxLIGHT_GREY);
-      grid->SetLabelTextColour(*wxBLACK);
-      grid->Refresh();
-}
-
-void MyFrame::ColourCellBackground(wxCommandEvent& WXUNUSED(event))
-{
-      wxColourData data;
-      data.SetChooseFull(TRUE);
-      wxColourDialog dialog(this, &data);
-      if (dialog.ShowModal() != wxID_CANCEL)
-      {
-        wxColourData retData = dialog.GetColourData();
-        wxColour col = retData.GetColour();
-        grid->SetCellBackgroundColour(col);
-        grid->Refresh();
-      }
-}
-
-void MyFrame::ColourCellText(wxCommandEvent& WXUNUSED(event))
-{
-      wxColourData data;
-      data.SetChooseFull(TRUE);
-      wxColourDialog dialog(this, &data);
-      if (dialog.ShowModal() != wxID_CANCEL)
-      {
-        wxColourData retData = dialog.GetColourData();
-        wxColour col = retData.GetColour();
-        grid->SetCellTextColour(col);
-        grid->Refresh();
-      }
-}
-
-void MyFrame::NormalCellColouring(wxCommandEvent& WXUNUSED(event))
-{
-      grid->SetCellBackgroundColour(*wxWHITE);
-      grid->SetCellTextColour(*wxBLACK);
-      grid->Refresh();
-}
-
-void MyFrame::Quit(wxCommandEvent& WXUNUSED(event))
-{
-      this->Close(TRUE);
-}
-
-// Ensure that the grid's edit control always has the focus.
-void MyFrame::OnActivate(wxActivateEvent& event)
-{
-  if (grid) grid->OnActivate(event.GetActive());
-}
-
diff --git a/samples/grid/test.def b/samples/grid/test.def
deleted file mode 100644 (file)
index 3dd3b7a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-NAME         Test
-DESCRIPTION  'wxTableWindow Test'
-EXETYPE      WINDOWS
-STUB         'WINSTUB.EXE'
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     1024
-STACKSIZE    16192
diff --git a/samples/grid/test.rc b/samples/grid/test.rc
deleted file mode 100644 (file)
index 571ada1..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "wx/msw/wx.rc"
-
-bitmap1 BITMAP "bitmap1.bmp"
-bitmap2 BITMAP "bitmap2.bmp"
-