Removed tabs from applet sample code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9985 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kendall Bennett
2001-05-03 17:33:55 +00:00
parent 67fc151d73
commit d20cf96f70
7 changed files with 3854 additions and 3854 deletions

View File

@@ -1,12 +1,12 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
* wxWindows HTML Applet Package
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows licence; you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
@@ -20,8 +20,8 @@
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
* Language: ANSI C++
* Environment: Any
*
* Description: Main wxApplet sample program
*
@@ -39,10 +39,10 @@
// Define the event tables for handling application frame events
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
EVT_MENU(Minimal_About, MyFrame::OnAbout)
EVT_MENU(Minimal_Back, MyFrame::OnBack)
EVT_MENU(Minimal_Forward, MyFrame::OnForward)
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
EVT_MENU(Minimal_About, MyFrame::OnAbout)
EVT_MENU(Minimal_Back, MyFrame::OnBack)
EVT_MENU(Minimal_Forward, MyFrame::OnForward)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWindows to create
@@ -56,40 +56,40 @@ IMPLEMENT_APP(MyApp)
/****************************************************************************
PARAMETERS:
title - Title for the frame window
pos - Position to place to frame window
size - Size of the frame window
title - Title for the frame window
pos - Position to place to frame window
size - Size of the frame window
REMARKS:
Application frame window constructor
****************************************************************************/
MyFrame::MyFrame(
const wxString& title,
const wxPoint& pos,
const wxSize& size)
: wxFrame(NULL, -1, title, pos, size)
const wxString& title,
const wxPoint& pos,
const wxSize& size)
: wxFrame(NULL, -1, title, pos, size)
{
// Create a menu bar
wxMenu *menuFile = new wxMenu;
wxMenu *menuNav = new wxMenu;
menuFile->Append(Minimal_Quit, "E&xit");
menuNav->Append(Minimal_Back, "Go &back");
menuNav->Append(Minimal_Forward, "Go &forward");
// Now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, "&File");
menuBar->Append(menuNav, "&Navigate");
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
CreateStatusBar(2);
// Create a menu bar
wxMenu *menuFile = new wxMenu;
wxMenu *menuNav = new wxMenu;
menuFile->Append(Minimal_Quit, "E&xit");
menuNav->Append(Minimal_Back, "Go &back");
menuNav->Append(Minimal_Forward, "Go &forward");
// Now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, "&File");
menuBar->Append(menuNav, "&Navigate");
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
CreateStatusBar(2);
// Create the HTML window
html = new wxHtmlAppletWindow(this);
html->SetRelatedFrame(this, "wxApplet Demo: '%s'");
html->SetRelatedStatusBar(1);
html->LoadPage("index.html");
// Create the HTML window
html = new wxHtmlAppletWindow(this);
html->SetRelatedFrame(this, "wxApplet Demo: '%s'");
html->SetRelatedStatusBar(1);
html->LoadPage("index.html");
}
/****************************************************************************
@@ -97,10 +97,10 @@ REMARKS:
Event handler for the 'Exit' menu item
****************************************************************************/
void MyFrame::OnQuit(
wxCommandEvent&)
wxCommandEvent&)
{
// TRUE is to force the frame to close
Close(TRUE);
// TRUE is to force the frame to close
Close(TRUE);
}
/****************************************************************************
@@ -108,9 +108,9 @@ REMARKS:
Event handler for the 'About' menu item
****************************************************************************/
void MyFrame::OnAbout(
wxCommandEvent&)
wxCommandEvent&)
{
// TODO: Bring up and about html page!
// TODO: Bring up and about html page!
}
/****************************************************************************
@@ -118,10 +118,10 @@ REMARKS:
Event handler for the 'Go back' menu item
****************************************************************************/
void MyFrame::OnBack(
wxCommandEvent&)
wxCommandEvent&)
{
if (!html -> HistoryBack())
wxMessageBox("You reached prehistory era!");
if (!html -> HistoryBack())
wxMessageBox("You reached prehistory era!");
}
/****************************************************************************
@@ -129,10 +129,10 @@ REMARKS:
Event handler for the 'Go forward' menu item
****************************************************************************/
void MyFrame::OnForward(
wxCommandEvent&)
wxCommandEvent&)
{
if (!html -> HistoryForward())
wxMessageBox("No more items in history!");
if (!html -> HistoryForward())
wxMessageBox("No more items in history!");
}
/****************************************************************************
@@ -141,15 +141,15 @@ REMARKS:
****************************************************************************/
bool MyApp::OnInit()
{
// Create the main application window
MyFrame *frame = new MyFrame("wxApplet testing application",
wxPoint(50, 50), wxSize(640, 480));
// Create the main application window
MyFrame *frame = new MyFrame("wxApplet testing application",
wxPoint(50, 50), wxSize(640, 480));
// Show it and tell the application that it's our main window
frame->Show(TRUE);
SetTopWindow(frame);
// Show it and tell the application that it's our main window
frame->Show(TRUE);
SetTopWindow(frame);
// Success: wxApp::OnRun() will be called to run the application
return TRUE;
// Success: wxApp::OnRun() will be called to run the application
return TRUE;
}

View File

@@ -1,12 +1,12 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
* wxWindows HTML Applet Package
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows licence; you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
@@ -20,8 +20,8 @@
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
* Language: ANSI C++
* Environment: Any
*
* Description: Main wxApplet sample program header file
*
@@ -32,15 +32,15 @@
/*------------------------------ Constants --------------------------------*/
enum {
// Menu items
Minimal_Quit = 1,
Minimal_About,
Minimal_Back,
Minimal_Forward,
// Controls start here (the numbers are, of course, arbitrary)
Minimal_Text = 1000,
};
// Menu items
Minimal_Quit = 1,
Minimal_About,
Minimal_Back,
Minimal_Forward,
// Controls start here (the numbers are, of course, arbitrary)
Minimal_Text = 1000,
};
/*--------------------------- Class Definitions ---------------------------*/
@@ -50,9 +50,9 @@ Define a new application type, each program should derive a class from wxApp
****************************************************************************/
class MyApp : public wxApp {
public:
// Initialise the application on startup
virtual bool OnInit();
};
// Initialise the application on startup
virtual bool OnInit();
};
/****************************************************************************
REMARKS:
@@ -60,19 +60,19 @@ Define a new frame type: this is going to be our main frame
****************************************************************************/
class MyFrame : public wxFrame {
private:
DECLARE_EVENT_TABLE() // Declare event table
wxHtmlAppletWindow *html; // Pointer to the html applet window
DECLARE_EVENT_TABLE() // Declare event table
wxHtmlAppletWindow *html; // Pointer to the html applet window
public:
// Constructor
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
// Constructor
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
// Event handlers
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnBack(wxCommandEvent& event);
void OnForward(wxCommandEvent& event);
};
// Event handlers
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnBack(wxCommandEvent& event);
void OnForward(wxCommandEvent& event);
};
#endif // __SAMPLE_H
#endif // __SAMPLE_H

View File

@@ -1,12 +1,12 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
* wxWindows HTML Applet Package
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows licence; you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
@@ -20,11 +20,11 @@
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
* Language: ANSI C++
* Environment: Any
*
* Description: Combobox wrapper. This file implements the custom
* combo boxes used for this sample program.
* combo boxes used for this sample program.
*
****************************************************************************/
@@ -38,135 +38,135 @@
/*------------------------- Implementation --------------------------------*/
ComboBox::ComboBox(
wxWindow *parent,
int listid,
int textid)
: m_Parent(parent), m_ListBoxId(listid), m_TextCtrlId(textid)
wxWindow *parent,
int listid,
int textid)
: m_Parent(parent), m_ListBoxId(listid), m_TextCtrlId(textid)
{
m_ListBox = wxDynamicCast(m_Parent->FindWindow(listid),wxListBox);
m_TextCtrl = wxDynamicCast(m_Parent->FindWindow(textid),wxTextCtrl);
m_ListBox = wxDynamicCast(m_Parent->FindWindow(listid),wxListBox);
m_TextCtrl = wxDynamicCast(m_Parent->FindWindow(textid),wxTextCtrl);
}
int ComboBox::GetListBoxId()
{
return m_ListBoxId;
return m_ListBoxId;
}
int ComboBox::GetSelection()
{
return m_ListBox->GetSelection();
return m_ListBox->GetSelection();
}
wxString ComboBox::GetStringSelection()
{
return m_ListBox->GetStringSelection();
return m_ListBox->GetStringSelection();
}
bool ComboBox::SetStringSelection(const wxString& s, bool select)
{
select = TRUE;
select = m_ListBox->SetStringSelection(s, select);
m_TextCtrl->SetValue(GetStringSelection());
return select;
select = TRUE;
select = m_ListBox->SetStringSelection(s, select);
m_TextCtrl->SetValue(GetStringSelection());
return select;
}
void ComboBox::Select(int n)
{
m_ListBox->Select(n);
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->Select(n);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Deselect(int n)
{
m_ListBox->Deselect(n);
m_ListBox->Deselect(n);
}
void ComboBox::Insert(const wxString& item, int pos)
{
m_ListBox->Insert(item,pos);
}
m_ListBox->Insert(item,pos);
}
void ComboBox::Insert(const wxString& item, int pos, void *clientData)
{
m_ListBox->Insert(item, pos, clientData);
m_ListBox->Insert(item, pos, clientData);
}
void ComboBox::Insert(const wxString& item, int pos, wxClientData *clientData)
{
m_ListBox->Insert(item, pos, clientData);
m_ListBox->Insert(item, pos, clientData);
}
void ComboBox::InsertItems(int nItems, const wxString *items, int pos)
{
m_ListBox->InsertItems(nItems, items, pos);
m_ListBox->InsertItems(nItems, items, pos);
}
void ComboBox::InsertItems(const wxArrayString& items, int pos)
{
m_ListBox->InsertItems(items, pos);
m_ListBox->InsertItems(items, pos);
}
void ComboBox::Set(int n, const wxString* items, void **clientData)
{
m_ListBox->Set(n, items, clientData);
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->Set(n, items, clientData);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Set(const wxArrayString& items, void **clientData)
{
m_ListBox->Set(items, clientData);
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->Set(items, clientData);
m_TextCtrl->SetValue(GetStringSelection());
}
int ComboBox::FindString(const wxString &s)
{
return (m_ListBox->FindString(s));
return (m_ListBox->FindString(s));
}
void ComboBox::SetFirstItem(int n)
{
m_ListBox->SetFirstItem(n);
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->SetFirstItem(n);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::SetFirstItem(const wxString &s)
{
m_ListBox->SetFirstItem(s);
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->SetFirstItem(s);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Append(const wxString &item)
{
m_ListBox->Append(item);
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->Append(item);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Append(const wxString& item, void *clientData)
{
m_ListBox->Append(item, clientData);
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->Append(item, clientData);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Append(const wxString& item, wxClientData *clientData)
{
m_ListBox->Append(item, clientData);
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->Append(item, clientData);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Clear()
void ComboBox::Clear()
{
m_ListBox->Clear();
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->Clear();
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Delete(int n)
{
m_ListBox->Delete(n);
m_TextCtrl->SetValue(GetStringSelection());
m_ListBox->Delete(n);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::OnChange(wxCommandEvent &)
{
m_TextCtrl->SetValue(GetStringSelection());
m_TextCtrl->SetValue(GetStringSelection());
}

View File

@@ -1,12 +1,12 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
* wxWindows HTML Applet Package
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows licence; you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
@@ -20,11 +20,11 @@
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
* Language: ANSI C++
* Environment: Any
*
* Description: Combobox wrapper. This header file defines the custom
* combo boxes used for this sample program.
* combo boxes used for this sample program.
*
****************************************************************************/
@@ -37,62 +37,62 @@
REMARKS:
Defines a Custom ComboBox. This combobox is a portable implementation of
the msw combobox control. It is made of the wxWindows textctrl primitive and
the listbox primitive. This object does not create or display the controls,
the listbox primitive. This object does not create or display the controls,
it provides the relationship and underlying behavior layer for the primitives
allready created via wxDesigner.
****************************************************************************/
class ComboBox {
private:
int m_ListBoxId;
int m_TextCtrlId;
wxWindow *m_Parent;
wxListBox *m_ListBox;
wxTextCtrl *m_TextCtrl;
int m_ListBoxId;
int m_TextCtrlId;
wxWindow *m_Parent;
wxListBox *m_ListBox;
wxTextCtrl *m_TextCtrl;
public:
// Constructor
ComboBox(wxWindow *parent, int,int);
// Returns the id of the listbox: listBoxId.
int GetListBoxId();
// Inserts: Used to insert items into the listbox
void Insert(const wxString& item, int pos);
void Insert(const wxString& item, int pos, void *clientData);
void Insert(const wxString& item, int pos, wxClientData *clientData);
void InsertItems(int nItems, const wxString *items, int pos);
void InsertItems(const wxArrayString& items, int pos);
// Sets: Used to set items in the combo box
void Set(int n, const wxString* items, void **clientData );
void Set(const wxArrayString& items, void **clientData);
int FindString(const wxString &s);
// Selections: Used to get/de/select items in the listbox
void Select(int n);
void Deselect(int n);
int GetSelection();
wxString GetStringSelection();
bool SetStringSelection(const wxString& s, bool select);
// Set the specified item at the first visible item or scroll to max
// range.
void SetFirstItem(int n);
void SetFirstItem(const wxString& s);
// Append items to the listbox
void Append(const wxString& item);
void Append(const wxString& item, void *clientData);
void Append(const wxString& item, wxClientData *clientData);
// Deleting items from the list box
void Clear();
void Delete(int n);
// OnChange event function (called from SDD dialog box code, see: dialog.h) Mimic
// msw combobox behavior: Click on listbox item it shows in textbox.
void OnChange(wxCommandEvent &event);
};
// Constructor
ComboBox(wxWindow *parent, int,int);
// Returns the id of the listbox: listBoxId.
int GetListBoxId();
// Inserts: Used to insert items into the listbox
void Insert(const wxString& item, int pos);
void Insert(const wxString& item, int pos, void *clientData);
void Insert(const wxString& item, int pos, wxClientData *clientData);
void InsertItems(int nItems, const wxString *items, int pos);
void InsertItems(const wxArrayString& items, int pos);
// Sets: Used to set items in the combo box
void Set(int n, const wxString* items, void **clientData );
void Set(const wxArrayString& items, void **clientData);
int FindString(const wxString &s);
// Selections: Used to get/de/select items in the listbox
void Select(int n);
void Deselect(int n);
int GetSelection();
wxString GetStringSelection();
bool SetStringSelection(const wxString& s, bool select);
// Set the specified item at the first visible item or scroll to max
// range.
void SetFirstItem(int n);
void SetFirstItem(const wxString& s);
// Append items to the listbox
void Append(const wxString& item);
void Append(const wxString& item, void *clientData);
void Append(const wxString& item, wxClientData *clientData);
// Deleting items from the list box
void Clear();
void Delete(int n);
// OnChange event function (called from SDD dialog box code, see: dialog.h) Mimic
// msw combobox behavior: Click on listbox item it shows in textbox.
void OnChange(wxCommandEvent &event);
};
#endif // __COMBOBOX_H
#endif // __COMBOBOX_H

View File

@@ -1,6 +1,6 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
* wxWindows HTML Applet Package
*
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
@@ -23,8 +23,8 @@
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* ======================================================================
*
* Language: ANSI C++
* Environment: Any
* Language: ANSI C++
* Environment: Any
*
* Description: Main wxApplet class implementation
*
@@ -40,18 +40,18 @@
// Implement the dynamic class so it can be constructed dynamically
IMPLEMENT_DYNAMIC_CLASS(MonitorApplet, wxApplet);
// Event handler table.
BEGIN_EVENT_TABLE(MonitorApplet, wxApplet)
EVT_LISTBOX(ID_LISTBOX_MFTR, MonitorApplet::OnChange)
EVT_LISTBOX(ID_LISTBOX_MDL, MonitorApplet::OnChange)
EVT_LISTBOX(ID_LISTBOX_MFTR, MonitorApplet::OnChange)
EVT_LISTBOX(ID_LISTBOX_MDL, MonitorApplet::OnChange)
END_EVENT_TABLE()
// Include database of known monitors. Normally this would come from a
// real database on disk, but for this simple example we hard code all
// the values into a table.
#include "monitors.c"
#include "monitors.c"
/*------------------------- Implementation --------------------------------*/
/****************************************************************************
@@ -61,10 +61,10 @@ internal values for the class so that it can be properly created later
via the virtual Create member function.
****************************************************************************/
MonitorApplet::MonitorApplet()
{
m_Mfr = NULL;
m_Model = NULL;
m_Data = NULL;
{
m_Mfr = NULL;
m_Model = NULL;
m_Data = NULL;
}
/****************************************************************************
@@ -72,39 +72,39 @@ REMARKS:
Psuedo virtual constructor for the MonitorApplet class.
****************************************************************************/
bool MonitorApplet::Create(
wxHtmlAppletWindow *parent,
const wxSize& size,
long style)
wxHtmlAppletWindow *parent,
const wxSize& size,
long style)
{
bool ret = wxApplet::Create(parent, size, style);
if (ret) {
// Read our cookie or create it if it does not exist
if ((m_Data = (MonitorData*)parent->FindCookie(MONITOR_COOKIE_NAME)) == NULL) {
m_Data = new MonitorData;
memset(&m_Data->m_Monitor,0,sizeof(m_Data->m_Monitor));
parent->RegisterCookie(MONITOR_COOKIE_NAME,m_Data);
}
// Create all the controls and initialise them
MonitorDialogFunc(this,true,true);
if ((m_Mfr = new ComboBox(this , ID_LISTBOX_MFTR, ID_TEXTCTRL_MFTR)) == NULL)
return false;
if ((m_Model = new ComboBox(this , ID_LISTBOX_MDL, ID_TEXTCTRL_MDL)) == NULL)
return false;
ReadMfrList();
ReadModelList(true);
}
// Read our cookie or create it if it does not exist
if ((m_Data = (MonitorData*)parent->FindCookie(MONITOR_COOKIE_NAME)) == NULL) {
m_Data = new MonitorData;
memset(&m_Data->m_Monitor,0,sizeof(m_Data->m_Monitor));
parent->RegisterCookie(MONITOR_COOKIE_NAME,m_Data);
}
// Create all the controls and initialise them
MonitorDialogFunc(this,true,true);
if ((m_Mfr = new ComboBox(this , ID_LISTBOX_MFTR, ID_TEXTCTRL_MFTR)) == NULL)
return false;
if ((m_Model = new ComboBox(this , ID_LISTBOX_MDL, ID_TEXTCTRL_MDL)) == NULL)
return false;
ReadMfrList();
ReadModelList(true);
}
return ret;
}
/****************************************************************************
REMARKS:
Destructor for the MonitorApplet class.
****************************************************************************/
MonitorApplet::~MonitorApplet()
{
delete m_Mfr;
delete m_Model;
delete m_Mfr;
delete m_Model;
}
/****************************************************************************
@@ -113,7 +113,7 @@ Save the current state for the applet to our cookie
****************************************************************************/
void MonitorApplet::SaveCurrentState()
{
// Read currently selected strings into cookie
// Read currently selected strings into cookie
strcpy(m_Data->m_Monitor.m_Mfr,m_Mfr->GetStringSelection());
strcpy(m_Data->m_Monitor.m_Model,m_Model->GetStringSelection());
}
@@ -123,52 +123,52 @@ REMARKS:
Handles user navigation away from the applet via an HTML link
****************************************************************************/
void MonitorApplet::OnLinkClicked(
const wxHtmlLinkInfo&)
const wxHtmlLinkInfo&)
{
SaveCurrentState();
SaveCurrentState();
}
/****************************************************************************
REMARKS:
Handles user navigation away from the applet via the history forward command
****************************************************************************/
void MonitorApplet::OnHistoryForward()
{
SaveCurrentState();
SaveCurrentState();
}
/****************************************************************************
REMARKS:
Handles user navigation away from the applet via the history back command
****************************************************************************/
void MonitorApplet::OnHistoryBack()
{
SaveCurrentState();
SaveCurrentState();
}
/****************************************************************************
REMARKS:
Handles inter applet communication messages
****************************************************************************/
void MonitorApplet::OnMessage(
wxEvent& msg)
void MonitorApplet::OnMessage(
wxEvent& msg)
{
msg.Skip(true);
msg.Skip(true);
}
/****************************************************************************
REMARKS:
****************************************************************************/
void MonitorApplet::OnChange(
wxCommandEvent &evt)
wxCommandEvent &evt)
{
if (evt.GetId() == m_Mfr->GetListBoxId()) {
m_Mfr->OnChange(evt);
ReadModelList(true);
}
else if (evt.GetId() == m_Model->GetListBoxId()) {
m_Model->OnChange(evt);
}
if (evt.GetId() == m_Mfr->GetListBoxId()) {
m_Mfr->OnChange(evt);
ReadModelList(true);
}
else if (evt.GetId() == m_Model->GetListBoxId()) {
m_Model->OnChange(evt);
}
}
/****************************************************************************
@@ -176,21 +176,21 @@ REMARKS:
Updates the manufacturer list for the dialog box from the database.
****************************************************************************/
void MonitorApplet::ReadMfrList()
{
char buf[80] = "";
int i,selected = 0;
MonitorEntry *m;
{
char buf[80] = "";
int i,selected = 0;
MonitorEntry *m;
m_Mfr->Clear();
for (m = m_Monitors,i = 0; m->m_Mfr[0] != 0; m++) {
if (stricmp(buf,m->m_Mfr) != 0) {
for (m = m_Monitors,i = 0; m->m_Mfr[0] != 0; m++) {
if (stricmp(buf,m->m_Mfr) != 0) {
m_Mfr->Append(m->m_Mfr);
if (stricmp(m_Data->m_Monitor.m_Mfr,m->m_Mfr) == 0)
selected = i;
strcpy(buf,m->m_Mfr);
i++;
}
}
if (stricmp(m_Data->m_Monitor.m_Mfr,m->m_Mfr) == 0)
selected = i;
strcpy(buf,m->m_Mfr);
i++;
}
}
m_Mfr->Select(selected);
}
@@ -201,21 +201,21 @@ manufacturer type.
****************************************************************************/
void MonitorApplet::ReadModelList(
bool selectCurrent)
{
int i,selected = 0;
MonitorEntry *m;
wxString mfrStr;
mfrStr = m_Mfr->GetStringSelection();
{
int i,selected = 0;
MonitorEntry *m;
wxString mfrStr;
mfrStr = m_Mfr->GetStringSelection();
m_Model->Clear();
for (m = m_Monitors,i = 0; m->m_Mfr[0] != 0; m++) {
if (stricmp(mfrStr,m->m_Mfr) == 0) {
for (m = m_Monitors,i = 0; m->m_Mfr[0] != 0; m++) {
if (stricmp(mfrStr,m->m_Mfr) == 0) {
m_Model->Append(m->m_Model);
if (selectCurrent && stricmp(m_Data->m_Monitor.m_Model,m->m_Model) == 0)
selected = i;
i++;
}
}
if (selectCurrent && stricmp(m_Data->m_Monitor.m_Model,m->m_Model) == 0)
selected = i;
i++;
}
}
m_Model->Select(selected);
}

View File

@@ -21,8 +21,8 @@
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* ======================================================================
*
* Language: ANSI C++
* Environment: Any
* Language: ANSI C++
* Environment: Any
*
* Description: Header file for the MonitorApplet class
*
@@ -42,9 +42,9 @@ REMARKS:
Structure defining the simple monitor database records.
****************************************************************************/
struct MonitorEntry {
char m_Mfr[60];
char m_Model[60];
};
char m_Mfr[60];
char m_Model[60];
};
/****************************************************************************
REMARKS:
@@ -53,12 +53,12 @@ information for this MonitorApplet.
****************************************************************************/
class MonitorData : public wxObject {
public:
MonitorEntry m_Monitor;
};
MonitorEntry m_Monitor;
};
// Name used to track the monitor data cookie
#define MONITOR_COOKIE_NAME "MonitorData"
// Name used to track the monitor data cookie
#define MONITOR_COOKIE_NAME "MonitorData"
/****************************************************************************
REMARKS:
Defines our wxMonitor applet class
@@ -67,48 +67,48 @@ class MonitorApplet : public wxApplet {
private:
DECLARE_DYNAMIC_CLASS(MonitorApplet);
DECLARE_EVENT_TABLE();
protected:
ComboBox *m_Mfr;
ComboBox *m_Model;
MonitorData *m_Data;
static MonitorEntry m_Monitors[];
// Flush the current state to a cookie
void SaveCurrentState();
ComboBox *m_Mfr;
ComboBox *m_Model;
MonitorData *m_Data;
static MonitorEntry m_Monitors[];
// Flush the current state to a cookie
void SaveCurrentState();
public:
// Constructor (called during dynamic creation)
MonitorApplet();
// Constructor (called during dynamic creation)
MonitorApplet();
// Psuedo virtual constructor
virtual bool Create(
wxHtmlAppletWindow *parent,
const wxSize& size,
long style);
// Virtual destructor
virtual ~MonitorApplet();
// Psuedo virtual constructor
virtual bool Create(
wxHtmlAppletWindow *parent,
const wxSize& size,
long style);
// Virtual destructor
virtual ~MonitorApplet();
// Handle HTML navigation to a new URL
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
// Handle HTML navigation forward command in applet
virtual void OnHistoryForward();
// Handle HTML navigation back command in applet
virtual void OnHistoryBack();
// Handle messages from the wxAppletManager and other applets
virtual void OnMessage(wxEvent& msg);
// Handle HTML navigation to a new URL
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
// Handle HTML navigation forward command in applet
virtual void OnHistoryForward();
// Handle HTML navigation back command in applet
virtual void OnHistoryBack();
// Handle messages from the wxAppletManager and other applets
virtual void OnMessage(wxEvent& msg);
// Update the model and menufacturer lists
void ReadMfrList();
void ReadModelList(bool selectCurrent);
// Update the model and menufacturer lists
void ReadMfrList();
void ReadModelList(bool selectCurrent);
// Event handlers
void OnChange(wxCommandEvent &event);
};
// Event handlers
void OnChange(wxCommandEvent &event);
};
#endif // __WX_MONITORAPPLET_H

File diff suppressed because it is too large Load Diff