/*
 * File:	noname.cc
 * Purpose:	main application module, generated by wxBuilder.
 * Author:	Julian Smart
 * Created:	1993
 * Updated:	
 * Copyright:	(c) 1993, AIAI, University of Edinburgh
 */

static const char sccsid[] = "%W% %G%";

#include "wx.h"
#include "wx_help.h"
#include "c:\c\project\noname.h"

// Declare an instance of the application: allows the program to start
AppClass theApp;

// Called to initialize the program
wxFrame *AppClass::OnInit(void)
{
  // Initialize all the top-level window members to NULL.
  frame5 = NULL;
  frame22 = NULL;
  if (!ParseCommandLine())
    return NULL;

  frame5 = 
    new FrameClass2(NULL, "The Frame", 17, 95, 557, 375, wxSDI | wxDEFAULT_FRAME, "frame1");

  return frame5;
}

// Parses the command line
Bool AppClass::ParseCommandLine(void)
{
  return TRUE;
}

FrameClass2::FrameClass2(wxFrame *parent, char *title, int x, int y, int width, int height, int style, char *name):
  wxFrame(parent, title, x, y, width, height, style, name)
{
  // Initialize child subwindow members.
  panel7 = NULL;
  canvas20 = NULL;

  CreateStatusLine(2);
  // Create a menu bar for the frame
  wxMenuBar *menuBar1 = new wxMenuBar;
  wxMenu *menu1 = new wxMenu;
  menu1->Append(FRAMECLASS2_OPEN, "&Open");
  menuBar1->Append(menu1, "&File");
  SetMenuBar(menuBar1);

  // Create child subwindows.
  toolbar3 = new ToolBarClass10(this, 0, 0, 549, 33, wxRETAINED, wxHORIZONTAL, 40);
;
  panel7 = new PanelClass4(this, 0, 33, 549, 134, wxABSOLUTE_POSITIONING | wxBORDER, "panel3");
  canvas20 = new CanvasClass6(this, 0, 167, 549, 134, wxRETAINED, "canvas5");

  // Ensure the subwindows get resized o.k.
  OnSize(width, height);

  // Centre frame on the screen.
  Centre(wxBOTH);

  // Show the frame.
  Show(TRUE);
}

FrameClass2::~FrameClass2(void)
{
}

Bool FrameClass2::OnClose(void)
{
  // Clean up any associated data here.
  theApp.frame5 = NULL;
  return TRUE;
}

void FrameClass2::OnSize(int w, int h)
{
  // Return if subwindows not yet initialized.
  if (!panel7) return;

  int clientW, clientH;
  GetClientSize(&clientW, &clientH);
  int toolbarHeight, toolbarWidth;
  // Find toolbar height from first tool
  if (toolbar3->GetTools().Number() > 0)
    toolbarHeight = ((wxToolBarTool *)toolbar3->GetTools().First()->Data())->bitmap1->GetHeight() + 4;
  else toolbarHeight = 26;
  toolbarWidth = clientW;
  toolbar3->SetSize(0, 0, toolbarWidth, toolbarHeight);
  int currentY = toolbarHeight;

  int top = toolbarHeight;
  int bottom = clientH;
  panel7->SetSize(0, currentY, clientW, (int)((float)(clientH - toolbarHeight)*50/100.0));
  currentY += (int)((float)(clientH - toolbarHeight)*50/100.0);
  top = currentY;
  canvas20->SetSize(0, currentY, clientW, (int)((float)(clientH - toolbarHeight)*50/100.0));
  currentY += (int)((float)(clientH - toolbarHeight)*50/100.0);
  top = currentY;
  currentY = clientH;
}

void FrameClass2::OnMenuCommand(int commandId)
{
  switch (commandId)
  {
    // &Open
    case FRAMECLASS2_OPEN:
    {
      break;
    }
  default:
    break;
  }
}

PanelClass4::PanelClass4(wxFrame *parent, int x, int y, int width, int height, int style, char *name):
  wxPanel(parent, x, y, width, height, style, name)
{
  // Create panel items
  button9 = new wxButton(this, (wxFunction)ButtonProc10, "untitled", 17, 19, 69, 24, 0, "button11");
  text11 = new wxText(this, (wxFunction)TextProc12, "untitled", "", 101, 19, 200, 24, 0, "text13");
  message13 = new wxMessage(this, "Stuff", 19, 59, 0, "message15");
  SetLabelPosition(wxVERTICAL);
  multitext16 = new wxMultiText(this, (wxFunction)MultiTextProc17, "Text", "Some text", 99, 55, 200, 74, 0, "multitext18");
  SetLabelPosition(wxHORIZONTAL);
  SetLabelPosition(wxVERTICAL);
  listbox18 = new wxListBox(this, (wxFunction)ListBoxProc19, "untitled", wxSINGLE, 321, 17, 200, 101, 0, NULL, 0, "listbox20");
  SetLabelPosition(wxHORIZONTAL);
}

PanelClass4::~PanelClass4(void)
{
}

void PanelClass4::OnSize(int w, int h)
{
  wxPanel::OnSize(w, h);
}

void ButtonProc10(wxButton& but, wxCommandEvent& event)
{
  // Create window, or show it if already created.
  if (!theApp.frame22)
  {
    theApp.frame22 = 
  new FrameClass23(NULL, "untitled", 219, 110, 300, 300, wxSDI | wxDEFAULT_FRAME, "frame22");

  }
  theApp.frame22->Iconize(FALSE);
  theApp.frame22->Show(TRUE);
}

void TextProc12(wxText& text, wxCommandEvent& event)
{
}

void MultiTextProc17(wxText& text, wxCommandEvent& event)
{
}

void ListBoxProc19(wxListBox& lbox, wxCommandEvent& event)
{
}

CanvasClass6::CanvasClass6(wxFrame *parent, int x, int y, int width, int height, int style, char *name):
  wxCanvas(parent, x, y, width, height, style, name)
{
  /* Set scrollbars to:
   *   20 pixels per horizontal units (1 unit = 1 scroll line)
   *   20 pixels per vertical units
   *   50 horizontal units
   *   50 vertical units
   *   10 units per horizontal page
   *   10 units per vertical page.
   * Virtual canvas is therefore 1000 pixels by 1000 pixels.
   */
  SetScrollbars(20, 20, 50, 50, 10, 10);
}

CanvasClass6::~CanvasClass6(void)
{
}

// Called when canvas is resized.
void CanvasClass6::OnSize(int w, int h)
{
  wxCanvas::OnSize(w, h);
}

// Called when canvas needs to be repainted.
void CanvasClass6::OnPaint(void)
{
  // Speeds up drawing under Windows.
  GetDC()->BeginDrawing();

  // Insert your drawing code here.

  GetDC()->EndDrawing();
}

// Called when the canvas receives a mouse event.
void CanvasClass6::OnEvent(wxMouseEvent& event)
{
  wxCanvas::OnEvent(event);
}

// Called when the canvas receives a key event.
void CanvasClass6::OnChar(wxKeyEvent& event)
{
  wxCanvas::OnChar(event);
}

ToolBarClass10::ToolBarClass10(wxFrame *parent, int x, int y, int width, int height, int style, int orient,
     int rowsOrCols):
    wxToolBar(parent, x, y, width, height, style, orient, rowsOrCols)
{
  static wxBitmap *bitmaps[1];

#ifdef wx_x
#include "choice.xbm"
  bitmaps[0] = new wxBitmap(choice, choice_width, choice_height);
#endif
#ifdef wx_msw
  bitmaps[0] = new wxBitmap("choice");
#endif
  SetMargins(2, 2);
  GetDC()->SetBackground(wxGREY_BRUSH);
  int toolX = 2;
  AddTool(TOOL1, bitmaps[0], NULL, FALSE, (float)toolX, -1, NULL);
  toolX += bitmaps[0]->GetWidth() + 2;
}

ToolBarClass10::~ToolBarClass10(void)
{
}

// Called when toolbar needs to be repainted.
void ToolBarClass10::OnPaint(void)
{
  // Speeds up drawing under Windows.
  GetDC()->BeginDrawing();

  // Insert your drawing code here.
  wxToolBar::OnPaint();

  GetDC()->EndDrawing();
}

// Called when the toolbar receives a click event.
Bool ToolBarClass10::OnLeftClick(int toolIndex, Bool toggleDown)
{
  return TRUE;
}

// Called when the mouse enters or exits a tool.
void ToolBarClass10::OnMouseEnter(int toolIndex)
{
}

FrameClass23::FrameClass23(wxFrame *parent, char *title, int x, int y, int width, int height, int style, char *name):
  wxFrame(parent, title, x, y, width, height, style, name)
{
  // Initialize child subwindow members.
  textwindow24 = NULL;

  // Create child subwindows.
  textwindow24 = new TextWindowClass25(this, 0, 0, 300, 300, 0, "textwindow24");

  // Ensure the subwindows get resized o.k.
  OnSize(width, height);

  // Centre frame on the screen.
  Centre(wxBOTH);

  // Show the frame.
  Show(TRUE);
}

FrameClass23::~FrameClass23(void)
{
}

Bool FrameClass23::OnClose(void)
{
  // Clean up any associated data here.
  theApp.frame22 = NULL;
  return TRUE;
}

void FrameClass23::OnSize(int w, int h)
{
  // Let default member handle sizing for only one subwindow.
  wxFrame::OnSize(w, h);
}

void FrameClass23::OnMenuCommand(int commandId)
{
  switch (commandId)
  {
  default:
    break;
  }
}

TextWindowClass25::TextWindowClass25(wxFrame *parent, int x, int y, int width, int height, int style, char *name):
  wxTextWindow(parent, x, y, width, height, style, name)
{
}

TextWindowClass25::~TextWindowClass25(void)
{
}

void TextWindowClass25::OnSize(int w, int h)
{
  wxTextWindow::OnSize(w, h);
}

