| 27 |
@@ -27,9 +27,21 @@ |
| 27 |
* SearchDialog constructor.
|
| 28 |
*/
|
| 29 |
SearchDialog::SearchDialog(Display *dpy, Theme *theme)
|
| 30 |
: InputDialog(dpy, theme, L"Search")
|
| 31 |
: InputDialog(dpy, theme, L"Search"),
|
| 32 |
_result_menu(0)
|
| 33 |
{
|
| 34 |
_type = PWinObj::WO_SEARCH_DIALOG;
|
| 35 |
|
| 36 |
// Setup ActionEvent
|
| 37 |
_ae.action_list.back().setAction(ACTION_FOCUS);
|
| 38 |
|
| 39 |
// Setup menu for displaying results
|
| 40 |
_result_menu = new PMenu(_dpy, _theme, L"", "");
|
| 41 |
_result_menu->reparent(this, borderLeft(), borderTop() + getTitleHeight() + _text_wo->getHeight());
|
| 42 |
_result_menu->setSticky(STATE_SET);
|
| 43 |
_result_menu->setBorder(STATE_UNSET);
|
| 44 |
_result_menu->setTitlebar(STATE_UNSET);
|
| 45 |
_result_menu->mapWindow();
|
| 46 |
}
|
| 47 |
|
| 48 |
/**
|
| ... |
|
| 63 |
@@ -51,9 +63,45 @@ |
| 63 |
ActionEvent*
|
| 64 |
SearchDialog::exec(void)
|
| 65 |
{
|
| 54 |
// FIXME: Implement exec
|
| 67 |
if (_result_menu->getItemCurr()) {
|
| 68 |
_wo_ref = _result_menu->getItemCurr()->getWORef();
|
| 69 |
} else {
|
| 70 |
_wo_ref = 0;
|
| 71 |
}
|
| 72 |
|
| 61 |
return 0;
|
| 74 |
return &_ae;
|
| 75 |
}
|
| 76 |
|
| 77 |
/**
|
| 78 |
* Focus next item in result menu.
|
| 79 |
*/
|
| 80 |
void
|
| 81 |
SearchDialog::histNext(void)
|
| 82 |
{
|
| 83 |
_result_menu->selectItemRel(1);
|
| 84 |
}
|
| 85 |
|
| 86 |
/**
|
| 87 |
* Focus previous item in result menu.
|
| 88 |
*/
|
| 89 |
void
|
| 90 |
SearchDialog::histPrev(void)
|
| 91 |
{
|
| 92 |
_result_menu->selectItemRel(-1);
|
| 93 |
}
|
| 94 |
|
| 95 |
/**
|
| 96 |
* Update size making sure result menu fits.
|
| 97 |
*/
|
| 98 |
void
|
| 99 |
SearchDialog::updateSize(void)
|
| 100 |
{
|
| 101 |
InputDialog::updateSize();
|
| 102 |
|
| 103 |
if (_result_menu->size()) {
|
| 104 |
_result_menu->setMenuWidth(_text_wo->getWidth());
|
| 105 |
resize(_gm.width, _gm.height + _result_menu->getHeight());
|
| 106 |
}
|
| 107 |
}
|
| 108 |
|
| 109 |
/**
|
| ... |
|
| 113 |
@@ -65,7 +113,7 @@ |
| 113 |
uint
|
| 114 |
SearchDialog::findClients(const std::wstring &search)
|
| 115 |
{
|
| 68 |
// FIXME: Clear previous matches
|
| 117 |
_result_menu->removeAll();
|
| 118 |
|
| 119 |
if (search.size() > 0) {
|
| 120 |
RegexString search_re(search);
|
| ... |
|
| 128 |
@@ -80,7 +128,14 @@ |
| 128 |
matches.push_back(*it);
|
| 129 |
}
|
| 130 |
}
|
| 131 |
|
| 132 |
for (it = matches.begin(); it != matches.end(); ++it) {
|
| 133 |
_result_menu->insert((*it)->getTitle()->getVisible(), *it, (*it)->getIcon());
|
| 134 |
}
|
| 135 |
}
|
| 136 |
|
| 137 |
_result_menu->buildMenu();
|
| 138 |
updateSize();
|
| 139 |
|
| 140 |
return 0;
|
| 141 |
}
|
| ... |
|