OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
Loading...
Searching...
No Matches
picklist.h
Go to the documentation of this file.
1
//----------------------------------------------------------------------------
2
// ObjectWindows
3
// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4
//
5
/// \file
6
/// Definition of classes TPickListPopup & TPickListDialog
7
//----------------------------------------------------------------------------
8
9
#if !defined(OWL_PICKLIST_H)
10
#define OWL_PICKLIST_H
11
12
#include <
owl/private/defs.h
>
13
#if defined(BI_HAS_PRAGMA_ONCE)
14
# pragma once
15
#endif
16
17
#include <
owl/dialog.h
>
18
#include <
owl/listbox.h
>
19
20
21
namespace
owl
{
22
23
#include <
owl/preclass.h
>
24
25
/// \addtogroup ctrl
26
/// @{
27
/// \class TPickListPopup
28
// ~~~~~ ~~~~~~~~~~~~~~
29
/// The PickList allows selection of an item from a popup list. The list can
30
/// have an optional title, provided by string or string resource id.
31
///
32
/// Strings can be added after construction using AddString()
33
///
34
/// The 0-based selection is returned from Execute(), or can be retrieved later
35
/// using GetResult()
36
//
37
class
_OWLCLASS
TPickListPopup
:
public
TWindow
{
38
public
:
39
TPickListPopup
(
TWindow
* parent, LPCTSTR title = 0);
40
TPickListPopup
(
TWindow
* parent,
const
tstring
& title);
41
TPickListPopup
(
TWindow
* parent,
uint
titleId);
42
43
void
ClearStrings
();
44
int
AddString
(LPCTSTR str);
45
int
AddString
(
const
tstring
& str) {
return
AddString
(str.c_str());}
46
int
Execute();
// Returns index picked (1 based), 0 if cancelled
47
int
GetResult()
const
;
48
49
protected
:
50
TResult
EvCommand(
uint
id
, THandle hWndCtl,
uint
notifyCode);
51
52
TPopupMenu
Popup
;
53
int
Count
;
54
55
private
:
56
int
Result;
57
};
58
59
/// @}
60
61
/// \addtogroup ctrl
62
/// @{
63
//
64
/// \class TPickListDialog
65
// ~~~~~ ~~~~~~~~~~~~~~~
66
/// The PickListDialog allows selection of an item from a list in a dialog with
67
/// OK and Cancel buttons. An initial string list can be provided, and an
68
/// initial selection. Also, the dialog template and title can be overriden.
69
///
70
/// Strings can be added after construction using AddString()
71
///
72
/// The 0-based selection is returned from Execute(), or can be retrieved later
73
/// using GetResult()
74
//
75
class
_OWLCLASS
TPickListDialog
:
public
TDialog
{
76
public
:
77
TPickListDialog
(
TWindow
* parent,
78
TStringArray
* strings = 0,
79
int
initialSelection = 0,
80
TResId
templateId = 0,
81
LPCTSTR title = 0,
82
TModule
* module = 0);
83
84
TPickListDialog
(
85
TWindow
* parent,
86
TStringArray
* strings,
87
int
initialSelection,
88
TResId
templateId,
89
const
tstring
& title,
90
TModule
* module = 0);
91
92
~TPickListDialog
()
override
;
93
94
void
ClearStrings
();
95
int
AddString
(LPCTSTR str);
96
int
AddString
(
const
tstring
& str) {
return
AddString
(str.c_str());}
97
int
GetResult()
const
;
98
99
protected
:
100
void
SetupWindow()
override
;
101
void
CmOK();
102
void
CmCancel();
103
104
private
:
105
TListBox
List;
106
int
Result;
107
TStringArray
* Strings;
108
bool
NewedStrings;
109
110
DECLARE_RESPONSE_TABLE
(
TPickListDialog
);
111
};
112
/// @}
113
114
#include <
owl/posclass.h
>
115
116
117
//----------------------------------------------------------------------------
118
// Inline implementation
119
//
120
121
//
122
/// Returns the result of the selection.
123
//
124
inline
int
125
TPickListPopup::GetResult
()
const
126
{
127
return
Result;
128
}
129
130
//
131
/// Returns the result of the selection.
132
//
133
inline
int
134
TPickListDialog::GetResult
()
const
135
{
136
return
Result;
137
}
138
139
}
// OWL namespace
140
141
142
#endif
// OWL_PICKLIST_H
owl::TDialog::TDialog
TDialog(TWindow *parent, TResId resId, TModule *module=nullptr)
Constructor for a TDialog object.
Definition
dialog.cpp:103
owl::TListBox
An interface object that represents a corresponding list box element.
Definition
listbox.h:43
owl::TModule
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition
module.h:78
owl::TPickListDialog
The PickListDialog allows selection of an item from a list in a dialog with OK and Cancel buttons.
Definition
picklist.h:75
owl::TPickListDialog::GetResult
int GetResult() const
Returns the result of the selection.
Definition
picklist.h:134
owl::TPickListDialog::AddString
int AddString(LPCTSTR str)
Adds a string to the Strings list and to the List box if it has already been created.
Definition
picklist.cpp:221
owl::TPickListDialog::AddString
int AddString(const tstring &str)
Definition
picklist.h:96
owl::TPickListDialog::ClearStrings
void ClearStrings()
Clears all strings from the list.
Definition
picklist.cpp:209
owl::TPickListDialog::TPickListDialog
TPickListDialog(TWindow *parent, TStringArray *strings=0, int initialSelection=0, TResId templateId=0, LPCTSTR title=0, TModule *module=0)
Initialize the dialog.
Definition
picklist.cpp:158
owl::TPickListPopup::AddString
int AddString(LPCTSTR str)
Adds a string to the pop-up.
Definition
picklist.cpp:87
owl::TPickListPopup::ClearStrings
void ClearStrings()
Clears all strings from the pop-up.
Definition
picklist.cpp:77
owl::TPickListPopup::Popup
TPopupMenu Popup
Definition
picklist.h:52
owl::TPickListPopup::GetResult
int GetResult() const
Returns the result of the selection.
Definition
picklist.h:125
owl::TPickListPopup::Count
int Count
Definition
picklist.h:53
owl::TPickListPopup::AddString
int AddString(const tstring &str)
Definition
picklist.h:45
owl::TPickListPopup::TPickListPopup
TPickListPopup(TWindow *parent, LPCTSTR title=0)
Constructs a popup menu.
Definition
picklist.cpp:27
owl::TPopupMenu
TPopupMenu creates an empty pop-up menu to add to an existing window or pop-up menu.
Definition
menu.h:189
owl::TResId
Definition
wsyscls.h:206
owl::TWindow
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition
window.h:414
owl::TWindow::TWindow
TWindow(TWindow *parent, LPCTSTR title=nullptr, TModule *module=nullptr)
Adds this to the child list of parent if nonzero, and calls EnableAutoCreate so that this will be cre...
Definition
window.cpp:341
dialog.h
Definition of TDialog class and TDialogAttr struct.
DECLARE_RESPONSE_TABLE
#define DECLARE_RESPONSE_TABLE(cls)
Definition
eventhan.h:436
listbox.h
Definition of class TListBox and TlistBoxData.
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
owl::TStringArray
TObjectArray< tstring > TStringArray
Definition
contain.h:37
owl::TResult
LRESULT TResult
Result type.
Definition
dispatch.h:52
owl::tstring
std::string tstring
Definition
defs.h:79
owl::uint
unsigned int uint
Definition
number.h:25
defs.h
_OWLCLASS
#define _OWLCLASS
Definition
defs.h:338
posclass.h
preclass.h
include
owl
picklist.h
Generated by
1.18.0