wxWindow split (MSW part of changes)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-05-10 00:42:57 +00:00
parent f03fc89fff
commit cc2b747254
27 changed files with 899 additions and 2160 deletions

View File

@@ -241,13 +241,12 @@ bool wxWindowBase::Close(bool force)
bool wxWindowBase::DestroyChildren()
{
wxWindowList::Node *node;
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
for ( node = GetChildren().GetFirst(); node; node = node->GetNext() )
{
wxWindow *child = node->GetData();
if ( child )
{
delete child;
delete node;
}
}

View File

@@ -319,8 +319,8 @@ void wxCheckListBox::InsertItems(int nItems, const wxString items[], int pos)
wxOwnerDrawn *wxCheckListBox::CreateItem(size_t nIndex)
{
wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this, nIndex);
if ( m_windowFont.Ok() )
pItem->SetFont(m_windowFont);
if ( m_font.Ok() )
pItem->SetFont(m_font);
return pItem;
}

View File

@@ -168,17 +168,17 @@ void wxControl::MSWOnMouseMove(int x, int y, WXUINT flags)
// Window gets a click down message followed by a mouse move
// message even if position isn't changed! We want to discard
// the trailing move event if x and y are the same.
if ((m_lastEvent == wxEVT_RIGHT_DOWN || m_lastEvent == wxEVT_LEFT_DOWN ||
m_lastEvent == wxEVT_MIDDLE_DOWN) &&
(m_lastXPos == event.GetX() && m_lastYPos == event.GetY()))
if ((m_lastMouseEvent == wxEVT_RIGHT_DOWN || m_lastMouseEvent == wxEVT_LEFT_DOWN ||
m_lastMouseEvent == wxEVT_MIDDLE_DOWN) &&
(m_lastMouseX == event.GetX() && m_lastMouseY == event.GetY()))
{
m_lastXPos = event.GetX(); m_lastYPos = event.GetY();
m_lastEvent = wxEVT_MOTION;
m_lastMouseX = event.GetX(); m_lastMouseY = event.GetY();
m_lastMouseEvent = wxEVT_MOTION;
return;
}
m_lastEvent = wxEVT_MOTION;
m_lastXPos = event.GetX(); m_lastYPos = event.GetY();
m_lastMouseEvent = wxEVT_MOTION;
m_lastMouseX = event.GetX(); m_lastMouseY = event.GetY();
if (!GetEventHandler()->ProcessEvent(event))
Default();
@@ -250,18 +250,6 @@ bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam,
#endif
}
/*
* Allocates control IDs within the appropriate range
*/
int NewControlId(void)
{
static int controlId = 0;
controlId ++;
return controlId;
}
void wxControl::ProcessCommand (wxCommandEvent & event)
{
// Tries:

View File

@@ -803,7 +803,7 @@ void wxDC::SetBackground(const wxBrush& brush)
{
if (m_backgroundBrush.GetStyle()==wxTRANSPARENT)
{
m_canvas->m_backgroundTransparent = TRUE;
m_canvas->SetTransparent(TRUE);
}
else
{
@@ -815,7 +815,7 @@ void wxDC::SetBackground(const wxBrush& brush)
// wxWindow::SetTransparency(). Should that apply to the child itself, or the
// parent?
// m_canvas->SetBackgroundColour(m_backgroundBrush.GetColour());
m_canvas->m_backgroundTransparent = FALSE;
m_canvas->SetTransparent(FALSE);
}
}
}

View File

@@ -415,9 +415,13 @@ bool wxDialog::Show(bool show)
// enable it, else we enable all modeless windows
if (last)
{
// VZ: I don't understand what this is supposed to do, so I'll leave
// it out for now and look for horrible consequences
wxDialog *box = (wxDialog *)last->Data();
HWND hwnd = (HWND) box->GetHWND();
if (box->m_winEnabled)
#if 0
if (box->IsUserEnabled())
#endif // 0
EnableWindow(hwnd, TRUE);
BringWindowToTop(hwnd);
}
@@ -429,7 +433,9 @@ bool wxDialog::Show(bool show)
wxWindow *win = (wxWindow *)node->Data();
HWND hwnd = (HWND) win->GetHWND();
// Only enable again if not user-disabled.
#if 0
if (win->IsUserEnabled())
#endif // 0
EnableWindow(hwnd, TRUE);
node = node->Next();
}

View File

@@ -75,7 +75,6 @@ wxFrame::wxFrame()
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
m_windowParent = NULL;
m_iconized = FALSE;
}
@@ -170,7 +169,7 @@ WXHMENU wxFrame::GetWinMenu() const
}
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
void wxFrame::GetClientSize(int *x, int *y) const
void wxFrame::DoGetClientSize(int *x, int *y) const
{
RECT rect;
::GetClientRect((HWND) GetHWND(), &rect);
@@ -230,7 +229,7 @@ void wxFrame::DoSetClientSize(int width, int height)
GetEventHandler()->ProcessEvent(event);
}
void wxFrame::GetSize(int *width, int *height) const
void wxFrame::DoGetSize(int *width, int *height) const
{
RECT rect;
GetWindowRect((HWND) GetHWND(), &rect);
@@ -238,7 +237,7 @@ void wxFrame::GetSize(int *width, int *height) const
*height = rect.bottom - rect.top;
}
void wxFrame::GetPosition(int *x, int *y) const
void wxFrame::DoGetPosition(int *x, int *y) const
{
RECT rect;
GetWindowRect((HWND) GetHWND(), &rect);

View File

@@ -182,14 +182,24 @@ int wxGauge95::GetValue(void) const
return m_gaugePos;
}
void wxGauge95::SetForegroundColour(const wxColour& col)
bool wxGauge95::SetForegroundColour(const wxColour& col)
{
m_foregroundColour = col ;
if ( !wxControl::SetForegroundColour(col) )
return FALSE;
m_foregroundColour = col ;
return TRUE;
}
void wxGauge95::SetBackgroundColour(const wxColour& col)
bool wxGauge95::SetBackgroundColour(const wxColour& col)
{
m_backgroundColour = col ;
if ( !wxControl::SetBackgroundColour(col) )
return FALSE;
m_backgroundColour = col ;
return TRUE;
}
#endif // wxUSE_GAUGE

View File

@@ -360,11 +360,14 @@ long wxListCtrl::ConvertToMSWStyle(long& oldStyle, long style) const
// Sets the background colour (GetBackgroundColour already implicit in
// wxWindow class)
void wxListCtrl::SetBackgroundColour(const wxColour& col)
bool wxListCtrl::SetBackgroundColour(const wxColour& col)
{
wxWindow::SetBackgroundColour(col);
if ( !wxWindow::SetBackgroundColour(col) )
return FALSE;
ListView_SetBkColor((HWND) GetHWND(), PALETTERGB(col.Red(), col.Green(), col.Blue()));
return TRUE;
}
// Gets information about this column

View File

@@ -159,12 +159,12 @@ wxMDIParentFrame::~wxMDIParentFrame()
if (m_clientWindow->MSWGetOldWndProc())
m_clientWindow->UnsubclassWin();
m_clientWindow->m_hWnd = 0;
m_clientWindow->SetHWND(0);
delete m_clientWindow;
}
// Get size *available for subwindows* i.e. excluding menu bar.
void wxMDIParentFrame::GetClientSize(int *x, int *y) const
void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
{
RECT rect;
::GetClientRect((HWND) GetHWND(), &rect);
@@ -662,7 +662,7 @@ wxMDIChildFrame::~wxMDIChildFrame()
// Set the client size (i.e. leave the calculation of borders etc.
// to wxWindows)
void wxMDIChildFrame::SetClientSize(int width, int height)
void wxMDIChildFrame::DoSetClientSize(int width, int height)
{
HWND hWnd = (HWND) GetHWND();
@@ -701,7 +701,7 @@ void wxMDIChildFrame::SetClientSize(int width, int height)
GetEventHandler()->ProcessEvent(event);
}
void wxMDIChildFrame::GetPosition(int *x, int *y) const
void wxMDIChildFrame::DoGetPosition(int *x, int *y) const
{
RECT rect;
GetWindowRect((HWND) GetHWND(), &rect);
@@ -1065,7 +1065,7 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
CLIENTCREATESTRUCT ccs;
m_windowStyle = style;
m_windowParent = parent;
m_parent = parent;
ccs.hWindowMenu = (HMENU) parent->GetWindowMenu();
ccs.idFirstChild = wxFIRST_MDI_CHILD;

View File

@@ -6,288 +6,296 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ===========================================================================
// declarations
// ===========================================================================
// ---------------------------------------------------------------------------
// headers
// ---------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation
#pragma implementation
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/wx.h"
#include <stdio.h>
#include "wx/wx.h"
#endif
#include "wx/spinbutt.h"
#include "wx/msw/private.h"
// ---------------------------------------------------------------------------
// global functions
// ---------------------------------------------------------------------------
extern wxWindow *wxWndHook;
extern LONG APIENTRY _EXPORT wxDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
extern LONG APIENTRY _EXPORT wxDlgProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
// ===========================================================================
// implementation
// ===========================================================================
bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID& id)
{
m_windowId = id;
m_windowId = id;
wxWndHook = this;
m_hWnd = (WXHWND) ::CreateDialog((HINSTANCE) wxGetInstance(), MAKEINTRESOURCE(id),
(HWND) (parent ? parent->GetHWND() : (WXHWND) NULL), (DLGPROC) wxDlgProc);
m_hWnd = (WXHWND)::CreateDialog((HINSTANCE)wxGetInstance(),
MAKEINTRESOURCE(id),
parent ? (HWND)parent->GetHWND() : 0,
(DLGPROC) wxDlgProc);
wxWndHook = NULL;
if ( !m_hWnd )
return FALSE;
if ( !m_hWnd )
return FALSE;
SubclassWin(GetHWND());
SubclassWin(GetHWND());
if (!parent)
wxTopLevelWindows.Append(this);
if ( parent )
parent->AddChild(this);
else
wxTopLevelWindows.Append(this);
if ( parent )
parent->AddChild(this);
// Enumerate all children
// Enumerate all children
HWND hWndNext;
hWndNext = ::GetWindow((HWND) m_hWnd, GW_CHILD);
wxWindow* child = NULL;
if (hWndNext)
child = CreateWindowFromHWND(this, (WXHWND) hWndNext);
wxWindow* child = NULL;
if (hWndNext)
child = CreateWindowFromHWND(this, (WXHWND) hWndNext);
while (hWndNext != (HWND) NULL)
{
hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT);
if (hWndNext)
child = CreateWindowFromHWND(this, (WXHWND) hWndNext);
hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT);
if (hWndNext)
child = CreateWindowFromHWND(this, (WXHWND) hWndNext);
}
return TRUE;
return TRUE;
}
bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name)
{
SetName(name);
SetName(name);
wxWndHook = this;
m_hWnd = (WXHWND) ::CreateDialog((HINSTANCE) wxGetInstance(), (const char *) name,
(HWND) (parent ? parent->GetHWND() : (WXHWND) NULL), (DLGPROC) wxDlgProc);
m_hWnd = (WXHWND)::CreateDialog((HINSTANCE) wxGetInstance(),
name.c_str(),
parent ? (HWND)parent->GetHWND() : 0,
(DLGPROC)wxDlgProc);
wxWndHook = NULL;
if ( !m_hWnd )
return FALSE;
if ( !m_hWnd )
return FALSE;
SubclassWin(GetHWND());
SubclassWin(GetHWND());
if (!parent)
wxTopLevelWindows.Append(this);
if ( parent )
parent->AddChild(this);
else
wxTopLevelWindows.Append(this);
if ( parent )
parent->AddChild(this);
// FIXME why don't we enum all children here?
return TRUE;
return TRUE;
}
wxWindow* wxWindow::GetWindowChild1(wxWindowID& id)
// ---------------------------------------------------------------------------
// look for child by id
// ---------------------------------------------------------------------------
wxWindow* wxWindow::GetWindowChild1(wxWindowID id)
{
if ( m_windowId == id )
return this;
if ( m_windowId == id )
return this;
wxNode *node = GetChildren().First();
while ( node )
{
wxWindow* child = (wxWindow*) node->Data();
wxWindow* win = child->GetWindowChild1(id);
if ( win )
return win;
node = node->Next();
}
wxWindowList::Node *node = GetChildren().GetFirst();
while ( node )
{
wxWindow* child = node->GetData();
wxWindow* win = child->GetWindowChild1(id);
if ( win )
return win;
return NULL;
node = node->GetNext();
}
return NULL;
}
wxWindow* wxWindow::GetWindowChild(wxWindowID& id)
wxWindow* wxWindow::GetWindowChild(wxWindowID id)
{
wxWindow* win = GetWindowChild1(id);
if ( !win )
{
HWND hWnd = ::GetDlgItem((HWND) GetHWND(), id);
wxWindow* win = GetWindowChild1(id);
if ( !win )
{
HWND hWnd = ::GetDlgItem((HWND) GetHWND(), id);
if (hWnd)
{
wxWindow* child = CreateWindowFromHWND(this, (WXHWND) hWnd);
if (child)
{
child->AddChild(this);
return child;
}
}
}
return NULL;
if (hWnd)
{
wxWindow* child = CreateWindowFromHWND(this, (WXHWND) hWnd);
if (child)
{
child->AddChild(this);
return child;
}
}
}
return NULL;
}
// ---------------------------------------------------------------------------
// create wxWin window from a native HWND
// ---------------------------------------------------------------------------
wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
{
char buf[256];
wxString str(wxGetWindowClass(hWnd));
str.UpperCase();
#ifndef __WIN32__
GetClassName((HWND) hWnd, buf, 256);
#else
#ifdef UNICODE
GetClassNameW((HWND) hWnd, buf, 256);
#else
#ifdef __TWIN32__
GetClassName((HWND) hWnd, buf, 256);
#else
GetClassNameA((HWND) hWnd, buf, 256);
#endif
#endif
#endif
long id = wxGetWindowId(hWnd);
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
wxString str(buf);
str.UpperCase();
wxWindow* win = NULL;
#ifndef __WIN32__
long id = (long) GetWindowWord((HWND) hWnd, GWW_ID);
#else
long id = GetWindowLong((HWND) hWnd, GWL_ID);
#endif
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
wxWindow* win = NULL;
if (str == "BUTTON")
{
int style1 = (style & 0xFF);
if ((style1 == BS_3STATE) || (style1 == BS_AUTO3STATE) || (style1 == BS_AUTOCHECKBOX) ||
(style1 == BS_CHECKBOX))
{
win = new wxCheckBox;
}
else if ((style1 == BS_AUTORADIOBUTTON) || (style1 == BS_RADIOBUTTON))
{
win = new wxRadioButton;
}
if (str == "BUTTON")
{
int style1 = (style & 0xFF);
if ((style1 == BS_3STATE) || (style1 == BS_AUTO3STATE) || (style1 == BS_AUTOCHECKBOX) ||
(style1 == BS_CHECKBOX))
{
win = new wxCheckBox;
}
else if ((style1 == BS_AUTORADIOBUTTON) || (style1 == BS_RADIOBUTTON))
{
win = new wxRadioButton;
}
#if defined(__WIN32__) && defined(BS_BITMAP)
else if (style & BS_BITMAP)
{
// TODO: how to find the bitmap?
win = new wxBitmapButton;
wxLogError("Have not yet implemented bitmap button as BS_BITMAP button.");
}
else if (style & BS_BITMAP)
{
// TODO: how to find the bitmap?
win = new wxBitmapButton;
wxLogError("Have not yet implemented bitmap button as BS_BITMAP button.");
}
#endif
else if (style1 == BS_OWNERDRAW)
{
// TODO: how to find the bitmap?
// TODO: can't distinguish between bitmap button and bitmap static.
// Change implementation of wxStaticBitmap to SS_BITMAP.
// PROBLEM: this assumes that we're using resource-based bitmaps.
// So maybe need 2 implementations of bitmap buttons/static controls,
// with a switch in the drawing code. Call default proc if BS_BITMAP.
win = new wxBitmapButton;
}
else if ((style1 == BS_PUSHBUTTON) || (style1 == BS_DEFPUSHBUTTON))
{
win = new wxButton;
}
else if (style1 == BS_GROUPBOX)
{
win = new wxStaticBox;
}
else
{
char buf[256];
sprintf(buf, "Don't know what kind of button this is: id = %d", (int) id);
wxLogError(buf);
}
}
else if (str == "COMBOBOX")
{
win = new wxComboBox;
}
// TODO: Problem if the user creates a multiline - but not rich text - text control,
// since wxWin assumes RichEdit control for this. Should have m_isRichText in
// wxTextCtrl. Also, convert as much of the window style as is necessary
// for correct functioning.
// Could have wxWindow::AdoptAttributesFromHWND(WXHWND)
// to be overridden by each control class.
else if (str == "EDIT")
{
win = new wxTextCtrl;
}
else if (str == "LISTBOX")
{
win = new wxListBox;
}
else if (str == "SCROLLBAR")
{
win = new wxScrollBar;
}
else if (style1 == BS_OWNERDRAW)
{
// TODO: how to find the bitmap?
// TODO: can't distinguish between bitmap button and bitmap static.
// Change implementation of wxStaticBitmap to SS_BITMAP.
// PROBLEM: this assumes that we're using resource-based bitmaps.
// So maybe need 2 implementations of bitmap buttons/static controls,
// with a switch in the drawing code. Call default proc if BS_BITMAP.
win = new wxBitmapButton;
}
else if ((style1 == BS_PUSHBUTTON) || (style1 == BS_DEFPUSHBUTTON))
{
win = new wxButton;
}
else if (style1 == BS_GROUPBOX)
{
win = new wxStaticBox;
}
else
{
wxLogError(_T("Don't know what kind of button this is: id = %d"),
id);
}
}
else if (str == "COMBOBOX")
{
win = new wxComboBox;
}
// TODO: Problem if the user creates a multiline - but not rich text - text control,
// since wxWin assumes RichEdit control for this. Should have m_isRichText in
// wxTextCtrl. Also, convert as much of the window style as is necessary
// for correct functioning.
// Could have wxWindow::AdoptAttributesFromHWND(WXHWND)
// to be overridden by each control class.
else if (str == "EDIT")
{
win = new wxTextCtrl;
}
else if (str == "LISTBOX")
{
win = new wxListBox;
}
else if (str == "SCROLLBAR")
{
win = new wxScrollBar;
}
#if defined(__WIN95__) && !defined(__TWIN32__)
else if (str == "MSCTLS_UPDOWN32")
{
win = new wxSpinButton;
}
else if (str == "MSCTLS_UPDOWN32")
{
win = new wxSpinButton;
}
#endif
else if (str == "MSCTLS_TRACKBAR32")
{
// Need to ascertain if it's horiz or vert
win = new wxSlider;
}
else if (str == "STATIC")
{
int style1 = (style & 0xFF);
else if (str == "MSCTLS_TRACKBAR32")
{
// Need to ascertain if it's horiz or vert
win = new wxSlider;
}
else if (str == "STATIC")
{
int style1 = (style & 0xFF);
if ((style1 == SS_LEFT) || (style1 == SS_RIGHT) || (style1 == SS_SIMPLE))
win = new wxStaticText;
if ((style1 == SS_LEFT) || (style1 == SS_RIGHT) || (style1 == SS_SIMPLE))
win = new wxStaticText;
#if defined(__WIN32__) && defined(BS_BITMAP)
else if (style1 == SS_BITMAP)
{
win = new wxStaticBitmap;
else if (style1 == SS_BITMAP)
{
win = new wxStaticBitmap;
// Help! this doesn't correspond with the wxWin implementation.
wxLogError("Please make SS_BITMAP statics into owner-draw buttons.");
}
// Help! this doesn't correspond with the wxWin implementation.
wxLogError("Please make SS_BITMAP statics into owner-draw buttons.");
}
#endif
}
else
{
wxString msg("Don't know how to convert from Windows class ");
msg += str;
wxLogError(msg);
}
}
else
{
wxString msg("Don't know how to convert from Windows class ");
msg += str;
wxLogError(msg);
}
if (win)
{
parent->AddChild(win);
win->SetEventHandler(win);
win->SetHWND(hWnd);
win->SetId(id);
win->SubclassWin(hWnd);
win->AdoptAttributesFromHWND();
win->SetupColours();
if (win)
{
parent->AddChild(win);
win->SetEventHandler(win);
win->SetHWND(hWnd);
win->SetId(id);
win->SubclassWin(hWnd);
win->AdoptAttributesFromHWND();
win->SetupColours();
return win;
}
else
return NULL;
return win;
}
else
return NULL;
}
// Make sure the window style (etc.) reflects the HWND style (roughly)
void wxWindow::AdoptAttributesFromHWND(void)
{
HWND hWnd = (HWND) GetHWND();
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
HWND hWnd = (HWND) GetHWND();
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
if (style & WS_VSCROLL)
m_windowStyle |= wxVSCROLL;
if (style & WS_HSCROLL)
m_windowStyle |= wxHSCROLL;
if (style & WS_VSCROLL)
m_windowStyle |= wxVSCROLL;
if (style & WS_HSCROLL)
m_windowStyle |= wxHSCROLL;
}

View File

@@ -46,13 +46,6 @@
// private functions
// ---------------------------------------------------------------------------
// get the id of the window
#ifdef __WIN32__
#define GET_WIN_ID(hwnd) ::GetWindowLong((HWND)hwnd, GWL_ID)
#else // Win16
#define GET_WIN_ID(hwnd) ::GetWindowWord((HWND)hwnd, GWW_ID)
#endif // Win32/16
// wnd proc for radio buttons
#ifdef __WIN32__
LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hWnd,
@@ -109,7 +102,7 @@ bool wxRadioBox::MSWCommand(WXUINT param, WXWORD id)
for ( int i = 0; i < m_noItems; i++ )
{
if ( id == GET_WIN_ID(m_radioButtons[i]) )
if ( id == wxGetWindowId(m_radioButtons[i]) )
{
selectedButton = i;
@@ -597,13 +590,16 @@ void wxRadioBox::Enable(int item, bool enable)
}
// Enable all controls
void wxRadioBox::Enable(bool enable)
bool wxRadioBox::Enable(bool enable)
{
wxControl::Enable(enable);
if ( !wxControl::Enable(enable) )
return FALSE;
int i;
for (i = 0; i < m_noItems; i++)
::EnableWindow((HWND) m_radioButtons[i], enable);
return TRUE;
}
// Show a specific button

View File

@@ -381,7 +381,7 @@ wxToolBarTool *wxToolBarMSW::AddTool(int index, const wxBitmap& bitmap, const wx
return tool;
}
void wxToolBarMSW::Layout(void)
void wxToolBarMSW::LayoutTools()
{
m_currentRowsOrColumns = 0;
m_lastX = m_xMargin;

View File

@@ -796,6 +796,10 @@ bool wxDirExists(const wxString& dir)
#endif
}
// ---------------------------------------------------------------------------
// window information functions
// ---------------------------------------------------------------------------
wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd)
{
wxString str;
@@ -806,6 +810,58 @@ wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd)
return str;
}
wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd)
{
wxString str;
int len = 256; // some starting value
for ( ;; )
{
// as we've #undefined GetClassName we must now manually choose the
// right function to call
int count =
#ifndef __WIN32__
GetClassName
#else // Win32
#ifdef UNICODE
GetClassNameW
#else // !Unicode
#ifdef __TWIN32__
GetClassName
#else // !Twin32
GetClassNameA
#endif // Twin32/!Twin32
#endif // Unicode/ANSI
#endif // Win16/32
((HWND)hWnd, str.GetWriteBuf(len), len);
str.UngetWriteBuf();
if ( count == len )
{
// the class name might have been truncated, retry with larger
// buffer
len *= 2;
}
else
{
break;
}
}
return str;
}
wxWindowID WXDLLEXPORT wxGetWindowId(WXHWND hWnd)
{
#ifndef __WIN32__
return (wxWindowID)GetWindowWord((HWND)hWnd, GWW_ID);
#else // Win32
return (wxWindowID)GetWindowLong((HWND)hWnd, GWL_ID);
#endif // Win16/32
}
#if 0
//------------------------------------------------------------------------
// wild character routines

File diff suppressed because it is too large Load Diff