]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/carbon/dirdlg.cpp
Committing in .
[wxWidgets.git] / src / mac / carbon / dirdlg.cpp
... / ...
Content-type: text/html ]> git.saurik.com Git - wxWidgets.git/blame_incremental - 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 101.
CommitLineData
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
23IMPLEMENT_CLASS(wxDirDialog, wxDialog)
24
25enum {
26 kSelectItem = 10, // select button item number
27 kSFGetFolderDlgID = 250, // dialog resource number
28 kStrListID = 250, // our strings
29 kSelectStrNum = 1, // word 'Select: ' for button
30 kDesktopStrNum = 2, // word 'Desktop' for button
31 kSelectNoQuoteStrNum = 3, // word 'Select: ' for button
32
33 kUseQuotes = true, // parameter for SetButtonName
34 kDontUseQuotes = false
35};
36
37// the data we need to pass to our standard file hook routine
38// includes a pointer to the dialog, a pointer to the standard
39// file reply record (so we can inspect the current selection)
40// and a copy of the "previous" file spec of the reply record
41// so we can see if the selection has changed
42
43struct UserDataRec {
44 StandardFileReply *sfrPtr;
45 FSSpec oldSelectionFSSpec;
46 DialogPtr theDlgPtr;
47};
48typedef struct UserDataRec
49 UserDataRec, *UserDataRecPtr;
50
51static void GetLabelString(StringPtr theStr, short stringNum)
52{
53 GetIndString(theStr, kStrListID, stringNum);
54}
55
56static void CopyPStr(StringPtr src, StringPtr dest)
57{
58 BlockMoveData(src, dest, 1 + src[0]);
59}
60
61static char GetSelectKey(void)
62{
63 // this is the key used to trigger the select button
64
65 // NOT INTERNATIONAL SAVVY; should at least grab it from resources
66
67 return 's';
68}
69
70
71// SetButtonName sets the name of the Select button in the dialog
72//
73// To do this, we need to call the Script Manager to truncate the
74// label in the middle to fit the button and to merge the button
75// name with the word Select (possibly followed by quotes). Using
76// the Script Manager avoids all sorts of problems internationally.
77//
78// buttonName is the name to appear following the word Select
79// quoteFlag should be true if the name is to appear in quotes
80
81static void SetButtonName(DialogPtr theDlgPtr, short buttonID, StringPtr buttonName,
82 Boolean quoteFlag)
83{
84 short buttonType;
85 Handle buttonHandle;
86 Rect buttonRect;
87 short textWidth;
88 Handle labelHandle;
89 Handle nameHandle;
90 Str15 keyStr;
91 Str255 labelStr;
92 OSErr err;
93
94 nameHandle = nil;
95 labelHandle = nil;
96
97 // get the details of the button from the dialog
98
99 GetDialogItem(theDlgPtr, buttonID, &buttonType, &buttonHandle, &buttonRect);
100
101