]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/dirdlg.cpp
setting and restoring the graf port
[wxWidgets.git] / src / mac / carbon / dirdlg.cpp
Content-type: text/html ]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/dirdlg.cpp


500 - Internal Server Error

Malformed UTF-8 character (fatal) at /usr/lib/x86_64-linux-gnu/perl5/5.40/HTML/Entities.pm line 485, <$fd> line 304.
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: dirdlg.cpp
3// Purpose: wxDirDialog
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "dirdlg.h"
14#endif
15
16#include "wx/defs.h"
17#include "wx/utils.h"
18#include "wx/dialog.h"
19#include "wx/dirdlg.h"
20
21#include "wx/cmndata.h"
22
f5c6eb5c 23#ifdef __DARWIN__
5fde6fcc 24 #include <Carbon/Carbon.h>
03e11df5
GD
25#else
26 #include <Navigation.h>
27#endif
5b781a67 28
2f1ae414 29#if !USE_SHARED_LIBRARY
e9576ca5 30IMPLEMENT_CLASS(wxDirDialog, wxDialog)
2f1ae414 31#endif
519cb848 32
5b781a67
SC
33bool gUseNavServices = NavServicesAvailable() ;
34
519cb848
SC
35// the data we need to pass to our standard file hook routine
36// includes a pointer to the dialog, a pointer to the standard
37// file reply record (so we can inspect the current selection)
38// and a copy of the "previous" file spec of the reply record
39// so we can see if the selection has changed
40
5b781a67
SC
41#if !TARGET_CARBON
42
519cb848
SC
43struct UserDataRec {
44 StandardFileReply *sfrPtr;
45 FSSpec oldSelectionFSSpec;
46 DialogPtr theDlgPtr;
47};
48typedef struct UserDataRec
49 UserDataRec, *UserDataRecPtr;
50
2f1ae414
SC
51enum {
52 kSelectItem = 10, // select button item number
53 kSFGetFolderDlgID = 250, // dialog resource number
54 kStrListID = 250, // our strings
55 kSelectStrNum = 1, // word 'Select: ' for button
56 kDesktopStrNum = 2, // word 'Desktop' for button
57 kSelectNoQuoteStrNum = 3, // word 'Select: ' for button
58
59 kUseQuotes = true, // parameter for SetButtonName
60 kDontUseQuotes = false
61};
62
63
519cb848
SC
64static void GetLabelString(StringPtr theStr, short stringNum)
65{
66 GetIndString(theStr, kStrListID, stringNum);
67}
68
69static void CopyPStr(StringPtr src, StringPtr dest)
70{
71 BlockMoveData(src, dest, 1 + src[0]);
72}
73
74static char GetSelectKey(void)
75{
76 // this is the key used to trigger the select button
77
78 // NOT INTERNATIONAL SAVVY; should at least grab it from resources
79
80 return 's';
81}
82
83
84// SetButtonName sets the name of the Select button in the dialog
85//
86// To do this, we need to call the Script Manager to truncate the
87// label in the middle to fit the button and to merge the button
88// name with the word Select (possibly followed by quotes). Using
89// the Script Manager avoids all sorts of problems internationally.
90//
91// buttonName is the name to appear following the word Select
92// quoteFlag should be true if the name is to appear in quotes
93
94static void SetButtonName(DialogPtr theDlgPtr, short buttonID, StringPtr buttonName,
95 Boolean quoteFlag)
96{
97 short buttonType;
98 Handle buttonHandle;
99 Rect buttonRect;
100 short textWidth;
101 Handle labelHandle;
102 Handle nameHandle;
103 Str15 keyStr;
104 Str255 labelStr;
105 OSErr err;
106
107 nameHandle = nil;
108 labelHandle = nil;
109
110 // get the details of the button from the dialog
111
112 GetDialogItem(theDlgPtr, buttonID, &buttonType, &buttonHandle, &buttonRect);
113
114