// the argument is ignored under Windows - the process is always killed
WXDLLEXPORT int wxKill(long pid, wxSignal sig = wxSIGTERM);
-// Execute a command in an interactive shell window
+// Execute a command in an interactive shell window (always synchronously)
// If no command then just the shell
WXDLLEXPORT bool wxShell(const wxString& command = wxEmptyString);
+// As wxShell(), but must give a (non interactive) command and its output will
+// be returned in output array
+WXDLLEXPORT bool wxShell(const wxString& command, wxArrayString& output);
+
// Sleep for nSecs seconds
WXDLLEXPORT void wxSleep(int nSecs);
//#define TEST_ARRAYS
//#define TEST_CMDLINE
//#define TEST_DIR
-//#define TEST_EXECUTE
-#define TEST_FILECONF
+#define TEST_EXECUTE
+//#define TEST_FILECONF
+//#define TEST_HASH
//#define TEST_LOG
//#define TEST_LONGLONG
//#define TEST_MIME
+//#define TEST_SOCKETS
//#define TEST_STRINGS
//#define TEST_THREADS
//#define TEST_TIME
#ifdef __UNIX__
#define COMMAND "echo hi"
+ #define SHELL_COMMAND "echo hi from shell"
+ #define REDIRECT_COMMAND "date"
#elif defined(__WXMSW__)
#define COMMAND "command.com -c 'echo hi'"
+ #define SHELL_COMMAND "echo hi"
+ #define REDIRECT_COMMAND COMMAND
#else
#error "no command to exec"
#endif // OS
- if ( wxExecute(COMMAND) == 0 )
- puts("\nOk.");
+ printf("Testing wxShell: ");
+ fflush(stdout);
+ if ( wxShell(SHELL_COMMAND) )
+ puts("Ok.");
else
- puts("\nError.");
+ puts("ERROR.");
+
+ printf("Testing wxExecute: ");
+ fflush(stdout);
+ if ( wxExecute(COMMAND, TRUE /* sync */) == 0 )
+ puts("Ok.");
+ else
+ puts("ERROR.");
+
+#if 0 // no, it doesn't work (yet?)
+ printf("Testing async wxExecute: ");
+ fflush(stdout);
+ if ( wxExecute(COMMAND) != 0 )
+ puts("Ok (command launched).");
+ else
+ puts("ERROR.");
+#endif // 0
+
+ printf("Testing wxExecute with redirection:\n");
+ wxArrayString output;
+ if ( wxExecute(REDIRECT_COMMAND, output) != 0 )
+ {
+ puts("ERROR.");
+ }
+ else
+ {
+ size_t count = output.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ printf("\t%s\n", output[n].c_str());
+ }
+
+ puts("Ok.");
+ }
}
#endif // TEST_EXECUTE
#endif // TEST_FILECONF
+// ----------------------------------------------------------------------------
+// wxHashTable
+// ----------------------------------------------------------------------------
+
+#ifdef TEST_HASH
+
+#include <wx/hash.h>
+
+struct Foo
+{
+ Foo(int n_) { n = n_; count++; }
+ ~Foo() { count--; }
+
+ int n;
+
+ static size_t count;
+};
+
+size_t Foo::count = 0;
+
+WX_DECLARE_LIST(Foo, wxListFoos);
+WX_DECLARE_HASH(Foo, wxListFoos, wxHashFoos);
+
+#include <wx/listimpl.cpp>
+
+WX_DEFINE_LIST(wxListFoos);
+
+static void TestHash()
+{
+ puts("*** Testing wxHashTable ***\n");
+
+ {
+ wxHashFoos hash;
+ hash.DeleteContents(TRUE);
+
+ printf("Hash created: %u foos in hash, %u foos totally\n",
+ hash.GetCount(), Foo::count);
+
+ static const int hashTestData[] =
+ {
+ 0, 1, 17, -2, 2, 4, -4, 345, 3, 3, 2, 1,
+ };
+
+ size_t n;
+ for ( n = 0; n < WXSIZEOF(hashTestData); n++ )
+ {
+ hash.Put(hashTestData[n], n, new Foo(n));
+ }
+
+ printf("Hash filled: %u foos in hash, %u foos totally\n",
+ hash.GetCount(), Foo::count);
+
+ puts("Hash access test:");
+ for ( n = 0; n < WXSIZEOF(hashTestData); n++ )
+ {
+ printf("\tGetting element with key %d, value %d: ",
+ hashTestData[n], n);
+ Foo *foo = hash.Get(hashTestData[n], n);
+ if ( !foo )
+ {
+ printf("ERROR, not found.\n");
+ }
+ else
+ {
+ printf("%d (%s)\n", foo->n,
+ (size_t)foo->n == n ? "ok" : "ERROR");
+ }
+ }
+
+ printf("\nTrying to get an element not in hash: ");
+
+ if ( hash.Get(1234) || hash.Get(1, 0) )
+ {
+ puts("ERROR: found!");
+ }
+ else
+ {
+ puts("ok (not found)");
+ }
+ }
+
+ printf("Hash destroyed: %u foos left\n", Foo::count);
+}
+
+#endif // TEST_HASH
+
// ----------------------------------------------------------------------------
// MIME types
// ----------------------------------------------------------------------------
#endif // TEST_LONGLONG
+// ----------------------------------------------------------------------------
+// sockets
+// ----------------------------------------------------------------------------
+
+#ifdef TEST_SOCKETS
+
+#include <wx/socket.h>
+
+static void TestSocketClient()
+{
+ puts("*** Testing wxSocketClient ***\n");
+
+ wxIPV4address addrDst;
+ addrDst.Hostname("www.wxwindows.org");
+ addrDst.Service(80);
+
+ wxSocketClient client;
+ if ( !client.Connect(addrDst) )
+ {
+ printf("ERROR: failed to connect to %s\n", addrDst.Hostname().c_str());
+ }
+ else
+ {
+ char buf[8192];
+
+ client.Write("get /front.htm\n", 17);
+ client.Read(buf, WXSIZEOF(buf));
+ printf("Server replied:\n%s", buf);
+ }
+}
+
+#endif // TEST_SOCKETS
+
// ----------------------------------------------------------------------------
// date time
// ----------------------------------------------------------------------------
}
#endif // TEST_LONGLONG
+#ifdef TEST_HASH
+ TestHash();
+#endif // TEST_HASH
+
#ifdef TEST_MIME
TestMimeEnum();
#endif // TEST_MIME
+#ifdef TEST_SOCKETS
+ TestSocketClient();
+#endif // TEST_SOCKETS
+
#ifdef TEST_TIME
if ( 0 )
{
max, // range
this, // parent
wxPD_CAN_ABORT |
+ wxPD_AUTO_HIDE |
wxPD_APP_MODAL |
wxPD_ELAPSED_TIME |
wxPD_ESTIMATED_TIME |
void MyFrame::LogDialog(wxCommandEvent& event)
{
- wxLogMessage("This is some message - everything is ok so far.");
- wxLogMessage("Another message...\n... this one is on multiple lines");
- wxLogWarning("And then something went wrong!");
+ // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
+ // being flushed -- test it
+ {
+ wxBusyCursor bc;
+ wxLogMessage("This is some message - everything is ok so far.");
+ wxLogMessage("Another message...\n... this one is on multiple lines");
+ wxLogWarning("And then something went wrong!");
+ }
+
wxLogError("Intermediary error handler decided to abort.");
wxLogError("The top level caller detected an unrecoverable error.");
m_horizontal = new MyTextCtrl( this, -1, "Multiline text control with a horizontal scrollbar.",
wxPoint(10,170), wxSize(140,70), wxTE_MULTILINE | wxHSCROLL );
m_horizontal->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL,
- FALSE, "", wxFONTENCODING_KOI8));
+ FALSE, "", wxFONTENCODING_ISO8859_2)); //wxFONTENCODING_KOI8));
+ //m_horizontal->SetValue("ËÁÖÅÔÓÑ ÕÄÁÞÎÙÍ");
+ m_horizontal->SetValue("®lu»ouèký kùò zbìsile èe¹tina «»");
m_multitext = new MyTextCtrl( this, -1, "Multi line.",
wxPoint(180,10), wxSize(240,70), wxTE_MULTILINE );
#include "math.h"
-#ifdef __WXMSW__
- // this is not supported at all under MSW
+#ifdef __WIN32__
+ // this is not supported by native control
#define NO_VARIABLE_HEIGHT
-
- #define NO_MULTIPLE_SELECTION
-
- // this is supported (so the next line may be uncommented) but not very
- // well :-(
- #undef NO_MULTIPLE_SELECTION
#endif
#include "treetest.h"
// under Windows the icons are in the .rc file
#ifndef __WXMSW__
- #include "icon1.xpm"
- #include "icon2.xpm"
- #include "icon3.xpm"
- #include "icon4.xpm"
- #include "icon5.xpm"
- #include "mondrian.xpm"
+ #include "icon1.xpm"
+ #include "icon2.xpm"
+ #include "icon3.xpm"
+ #include "icon4.xpm"
+ #include "icon5.xpm"
+ #include "mondrian.xpm"
#endif
// verify that the item is ok and insult the user if it is not
EVT_MENU(TreeTest_DeleteChildren, MyFrame::OnDeleteChildren)
EVT_MENU(TreeTest_DeleteAll, MyFrame::OnDeleteAll)
EVT_MENU(TreeTest_Recreate, MyFrame::OnRecreate)
+ EVT_MENU(TreeTest_ToggleImages, MyFrame::OnToggleImages)
+ EVT_MENU(TreeTest_SetImageSize, MyFrame::OnSetImageSize)
EVT_MENU(TreeTest_CollapseAndReset, MyFrame::OnCollapseAndReset)
EVT_MENU(TreeTest_EnsureVisible, MyFrame::OnEnsureVisible)
EVT_MENU(TreeTest_AddItem, MyFrame::OnAddItem)
#ifndef NO_MULTIPLE_SELECTION
tree_menu->Append(TreeTest_ToggleSel, "&Toggle selection mode");
#endif // NO_MULTIPLE_SELECTION
+ tree_menu->Append(TreeTest_ToggleImages, "&Show images", "", TRUE);
+ tree_menu->Append(TreeTest_SetImageSize, "Set image si&ze...");
tree_menu->Append(TreeTest_Recreate, "&Recreate the tree");
tree_menu->Append(TreeTest_CollapseAndReset, "C&ollapse and reset");
tree_menu->AppendSeparator();
menu_bar->Append(item_menu, "&Item");
SetMenuBar(menu_bar);
+ menu_bar->Check(TreeTest_ToggleImages, TRUE);
+
m_treeCtrl = new MyTreeCtrl(this, TreeTest_Ctrl,
wxDefaultPosition, wxDefaultSize,
wxTR_HAS_BUTTONS |
m_treeCtrl->AddTestItemsToTree(3, 2);
}
+void MyFrame::OnSetImageSize(wxCommandEvent& event)
+{
+ long size = wxGetNumberFromUser("Enter the size for the images to use",
+ "Size: ",
+ "TreeCtrl sample",
+ 32);
+ if ( size == -1 )
+ return;
+
+ m_treeCtrl->CreateImageList((int)size);
+
+ OnRecreate(event);
+}
+
+void MyFrame::OnToggleImages(wxCommandEvent& event)
+{
+ wxGetApp().SetShowImages(!wxGetApp().ShowImages());
+
+ OnRecreate(event);
+}
+
void MyFrame::OnCollapseAndReset(wxCommandEvent& event)
{
m_treeCtrl->CollapseAndReset(m_treeCtrl->GetRootItem());
void MyFrame::OnInsertItem(wxCommandEvent& WXUNUSED(event))
{
- m_treeCtrl->InsertItem(m_treeCtrl->GetRootItem(), 1, "2nd item");
+ int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_File : -1;
+ m_treeCtrl->InsertItem(m_treeCtrl->GetRootItem(), image, "2nd item");
}
void MyFrame::OnAddItem(wxCommandEvent& WXUNUSED(event))
long style)
: wxTreeCtrl(parent, id, pos, size, style)
{
-#ifndef NO_VARIABLE_HEIGHT
-#if wxUSE_LIBJPEG
- wxImage::AddHandler(new wxJPEGHandler);
- wxImage image;
+ m_reverseSort = FALSE;
- image.LoadFile(wxString("horse.jpg"), wxBITMAP_TYPE_JPEG );
-#endif
-#endif
+ CreateImageList();
- m_reverseSort = FALSE;
+ // Add some items to the tree
+ AddTestItemsToTree(3, 2);
+}
+
+void MyTreeCtrl::CreateImageList(int size)
+{
+ delete m_imageListNormal;
+
+ if ( size == -1 )
+ {
+ m_imageListNormal = NULL;
+
+ return;
+ }
// Make an image list containing small icons
- m_imageListNormal = new wxImageList(16, 16, TRUE);
+ m_imageListNormal = new wxImageList(size, size, TRUE);
// should correspond to TreeCtrlIcon_xxx enum
#if defined(__WXMSW__) && defined(__WIN16__)
- // This is required in 16-bit Windows mode only because we can't load a specific (16x16)
- // icon image, so it comes out stretched
-# ifndef NO_VARIABLE_HEIGHT
- m_imageListNormal->Add(image.ConvertToBitmap());
-# else
m_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
-# endif
m_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
#else
-# ifndef NO_VARIABLE_HEIGHT
- m_imageListNormal->Add(image.ConvertToBitmap());
-# else
- m_imageListNormal->Add(wxICON(icon1));
-# endif
- m_imageListNormal->Add(wxICON(icon2));
- m_imageListNormal->Add(wxICON(icon3));
- m_imageListNormal->Add(wxICON(icon4));
- m_imageListNormal->Add(wxICON(icon5));
+ wxIcon icons[5];
+ icons[0] = wxICON(icon1);
+ icons[1] = wxICON(icon2);
+ icons[2] = wxICON(icon3);
+ icons[3] = wxICON(icon4);
+ icons[4] = wxICON(icon5);
+
+ int sizeOrig = icons[0].GetWidth();
+ for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
+ {
+ if ( size == sizeOrig )
+ {
+ m_imageListNormal->Add(icons[i]);
+ }
+ else
+ {
+ m_imageListNormal->Add(wxImage(icons[i]).Rescale(size, size).
+ ConvertToBitmap());
+ }
+ }
#endif
SetImageList(m_imageListNormal);
-
- // Add some items to the tree
- AddTestItemsToTree(3, 2);
}
MyTreeCtrl::~MyTreeCtrl()
// here we pass to AppendItem() normal and selected item images (we
// suppose that selected image follows the normal one in the enum)
- int image = depth == 1 ? TreeCtrlIcon_File : TreeCtrlIcon_Folder;
- wxTreeItemId id = AppendItem(idParent, str, image, image + 1,
+ int image, imageSel;
+ if ( wxGetApp().ShowImages() )
+ {
+ image = depth == 1 ? TreeCtrlIcon_File : TreeCtrlIcon_Folder;
+ imageSel = image + 1;
+ }
+ else
+ {
+ image = imageSel = -1;
+ }
+ wxTreeItemId id = AppendItem(idParent, str, image, imageSel,
new MyTreeItemData(str));
// and now we also set the expanded one (only for the folders)
- if ( hasChildren )
+ if ( hasChildren && wxGetApp().ShowImages() )
{
SetItemImage(id, TreeCtrlIcon_FolderOpened,
wxTreeItemIcon_Expanded);
void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
size_t depth)
{
+ int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_Folder : -1;
wxTreeItemId rootId = AddRoot("Root",
- TreeCtrlIcon_Folder, TreeCtrlIcon_Folder,
+ image, image,
new MyTreeItemData("Root item"));
- SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
+ if ( image != -1 )
+ {
+ SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
+ }
AddItemsRecursively(rootId, numChildren, depth, 0);
//
// Finally, we only copy one item here but we might copy the entire tree if
// we were dragging a folder.
- AppendItem(itemDst, text, TreeCtrlIcon_File);
+ int image = wxGetApp().ShowImages() ? TreeCtrlIcon_File : -1;
+ AppendItem(itemDst, text, image);
}
void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event)
class MyApp : public wxApp
{
public:
+ MyApp() { m_showImages = TRUE; }
+
bool OnInit();
+
+ void SetShowImages(bool show) { m_showImages = show; }
+ bool ShowImages() const { return m_showImages; }
+
+private:
+ bool m_showImages;
};
class MyTreeItemData : public wxTreeItemData
void GetItemsRecursively(const wxTreeItemId& idParent, long cookie);
+ void CreateImageList(int size = 32);
+
void AddTestItemsToTree(size_t numChildren, size_t depth);
void DoSortChildren(const wxTreeItemId& item, bool reverse = FALSE)
void OnDelete(wxCommandEvent& event);
void OnDeleteChildren(wxCommandEvent& event);
void OnDeleteAll(wxCommandEvent& event);
+
void OnRecreate(wxCommandEvent& event);
+ void OnToggleImages(wxCommandEvent& event);
+ void OnSetImageSize(wxCommandEvent& event);
void OnCollapseAndReset(wxCommandEvent& event);
void OnSetBold(wxCommandEvent& WXUNUSED(event)) { DoSetBold(TRUE); }
TreeTest_DeleteChildren,
TreeTest_DeleteAll,
TreeTest_Recreate,
+ TreeTest_ToggleImages,
+ TreeTest_SetImageSize,
TreeTest_ToggleSel,
TreeTest_CollapseAndReset,
TreeTest_EnsureVisible,
if (t0 != (time_t)-1 )
return (long)difftime(t1, t0) + (60 * 60 * 24 * 4);
- wxLogSysError(_("Failed 2nd mktime"));
+ wxLogSysError(_("mktime() failed"));
+ }
+ else
+ {
+ wxLogSysError(_("gmtime() failed"));
}
- wxLogSysError(_("Failed gmtime"));
}
- wxLogSysError(_("Failed to get the UTC system time"));
+
+ wxLogError(_("Failed to get the UTC system time."));
+
return -1;
}
val *= tp.tv_sec;
return (val + (tp.tv_usec / 1000));
}
- return 0;
+ return 0;
#elif defined(HAVE_FTIME)
struct timeb tp;
- if ( ftime(&tp) == 0 )
- {
- val *= tp.time;
- return (val + tp.millitm);
- }
+
+ // ftime() is void and not int in some mingw32 headers, so don't test the
+ // return code (well, it shouldn't fail anyhow...)
+ (void)ftime(&tp);
+ val *= tp.time;
+ return (val + tp.millitm);
#else
// We use wxGetLocalTime() to get the seconds since
// 00:00:00 Jan 1st 1970 and then whatever is available
#endif
return val;
-
#endif
}
{
m_imageListNormal = imageList;
+ if ( !m_imageListNormal )
+ return;
+
// Calculate a m_lineHeight value from the image sizes.
// May be toggle off. Then wxTreeCtrl will spread when
// necessary (which might look ugly).
-#if 1
wxClientDC dc(this);
m_lineHeight = (int)(dc.GetCharHeight() + 4);
int width = 0, height = 0,
m_lineHeight += 2; // at least 2 pixels
else
m_lineHeight += m_lineHeight/10; // otherwise 10% extra spacing
-#endif
}
void wxTreeCtrl::SetStateImageList(wxImageList *imageList)
int image = item->GetCurrentImage();
if ( image != NO_IMAGE )
{
- m_imageListNormal->GetSize( image, image_w, image_h );
- image_w += 4;
+ if ( m_imageListNormal )
+ {
+ m_imageListNormal->GetSize( image, image_w, image_h );
+ image_w += 4;
+ }
+ else
+ {
+ image = NO_IMAGE;
+ }
}
int total_h = GetLineHeight(item);
int image = m_currentEdit->GetCurrentImage();
if ( image != NO_IMAGE )
{
- m_imageListNormal->GetSize( image, image_w, image_h );
- image_w += 4;
+ if ( m_imageListNormal )
+ {
+ m_imageListNormal->GetSize( image, image_w, image_h );
+ image_w += 4;
+ }
+ else
+ {
+ wxFAIL_MSG(_T("you must create an image list to use images!"));
+ }
}
x += image_w;
w -= image_w + 4; // I don't know why +4 is needed
int image = item->GetCurrentImage();
if ( image != NO_IMAGE )
{
- m_imageListNormal->GetSize( image, image_w, image_h );
- image_w += 4;
+ if ( m_imageListNormal )
+ {
+ m_imageListNormal->GetSize( image, image_w, image_h );
+ image_w += 4;
+ }
}
int total_h = (image_h > text_h) ? image_h : text_h;
-# This file was automatically generated by tmake at 20:56, 2000/03/01
+# This file was automatically generated by tmake at 08:59, 2000/03/03
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
generic/busyinfo.cpp \
html/m_meta.cpp \
html/m_pre.cpp \
html/m_tables.cpp \
- html/winpars.cpp \
- ogl/basic.cpp \
- ogl/basic2.cpp \
- ogl/bmpshape.cpp \
- ogl/canvas.cpp \
- ogl/composit.cpp \
- ogl/constrnt.cpp \
- ogl/divided.cpp \
- ogl/drawn.cpp \
- ogl/lines.cpp \
- ogl/mfutils.cpp \
- ogl/ogldiag.cpp \
- ogl/oglmisc.cpp
+ html/winpars.cpp
ALL_HEADERS = \
accel.h \
html/htmprint.h \
html/m_templ.h \
html/winpars.h \
- ogl/basic.h \
- ogl/basicp.h \
- ogl/bmpshape.h \
- ogl/canvas.h \
- ogl/composit.h \
- ogl/constrnt.h \
- ogl/divided.h \
- ogl/drawn.h \
- ogl/drawnp.h \
- ogl/lines.h \
- ogl/linesp.h \
- ogl/mfutils.h \
- ogl/misc.h \
- ogl/ogl.h \
- ogl/ogldiag.h \
protocol/file.h \
protocol/ftp.h \
protocol/http.h \
m_tables.d \
winpars.d
-OGLOBJS = \
- basic.o \
- basic2.o \
- bmpshape.o \
- canvas.o \
- composit.o \
- constrnt.o \
- divided.o \
- drawn.o \
- lines.o \
- mfutils.o \
- ogldiag.o \
- oglmisc.o
-
-OGLDEPS = \
- basic.d \
- basic2.d \
- bmpshape.d \
- canvas.d \
- composit.d \
- constrnt.d \
- divided.d \
- drawn.d \
- lines.d \
- mfutils.d \
- ogldiag.d \
- oglmisc.d
-
-# This file was automatically generated by tmake at 20:56, 2000/03/01
+# This file was automatically generated by tmake at 08:59, 2000/03/03
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
generic/busyinfo.cpp \
html/m_meta.cpp \
html/m_pre.cpp \
html/m_tables.cpp \
- html/winpars.cpp \
- ogl/basic.cpp \
- ogl/basic2.cpp \
- ogl/bmpshape.cpp \
- ogl/canvas.cpp \
- ogl/composit.cpp \
- ogl/constrnt.cpp \
- ogl/divided.cpp \
- ogl/drawn.cpp \
- ogl/lines.cpp \
- ogl/mfutils.cpp \
- ogl/ogldiag.cpp \
- ogl/oglmisc.cpp
+ html/winpars.cpp
ALL_HEADERS = \
accel.h \
html/htmprint.h \
html/m_templ.h \
html/winpars.h \
- ogl/basic.h \
- ogl/basicp.h \
- ogl/bmpshape.h \
- ogl/canvas.h \
- ogl/composit.h \
- ogl/constrnt.h \
- ogl/divided.h \
- ogl/drawn.h \
- ogl/drawnp.h \
- ogl/lines.h \
- ogl/linesp.h \
- ogl/mfutils.h \
- ogl/misc.h \
- ogl/ogl.h \
- ogl/ogldiag.h \
protocol/file.h \
protocol/ftp.h \
protocol/http.h \
m_tables.d \
winpars.d
-OGLOBJS = \
- basic.o \
- basic2.o \
- bmpshape.o \
- canvas.o \
- composit.o \
- constrnt.o \
- divided.o \
- drawn.o \
- lines.o \
- mfutils.o \
- ogldiag.o \
- oglmisc.o
-
-OGLDEPS = \
- basic.d \
- basic2.d \
- bmpshape.d \
- canvas.d \
- composit.d \
- constrnt.d \
- divided.d \
- drawn.d \
- lines.d \
- mfutils.d \
- ogldiag.d \
- oglmisc.d
-
tvht.pt.x = x;
tvht.pt.y = y;
- // TreeView_HitTest() doesn't do the right cast in mingw32 headers
return (HTREEITEM)TreeView_HitTest(hwndTV, &tvht);
}
{
// find the first (or last) item and select it
bool cont = TRUE;
- HTREEITEM htItem = TreeView_GetRoot(hwndTV);
+ HTREEITEM htItem = (HTREEITEM)TreeView_GetRoot(hwndTV);
while ( htItem && cont )
{
if ( (htItem == htFirst) || (htItem == htLast) )
}
}
- htItem = TreeView_GetNextVisible(hwndTV, htItem);
+ htItem = (HTREEITEM)TreeView_GetNextVisible(hwndTV, htItem);
}
// select the items in range
cont = (htItem != htFirst) && (htItem != htLast);
- htItem = TreeView_GetNextVisible(hwndTV, htItem);
+ htItem = (HTREEITEM)TreeView_GetNextVisible(hwndTV, htItem);
}
// unselect the rest
UnselectItem(hwndTV, htItem);
}
- htItem = TreeView_GetNextVisible(hwndTV, htItem);
+ htItem = (HTREEITEM)TreeView_GetNextVisible(hwndTV, htItem);
}
}
static void SetFocus(HWND hwndTV, HTREEITEM htItem)
{
// the current focus
- HTREEITEM htFocus = TreeView_GetSelection(hwndTV);
+ HTREEITEM htFocus = (HTREEITEM)TreeView_GetSelection(hwndTV);
if ( htItem )
{
// we handle.arrows and space, but not page up/down and home/end: the
// latter should be easy, but not the former
- HTREEITEM htSel = TreeView_GetSelection(GetHwnd());
+ HTREEITEM htSel = (HTREEITEM)TreeView_GetSelection(GetHwnd());
if ( !m_htSelStart )
{
m_htSelStart = (WXHTREEITEM)htSel;
{
(void)wxControl::MSWWindowProc(nMsg, wParam, lParam);
- HTREEITEM htNext =
- wParam == VK_UP ? TreeView_GetPrevVisible(GetHwnd(), htSel)
- : TreeView_GetNextVisible(GetHwnd(), htSel);
+ HTREEITEM htNext = (HTREEITEM)(wParam == VK_UP
+ ? TreeView_GetPrevVisible(GetHwnd(), htSel)
+ : TreeView_GetNextVisible(GetHwnd(), htSel));
if ( !htNext )
{
return lRc;
}
-bool wxShell(const wxString& command)
+// ----------------------------------------------------------------------------
+// wxShell
+// ----------------------------------------------------------------------------
+
+static wxString wxMakeShellCommand(const wxString& command)
{
wxString cmd;
if ( !command )
+ {
+ // just an interactive shell
cmd = _T("xterm");
+ }
else
- cmd = command;
+ {
+ // execute command in a shell
+ cmd << _T("/bin/sh -c '") << command << _T('\'');
+ }
+
+ return cmd;
+}
+
+bool wxShell(const wxString& command)
+{
+ return wxExecute(wxMakeShellCommand(command), TRUE /* sync */) == 0;
+}
+
+bool wxShell(const wxString& command, wxArrayString& output)
+{
+ wxCHECK_MSG( !!command, FALSE, _T("can't exec shell non interactively") );
- return wxExecute(cmd) != 0;
+ return wxExecute(wxMakeShellCommand(command), output);
}
#if wxUSE_GUI