Changeset View
Changeset View
Standalone View
Standalone View
src/mode/katemodemenulist.h
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Line(s) | 74 | public: | |||
---|---|---|---|---|---|
169 | * @param autoUpdateTextButton Determines whether the text of the button should be | 169 | * @param autoUpdateTextButton Determines whether the text of the button should be | ||
170 | * changed when selecting an item from the menu. | 170 | * changed when selecting an item from the menu. | ||
171 | * | 171 | * | ||
172 | * @see AlignmentHButton, AlignmentVButton, AutoUpdateTextButton | 172 | * @see AlignmentHButton, AlignmentVButton, AutoUpdateTextButton | ||
173 | */ | 173 | */ | ||
174 | void setButton(QPushButton *button, AlignmentHButton positionX = AlignHDefault, AlignmentVButton positionY = AlignTop, AutoUpdateTextButton autoUpdateTextButton = AutoUpdateTextButton(false)); | 174 | void setButton(QPushButton *button, AlignmentHButton positionX = AlignHDefault, AlignmentVButton positionY = AlignTop, AutoUpdateTextButton autoUpdateTextButton = AutoUpdateTextButton(false)); | ||
175 | 175 | | |||
176 | /** | 176 | /** | ||
177 | * Define the size of the list widget, in pixels. | | |||
178 | */ | | |||
179 | inline void setSizeList(const int height, const int width = 260); | | |||
180 | | ||||
181 | /** | | |||
182 | * Define the scroll when cleaning the search or changing the view. | 177 | * Define the scroll when cleaning the search or changing the view. | ||
183 | * The default value is AutoScroll::ScrollToSelectedItem. | 178 | * The default value is AutoScroll::ScrollToSelectedItem. | ||
184 | * @see AutoScroll | 179 | * @see AutoScroll | ||
185 | */ | 180 | */ | ||
186 | void setAutoScroll(AutoScroll scroll) | 181 | void setAutoScroll(AutoScroll scroll) | ||
187 | { | 182 | { | ||
188 | m_autoScroll = scroll; | 183 | m_autoScroll = scroll; | ||
189 | } | 184 | } | ||
Show All 14 Lines | 192 | protected: | |||
204 | * Override from QWidget. | 199 | * Override from QWidget. | ||
205 | */ | 200 | */ | ||
206 | void showEvent(QShowEvent *event) override; | 201 | void showEvent(QShowEvent *event) override; | ||
207 | 202 | | |||
208 | private: | 203 | private: | ||
209 | void init(const SearchBarPosition searchBarPos); | 204 | void init(const SearchBarPosition searchBarPos); | ||
210 | 205 | | |||
211 | /** | 206 | /** | ||
207 | * Define the size of the list widget, in pixels. The @p width is also | ||||
208 | * applied to the search bar. This does not recalculate the word wrap in items. | ||||
209 | */ | ||||
210 | inline void setSizeList(const int height, const int width = 260); | ||||
211 | | ||||
212 | /** | ||||
212 | * Load the data model with the syntax highlighting definitions to show in the list. | 213 | * Load the data model with the syntax highlighting definitions to show in the list. | ||
213 | */ | 214 | */ | ||
214 | void loadHighlightingModel(); | 215 | void loadHighlightingModel(); | ||
215 | 216 | | |||
216 | /** | 217 | /** | ||
217 | * Scroll the list, according to AutoScroll. | 218 | * Scroll the list, according to AutoScroll. | ||
218 | * @see AutoScroll | 219 | * @see AutoScroll | ||
219 | */ | 220 | */ | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
281 | 282 | | |||
282 | /** | 283 | /** | ||
283 | * Icon for selected/active item (checkbox). | 284 | * Icon for selected/active item (checkbox). | ||
284 | * NOTE: Selected and inactive items show an icon with incorrect color, | 285 | * NOTE: Selected and inactive items show an icon with incorrect color, | ||
285 | * however, this isn't a problem, since the list widget is never inactive. | 286 | * however, this isn't a problem, since the list widget is never inactive. | ||
286 | */ | 287 | */ | ||
287 | const QIcon m_checkIcon = QIcon::fromTheme(QStringLiteral("checkbox")); | 288 | const QIcon m_checkIcon = QIcon::fromTheme(QStringLiteral("checkbox")); | ||
288 | QIcon m_emptyIcon; | 289 | QIcon m_emptyIcon; | ||
289 | static const int m_iconSize = 16; | 290 | int m_iconSize = 16; | ||
291 | | ||||
292 | int m_defaultHeightItemSection; | ||||
293 | static const int m_scrollbarMargin = 2; | ||||
290 | 294 | | |||
291 | QPointer<KTextEditor::DocumentPrivate> m_doc; | 295 | QPointer<KTextEditor::DocumentPrivate> m_doc; | ||
292 | 296 | | |||
293 | private Q_SLOTS: | 297 | private Q_SLOTS: | ||
294 | /** | 298 | /** | ||
295 | * Action when selecting a item in the list. This also applies | 299 | * Action when selecting a item in the list. This also applies | ||
296 | * the syntax highlighting in the document and hides the menu. | 300 | * the syntax highlighting in the document and hides the menu. | ||
297 | * This is equivalent to KateModeMenuList::selectHighlightingSetVisibility(). | 301 | * This is equivalent to KateModeMenuList::selectHighlightingSetVisibility(). | ||
Show All 24 Lines | 323 | public: | |||
322 | } | 326 | } | ||
323 | 327 | | |||
324 | /** | 328 | /** | ||
325 | * Define the size of the widget list. | 329 | * Define the size of the widget list. | ||
326 | * @p height and @p width are values in pixels. | 330 | * @p height and @p width are values in pixels. | ||
327 | */ | 331 | */ | ||
328 | void setSizeList(const int height, const int width = 260); | 332 | void setSizeList(const int height, const int width = 260); | ||
329 | 333 | | |||
334 | /** | ||||
335 | * Get the width of the list, in pixels. | ||||
336 | * @see QAbstractScrollArea::sizeHint() | ||||
337 | */ | ||||
338 | inline int getWidth() const; | ||||
339 | | ||||
340 | /** | ||||
341 | * Get the width of the contents of the list (in pixels), that is, | ||||
342 | * the list minus the scroll bar and margins. | ||||
343 | */ | ||||
344 | int getContentWidth() const; | ||||
345 | | ||||
346 | /** | ||||
347 | * Get the width of the contents of the list (in pixels), that is, the list minus | ||||
348 | * the scroll bar and margins. The parameter allows you to specify additional margins | ||||
349 | * according to the scroll bar, which can be superimposed or fixed depending to the | ||||
350 | * desktop environment or operating system. | ||||
351 | * @param overlayScrollbarMargin Additional margin for the scroll bar, if it is | ||||
352 | * superimposed on the list. | ||||
353 | * @param classicScrollbarMargin Additional margin for the scroll bar, if fixed in the list. | ||||
354 | */ | ||||
355 | inline int getContentWidth(const int overlayScrollbarMargin, const int classicScrollbarMargin) const; | ||||
356 | | ||||
330 | inline void setCurrentItem(const int rowItem) | 357 | inline void setCurrentItem(const int rowItem) | ||
331 | { | 358 | { | ||
332 | selectionModel()->setCurrentIndex(m_parentMenu->m_model->index(rowItem, 0), QItemSelectionModel::ClearAndSelect); | 359 | selectionModel()->setCurrentIndex(m_parentMenu->m_model->index(rowItem, 0), QItemSelectionModel::ClearAndSelect); | ||
333 | } | 360 | } | ||
334 | inline QStandardItem *currentItem() const | 361 | inline QStandardItem *currentItem() const | ||
335 | { | 362 | { | ||
336 | return m_parentMenu->m_model->item(currentIndex().row(), 0); | 363 | return m_parentMenu->m_model->item(currentIndex().row(), 0); | ||
337 | } | 364 | } | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 446 | { | |||
420 | Q_OBJECT | 447 | Q_OBJECT | ||
421 | 448 | | |||
422 | public: | 449 | public: | ||
423 | ~SearchLine() | 450 | ~SearchLine() | ||
424 | { | 451 | { | ||
425 | m_bestResults.clear(); | 452 | m_bestResults.clear(); | ||
426 | } | 453 | } | ||
427 | 454 | | |||
455 | /** | ||||
456 | * Define the width of the search bar, in pixels. | ||||
457 | */ | ||||
458 | void setWidth(const int width); | ||||
459 | | ||||
428 | private: | 460 | private: | ||
429 | SearchLine(KateModeMenuList *menu) | 461 | SearchLine(KateModeMenuList *menu) | ||
430 | : QLineEdit(menu) | 462 | : QLineEdit(menu) | ||
431 | { | 463 | { | ||
432 | m_parentMenu = menu; | 464 | m_parentMenu = menu; | ||
433 | init(); | 465 | init(); | ||
434 | } | 466 | } | ||
435 | 467 | | |||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |