wxToolBar API changes; now frames manage their toolbar & statusbar properly;
client area position is used in SetSize; changes for BC++ & VC++ 1.5; wxWindow::GetUpdateRegion added; removed wxUpdateIterator; some missing functions added to process.cpp; bad navigation key event cast fixed; MDI and toolbar samples updated; new wxMSW wxRegion constructor (WXHRGN) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -102,6 +102,9 @@
|
||||
#include <wx/file.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 512
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// implementation of wxFile
|
||||
@@ -401,7 +404,12 @@ bool wxTempFile::Open(const wxString& strName)
|
||||
wxSplitPath(strName, &strPath, NULL, NULL);
|
||||
if ( strPath.IsEmpty() )
|
||||
strPath = '.'; // GetTempFileName will fail if we give it empty string
|
||||
#ifdef __WIN32__
|
||||
if ( !GetTempFileName(strPath, "wx_",0, m_strTemp.GetWriteBuf(MAX_PATH)) )
|
||||
#else
|
||||
// Not sure why MSVC++ 1.5 header defines first param as BYTE - bug?
|
||||
if ( !GetTempFileName((BYTE) (const char*) strPath, "wx_",0, m_strTemp.GetWriteBuf(MAX_PATH)) )
|
||||
#endif
|
||||
wxLogLastError("GetTempFileName");
|
||||
m_strTemp.UngetWriteBuf();
|
||||
#endif // Windows/Unix
|
||||
|
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <wx/file.h>
|
||||
#include <wx/textfile.h>
|
||||
#include <wx/utils.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
// other standard headers
|
||||
@@ -786,7 +787,7 @@ const char *wxSysErrorMsg(unsigned long nErrCode)
|
||||
LocalFree(lpMsgBuf);
|
||||
|
||||
// returned string is capitalized and ended with '\r\n' - bad
|
||||
s_szBuf[0] = (char)tolower(s_szBuf[0]);
|
||||
s_szBuf[0] = (char)wxToLower(s_szBuf[0]);
|
||||
size_t len = strlen(s_szBuf);
|
||||
if ( len > 0 ) {
|
||||
// truncate string
|
||||
|
@@ -39,9 +39,19 @@ wxProcess::wxProcess(wxEvtHandler *parent, int id)
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
wxProcess::~wxProcess()
|
||||
{
|
||||
}
|
||||
|
||||
void wxProcess::OnTerminate(int pid)
|
||||
{
|
||||
wxProcessEvent event(m_id, pid);
|
||||
|
||||
ProcessEvent(event);
|
||||
}
|
||||
|
||||
wxProcessEvent::wxProcessEvent(int id, int pid):
|
||||
wxEvent(id), m_pid(pid)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include "wx/tbarbase.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarBase, wxControl)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxToolBarBase, wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool, wxObject)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
|
||||
@@ -88,8 +88,8 @@ wxToolBarBase::wxToolBarBase(void) : m_tools(wxKEY_INTEGER)
|
||||
{
|
||||
gs_ToolBars.Append(this);
|
||||
|
||||
m_tilingDirection = wxVERTICAL;
|
||||
m_rowsOrColumns = 0;
|
||||
m_maxRows = 1;
|
||||
m_maxCols = 32000;
|
||||
m_maxWidth = 0;
|
||||
m_maxHeight = 0;
|
||||
m_defaultWidth = 16;
|
||||
@@ -148,9 +148,12 @@ void wxToolBarBase::OnRightClick(int toolIndex, long x, long y)
|
||||
|
||||
// Called when the mouse cursor enters a tool bitmap (no button pressed).
|
||||
// Argument is -1 if mouse is exiting the toolbar.
|
||||
// Note that for this event, the id of the window is used,
|
||||
// and the integer parameter of wxCommandEvent is used to retrieve
|
||||
// the tool id.
|
||||
void wxToolBarBase::OnMouseEnter ( int toolIndex )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex);
|
||||
wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, GetId());
|
||||
event.SetEventObject(this);
|
||||
event.SetInt(toolIndex);
|
||||
|
||||
@@ -369,94 +372,6 @@ void wxToolBarBase::Command(wxCommandEvent& event)
|
||||
|
||||
void wxToolBarBase::Layout(void)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX = m_xMargin;
|
||||
m_lastY = m_yMargin;
|
||||
int maxToolWidth = 0;
|
||||
int maxToolHeight = 0;
|
||||
m_maxWidth = 0;
|
||||
m_maxHeight = 0;
|
||||
|
||||
// Find the maximum tool width and height
|
||||
wxNode *node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
||||
if (tool->GetWidth() > maxToolWidth)
|
||||
maxToolWidth = (int)tool->GetWidth();
|
||||
if (tool->GetHeight() > maxToolHeight)
|
||||
maxToolHeight = (int)tool->GetHeight();
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
int separatorSize = m_toolSeparation;
|
||||
|
||||
node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
||||
if (tool->m_toolStyle == wxTOOL_STYLE_SEPARATOR)
|
||||
{
|
||||
if (m_tilingDirection == wxHORIZONTAL)
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_rowsOrColumns)
|
||||
m_lastY += separatorSize;
|
||||
else
|
||||
m_lastX += separatorSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_rowsOrColumns)
|
||||
m_lastX += separatorSize;
|
||||
else
|
||||
m_lastY += separatorSize;
|
||||
}
|
||||
}
|
||||
else if (tool->m_toolStyle == wxTOOL_STYLE_BUTTON)
|
||||
{
|
||||
if (m_tilingDirection == wxHORIZONTAL)
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_rowsOrColumns)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX = m_xMargin;
|
||||
m_lastY += maxToolHeight + m_toolPacking;
|
||||
}
|
||||
tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
|
||||
tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
|
||||
|
||||
m_lastX += maxToolWidth + m_toolPacking;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_rowsOrColumns)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX += (maxToolWidth + m_toolPacking);
|
||||
m_lastY = m_yMargin;
|
||||
}
|
||||
tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
|
||||
tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
|
||||
|
||||
m_lastY += maxToolHeight + m_toolPacking;
|
||||
}
|
||||
m_currentRowsOrColumns ++;
|
||||
}
|
||||
|
||||
if (m_lastX > m_maxWidth)
|
||||
m_maxWidth = m_lastX;
|
||||
if (m_lastY > m_maxHeight)
|
||||
m_maxHeight = m_lastY;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
if (m_tilingDirection == wxVERTICAL)
|
||||
m_maxWidth += maxToolWidth;
|
||||
else
|
||||
m_maxHeight += maxToolHeight;
|
||||
|
||||
m_maxWidth += m_xMargin;
|
||||
m_maxHeight += m_yMargin;
|
||||
}
|
||||
|
||||
|
||||
@@ -781,20 +696,6 @@ void wxToolBarBase::ViewStart (int *x, int *y) const
|
||||
*y = m_yScrollPosition;
|
||||
}
|
||||
|
||||
/*
|
||||
void wxToolBarBase::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{
|
||||
*xx = (m_calcScrolledOffset ? (x - m_xScrollPosition * m_xScrollPixelsPerLine) : x);
|
||||
*yy = (m_calcScrolledOffset ? (y - m_yScrollPosition * m_yScrollPixelsPerLine) : y);
|
||||
}
|
||||
|
||||
void wxToolBarBase::CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const
|
||||
{
|
||||
*xx = (float)(m_calcScrolledOffset ? (x + m_xScrollPosition * m_xScrollPixelsPerLine) : x);
|
||||
*yy = (float)(m_calcScrolledOffset ? (y + m_yScrollPosition * m_yScrollPixelsPerLine) : y);
|
||||
}
|
||||
*/
|
||||
|
||||
void wxToolBarBase::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
wxWindow::OnIdle(event);
|
||||
|
@@ -47,10 +47,13 @@ static wxPen * white_pen = NULL,
|
||||
|
||||
wxToolBarSimple::wxToolBarSimple(void)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX = 0;
|
||||
m_lastY = 0;
|
||||
}
|
||||
|
||||
bool wxToolBarSimple::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style,
|
||||
int direction, int RowsOrColumns, const wxString& name )
|
||||
const wxString& name )
|
||||
{
|
||||
if ( ! wxWindow::Create(parent, id, pos, size, style, name) )
|
||||
return FALSE;
|
||||
@@ -79,12 +82,10 @@ bool wxToolBarSimple::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos
|
||||
{
|
||||
thick_black_pen = new wxPen("BLACK", 3, wxSOLID);
|
||||
}
|
||||
m_tilingDirection = direction;
|
||||
m_rowsOrColumns = RowsOrColumns;
|
||||
if ( m_tilingDirection == wxVERTICAL )
|
||||
{ m_lastX = 3; m_lastY = 7; }
|
||||
else
|
||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
||||
{ m_lastX = 7; m_lastY = 3; }
|
||||
else
|
||||
{ m_lastX = 3; m_lastY = 7; }
|
||||
m_maxWidth = m_maxHeight = 0;
|
||||
m_pressedTool = m_currentTool = -1;
|
||||
m_xMargin = 0;
|
||||
@@ -356,4 +357,97 @@ void wxToolBarSimple::SpringUpButton(int index)
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolBarSimple::Layout(void)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX = m_xMargin;
|
||||
m_lastY = m_yMargin;
|
||||
int maxToolWidth = 0;
|
||||
int maxToolHeight = 0;
|
||||
m_maxWidth = 0;
|
||||
m_maxHeight = 0;
|
||||
|
||||
// Find the maximum tool width and height
|
||||
wxNode *node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
||||
if (tool->GetWidth() > maxToolWidth)
|
||||
maxToolWidth = (int)tool->GetWidth();
|
||||
if (tool->GetHeight() > maxToolHeight)
|
||||
maxToolHeight = (int)tool->GetHeight();
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
int separatorSize = m_toolSeparation;
|
||||
|
||||
node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
||||
if (tool->m_toolStyle == wxTOOL_STYLE_SEPARATOR)
|
||||
{
|
||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_maxCols)
|
||||
m_lastY += separatorSize;
|
||||
else
|
||||
m_lastX += separatorSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_maxRows)
|
||||
m_lastX += separatorSize;
|
||||
else
|
||||
m_lastY += separatorSize;
|
||||
}
|
||||
}
|
||||
else if (tool->m_toolStyle == wxTOOL_STYLE_BUTTON)
|
||||
{
|
||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_maxCols)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX = m_xMargin;
|
||||
m_lastY += maxToolHeight + m_toolPacking;
|
||||
}
|
||||
tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
|
||||
tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
|
||||
|
||||
m_lastX += maxToolWidth + m_toolPacking;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_maxRows)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX += (maxToolWidth + m_toolPacking);
|
||||
m_lastY = m_yMargin;
|
||||
}
|
||||
tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
|
||||
tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
|
||||
|
||||
m_lastY += maxToolHeight + m_toolPacking;
|
||||
}
|
||||
m_currentRowsOrColumns ++;
|
||||
}
|
||||
|
||||
if (m_lastX > m_maxWidth)
|
||||
m_maxWidth = m_lastX;
|
||||
if (m_lastY > m_maxHeight)
|
||||
m_maxHeight = m_lastY;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
||||
m_maxWidth += maxToolWidth;
|
||||
else
|
||||
m_maxHeight += maxToolHeight;
|
||||
|
||||
m_maxWidth += m_xMargin;
|
||||
m_maxHeight += m_yMargin;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -106,6 +106,8 @@ void wxButton::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
int actualWidth = width;
|
||||
int actualHeight = height;
|
||||
int ww, hh;
|
||||
|
@@ -130,6 +130,8 @@ void wxCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
char buf[300];
|
||||
|
||||
int current_width, cyf;
|
||||
@@ -280,6 +282,8 @@ void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlag
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
HWND button = (HWND) GetHWND();
|
||||
/*
|
||||
if (w1<0)
|
||||
|
@@ -192,6 +192,8 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
// If we're prepared to use the existing size, then...
|
||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||
{
|
||||
|
@@ -117,12 +117,6 @@ wxPaintDC::wxPaintDC(wxWindow *the_canvas)
|
||||
}
|
||||
|
||||
m_canvas = the_canvas;
|
||||
RECT updateRect1 = g_paintStruct.rcPaint;
|
||||
m_canvas->m_updateRect.x = updateRect1.left;
|
||||
m_canvas->m_updateRect.y = updateRect1.top;
|
||||
m_canvas->m_updateRect.width = updateRect1.right - updateRect1.left;
|
||||
m_canvas->m_updateRect.height = updateRect1.bottom - updateRect1.top;
|
||||
// m_canvas->m_paintHDC = m_staticPaintHDC ;
|
||||
}
|
||||
|
||||
wxPaintDC::~wxPaintDC(void)
|
||||
@@ -131,8 +125,6 @@ wxPaintDC::~wxPaintDC(void)
|
||||
|
||||
if (m_staticPaintCount == 0)
|
||||
{
|
||||
// m_canvas->m_paintHDC = 0;
|
||||
|
||||
if ( m_hDC && m_canvas)
|
||||
{
|
||||
::EndPaint((HWND) m_canvas->GetHWND(), &g_paintStruct);
|
||||
@@ -149,3 +141,4 @@ wxPaintDC::~wxPaintDC(void)
|
||||
wxDebugMsg("~wxPaintDC: Did not release HDC\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/toolbar.h"
|
||||
#include "wx/menuitem.h"
|
||||
|
||||
#ifdef LoadAccelerators
|
||||
@@ -154,19 +155,23 @@ WXHMENU wxFrame::GetWinMenu(void) const
|
||||
return m_hMenu;
|
||||
}
|
||||
|
||||
// Get size *available for subwindows* i.e. excluding menu bar etc.
|
||||
// For XView, this is the same as GetSize
|
||||
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
|
||||
void wxFrame::GetClientSize(int *x, int *y) const
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect((HWND) GetHWND(), &rect);
|
||||
|
||||
if ( m_frameStatusBar )
|
||||
if ( GetStatusBar() )
|
||||
{
|
||||
int statusX, statusY;
|
||||
m_frameStatusBar->GetClientSize(&statusX, &statusY);
|
||||
rect.bottom -= statusY;
|
||||
int statusX, statusY;
|
||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
||||
rect.bottom -= statusY;
|
||||
}
|
||||
|
||||
wxPoint pt(GetClientAreaOrigin());
|
||||
rect.bottom -= pt.y;
|
||||
rect.right -= pt.x;
|
||||
|
||||
*x = rect.right;
|
||||
*y = rect.bottom;
|
||||
}
|
||||
@@ -189,13 +194,17 @@ void wxFrame::SetClientSize(int width, int height)
|
||||
int actual_width = rect2.right - rect2.left - rect.right + width;
|
||||
int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
|
||||
|
||||
if ( m_frameStatusBar )
|
||||
if ( GetStatusBar() )
|
||||
{
|
||||
int statusX, statusY;
|
||||
m_frameStatusBar->GetClientSize(&statusX, &statusY);
|
||||
actual_height += statusY;
|
||||
int statusX, statusY;
|
||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
||||
actual_height += statusY;
|
||||
}
|
||||
|
||||
wxPoint pt(GetClientAreaOrigin());
|
||||
actual_width += pt.y;
|
||||
actual_height += pt.x;
|
||||
|
||||
POINT point;
|
||||
point.x = rect2.left;
|
||||
point.y = rect2.top;
|
||||
@@ -339,19 +348,21 @@ void wxFrame::SetIcon(const wxIcon& icon)
|
||||
#endif
|
||||
}
|
||||
|
||||
wxStatusBar *wxFrame::OnCreateStatusBar(int number)
|
||||
wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
|
||||
const wxString& name)
|
||||
{
|
||||
wxStatusBar *statusBar = NULL;
|
||||
|
||||
#if USE_NATIVE_STATUSBAR
|
||||
if (UsesNativeStatusBar())
|
||||
{
|
||||
statusBar = new wxStatusBar95(this);
|
||||
statusBar = new wxStatusBar95(this, id, style);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
statusBar = new wxStatusBar(this, -1, wxPoint(0, 0), wxSize(100, 20));
|
||||
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20),
|
||||
style, name);
|
||||
|
||||
// Set the height according to the font and the border size
|
||||
wxClientDC dc(statusBar);
|
||||
@@ -369,20 +380,22 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number)
|
||||
return statusBar;
|
||||
}
|
||||
|
||||
bool wxFrame::CreateStatusBar(int number)
|
||||
wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id,
|
||||
const wxString& name)
|
||||
{
|
||||
// VZ: calling CreateStatusBar twice is an error - why anyone would do it?
|
||||
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE,
|
||||
"recreating status bar in wxFrame" );
|
||||
|
||||
m_frameStatusBar = OnCreateStatusBar(number);
|
||||
m_frameStatusBar = OnCreateStatusBar(number, style, id,
|
||||
name);
|
||||
if ( m_frameStatusBar )
|
||||
{
|
||||
PositionStatusBar();
|
||||
return TRUE;
|
||||
return m_frameStatusBar;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxFrame::SetStatusText(const wxString& text, int number)
|
||||
@@ -413,6 +426,9 @@ void wxFrame::PositionStatusBar(void)
|
||||
GetClientSize(&w, &h);
|
||||
int sw, sh;
|
||||
m_frameStatusBar->GetSize(&sw, &sh);
|
||||
|
||||
// Since we wish the status bar to be directly under the client area,
|
||||
// we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
|
||||
m_frameStatusBar->SetSize(0, h, w, sh);
|
||||
}
|
||||
}
|
||||
@@ -683,6 +699,8 @@ void wxFrame::MSWOnSize(int x, int y, WXUINT id)
|
||||
#endif
|
||||
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
|
||||
wxSizeEvent event(wxSize(x, y), m_windowId);
|
||||
event.SetEventObject( this );
|
||||
if (!GetEventHandler()->ProcessEvent(event))
|
||||
@@ -783,16 +801,6 @@ void wxFrame::OnSize(wxSizeEvent& event)
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
// Manage the toolbar if there is one
|
||||
if ( GetToolBar() )
|
||||
{
|
||||
int wt, ht;
|
||||
GetToolBar()->GetSize(&wt, &ht);
|
||||
clientH -= ht;
|
||||
y += ht;
|
||||
GetToolBar()->SetSize(0, 0, clientW, ht);
|
||||
}
|
||||
|
||||
child->SetSize(x, y, clientW, clientH);
|
||||
}
|
||||
}
|
||||
@@ -907,3 +915,79 @@ void wxFrame::ProcessCommand(int id)
|
||||
GetEventHandler()->ProcessEvent(commandEvent);
|
||||
}
|
||||
|
||||
// Checks if there is a toolbar, and returns the first free client position
|
||||
wxPoint wxFrame::GetClientAreaOrigin() const
|
||||
{
|
||||
wxPoint pt(0, 0);
|
||||
if (GetToolBar())
|
||||
{
|
||||
int w, h;
|
||||
GetToolBar()->GetSize(& w, & h);
|
||||
|
||||
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
|
||||
{
|
||||
pt.x += w;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt.y += h;
|
||||
}
|
||||
}
|
||||
return pt;
|
||||
}
|
||||
|
||||
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
|
||||
{
|
||||
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
|
||||
"recreating toolbar in wxFrame" );
|
||||
|
||||
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
|
||||
if (toolBar)
|
||||
{
|
||||
SetToolBar(toolBar);
|
||||
PositionToolBar();
|
||||
return toolBar;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
|
||||
{
|
||||
return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name);
|
||||
}
|
||||
|
||||
void wxFrame::PositionToolBar(void)
|
||||
{
|
||||
int cw, ch;
|
||||
|
||||
RECT rect;
|
||||
::GetClientRect((HWND) GetHWND(), &rect);
|
||||
|
||||
if ( GetStatusBar() )
|
||||
{
|
||||
int statusX, statusY;
|
||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
||||
rect.bottom -= statusY;
|
||||
}
|
||||
|
||||
if (GetToolBar())
|
||||
{
|
||||
int tw, th;
|
||||
GetToolBar()->GetSize(& tw, & th);
|
||||
|
||||
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
|
||||
{
|
||||
// Use the 'real' MSW position
|
||||
GetToolBar()->SetSize(0, 0, tw, rect.bottom, wxSIZE_NO_ADJUSTMENTS);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the 'real' MSW position
|
||||
GetToolBar()->SetSize(0, 0, rect.right, th, wxSIZE_NO_ADJUSTMENTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -107,6 +107,8 @@ void wxGauge95::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
// If we're prepared to use the existing size, then...
|
||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||
{
|
||||
|
@@ -154,6 +154,8 @@ void wxGaugeMSW::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
// If we're prepared to use the existing size, then...
|
||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||
{
|
||||
|
@@ -484,6 +484,8 @@ void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
// If we're prepared to use the existing size, then...
|
||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||
{
|
||||
|
@@ -78,7 +78,6 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\event.obj \
|
||||
$(COMMDIR)\file.obj \
|
||||
$(COMMDIR)\filefn.obj \
|
||||
$(COMMDIR)\fileconf.obj \
|
||||
$(COMMDIR)\framecmn.obj \
|
||||
$(COMMDIR)\gdicmn.obj \
|
||||
$(COMMDIR)\intl.obj \
|
||||
@@ -116,6 +115,8 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\extended.obj \
|
||||
$(COMMDIR)\wincmn.obj
|
||||
|
||||
# $(COMMDIR)\fileconf.obj # Doens't compile (nested classes)
|
||||
|
||||
MSWOBJS = \
|
||||
$(MSWDIR)\app.obj \
|
||||
$(MSWDIR)\bitmap.obj \
|
||||
@@ -829,6 +830,26 @@ $(COMMDIR)/time.obj: $*.$(SRCSUFF)
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/stream.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/fstream.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/mstream.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/zstream.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/datstrm.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
|
@@ -114,9 +114,9 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\mstream.obj \
|
||||
$(COMMDIR)\zstream.obj \
|
||||
$(COMMDIR)\stream.obj \
|
||||
$(COMMDIR)\datstrm.obj \
|
||||
$(COMMDIR)\wincmn.obj
|
||||
|
||||
# $(COMMDIR)\datstrm.obj
|
||||
|
||||
MSWOBJS = \
|
||||
$(MSWDIR)\app.obj \
|
||||
|
@@ -174,14 +174,7 @@ void wxMDIParentFrame::GetClientSize(int *x, int *y) const
|
||||
|
||||
int cwidth = rect.right;
|
||||
int cheight = rect.bottom;
|
||||
/*
|
||||
if (m_frameToolBar)
|
||||
{
|
||||
int tw, th;
|
||||
m_frameToolBar->GetSize(&tw, &th);
|
||||
cheight -= th;
|
||||
}
|
||||
*/
|
||||
|
||||
if ( GetStatusBar() )
|
||||
{
|
||||
int sw, sh;
|
||||
@@ -189,6 +182,10 @@ void wxMDIParentFrame::GetClientSize(int *x, int *y) const
|
||||
cheight -= sh;
|
||||
}
|
||||
|
||||
wxPoint pt(GetClientAreaOrigin());
|
||||
cheight -= pt.y;
|
||||
cwidth -= pt.x;
|
||||
|
||||
*x = cwidth;
|
||||
*y = cheight;
|
||||
}
|
||||
@@ -276,23 +273,18 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
||||
int y = 0;
|
||||
int width, height;
|
||||
GetClientSize(&width, &height);
|
||||
if ( GetToolBar() )
|
||||
{
|
||||
int wt, ht;
|
||||
GetToolBar()->GetSize(&wt, &ht);
|
||||
height -= ht;
|
||||
y += ht;
|
||||
GetToolBar()->SetSize(0, 0, width, ht);
|
||||
}
|
||||
|
||||
if ( GetClientWindow() )
|
||||
GetClientWindow()->SetSize(x, y, width, height);
|
||||
|
||||
/* Already done in MSWOnSize
|
||||
// forward WM_SIZE to status bar control
|
||||
#if USE_NATIVE_STATUSBAR
|
||||
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
|
||||
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
||||
#endif
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
||||
@@ -461,6 +453,7 @@ void wxMDIParentFrame::MSWOnSize(int x, int y, WXUINT id)
|
||||
#endif
|
||||
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
|
||||
wxSizeEvent event(wxSize(x, y), m_windowId);
|
||||
event.SetEventObject( this );
|
||||
@@ -914,6 +907,7 @@ void wxMDIChildFrame::MSWOnSize(int x, int y, WXUINT id)
|
||||
#endif
|
||||
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
|
||||
wxWindow::MSWOnSize(x, y, id);
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#include <penwin.h>
|
||||
#endif
|
||||
|
||||
HANDLE s_hPenWin = (HANDLE)NULL;
|
||||
HANDLE g_hPenWin = (HANDLE)NULL;
|
||||
typedef void (CALLBACK * PENREGPROC)(WORD,BOOL);
|
||||
|
||||
// The routine below allows Windows applications (binaries) to
|
||||
@@ -56,17 +56,17 @@ void wxEnablePenAppHooks (bool hook)
|
||||
#ifndef __WIN32__
|
||||
if (hook)
|
||||
{
|
||||
if (s_hPenWin)
|
||||
if (g_hPenWin)
|
||||
return;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// If running on a Pen Windows system, register this app so all
|
||||
// EDIT controls in dialogs are replaced by HEDIT controls.
|
||||
if ((s_hPenWin = (HANDLE)GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL)
|
||||
if ((g_hPenWin = (HANDLE)GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL)
|
||||
{
|
||||
// We do this fancy GetProcAddress simply because we don't
|
||||
// know if we're running Pen Windows.
|
||||
if ((RegPenApp = (PENREGPROC)GetProcAddress (s_hPenWin, "RegisterPenApp")) != NULL)
|
||||
if ((RegPenApp = (PENREGPROC)GetProcAddress (g_hPenWin, "RegisterPenApp")) != NULL)
|
||||
(*RegPenApp) (RPA_DEFAULT, TRUE);
|
||||
}
|
||||
}
|
||||
@@ -74,12 +74,12 @@ void wxEnablePenAppHooks (bool hook)
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// If running on a Pen Windows system, unregister
|
||||
if (s_hPenWin)
|
||||
if (g_hPenWin)
|
||||
{
|
||||
// Unregister this app
|
||||
if (RegPenApp != NULL)
|
||||
(*RegPenApp) (RPA_DEFAULT, FALSE);
|
||||
s_hPenWin = (HANDLE) NULL;
|
||||
g_hPenWin = (HANDLE) NULL;
|
||||
}
|
||||
}
|
||||
#endif /* ! Windows-NT */
|
||||
@@ -97,10 +97,10 @@ void wxRegisterPenWin(void)
|
||||
// (Notice the CONTROL statement in the RC file is "EDIT",
|
||||
// RegisterPenApp will automatically change that control to
|
||||
// an HEDIT.
|
||||
if ((s_hPenWin = (HANDLE)GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) {
|
||||
if ((g_hPenWin = (HANDLE)GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) {
|
||||
// We do this fancy GetProcAddress simply because we don't
|
||||
// know if we're running Pen Windows.
|
||||
if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(s_hPenWin, "RegisterPenApp"))!= NULL)
|
||||
if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(g_hPenWin, "RegisterPenApp"))!= NULL)
|
||||
(*RegPenApp)(RPA_DEFAULT, TRUE);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
@@ -110,8 +110,8 @@ void wxRegisterPenWin(void)
|
||||
void wxCleanUpPenWin(void)
|
||||
{
|
||||
#if USE_PENWINDOWS
|
||||
if (s_hPenWin) {
|
||||
// Unregister this app
|
||||
if (g_hPenWin) {
|
||||
// Unregister this app
|
||||
if (RegPenApp != NULL)
|
||||
(*RegPenApp)(RPA_DEFAULT, FALSE);
|
||||
}
|
||||
|
@@ -172,7 +172,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
|
||||
wxWindow *win = CreateAbortWindow(parent, printout);
|
||||
wxYield();
|
||||
|
||||
#if defined(__BORLANDC__) || defined(__GNUWIN32__)
|
||||
#if defined(__BORLANDC__) || defined(__GNUWIN32__) || !defined(__WIN32__)
|
||||
::SetAbortProc((HDC) dc->GetHDC(), (FARPROC) lpAbortProc);
|
||||
#else
|
||||
::SetAbortProc((HDC) dc->GetHDC(), (int (_stdcall *)
|
||||
|
@@ -410,6 +410,8 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
yy = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(xx, yy, sizeFlags);
|
||||
|
||||
char buf[400];
|
||||
|
||||
int y_offset = yy;
|
||||
@@ -576,6 +578,15 @@ void wxRadioBox::GetPosition(int *x, int *y) const
|
||||
{
|
||||
::ScreenToClient((HWND) parent->GetHWND(), &point);
|
||||
}
|
||||
// We may be faking the client origin.
|
||||
// So a window that's really at (0, 30) may appear
|
||||
// (to wxWin apps) to be at (0, 0).
|
||||
if (GetParent())
|
||||
{
|
||||
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
||||
point.x -= pt.x;
|
||||
point.y -= pt.y;
|
||||
}
|
||||
|
||||
*x = point.x;
|
||||
*y = point.y;
|
||||
|
@@ -77,6 +77,12 @@ wxRegion::wxRegion(void)
|
||||
M_REGION = ::CreateRectRgn(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
wxRegion::wxRegion(WXHRGN hRegion)
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
M_REGION = (HRGN) hRegion;
|
||||
}
|
||||
|
||||
wxRegion::wxRegion(long x, long y, long w, long h)
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
|
@@ -328,6 +328,15 @@ void wxSlider95::GetPosition(int *x, int *y) const
|
||||
if (parent)
|
||||
::ScreenToClient((HWND) parent->GetHWND(), &point);
|
||||
|
||||
// We may be faking the client origin.
|
||||
// So a window that's really at (0, 30) may appear
|
||||
// (to wxWin apps) to be at (0, 0).
|
||||
if (GetParent())
|
||||
{
|
||||
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
||||
point.x -= pt.x;
|
||||
point.y -= pt.y;
|
||||
}
|
||||
*x = point.x;
|
||||
*y = point.y;
|
||||
}
|
||||
@@ -346,6 +355,8 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
char buf[300];
|
||||
|
||||
int x_offset = x;
|
||||
|
@@ -302,6 +302,15 @@ void wxSliderMSW::GetPosition(int *x, int *y) const
|
||||
if (parent)
|
||||
::ScreenToClient((HWND) parent->GetHWND(), &point);
|
||||
|
||||
// We may be faking the client origin.
|
||||
// So a window that's really at (0, 30) may appear
|
||||
// (to wxWin apps) to be at (0, 0).
|
||||
if (GetParent())
|
||||
{
|
||||
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
||||
point.x -= pt.x;
|
||||
point.y -= pt.y;
|
||||
}
|
||||
*x = point.x;
|
||||
*y = point.y;
|
||||
}
|
||||
@@ -320,6 +329,8 @@ void wxSliderMSW::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
char buf[300];
|
||||
|
||||
int x_offset = x;
|
||||
|
@@ -93,6 +93,8 @@ void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
int actualWidth = width;
|
||||
int actualHeight = height;
|
||||
|
||||
|
@@ -117,6 +117,8 @@ void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
// If we're prepared to use the existing size, then...
|
||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||
{
|
||||
|
@@ -104,6 +104,8 @@ void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
int actualWidth = width;
|
||||
int actualHeight = height;
|
||||
|
||||
|
@@ -64,6 +64,12 @@ Set the TBSTYLE_CUSTOMERASE style, then handle the
|
||||
NM_CUSTOMDRAW message and do your custom drawing.
|
||||
*/
|
||||
|
||||
#define DEFAULTBITMAPX 16
|
||||
#define DEFAULTBITMAPY 15
|
||||
#define DEFAULTBUTTONX 24
|
||||
#define DEFAULTBUTTONY 24
|
||||
#define DEFAULTBARHEIGHT 27
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
|
||||
|
||||
@@ -80,9 +86,6 @@ void wxMapBitmap(HBITMAP hBitmap, int width, int height);
|
||||
|
||||
wxToolBar95::wxToolBar95(void)
|
||||
{
|
||||
m_tilingDirection = wxVERTICAL ;
|
||||
m_rowsOrColumns = 0;
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_maxWidth = -1;
|
||||
m_maxHeight = -1;
|
||||
m_hBitmap = 0;
|
||||
@@ -91,8 +94,7 @@ wxToolBar95::wxToolBar95(void)
|
||||
}
|
||||
|
||||
bool wxToolBar95::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||
long style, int orientation,
|
||||
int RowsOrColumns, const wxString& name)
|
||||
long style, const wxString& name)
|
||||
{
|
||||
m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
|
||||
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
|
||||
@@ -102,11 +104,8 @@ bool wxToolBar95::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, co
|
||||
m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
|
||||
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
|
||||
|
||||
m_tilingDirection = orientation;
|
||||
if (m_tilingDirection == wxHORIZONTAL)
|
||||
wxMessageBox("Sorry, wxToolBar95 under Windows 95 only supports vertical tiling.\nPass the number of rows.", "wxToolBar95 usage", wxOK);
|
||||
m_rowsOrColumns = RowsOrColumns;
|
||||
m_currentRowsOrColumns = 0;
|
||||
if (style & wxTB_VERTICAL)
|
||||
wxMessageBox("Sorry, wxToolBar95 under Windows 95 only supports vertical tiling.", "wxToolBar95 usage", wxOK);
|
||||
m_maxWidth = -1;
|
||||
m_maxHeight = -1;
|
||||
|
||||
@@ -305,7 +304,7 @@ bool wxToolBar95::CreateTools(void)
|
||||
ans = (int)::SendMessage((HWND) GetHWND(), TB_AUTOSIZE, (WPARAM)0, (LPARAM) 0);
|
||||
|
||||
RECT rect;
|
||||
::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_rowsOrColumns, TRUE), (LPARAM) & rect);
|
||||
::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_maxRows, TRUE), (LPARAM) & rect);
|
||||
m_maxWidth = (rect.right - rect.left + 2);
|
||||
m_maxHeight = (rect.bottom - rect.top + 2);
|
||||
|
||||
@@ -368,7 +367,7 @@ bool wxToolBar95::MSWNotify(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxToolBar95::SetDefaultSize(const wxSize& size)
|
||||
void wxToolBar95::SetToolBitmapSize(const wxSize& size)
|
||||
{
|
||||
m_defaultWidth = size.x; m_defaultHeight = size.y;
|
||||
::SendMessage((HWND) GetHWND(), TB_SETBITMAPSIZE, 0, (LPARAM) MAKELONG ((int)size.x, (int)size.y));
|
||||
@@ -387,7 +386,7 @@ wxSize wxToolBar95::GetMaxSize(void) const
|
||||
if (m_maxWidth == -1 | m_maxHeight == -1)
|
||||
{
|
||||
RECT rect;
|
||||
::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_rowsOrColumns, TRUE), (LPARAM) & rect);
|
||||
::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_maxRows, TRUE), (LPARAM) & rect);
|
||||
((wxToolBar95 *)this)->m_maxWidth = (rect.right - rect.left + 2); // ???
|
||||
((wxToolBar95 *)this)->m_maxHeight = (rect.bottom - rect.top + 2); // ???
|
||||
}
|
||||
@@ -403,7 +402,7 @@ void wxToolBar95::GetSize(int *w, int *h) const
|
||||
}
|
||||
|
||||
// The button size is bigger than the bitmap size
|
||||
wxSize wxToolBar95::GetDefaultButtonSize(void) const
|
||||
wxSize wxToolBar95::GetToolSize(void) const
|
||||
{
|
||||
return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
|
||||
}
|
||||
|
@@ -38,6 +38,12 @@
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/msw/dib.h"
|
||||
|
||||
#define DEFAULTBITMAPX 16
|
||||
#define DEFAULTBITMAPY 15
|
||||
#define DEFAULTBUTTONX 24
|
||||
#define DEFAULTBUTTONY 22
|
||||
#define DEFAULTBARHEIGHT 27
|
||||
|
||||
/////// Non-Windows 95 implementation
|
||||
|
||||
#if !USE_IMAGE_LOADING_IN_MSW
|
||||
@@ -69,15 +75,12 @@ wxToolBarMSW::wxToolBarMSW(void)
|
||||
}
|
||||
|
||||
bool wxToolBarMSW::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||
long style, int orientation,
|
||||
int RowsOrColumns, const wxString& name)
|
||||
long style, const wxString& name)
|
||||
{
|
||||
if ( ! wxWindow::Create(parent, id, pos, size, style, name) )
|
||||
return FALSE;
|
||||
|
||||
m_tilingDirection = orientation;
|
||||
m_rowsOrColumns = RowsOrColumns;
|
||||
if ( m_tilingDirection == wxVERTICAL )
|
||||
if ( style & wxTB_HORIZONTAL )
|
||||
{ m_lastX = 3; m_lastY = 7; }
|
||||
else
|
||||
{ m_lastX = 7; m_lastY = 3; }
|
||||
@@ -112,7 +115,7 @@ wxToolBarMSW::~wxToolBarMSW(void)
|
||||
FreeGlobalObjects();
|
||||
}
|
||||
|
||||
void wxToolBarMSW::SetDefaultSize(const wxSize& size)
|
||||
void wxToolBarMSW::SetToolBitmapSize(const wxSize& size)
|
||||
{
|
||||
m_defaultWidth = size.x; m_defaultHeight = size.y;
|
||||
FreeGlobalObjects();
|
||||
@@ -120,7 +123,7 @@ void wxToolBarMSW::SetDefaultSize(const wxSize& size)
|
||||
}
|
||||
|
||||
// The button size is bigger than the bitmap size
|
||||
wxSize wxToolBarMSW::GetDefaultButtonSize(void) const
|
||||
wxSize wxToolBarMSW::GetToolSize(void) const
|
||||
{
|
||||
return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
|
||||
}
|
||||
@@ -361,7 +364,7 @@ wxToolBarTool *wxToolBarMSW::AddTool(int index, const wxBitmap& bitmap, const wx
|
||||
tool->m_y = m_yMargin;
|
||||
|
||||
tool->m_deleteSecondBitmap = TRUE;
|
||||
tool->SetSize(GetDefaultButtonWidth(), GetDefaultButtonHeight());
|
||||
tool->SetSize(GetToolSize().x, GetToolSize().y);
|
||||
|
||||
// Calculate reasonable max size in case Layout() not called
|
||||
if ((tool->m_x + bitmap.GetWidth() + m_xMargin) > m_maxWidth)
|
||||
@@ -374,6 +377,99 @@ wxToolBarTool *wxToolBarMSW::AddTool(int index, const wxBitmap& bitmap, const wx
|
||||
return tool;
|
||||
}
|
||||
|
||||
void wxToolBarMSW::Layout(void)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX = m_xMargin;
|
||||
m_lastY = m_yMargin;
|
||||
int maxToolWidth = 0;
|
||||
int maxToolHeight = 0;
|
||||
m_maxWidth = 0;
|
||||
m_maxHeight = 0;
|
||||
|
||||
// Find the maximum tool width and height
|
||||
wxNode *node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
||||
if (tool->GetWidth() > maxToolWidth)
|
||||
maxToolWidth = (int)tool->GetWidth();
|
||||
if (tool->GetHeight() > maxToolHeight)
|
||||
maxToolHeight = (int)tool->GetHeight();
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
int separatorSize = m_toolSeparation;
|
||||
|
||||
node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
||||
if (tool->m_toolStyle == wxTOOL_STYLE_SEPARATOR)
|
||||
{
|
||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_maxCols)
|
||||
m_lastY += separatorSize;
|
||||
else
|
||||
m_lastX += separatorSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_maxRows)
|
||||
m_lastX += separatorSize;
|
||||
else
|
||||
m_lastY += separatorSize;
|
||||
}
|
||||
}
|
||||
else if (tool->m_toolStyle == wxTOOL_STYLE_BUTTON)
|
||||
{
|
||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_maxCols)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX = m_xMargin;
|
||||
m_lastY += maxToolHeight + m_toolPacking;
|
||||
}
|
||||
tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
|
||||
tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
|
||||
|
||||
m_lastX += maxToolWidth + m_toolPacking;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_currentRowsOrColumns >= m_maxRows)
|
||||
{
|
||||
m_currentRowsOrColumns = 0;
|
||||
m_lastX += (maxToolWidth + m_toolPacking);
|
||||
m_lastY = m_yMargin;
|
||||
}
|
||||
tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
|
||||
tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
|
||||
|
||||
m_lastY += maxToolHeight + m_toolPacking;
|
||||
}
|
||||
m_currentRowsOrColumns ++;
|
||||
}
|
||||
|
||||
if (m_lastX > m_maxWidth)
|
||||
m_maxWidth = m_lastX;
|
||||
if (m_lastY > m_maxHeight)
|
||||
m_maxHeight = m_lastY;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
||||
m_maxWidth += maxToolWidth;
|
||||
else
|
||||
m_maxHeight += maxToolHeight;
|
||||
|
||||
m_maxWidth += m_xMargin;
|
||||
m_maxHeight += m_yMargin;
|
||||
}
|
||||
|
||||
|
||||
bool wxToolBarMSW::InitGlobalObjects(void)
|
||||
{
|
||||
GetSysColors();
|
||||
@@ -384,7 +480,7 @@ bool wxToolBarMSW::InitGlobalObjects(void)
|
||||
if (!m_hdcMono)
|
||||
return FALSE;
|
||||
|
||||
m_hbmMono = (WXHBITMAP) CreateBitmap((int)GetDefaultButtonWidth(), (int)GetDefaultButtonHeight(), 1, 1, NULL);
|
||||
m_hbmMono = (WXHBITMAP) CreateBitmap((int)GetToolSize().x, (int)GetToolSize().y, 1, 1, NULL);
|
||||
if (!m_hbmMono)
|
||||
return FALSE;
|
||||
|
||||
@@ -448,12 +544,12 @@ void wxToolBarMSW::CreateMask(WXHDC hdc, int xoffset, int yoffset, int dx, int d
|
||||
// create mask based on color bitmap
|
||||
// convert this to 1's
|
||||
SetBkColor(hdcGlyphs, m_rgbFace);
|
||||
BitBlt((HDC) m_hdcMono, xoffset, yoffset, (int)GetDefaultWidth(), (int)GetDefaultHeight(),
|
||||
BitBlt((HDC) m_hdcMono, xoffset, yoffset, (int)GetToolBitmapSize().x, (int)GetToolBitmapSize().y,
|
||||
hdcGlyphs, 0, 0, SRCCOPY);
|
||||
// convert this to 1's
|
||||
SetBkColor(hdcGlyphs, m_rgbHilight);
|
||||
// OR in the new 1's
|
||||
BitBlt((HDC) m_hdcMono, xoffset, yoffset, (int)GetDefaultWidth(), (int)GetDefaultHeight(),
|
||||
BitBlt((HDC) m_hdcMono, xoffset, yoffset, (int)GetToolBitmapSize().x, (int)GetToolBitmapSize().y,
|
||||
hdcGlyphs, 0, 0, SRCPAINT);
|
||||
|
||||
SelectObject(hdcGlyphs, bitmapOld);
|
||||
@@ -538,7 +634,7 @@ void wxToolBarMSW::DrawButton(WXHDC hdc, int x, int y, int dx, int dy, wxToolBar
|
||||
// calculate offset of face from (x,y). y is always from the top,
|
||||
// so the offset is easy. x needs to be centered in face.
|
||||
yOffset = 1;
|
||||
xCenterOffset = (dxFace - (int)GetDefaultWidth())/2;
|
||||
xCenterOffset = (dxFace - (int)GetToolBitmapSize().x)/2;
|
||||
if (state & (wxTBSTATE_PRESSED | wxTBSTATE_CHECKED))
|
||||
{
|
||||
// pressed state moves down and to the right
|
||||
@@ -549,7 +645,7 @@ void wxToolBarMSW::DrawButton(WXHDC hdc, int x, int y, int dx, int dy, wxToolBar
|
||||
// now put on the face
|
||||
if (state & wxTBSTATE_ENABLED) {
|
||||
// regular version
|
||||
BitBlt((HDC) hdc, x+xCenterOffset, y + yOffset, (int)GetDefaultWidth(), (int)GetDefaultHeight(),
|
||||
BitBlt((HDC) hdc, x+xCenterOffset, y + yOffset, (int)GetToolBitmapSize().x, (int)GetToolBitmapSize().y,
|
||||
hdcGlyphs, 0, 0, SRCCOPY);
|
||||
} else {
|
||||
// disabled version (or indeterminate)
|
||||
|
@@ -314,6 +314,8 @@ void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
int cx; // button font dimensions
|
||||
int cy;
|
||||
|
||||
|
@@ -189,8 +189,8 @@ bool wxGetUserName(char *buf, int maxSize)
|
||||
// }
|
||||
#else
|
||||
#if !defined(__WATCOMC__) && !defined(__GNUWIN32__) && USE_PENWINDOWS
|
||||
extern HANDLE hPenWin; // PenWindows Running?
|
||||
if (hPenWin)
|
||||
extern HANDLE g_hPenWin; // PenWindows Running?
|
||||
if (g_hPenWin)
|
||||
{
|
||||
// PenWindows Does have a user concept!
|
||||
// Get the current owner of the recognizer
|
||||
@@ -365,9 +365,9 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
|
||||
# ifdef __WINDOWS_386__
|
||||
retValue = wxWIN386;
|
||||
# else
|
||||
# if !defined(__WATCOMC__) && !defined(GNUWIN32)
|
||||
extern HANDLE hPenWin;
|
||||
retValue = hPenWin ? wxPENWINDOWS : wxWINDOWS ;
|
||||
# if !defined(__WATCOMC__) && !defined(GNUWIN32) && USE_PENWINDOWS
|
||||
extern HANDLE g_hPenWin;
|
||||
retValue = g_hPenWin ? wxPENWINDOWS : wxWINDOWS ;
|
||||
# endif
|
||||
# endif
|
||||
// @@@@ To be completed. I don't have the manual here...
|
||||
|
@@ -621,6 +621,16 @@ void wxWindow::GetPosition(int *x, int *y) const
|
||||
{
|
||||
::ScreenToClient(hParentWnd, &point);
|
||||
}
|
||||
|
||||
// We may be faking the client origin.
|
||||
// So a window that's really at (0, 30) may appear
|
||||
// (to wxWin apps) to be at (0, 0).
|
||||
if (GetParent())
|
||||
{
|
||||
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
||||
point.x -= pt.x;
|
||||
point.y -= pt.y;
|
||||
}
|
||||
*x = point.x;
|
||||
*y = point.y;
|
||||
}
|
||||
@@ -633,6 +643,15 @@ void wxWindow::ScreenToClient(int *x, int *y) const
|
||||
pt.y = *y;
|
||||
::ScreenToClient(hWnd, &pt);
|
||||
|
||||
// We may be faking the client origin.
|
||||
// So a window that's really at (0, 30) may appear
|
||||
// (to wxWin apps) to be at (0, 0).
|
||||
if (GetParent())
|
||||
{
|
||||
wxPoint pt1(GetParent()->GetClientAreaOrigin());
|
||||
pt.x -= pt1.x;
|
||||
pt.y -= pt1.y;
|
||||
}
|
||||
*x = pt.x;
|
||||
*y = pt.y;
|
||||
}
|
||||
@@ -643,6 +662,17 @@ void wxWindow::ClientToScreen(int *x, int *y) const
|
||||
POINT pt;
|
||||
pt.x = *x;
|
||||
pt.y = *y;
|
||||
|
||||
// We may be faking the client origin.
|
||||
// So a window that's really at (0, 30) may appear
|
||||
// (to wxWin apps) to be at (0, 0).
|
||||
if (GetParent())
|
||||
{
|
||||
wxPoint pt1(GetParent()->GetClientAreaOrigin());
|
||||
pt.x += pt1.x;
|
||||
pt.y += pt1.y;
|
||||
}
|
||||
|
||||
::ClientToScreen(hWnd, &pt);
|
||||
|
||||
*x = pt.x;
|
||||
@@ -674,7 +704,6 @@ void wxWindow::SetCursor(const wxCursor& cursor)
|
||||
|
||||
|
||||
// Get size *available for subwindows* i.e. excluding menu bar etc.
|
||||
// For XView, this is the same as GetSize
|
||||
void wxWindow::GetClientSize(int *x, int *y) const
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
@@ -697,6 +726,8 @@ void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
actualY = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
|
||||
|
||||
int currentW,currentH;
|
||||
GetSize(¤tW, ¤tH);
|
||||
if (width == -1)
|
||||
@@ -745,6 +776,24 @@ void wxWindow::SetClientSize(int width, int height)
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
// For implementation purposes - sometimes decorations make the client area
|
||||
// smaller
|
||||
wxPoint wxWindow::GetClientAreaOrigin() const
|
||||
{
|
||||
return wxPoint(0, 0);
|
||||
}
|
||||
|
||||
// Makes an adjustment to the window position (for example, a frame that has
|
||||
// a toolbar that it manages itself).
|
||||
void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
|
||||
{
|
||||
if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent())
|
||||
{
|
||||
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
||||
x += pt.x; y += pt.y;
|
||||
}
|
||||
}
|
||||
|
||||
bool wxWindow::Show(bool show)
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
@@ -1956,6 +2005,19 @@ void wxWindow::MSWDetachWindowMenu(void)
|
||||
|
||||
bool wxWindow::MSWOnPaint(void)
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
|
||||
::GetUpdateRgn((HWND) GetHWND(), hRegion, FALSE);
|
||||
|
||||
m_updateRegion = wxRegion((WXHRGN) hRegion);
|
||||
#else
|
||||
RECT updateRect;
|
||||
::GetUpdateRect((HWND) GetHWND(), & updateRect, FALSE);
|
||||
|
||||
m_updateRegion = wxRegion(updateRect.left, updateRect.top,
|
||||
updateRect.right - updateRect.left, updateRect.bottom - updateRect.top);
|
||||
#endif
|
||||
|
||||
wxPaintEvent event(m_windowId);
|
||||
event.SetEventObject(this);
|
||||
if (!GetEventHandler()->ProcessEvent(event))
|
||||
@@ -2866,6 +2928,9 @@ void wxWindow::GetCaretPos(int *x, int *y) const
|
||||
*y = point.y;
|
||||
}
|
||||
|
||||
// OBSOLETE: use GetUpdateRegion instead.
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Update iterator. Use from within OnPaint.
|
||||
*/
|
||||
@@ -2952,6 +3017,7 @@ int wxUpdateIterator::GetH()
|
||||
{
|
||||
return ((RECT *)rp)[current].bottom-GetY();
|
||||
}
|
||||
#endif
|
||||
|
||||
wxWindow *wxGetActiveWindow(void)
|
||||
{
|
||||
@@ -4470,6 +4536,29 @@ bool wxWindow::AcceptsFocus() const
|
||||
return IsShown() && IsEnabled();
|
||||
}
|
||||
|
||||
// Update region access
|
||||
wxRegion wxWindow::GetUpdateRegion() const
|
||||
{
|
||||
return m_updateRegion;
|
||||
}
|
||||
|
||||
bool wxWindow::IsExposed(int x, int y, int w, int h) const
|
||||
{
|
||||
return (m_updateRegion.Contains(x, y, w, h) != wxOutRegion);
|
||||
}
|
||||
|
||||
bool wxWindow::IsExposed(const wxPoint& pt) const
|
||||
{
|
||||
return (m_updateRegion.Contains(pt) != wxOutRegion);
|
||||
}
|
||||
|
||||
bool wxWindow::IsExposed(const wxRect& rect) const
|
||||
{
|
||||
return (m_updateRegion.Contains(rect) != wxOutRegion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
static const char *GetMessageName(int message)
|
||||
{
|
||||
|
Reference in New Issue
Block a user