wxPen *blackPen = wxThePenList->FindOrCreatePen(*wxBlack, 1, wxSOLID);
wxPen *redPen = wxThePenList->FindOrCreatePen(*wxRed, 1, wxSOLID);
wxPen *bluePen = wxThePenList->FindOrCreatePen(*wxBlue, 1, wxSOLID);
- wxPen *whitePen = wxThePenList->FindOrCreatePen(*wxWhite, 1, wxSOLID);
- wxPen *greyPen = wxThePenList->FindOrCreatePen(*wxGrey, 1, wxSOLID);
wxBrush *whiteBrush = wxTheBrushList->FindOrCreateBrush(*wxWhite, wxSOLID);
wxBrush *greyBrush = wxTheBrushList->FindOrCreateBrush(*wxGrey, wxSOLID);
wxBrush *redBrush = wxTheBrushList->FindOrCreateBrush(*wxRed, wxSOLID);
// Called when the canvas receives a mouse event.
void BombsCanvasClass::OnEvent(wxMouseEvent& event)
-{ float fx, fy;
+{
+ long fx, fy;
event.Position(&fx, &fy);
int x = fx/(x_cell*X_UNIT);
int y = fy/(y_cell*Y_UNIT);
END_EVENT_TABLE()
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
- : m_notebook(NULL), m_text(NULL),
- wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) )
+ : wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ),
+ m_text(NULL), m_notebook(NULL)
{
// SetBackgroundColour("cadet blue");
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows license
+// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
class MyFrame: public wxFrame
{ public:
MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
-
+
public:
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
- bool OnClose(void) { return TRUE; }
+ bool OnClose(void) { return TRUE; }
};
// ID for the menu commands
-#define DYNAMIC_QUIT 1
-#define DYNAMIC_TEXT 101
-#define DYNAMIC_ABOUT 102
+#define DYNAMIC_QUIT 1
+#define DYNAMIC_TEXT 101
+#define DYNAMIC_ABOUT 102
// Create a new application object
-IMPLEMENT_APP (MyApp)
+IMPLEMENT_APP (MyApp)
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit(void)
// Create the main frame window
MyFrame *frame = new MyFrame(NULL, "Dynamic wxWindows App", 50, 50, 450, 340);
- frame->Connect( DYNAMIC_QUIT, -1, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) MyFrame::OnQuit );
- frame->Connect( DYNAMIC_ABOUT, -1, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) MyFrame::OnAbout );
+ frame->Connect( DYNAMIC_QUIT, -1, wxEVT_COMMAND_MENU_SELECTED,
+ (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
+ &MyFrame::OnQuit );
+ frame->Connect( DYNAMIC_ABOUT, -1, wxEVT_COMMAND_MENU_SELECTED,
+ (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
+ &MyFrame::OnAbout );
// Give it an icon
#ifdef __WXMSW__
// Show the frame
frame->Show(TRUE);
-
+
SetTopWindow(frame);
return TRUE;
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{
wxMessageDialog dialog(this, "This demonstrates dynamic event handling",
- "About Dynamic", wxYES_NO|wxCANCEL);
+ "About Dynamic", wxYES_NO|wxCANCEL);
dialog.ShowModal();
}
static long poem_index[600]; // Index of poem starts
static long nitems = 0; // Number of poems
-static int desired_char_height = DEFAULT_CHAR_HEIGHT; // Desired height
-static char DesiredFont[64]; // Chosen font
static int char_height = DEFAULT_CHAR_HEIGHT; // Actual height
static int index_ptr = -1; // Pointer into index
static int poem_height, poem_width; // Size of poem
dc->GetTextExtent(line, &xx, &yy);
FindMax(&curr_width, (int)xx);
-
+
if (DrawIt)
{
int x = (int)((width - xx)/2.0);
dc->DrawLine(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width-THIN_LINE_BORDER, height-THIN_LINE_BORDER);
dc->DrawLine(width-THIN_LINE_BORDER, height-THIN_LINE_BORDER, THIN_LINE_BORDER, height-THIN_LINE_BORDER);
dc->DrawLine(THIN_LINE_BORDER, height-THIN_LINE_BORDER, THIN_LINE_BORDER, THIN_LINE_BORDER);
-
+
// Right and bottom white lines - 'grey' (black!) if
// we're running on a mono display.
if (wxColourDisplay())
bool MyApp::OnInit()
{
poem_buffer = new char[buf_size];
-
+
GreyPen = new wxPen("LIGHT GREY", THICK_LINE_WIDTH, wxSOLID);
DarkGreyPen = new wxPen("GREY", THICK_LINE_WIDTH, wxSOLID);
WhitePen = new wxPen("WHITE", THICK_LINE_WIDTH, wxSOLID);
{
int xx, yy;
TheMainWindow->GetClientSize(&xx, &yy);
-
+
wxMemoryDC memDC;
memDC.SelectObject(* backingBitmap);
dc.Blit(0, 0, backingBitmap->GetWidth(), backingBitmap->GetHeight(), &memDC, 0, 0);
void MyCanvas::OnMouseEvent(wxMouseEvent& event)
{
- float x, y;
+ long x, y;
event.Position(&x, &y);
static int startPosX, startPosY, startFrameX, startFrameY;
if (event.RightDown())
{
// Versions from wxWin 1.67 are probably OK
-#if 0 // wx_motif
- FakePopupMenu(popupMenu, x, y);
-#else
PopupMenu(popupMenu, (int)x, (int)y );
-#endif
}
else if (event.LeftDown())
{
int x1 = (int)x;
int y1 = (int)y;
ClientToScreen(&x1, &y1);
-
+
int dX = x1 - startPosX;
int dY = y1 - startPosY;
GetParent()->Move(startFrameX + dX, startFrameY + dY);
fprintf(file, "%ld\n\n", nitems);
for (j = 0; j < nitems; j++)
fprintf(file, "%ld\n", poem_index[j]);
-
+
fclose(file);
PoetryNotify("Poetry index compiled.");
return TRUE;