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