1 namespace gui::dialogs;
5 public class FindDialog : Window
11 background = formColor;
12 minClientSize = { 400, 112 };
15 property EditBox editBox { set { editBox = value; } };
16 property char * searchString { set { findWhat.contents = value; } get { return findWhat.contents; } };
17 property bool wholeWord { set { wholeWord.checked = value; } get { return wholeWord.checked; } };
18 property bool matchCase { set { matchCase.checked = value; } get { return matchCase.checked; } };
19 property bool searchUp { set { (value ? searchUp : searchDown).checked = true; } get { return searchUp.checked; } };
26 this, isCheckbox = true, text = $"Whole word only", position = { 10, 40 }, hotKey = altW
31 this, isCheckbox = true, text = $"Match case", position = { 10, 60 }, hotKey = altC
36 this, isRadio = true, text = $"Up", position = { 220, 50 }, hotKey = altU
41 this, isRadio = true, text = $"Down", position = { 220, 70 }, hotKey = altD, checked = true;
46 this, text = $"Direction", position = { 220, 35 }
51 this, keyRepeat = true, isDefault = true, text = $"Find Next", anchor = { right = 10, top = 10 }, size = { 80 }, hotKey = altF;
53 bool NotifyClicked(Button control, int x, int y, Modifiers mods)
55 char * searchString = findWhat.contents;
56 bool searchUp = this.searchUp.checked;
57 bool wholeWord = this.wholeWord.checked;
58 bool matchCase = this.matchCase.checked;
60 if(!editBox || !editBox.Find(searchString, wholeWord, matchCase, !searchUp))
61 MessageBox { type = ok, master = this, text = $"Find", contents = $"Search string not found." }.Modal();
73 this, text = $"Cancel", anchor = Anchor { right = 10, top = 45 }, size = { 80 }, hotKey = escape;
75 bool NotifyClicked(Button control, int x, int y, Modifiers mods)
85 this, text = $"Find what:", anchor = { left = 100, right = 100, top = 10 }, size.h = 20, hotKey = altN;
88 Label findWhatLabel { this, position = { 10, 10 }, labeledWindow = findWhat };
90 bool OnKeyHit(Key key, unichar ch)
92 if(ch && !key.alt && !key.ctrl && !key.shift && (matchCase.active || wholeWord.active))
95 return findWhat.OnKeyHit(key, ch);