removed a few warnings and CW compilation problems (patch from Dimitri)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14821 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -773,6 +773,16 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif /* wxUSE_UNICODE_MSLU */
|
#endif /* wxUSE_UNICODE_MSLU */
|
||||||
|
|
||||||
|
#if wxUSE_ODBC && wxUSE_UNICODE
|
||||||
|
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||||
|
/* (ODBC classes aren't Unicode-compatible yet) */
|
||||||
|
# error "wxUSE_ODBC can't be used with wxUSE_UNICODE"
|
||||||
|
# else
|
||||||
|
# undef wxUSE_ODBC
|
||||||
|
# define wxUSE_ODBC 0
|
||||||
|
# endif
|
||||||
|
#endif /* wxUSE_ODBC */
|
||||||
|
|
||||||
/* the rest of the tests is for the GUI settings only */
|
/* the rest of the tests is for the GUI settings only */
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
|
@@ -1017,12 +1017,6 @@
|
|||||||
#define wxUSE_DEBUG_NEW_ALWAYS 0
|
#define wxUSE_DEBUG_NEW_ALWAYS 0
|
||||||
#endif // wxUSE_MFC
|
#endif // wxUSE_MFC
|
||||||
|
|
||||||
// ODBC classes aren't Unicode-compatible yet
|
|
||||||
#if wxUSE_UNICODE
|
|
||||||
#undef wxUSE_ODBC
|
|
||||||
#define wxUSE_ODBC 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Only WIN32 supports wxStatusBar95
|
// Only WIN32 supports wxStatusBar95
|
||||||
#if !defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
|
#if !defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#ifndef _WX_CURSOR_H_
|
#ifndef _WX_CURSOR_H_
|
||||||
#define _WX_CURSOR_H_
|
#define _WX_CURSOR_H_
|
||||||
|
|
||||||
#include <wx/image.h>
|
#include "wx/image.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "cursor.h"
|
#pragma interface "cursor.h"
|
||||||
|
@@ -1086,12 +1086,6 @@
|
|||||||
#define wxUSE_DEBUG_NEW_ALWAYS 0
|
#define wxUSE_DEBUG_NEW_ALWAYS 0
|
||||||
#endif // wxUSE_MFC
|
#endif // wxUSE_MFC
|
||||||
|
|
||||||
// ODBC classes aren't Unicode-compatible yet
|
|
||||||
#if wxUSE_UNICODE
|
|
||||||
#undef wxUSE_ODBC
|
|
||||||
#define wxUSE_ODBC 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (!defined(WIN32) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)
|
#if (!defined(WIN32) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)
|
||||||
// Can't use OLE drag and drop in Windows 3.1 because we don't know how
|
// Can't use OLE drag and drop in Windows 3.1 because we don't know how
|
||||||
// to implement UUIDs
|
// to implement UUIDs
|
||||||
|
@@ -1063,12 +1063,6 @@
|
|||||||
#define wxUSE_DEBUG_NEW_ALWAYS 0
|
#define wxUSE_DEBUG_NEW_ALWAYS 0
|
||||||
#endif // wxUSE_MFC
|
#endif // wxUSE_MFC
|
||||||
|
|
||||||
// ODBC classes aren't Unicode-compatible yet
|
|
||||||
#if wxUSE_UNICODE
|
|
||||||
#undef wxUSE_ODBC
|
|
||||||
#define wxUSE_ODBC 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (!defined(WIN32) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)
|
#if (!defined(WIN32) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)
|
||||||
// Can't use OLE drag and drop in Windows 3.1 because we don't know how
|
// Can't use OLE drag and drop in Windows 3.1 because we don't know how
|
||||||
// to implement UUIDs
|
// to implement UUIDs
|
||||||
|
@@ -174,6 +174,19 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
When this file is included, sometimes the wxCHECK_W32API_VERSION macro
|
||||||
|
is undefined. With for example CodeWarrior this gives problems with
|
||||||
|
the following code:
|
||||||
|
#if 0 && wxCHECK_W32API_VERSION( 0, 5 )
|
||||||
|
Because CodeWarrior does macro expansion before test evaluation.
|
||||||
|
We define wxCHECK_W32API_VERSION here if it's undefined.
|
||||||
|
*/
|
||||||
|
#if !defined(__GNUG__) && !defined(wxCHECK_W32API_VERSION)
|
||||||
|
#define wxCHECK_W32API_VERSION(maj, min) (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
// StartDoc
|
// StartDoc
|
||||||
|
|
||||||
#ifdef StartDoc
|
#ifdef StartDoc
|
||||||
|
@@ -17,11 +17,11 @@
|
|||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/ownerdrw.h"
|
#include "wx/ownerdrw.h"
|
||||||
@@ -32,50 +32,50 @@
|
|||||||
class OwnerDrawnApp: public wxApp
|
class OwnerDrawnApp: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define a new frame type
|
// Define a new frame type
|
||||||
class OwnerDrawnFrame : public wxFrame
|
class OwnerDrawnFrame : public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// ctor & dtor
|
// ctor & dtor
|
||||||
OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
|
OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
|
||||||
~OwnerDrawnFrame();
|
~OwnerDrawnFrame();
|
||||||
|
|
||||||
// notifications
|
// notifications
|
||||||
void OnQuit (wxCommandEvent& event);
|
void OnQuit (wxCommandEvent& event);
|
||||||
void OnAbout (wxCommandEvent& event);
|
void OnAbout (wxCommandEvent& event);
|
||||||
void OnListboxSelect (wxCommandEvent& event);
|
void OnListboxSelect (wxCommandEvent& event);
|
||||||
void OnCheckboxToggle (wxCommandEvent& event);
|
void OnCheckboxToggle (wxCommandEvent& event);
|
||||||
void OnListboxDblClick (wxCommandEvent& event);
|
void OnListboxDblClick (wxCommandEvent& event);
|
||||||
bool OnClose () { return TRUE; }
|
bool OnClose () { return TRUE; }
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitMenu();
|
void InitMenu();
|
||||||
|
|
||||||
wxCheckListBox *m_pListBox;
|
wxCheckListBox *m_pListBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
Menu_Quit = 1,
|
Menu_Quit = 1,
|
||||||
Menu_First = 100,
|
Menu_First = 100,
|
||||||
Menu_Test1, Menu_Test2, Menu_Test3,
|
Menu_Test1, Menu_Test2, Menu_Test3,
|
||||||
Menu_Bitmap, Menu_Bitmap2,
|
Menu_Bitmap, Menu_Bitmap2,
|
||||||
Menu_Submenu, Menu_Sub1, Menu_Sub2, Menu_Sub3,
|
Menu_Submenu, Menu_Sub1, Menu_Sub2, Menu_Sub3,
|
||||||
Control_First = 1000,
|
Control_First = 1000,
|
||||||
Control_Listbox, Control_Listbox2,
|
Control_Listbox, Control_Listbox2,
|
||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(OwnerDrawnFrame, wxFrame)
|
BEGIN_EVENT_TABLE(OwnerDrawnFrame, wxFrame)
|
||||||
EVT_MENU(Menu_Quit, OwnerDrawnFrame::OnQuit)
|
EVT_MENU(Menu_Quit, OwnerDrawnFrame::OnQuit)
|
||||||
EVT_LISTBOX(Control_Listbox, OwnerDrawnFrame::OnListboxSelect)
|
EVT_LISTBOX(Control_Listbox, OwnerDrawnFrame::OnListboxSelect)
|
||||||
EVT_CHECKLISTBOX(Control_Listbox, OwnerDrawnFrame::OnCheckboxToggle)
|
EVT_CHECKLISTBOX(Control_Listbox, OwnerDrawnFrame::OnCheckboxToggle)
|
||||||
EVT_COMMAND(Control_Listbox, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
|
EVT_COMMAND(Control_Listbox, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
|
||||||
OwnerDrawnFrame::OnListboxDblClick)
|
OwnerDrawnFrame::OnListboxDblClick)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_APP(OwnerDrawnApp);
|
IMPLEMENT_APP(OwnerDrawnApp);
|
||||||
@@ -83,173 +83,194 @@ IMPLEMENT_APP(OwnerDrawnApp);
|
|||||||
// init our app: create windows
|
// init our app: create windows
|
||||||
bool OwnerDrawnApp::OnInit(void)
|
bool OwnerDrawnApp::OnInit(void)
|
||||||
{
|
{
|
||||||
OwnerDrawnFrame *pFrame = new OwnerDrawnFrame(NULL, "wxWindows Ownerdraw Sample",
|
OwnerDrawnFrame *pFrame
|
||||||
50, 50, 450, 340);
|
= new OwnerDrawnFrame(NULL, "wxWindows Ownerdraw Sample",
|
||||||
SetTopWindow(pFrame);
|
50, 50, 450, 340);
|
||||||
|
|
||||||
return TRUE;
|
SetTopWindow(pFrame);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the menu bar for the main frame
|
// create the menu bar for the main frame
|
||||||
void OwnerDrawnFrame::InitMenu()
|
void OwnerDrawnFrame::InitMenu()
|
||||||
{
|
{
|
||||||
// Make a menubar
|
// Make a menubar
|
||||||
wxMenu *file_menu = new wxMenu,
|
wxMenu *file_menu = new wxMenu,
|
||||||
*sub_menu = new wxMenu;
|
*sub_menu = new wxMenu;
|
||||||
|
|
||||||
// vars used for menu construction
|
// vars used for menu construction
|
||||||
wxMenuItem *pItem;
|
wxMenuItem *pItem;
|
||||||
wxFont fontLarge(18, wxROMAN, wxNORMAL, wxBOLD, FALSE),
|
wxFont fontLarge(18, wxROMAN, wxNORMAL, wxBOLD, FALSE),
|
||||||
fontUlined(12, wxDEFAULT, wxNORMAL, wxNORMAL, TRUE),
|
fontUlined(12, wxDEFAULT, wxNORMAL, wxNORMAL, TRUE),
|
||||||
fontItalic(12, wxMODERN, wxITALIC, wxBOLD, FALSE),
|
fontItalic(12, wxMODERN, wxITALIC, wxBOLD, FALSE),
|
||||||
// should be at least of the size of bitmaps
|
// should be at least of the size of bitmaps
|
||||||
fontBmp(14, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE);
|
fontBmp(14, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE);
|
||||||
|
|
||||||
// sorry for my artistic skills...
|
// sorry for my artistic skills...
|
||||||
wxBitmap bmpBell("bell"), bmpSound("sound"), bmpNoSound("nosound");
|
wxBitmap bmpBell("bell"), bmpSound("sound"), bmpNoSound("nosound");
|
||||||
|
|
||||||
// construct submenu
|
// construct submenu
|
||||||
pItem = new wxMenuItem(sub_menu, Menu_Sub1, "Submenu &first", "large", TRUE);
|
pItem = new wxMenuItem(sub_menu, Menu_Sub1, "Submenu &first", "large");
|
||||||
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(fontLarge);
|
||||||
pItem->SetFont(*wxSMALL_FONT);
|
sub_menu->Append(pItem);
|
||||||
file_menu->Append(pItem);
|
|
||||||
file_menu->Check(Menu_Test2, TRUE);
|
|
||||||
|
|
||||||
pItem = new wxMenuItem(file_menu, Menu_Test3, "&Disabled", "disabled item");
|
pItem = new wxMenuItem(sub_menu, Menu_Sub2, "Submenu &second", "italic",
|
||||||
pItem->SetFont(*wxNORMAL_FONT);
|
wxITEM_CHECK);
|
||||||
file_menu->Append(pItem);
|
pItem->SetFont(fontItalic);
|
||||||
file_menu->Enable(Menu_Test3, FALSE);
|
sub_menu->Append(pItem);
|
||||||
|
|
||||||
file_menu->AppendSeparator();
|
pItem = new wxMenuItem(sub_menu, Menu_Sub3, "Submenu &third", "underlined",
|
||||||
|
wxITEM_CHECK);
|
||||||
|
pItem->SetFont(fontUlined);
|
||||||
|
sub_menu->Append(pItem);
|
||||||
|
|
||||||
pItem = new wxMenuItem(file_menu, Menu_Bitmap, "&Bell", "check/uncheck me!", TRUE);
|
// construct menu
|
||||||
pItem->SetFont(fontBmp);
|
pItem = new wxMenuItem(file_menu, Menu_Test1, "&Uncheckable", "red item");
|
||||||
pItem->SetBitmaps(bmpBell);
|
pItem->SetFont(*wxITALIC_FONT);
|
||||||
file_menu->Append(pItem);
|
pItem->SetTextColour(wxColor(255, 0, 0));
|
||||||
|
pItem->SetMarginWidth(23);
|
||||||
|
file_menu->Append(pItem);
|
||||||
|
|
||||||
pItem = new wxMenuItem(file_menu, Menu_Bitmap2, "So&und", "icon changes!", TRUE);
|
pItem = new wxMenuItem(file_menu, Menu_Test2, "&Checkable",
|
||||||
pItem->SetFont(fontBmp);
|
"checkable item", wxITEM_CHECK);
|
||||||
pItem->SetBitmaps(bmpSound, bmpNoSound);
|
pItem->SetFont(*wxSMALL_FONT);
|
||||||
file_menu->Append(pItem);
|
file_menu->Append(pItem);
|
||||||
|
file_menu->Check(Menu_Test2, TRUE);
|
||||||
|
|
||||||
file_menu->AppendSeparator();
|
pItem = new wxMenuItem(file_menu, Menu_Test3, "&Disabled", "disabled item");
|
||||||
|
pItem->SetFont(*wxNORMAL_FONT);
|
||||||
|
file_menu->Append(pItem);
|
||||||
|
file_menu->Enable(Menu_Test3, FALSE);
|
||||||
|
|
||||||
pItem = new wxMenuItem(file_menu, Menu_Submenu, "&Sub menu", "", TRUE, sub_menu);
|
file_menu->AppendSeparator();
|
||||||
pItem->SetFont(*wxSWISS_FONT);
|
|
||||||
file_menu->Append(pItem);
|
|
||||||
|
|
||||||
file_menu->AppendSeparator();
|
pItem = new wxMenuItem(file_menu, Menu_Bitmap, "&Bell",
|
||||||
file_menu->Append(Menu_Quit, "&Quit", "Normal item");
|
"check/uncheck me!", wxITEM_CHECK);
|
||||||
|
pItem->SetFont(fontBmp);
|
||||||
|
pItem->SetBitmaps(bmpBell);
|
||||||
|
file_menu->Append(pItem);
|
||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar;
|
pItem = new wxMenuItem(file_menu, Menu_Bitmap2, "So&und",
|
||||||
|
"icon changes!", wxITEM_CHECK);
|
||||||
|
pItem->SetFont(fontBmp);
|
||||||
|
pItem->SetBitmaps(bmpSound, bmpNoSound);
|
||||||
|
file_menu->Append(pItem);
|
||||||
|
|
||||||
menu_bar->Append(file_menu, "&File");
|
file_menu->AppendSeparator();
|
||||||
SetMenuBar(menu_bar);
|
|
||||||
|
pItem = new wxMenuItem(file_menu, Menu_Submenu, "&Sub menu", "",
|
||||||
|
wxITEM_CHECK, 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
|
// main frame constructor
|
||||||
OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, char *title,
|
||||||
|
int x, int y, int w, int h)
|
||||||
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
|
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
|
||||||
{
|
{
|
||||||
// set the icon
|
// set the icon
|
||||||
SetIcon(wxIcon("mondrian"));
|
SetIcon(wxIcon("mondrian"));
|
||||||
|
|
||||||
// create the menu
|
// create the menu
|
||||||
InitMenu();
|
InitMenu();
|
||||||
|
|
||||||
// create the status line
|
// create the status line
|
||||||
const int widths[] = { -1, 60 };
|
const int widths[] = { -1, 60 };
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
SetStatusWidths(2, widths);
|
SetStatusWidths(2, widths);
|
||||||
SetStatusText("no selection", 0);
|
SetStatusText("no selection", 0);
|
||||||
|
|
||||||
// make a panel with some controls
|
// make a panel with some controls
|
||||||
wxPanel *pPanel = new wxPanel(this, -1, wxPoint(0, 0),
|
wxPanel *pPanel = new wxPanel(this, -1, wxPoint(0, 0),
|
||||||
wxSize(400, 200), wxTAB_TRAVERSAL);
|
wxSize(400, 200), wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
// check list box
|
// check list box
|
||||||
static const char* aszChoices[] = { "Hello", "world", "and",
|
static const char* aszChoices[] = { "Hello", "world", "and",
|
||||||
"goodbye", "cruel", "world",
|
"goodbye", "cruel", "world",
|
||||||
"-------", "owner-drawn", "listbox" };
|
"-------", "owner-drawn", "listbox" };
|
||||||
|
|
||||||
wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
|
wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
|
||||||
unsigned int ui;
|
unsigned int ui;
|
||||||
for ( ui = 0; ui < WXSIZEOF(aszChoices); ui++ )
|
for ( ui = 0; ui < WXSIZEOF(aszChoices); ui++ )
|
||||||
astrChoices[ui] = aszChoices[ui];
|
astrChoices[ui] = aszChoices[ui];
|
||||||
|
|
||||||
m_pListBox = new wxCheckListBox
|
m_pListBox = new wxCheckListBox
|
||||||
(
|
(
|
||||||
pPanel, // parent
|
pPanel, // parent
|
||||||
Control_Listbox, // control id
|
Control_Listbox, // control id
|
||||||
wxPoint(10, 10), // listbox poistion
|
wxPoint(10, 10), // listbox position
|
||||||
wxSize(200, 200), // listbox size
|
wxSize(200, 200), // listbox size
|
||||||
WXSIZEOF(aszChoices), // number of strings
|
WXSIZEOF(aszChoices), // number of strings
|
||||||
astrChoices // array of strings
|
astrChoices // array of strings
|
||||||
);
|
);
|
||||||
|
|
||||||
delete [] astrChoices;
|
|
||||||
|
|
||||||
for ( ui = 0; ui < WXSIZEOF(aszChoices); ui += 2 ) {
|
delete [] astrChoices;
|
||||||
m_pListBox->GetItem(ui)->SetBackgroundColour(wxColor(200, 200, 200));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pListBox->Check(2);
|
for ( ui = 0; ui < WXSIZEOF(aszChoices); ui += 2 )
|
||||||
|
{
|
||||||
|
m_pListBox->GetItem(ui)->SetBackgroundColour(wxColor(200, 200, 200));
|
||||||
|
}
|
||||||
|
|
||||||
// normal (but owner-drawn) listbox
|
m_pListBox->Check(2);
|
||||||
static const char* aszColors[] = { "Red", "Blue", "Pink",
|
|
||||||
"Green", "Yellow",
|
|
||||||
"Black", "Violet" };
|
|
||||||
struct { unsigned int 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
|
// normal (but owner-drawn) listbox
|
||||||
(
|
static const char* aszColors[] = { "Red", "Blue", "Pink",
|
||||||
pPanel, // parent
|
"Green", "Yellow",
|
||||||
Control_Listbox2, // control id
|
"Black", "Violet" };
|
||||||
wxPoint(220, 10), // listbox poistion
|
struct { unsigned int r, g, b; } aColors[] =
|
||||||
wxDefaultSize, // listbox size
|
{
|
||||||
WXSIZEOF(aszColors), // number of strings
|
{255,0,0}, {0,0,255}, {255,128,192},
|
||||||
astrChoices, // array of strings
|
{0,255,0}, {255,255,128},
|
||||||
wxLB_OWNERDRAW, // owner-drawn
|
{0,0,0}, {128,0,255}
|
||||||
wxDefaultValidator, //
|
};
|
||||||
wxListBoxNameStr
|
|
||||||
);
|
|
||||||
|
|
||||||
for ( ui = 0; ui < WXSIZEOF(aszColors); ui++ ) {
|
astrChoices = new wxString[WXSIZEOF(aszColors)];
|
||||||
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));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] astrChoices;
|
for ( ui = 0; ui < WXSIZEOF(aszColors); ui++ )
|
||||||
|
{
|
||||||
|
astrChoices[ui] = aszColors[ui];
|
||||||
|
}
|
||||||
|
|
||||||
Show(TRUE);
|
wxListBox *pListBox = new wxListBox
|
||||||
|
(
|
||||||
|
pPanel, // parent
|
||||||
|
Control_Listbox2, // control id
|
||||||
|
wxPoint(220, 10), // listbox position
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] astrChoices;
|
||||||
|
|
||||||
|
Show(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
OwnerDrawnFrame::~OwnerDrawnFrame()
|
OwnerDrawnFrame::~OwnerDrawnFrame()
|
||||||
@@ -258,40 +279,40 @@ OwnerDrawnFrame::~OwnerDrawnFrame()
|
|||||||
|
|
||||||
void OwnerDrawnFrame::OnQuit(wxCommandEvent& event)
|
void OwnerDrawnFrame::OnQuit(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
Close(TRUE);
|
Close(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OwnerDrawnFrame::OnAbout(wxCommandEvent& event)
|
void OwnerDrawnFrame::OnAbout(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxMessageDialog dialog(this,
|
wxMessageDialog dialog(this,
|
||||||
"Demo of owner-drawn controls\n",
|
"Demo of owner-drawn controls\n",
|
||||||
"About wxOwnerDrawn", wxYES_NO | wxCANCEL);
|
"About wxOwnerDrawn", wxYES_NO | wxCANCEL);
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
|
void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxString strSelection;
|
wxString strSelection;
|
||||||
unsigned int nSel = event.GetSelection();
|
unsigned int nSel = event.GetSelection();
|
||||||
strSelection.sprintf(wxT("item %d selected (%schecked)"), nSel,
|
strSelection.sprintf(wxT("item %d selected (%schecked)"), nSel,
|
||||||
m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not "));
|
m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not "));
|
||||||
SetStatusText(strSelection);
|
SetStatusText(strSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& event)
|
void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxString strSelection;
|
wxString strSelection;
|
||||||
strSelection.sprintf(wxT("item %d double clicked"),
|
strSelection.sprintf(wxT("item %d double clicked"),
|
||||||
m_pListBox->GetSelection());
|
m_pListBox->GetSelection());
|
||||||
wxMessageDialog dialog(this, strSelection);
|
wxMessageDialog dialog(this, strSelection);
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event)
|
void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxString strSelection;
|
wxString strSelection;
|
||||||
unsigned int nItem = event.GetInt();
|
unsigned int nItem = event.GetInt();
|
||||||
strSelection.sprintf(wxT("item %d was %schecked"), nItem,
|
strSelection.sprintf(wxT("item %d was %schecked"), nItem,
|
||||||
m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un"));
|
m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un"));
|
||||||
SetStatusText(strSelection);
|
SetStatusText(strSelection);
|
||||||
}
|
}
|
||||||
|
@@ -416,8 +416,7 @@ bool wxPropertyListView::CreateControls()
|
|||||||
if (!panel)
|
if (!panel)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
wxSystemSettings settings;
|
wxFont guiFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
wxFont *boringFont =
|
wxFont *boringFont =
|
||||||
|
@@ -956,8 +956,8 @@ bool wxDialUpManagerMSW::IsAlwaysOnline() const
|
|||||||
if ( pfnInternetGetConnectedState(&flags, 0 /* reserved */) )
|
if ( pfnInternetGetConnectedState(&flags, 0 /* reserved */) )
|
||||||
{
|
{
|
||||||
// there is some connection to the net, see of which type
|
// there is some connection to the net, see of which type
|
||||||
ms_isAlwaysOnline = (flags & INTERNET_CONNECTION_LAN != 0) ||
|
ms_isAlwaysOnline = ((flags & INTERNET_CONNECTION_LAN) != 0)
|
||||||
(flags & INTERNET_CONNECTION_PROXY != 0);
|
|| ((flags & INTERNET_CONNECTION_PROXY) != 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user