mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-19 20:41:04 +08:00
More-or-less finished reasonably cool wxToolBar class with tooltips.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@899 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
+12
-13
@@ -37,29 +37,19 @@ High Priority
|
||||
|
||||
- wxSpinButton
|
||||
|
||||
- wxTextCtrl text file loading and saving.
|
||||
|
||||
- A generic version of wxNotebook that can be used in wxMotif and
|
||||
other toolkits that don't have a native control. Perhaps use wxTab as a
|
||||
starting point.
|
||||
|
||||
- Complete the MDI implementation. Could eventually alter the MDI
|
||||
widgets to be more Windows-like -- currently it's half-hearted.
|
||||
|
||||
- Tidy dialogs such as the colour and font selectors.
|
||||
|
||||
- Use generic wxTreeCtrl, wxListCtrl: debug and enhance these.
|
||||
|
||||
- Write a better generic wxToolBar class than wxToolBarSimple.
|
||||
Alternatively, write a toolbar using Motif as described here:
|
||||
http://www.motifzone.com/tmd/articles/Kurt_Huhner/jun96.html.
|
||||
This article also explains how to implement tooltips.
|
||||
|
||||
- Find out why modal dialogs give a grab warning.
|
||||
|
||||
- Find out why UI updates aren't working (probably an OnIdle failure).
|
||||
|
||||
- wxSystemSettings
|
||||
- wxSystemSettings. Eventually, should have control panel-like utility
|
||||
to change colours/fonts but meanwhile should maybe read them
|
||||
from a file.
|
||||
|
||||
- wxThread (hopefully, similar to wxGTK)
|
||||
|
||||
@@ -106,8 +96,14 @@ Low Priority
|
||||
Netscape is running. See:
|
||||
http://www.motifzone.com/tmd/articles/John_Cwikla/index.html
|
||||
|
||||
- wxRCConfig (a config class using X .rc files). Could simply
|
||||
implement it in terms of current wxGet/WriteResource functions.
|
||||
|
||||
- wxCheckBoxList
|
||||
|
||||
- Reimplement combobox using Lesstif's widget (avoiding GPL'ed
|
||||
widget currently used).
|
||||
|
||||
- Write generic wxDirDialog (directory selector)
|
||||
|
||||
- Use native Motif dialogs for wxMessageBox
|
||||
@@ -116,3 +112,6 @@ Low Priority
|
||||
Linux)
|
||||
|
||||
- Blit scaling
|
||||
|
||||
- Could eventually alter the MDI widgets to be more Windows-like
|
||||
-- currently it's half-hearted.
|
||||
|
||||
@@ -70,10 +70,19 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
|
||||
// necessary for completing the toolbar construction.
|
||||
bool Realize() { return CreateTools(); };
|
||||
|
||||
// Implementation
|
||||
void DestroyPixmaps();
|
||||
int FindIndexForWidget(WXWidget w);
|
||||
WXWidget FindWidgetForIndex(int index);
|
||||
|
||||
protected:
|
||||
// List of widgets in the toolbar, indexed by tool index
|
||||
wxList m_widgets;
|
||||
|
||||
// List of pixmaps to destroy when tools are recreated or
|
||||
// or toolbar is destroyed.
|
||||
wxList m_pixmaps;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -39,8 +39,8 @@ MAKE=make
|
||||
LEX=flex.exe -t -L
|
||||
|
||||
# YACC. byacc or bison
|
||||
# YACC=byacc.exe
|
||||
YACC=bison.exe
|
||||
YACC=byacc.exe
|
||||
# YACC=bison.exe
|
||||
|
||||
# Resource compiler
|
||||
RESCOMP=windres.exe
|
||||
|
||||
@@ -169,7 +169,7 @@ void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
|
||||
// since it is no longer valid.
|
||||
XtVaSetValues ((Widget) m_mainWidget,
|
||||
XmNlabelType, XmSTRING,
|
||||
XmNlabelPixmap, NULL, // TODO: Does this work?
|
||||
XmNlabelPixmap, XmUNSPECIFIED_PIXMAP,
|
||||
XmNlabelInsensitivePixmap, NULL,
|
||||
XmNarmPixmap, NULL,
|
||||
NULL);
|
||||
|
||||
@@ -114,7 +114,7 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
|
||||
// since it is no longer valid.
|
||||
XtVaSetValues (widget,
|
||||
XmNlabelType, XmSTRING,
|
||||
XmNlabelPixmap, NULL, // TODO: Does this work?
|
||||
XmNlabelPixmap, XmUNSPECIFIED_PIXMAP,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
+50
-33
@@ -257,37 +257,36 @@ bool wxTextCtrl::LoadFile(const wxString& file)
|
||||
|
||||
Clear();
|
||||
|
||||
ifstream input((char*) (const char*) file, ios::nocreate | ios::in);
|
||||
Widget textWidget = (Widget) m_mainWidget;
|
||||
FILE *fp;
|
||||
|
||||
if (!input.bad())
|
||||
struct stat statb;
|
||||
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
|
||||
!(fp = fopen ((char*) (const char*) file, "r")))
|
||||
{
|
||||
struct stat stat_buf;
|
||||
if (stat(file, &stat_buf) < 0)
|
||||
return FALSE;
|
||||
// This may need to be a bigger buffer than the file size suggests,
|
||||
// if it's a UNIX file. Give it an extra 1000 just in case.
|
||||
char *tmp_buffer = (char*)malloc((size_t)(stat_buf.st_size+1+1000));
|
||||
long no_lines = 0;
|
||||
long pos = 0;
|
||||
while (!input.eof() && input.peek() != EOF)
|
||||
{
|
||||
input.getline(wxBuffer, 500);
|
||||
int len = strlen(wxBuffer);
|
||||
wxBuffer[len] = 13;
|
||||
wxBuffer[len+1] = 10;
|
||||
wxBuffer[len+2] = 0;
|
||||
strcpy(tmp_buffer+pos, wxBuffer);
|
||||
pos += strlen(wxBuffer);
|
||||
no_lines++;
|
||||
}
|
||||
|
||||
// TODO add line
|
||||
|
||||
free(tmp_buffer);
|
||||
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
long len = statb.st_size;
|
||||
char *text;
|
||||
if (!(text = XtMalloc ((unsigned) (len + 1))))
|
||||
{
|
||||
fclose (fp);
|
||||
return FALSE;
|
||||
}
|
||||
if (fread (text, sizeof (char), len, fp) != (size_t) len)
|
||||
{
|
||||
}
|
||||
fclose (fp);
|
||||
|
||||
text[len] = 0;
|
||||
XmTextSetString (textWidget, text);
|
||||
// m_textPosition = len;
|
||||
XtFree (text);
|
||||
m_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// If file is null, try saved file name first
|
||||
@@ -301,13 +300,31 @@ bool wxTextCtrl::SaveFile(const wxString& file)
|
||||
return FALSE;
|
||||
m_fileName = theFile;
|
||||
|
||||
ofstream output((char*) (const char*) theFile);
|
||||
if (output.bad())
|
||||
return FALSE;
|
||||
Widget textWidget = (Widget) m_mainWidget;
|
||||
FILE *fp;
|
||||
|
||||
// TODO get and save text
|
||||
if (!(fp = fopen ((char*) (const char*) theFile, "w")))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *text = XmTextGetString (textWidget);
|
||||
long len = XmTextGetLastPosition (textWidget);
|
||||
|
||||
return FALSE;
|
||||
if (fwrite (text, sizeof (char), len, fp) != (size_t) len)
|
||||
{
|
||||
// Did not write whole file
|
||||
}
|
||||
// Make sure newline terminates the file
|
||||
if (text[len - 1] != '\n')
|
||||
fputc ('\n', fp);
|
||||
|
||||
fclose (fp);
|
||||
XtFree (text);
|
||||
m_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void wxTextCtrl::WriteText(const wxString& text)
|
||||
|
||||
@@ -55,6 +55,7 @@ wxTimer::wxTimer()
|
||||
wxTimer::~wxTimer()
|
||||
{
|
||||
Stop();
|
||||
wxTimerList.DeleteObject(this);
|
||||
}
|
||||
|
||||
bool wxTimer::Start(int milliseconds, bool mode)
|
||||
|
||||
+322
-60
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user