Some Motif corrections; Dialog Editor compilation under Motif

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1424 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 1999-01-17 23:55:38 +00:00
parent 28d9589a71
commit 15d5ab6757
7 changed files with 108 additions and 56 deletions

View File

@ -83,7 +83,7 @@ wxString wxControl::GetLabel() const
}
else
{
XmStringFree(text);
// XmStringFree(text);
return wxEmptyString;
}
}

View File

@ -111,6 +111,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, width, height);
ChangeBackgroundColour();
@ -765,6 +766,13 @@ void wxListBox::ChangeBackgroundColour()
wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
XtVaSetValues (hsb,
XmNtroughColor, backgroundColour.AllocColour(XtDisplay(hsb)),
NULL);
XtVaSetValues (vsb,
XmNtroughColor, backgroundColour.AllocColour(XtDisplay(vsb)),
NULL);
DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
}

View File

@ -181,7 +181,18 @@ wxRadioBox::~wxRadioBox()
{
delete[] m_radioButtonLabels;
delete[] m_radioButtons;
DetachWidget(m_formWidget);
DetachWidget(m_mainWidget);
if (m_labelWidget)
XtDestroyWidget((Widget) m_labelWidget);
XtDestroyWidget((Widget) m_mainWidget);
XtDestroyWidget((Widget) m_formWidget);
m_mainWidget = (WXWidget) 0;
m_formWidget = (WXWidget) 0;
m_labelWidget = (WXWidget) 0;
}
wxString wxRadioBox::GetLabel(int item) const

View File

@ -161,6 +161,10 @@ void wxScrollBar::ChangeFont(bool keepOriginalSize)
void wxScrollBar::ChangeBackgroundColour()
{
wxWindow::ChangeBackgroundColour();
XtVaSetValues ((Widget) GetMainWidget(),
XmNtroughColor, m_backgroundColour.AllocColour(XtDisplay((Widget) GetMainWidget())),
NULL);
}
void wxScrollBar::ChangeForegroundColour()

View File

@ -127,6 +127,15 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
wxStaticBox::~wxStaticBox()
{
DetachWidget(m_formWidget);
DetachWidget(m_mainWidget);
XtDestroyWidget((Widget) m_mainWidget);
if (m_labelWidget)
XtDestroyWidget((Widget) m_labelWidget);
XtDestroyWidget((Widget) m_formWidget);
m_mainWidget = (WXWidget) 0;
m_labelWidget = (WXWidget) 0;
m_formWidget = (WXWidget) 0;
}
void wxStaticBox::SetLabel(const wxString& label)

View File

@ -71,7 +71,7 @@
static void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event);
wxResourceManager *wxResourceManager::sm_currentResourceManager = NULL;
#ifdef __WXGTK__
#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "bitmaps/load.xpm"
#include "bitmaps/save.xpm"
#include "bitmaps/new.xpm"
@ -158,7 +158,7 @@ bool wxResourceManager::Initialize()
GetWindowsDirectory(buf, 256);
strcat(buf, "\\dialoged.ini");
m_optionsResourceFilename = buf;
#elif defined(__WXGTK__)
#elif defined(__WXGTK__) || defined(__WXMOTIF__)
wxGetHomeDir( &m_optionsResourceFilename );
m_optionsResourceFilename += "/.dialogedrc";
#else
@ -181,7 +181,7 @@ bool wxResourceManager::Initialize()
#ifdef __WXMSW__
m_bitmapImage = new wxBitmap("WXWINBMP", wxBITMAP_TYPE_BMP_RESOURCE);
#endif
#ifdef __WXGTK__
#if defined(__WXGTK__) || defined(__WXMOTIF__)
m_bitmapImage = new wxBitmap( wxwin_xpm );
#endif
}
@ -322,7 +322,7 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *WXUNUSED(parent)
c->right.SameAs (m_editorFrame, wxRight, 0);
c->bottom.SameAs (m_editorFrame, wxBottom, 0);
c->width.Unconstrained();
#ifdef __WXGTK__
#if defined(__WXGTK__) || defined(__WXMOTIF__)
c->height.Absolute(105);
#else
c->height.Absolute(60);
@ -741,7 +741,11 @@ wxResourceEditorScrolledWindow *wxResourceManager::OnCreateEditorPanel(wxFrame *
{
wxResourceEditorScrolledWindow *panel = new wxResourceEditorScrolledWindow(parent, wxDefaultPosition, wxDefaultSize,
// wxSUNKEN_BORDER|wxCLIP_CHILDREN);
#ifdef __WXMOTIF__
wxBORDER);
#else
wxSUNKEN_BORDER);
#endif
panel->SetScrollbars(10, 10, 100, 100);
@ -766,7 +770,7 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
wxBitmap ToolbarToFrontBitmap("TOFRONTTOOL");
wxBitmap ToolbarHelpBitmap("HELPTOOL");
#endif
#ifdef __WXGTK__
#if defined(__WXGTK__) || defined(__WXMOTIF__)
wxBitmap ToolbarLoadBitmap( load_xpm );
wxBitmap ToolbarSaveBitmap( save_xpm);
wxBitmap ToolbarNewBitmap( new_xpm );
@ -798,47 +802,47 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
int currentX = gap;
toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_NEW, ToolbarNewBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "New dialog");
FALSE, currentX, -1, NULL, "New dialog");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_LOAD_FILE, ToolbarLoadBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Load");
FALSE, currentX, -1, NULL, "Load");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_SAVE_FILE, ToolbarSaveBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Save");
FALSE, currentX, -1, NULL, "Save");
currentX += width + dx + gap;
toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_FORMAT_HORIZ, ToolbarVertBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Horizontal align");
FALSE, currentX, -1, NULL, "Horizontal align");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_FORMAT_VERT_TOP_ALIGN, ToolbarAlignTBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Top align");
FALSE, currentX, -1, NULL, "Top align");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_FORMAT_VERT_BOT_ALIGN, ToolbarAlignBBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Bottom align");
FALSE, currentX, -1, NULL, "Bottom align");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_FORMAT_VERT, ToolbarHorizBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Vertical align");
FALSE, currentX, -1, NULL, "Vertical align");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN, ToolbarAlignLBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Left align");
FALSE, currentX, -1, NULL, "Left align");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN, ToolbarAlignRBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Right align");
FALSE, currentX, -1, NULL, "Right align");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_COPY_SIZE, ToolbarCopySizeBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Copy size");
FALSE, currentX, -1, NULL, "Copy size");
currentX += width + dx + gap;
toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_TO_FRONT, ToolbarToFrontBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "To front");
FALSE, currentX, -1, NULL, "To front");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_TO_BACK, ToolbarToBackBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "To back");
FALSE, currentX, -1, NULL, "To back");
currentX += width + dx + gap;
toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_HELP, ToolbarHelpBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Help");
FALSE, currentX, -1, NULL, "Help");
currentX += width + dx;
toolbar->Realize();
@ -2196,6 +2200,8 @@ wxResourceEditorScrolledWindow::wxResourceEditorScrolledWindow(wxWindow *parent,
m_marginX = 10;
m_marginY = 40;
m_childWindow = NULL;
SetBackgroundColour(* wxWHITE);
}
wxResourceEditorScrolledWindow::~wxResourceEditorScrolledWindow()
@ -2275,7 +2281,7 @@ void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event)
*
*/
#ifdef __WXGTK__ // I don't dare to delete it...
#if defined(__WXGTK__) || defined(__WXMOTIF__) // I don't dare to delete it...
BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar)
END_EVENT_TABLE()

View File

@ -179,6 +179,13 @@ bool wxPropertyInfo::Edit(wxWindow *WXUNUSED(parent), const wxString& title)
view->ShowView(propSheet, propWin->GetPropertyPanel());
propWin->Show(TRUE);
// Otherwise doesn't show itself
#ifdef __WXMOTIF__
wxNoOptimize noOptimize;
propWin->SetSize(-1, -1, width, height);
#endif
return TRUE;
}
@ -416,7 +423,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
}
}
if (x != newX)
if (x != pixelX)
{
m_propertyWindow->Move(pixelX, y);
resource->SetSize(newX, resource->GetY(), resource->GetWidth(), resource->GetHeight());
@ -452,7 +459,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
}
}
if (y != newY)
if (y != pixelY)
{
m_propertyWindow->Move(x, pixelY);
resource->SetSize(resource->GetX(), newY, resource->GetWidth(), resource->GetHeight());
@ -488,7 +495,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
}
}
if (width != newWidth)
if (width != pixelWidth)
{
m_propertyWindow->SetSize(pixelWidth, height);
resource->SetSize(resource->GetX(), resource->GetY(), newWidth, resource->GetHeight());
@ -524,9 +531,9 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
}
}
if (height != newHeight)
if (height != pixelHeight)
{
m_propertyWindow->SetSize(width, newHeight);
m_propertyWindow->SetSize(width, pixelHeight);
resource->SetSize(resource->GetX(), resource->GetY(), resource->GetWidth(), newHeight);
}
return TRUE;
@ -757,7 +764,7 @@ bool wxItemPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
wxFont *newFont = SetFontProperty(name, property, font);
if (newFont)
itemWindow->SetLabelFont(* newFont);
itemWindow->SetFont(* newFont);
return TRUE;
}
else if (name == "label")
@ -787,6 +794,7 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
wxControl *item = (wxControl *)m_propertyWindow;
wxString str(item->GetLabel());
resource->SetTitle(str);
if (item->GetFont().Ok())
resource->SetFont(* wxTheFontList->FindOrCreateFont(item->GetFont().GetPointSize(),
item->GetFont().GetFamily(), item->GetFont().GetStyle(), item->GetFont().GetWeight(),
@ -1754,8 +1762,8 @@ bool wxGaugePropertyInfo::InstantiateResource(wxItemResource *resource)
wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name)
{
wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow;
if (name == "value")
return new wxProperty("value", (long)scrollBar->GetValue(), "integer");
if (name == "thumbPosition")
return new wxProperty("value", (long)scrollBar->GetThumbPosition(), "integer");
else if (name == "orientation")
{
char *pos = NULL;
@ -1770,24 +1778,20 @@ wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name)
}
else if (name == "pageSize")
{
int viewStart, pageLength, objectLength, viewLength;
scrollBar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength);
int pageLength = scrollBar->GetPageSize();
return new wxProperty("pageSize", (long)pageLength, "integer");
}
else if (name == "viewLength")
else if (name == "thumbSize")
{
int viewStart, pageLength, objectLength, viewLength;
scrollBar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength);
int thumbSize = scrollBar->GetThumbSize();
return new wxProperty("viewLength", (long)viewLength, "integer");
return new wxProperty("thumbSize", (long)thumbSize, "integer");
}
else if (name == "objectLength")
else if (name == "range")
{
int viewStart, pageLength, objectLength, viewLength;
scrollBar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength);
return new wxProperty("objectLength", (long)objectLength, "integer");
int range = scrollBar->GetRange();
return new wxProperty("range", (long)range, "integer");
}
else
return wxItemPropertyInfo::GetProperty(name);
@ -1796,9 +1800,9 @@ wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name)
bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow;
if (name == "value")
if (name == "thumbPosition")
{
scrollBar->SetValue((int)property->GetValue().IntegerValue());
scrollBar->SetThumbPosition((int)property->GetValue().IntegerValue());
return TRUE;
}
else if (name == "orientation")
@ -1835,17 +1839,26 @@ bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
}
else if (name == "pageSize")
{
scrollBar->SetPageSize((int)property->GetValue().IntegerValue());
int pos = scrollBar->GetThumbPosition();
int range = scrollBar->GetRange();
int thumbSize = scrollBar->GetThumbSize();
scrollBar->SetScrollbar(pos, thumbSize, range, (int)property->GetValue().IntegerValue());
return TRUE;
}
else if (name == "viewLength")
else if (name == "thumbSize")
{
scrollBar->SetViewLength((int)property->GetValue().IntegerValue());
int pos = scrollBar->GetThumbPosition();
int range = scrollBar->GetRange();
int pageSize = scrollBar->GetPageSize();
scrollBar->SetScrollbar(pos, (int)property->GetValue().IntegerValue(), range, pageSize);
return TRUE;
}
else if (name == "objectLength")
else if (name == "range")
{
scrollBar->SetObjectLength((int)property->GetValue().IntegerValue());
int pos = scrollBar->GetThumbPosition();
int thumbSize = scrollBar->GetThumbSize();
int pageSize = scrollBar->GetPageSize();
scrollBar->SetScrollbar(pos, thumbSize, (int)property->GetValue().IntegerValue(), pageSize);
return TRUE;
}
else
@ -1856,10 +1869,10 @@ void wxScrollBarPropertyInfo::GetPropertyNames(wxStringList& names)
{
wxItemPropertyInfo::GetPropertyNames(names);
names.Add("orientation");
names.Add("value");
names.Add("thumbPosition");
names.Add("thumbSize");
names.Add("pageSize");
names.Add("viewLength");
names.Add("objectLength");
names.Add("range");
// Remove some properties we don't inherit
names.Delete("fontPoints");
@ -1873,14 +1886,15 @@ bool wxScrollBarPropertyInfo::InstantiateResource(wxItemResource *resource)
{
wxScrollBar *sbar = (wxScrollBar *)m_propertyWindow;
resource->SetValue1(sbar->GetValue());
int viewStart, pageLength, objectLength, viewLength;
sbar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength);
int thumbPosition = sbar->GetThumbPosition();
int thumbSize = sbar->GetThumbSize();
int pageSize = sbar->GetPageSize();
int range = sbar->GetRange();
resource->SetValue2(pageLength);
resource->SetValue3(objectLength);
resource->SetValue5(viewLength);
resource->SetValue1(thumbPosition);
resource->SetValue2(thumbSize);
resource->SetValue3(range);
resource->SetValue5(pageSize);
return wxItemPropertyInfo::InstantiateResource(resource);
}