Qt 4.8
qmenu_wince.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 //Native menubars are only supported for Windows Mobile not the standard SDK/generic WinCE
43 #ifdef Q_WS_WINCE
44 #include "qmenu.h"
45 #include "qt_windows.h"
46 #include "qapplication.h"
47 #include "qmainwindow.h"
48 #include "qtoolbar.h"
49 #include "qevent.h"
50 #include "qstyle.h"
51 #include "qdebug.h"
52 #include "qwidgetaction.h"
53 #include <private/qapplication_p.h>
54 #include <private/qmenu_p.h>
55 #include <private/qmenubar_p.h>
56 
57 #include "qmenu_wince_resource_p.h"
58 
59 #include <QtCore/qlibrary.h>
60 #include <commctrl.h>
61 #if Q_OS_WINCE_WM
62 # include <windowsm.h>
63 #endif
64 
65 #include "qguifunctions_wince.h"
66 
67 #ifndef QT_NO_MENUBAR
68 
69 #ifndef SHCMBF_EMPTYBAR
70 #define SHCMBF_EMPTYBAR 0x0001
71 #endif
72 
73 #ifndef SHCMBM_GETSUBMENU
74 #define SHCMBM_GETSUBMENU (WM_USER + 401)
75 #endif
76 
77 #ifdef Q_OS_WINCE_WM
78 # define SHMBOF_NODEFAULT 0x00000001
79 # define SHMBOF_NOTIFY 0x00000002
80 # define SHCMBM_OVERRIDEKEY (WM_USER + 0x193)
81 #endif
82 
83 extern bool qt_wince_is_smartphone();//defined in qguifunctions_wce.cpp
84 extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wce.cpp
85 
87 
90 
92 {
93  DWORD cbSize;
94  HWND hwndParent;
95  DWORD dwFlags;
96  UINT nToolBarId;
97  HINSTANCE hInstRes;
98  int nBmpId;
100  HWND hwndMB;
101  COLORREF clrBk;
102 };
103 
104 typedef BOOL (WINAPI *AygCreateMenuBar)(qt_SHMENUBARINFO*);
105 typedef HRESULT (WINAPI *AygEnableSoftKey)(HWND,UINT,BOOL,BOOL);
106 
107 static bool aygResolved = false;
110 
111 static void resolveAygLibs()
112 {
113  if (!aygResolved) {
114  QLibrary aygLib(QLatin1String("aygshell"));
115  ptrCreateMenuBar = (AygCreateMenuBar) aygLib.resolve("SHCreateMenuBar");
116  ptrEnableSoftKey = (AygEnableSoftKey) aygLib.resolve("SHEnableSoftkey");
117  aygResolved = true;
118  }
119 }
120 
121 static void qt_wce_enable_soft_key(HWND handle, uint command)
122 {
123  resolveAygLibs();
124  if (ptrEnableSoftKey)
125  ptrEnableSoftKey(handle, command, false, true);
126 }
127 
128 static void qt_wce_disable_soft_key(HWND handle, uint command)
129 {
130  resolveAygLibs();
131  if (ptrEnableSoftKey)
132  ptrEnableSoftKey(handle, command, false, false);
133 }
134 
136 {
137  for(QList<QWceMenuAction*>::Iterator it = list->begin(); it != list->end(); ++it) {
138  QWceMenuAction *action = (*it);
139  delete action;
140  action = 0;
141  }
142  list->clear();
143 }
144 
145 //search for first QuitRole in QMenuBar
147 {
148  QAction *returnAction = 0;
149  for (int i = 0; i < actionItems.size(); ++i) {
150  QAction *action = actionItems.at(i);
151  if (action->menuRole() == QAction::QuitRole)
152  returnAction = action;
153  else
154  if (action->menu())
155  returnAction = qt_wce_get_quit_action(action->menu()->actions());
156  if (returnAction)
157  return returnAction; //return first action found
158  }
159  return 0; //nothing found;
160 }
161 
163 {
164  for (int i = 0; i < actionItems.size(); ++i) {
165  if (actionItems.at(i)->action->menuRole() == QAction::QuitRole)
166  return actionItems.at(i)->action;
167  else if (actionItems.at(i)->action->menu()) {
168  QAction *returnAction = qt_wce_get_quit_action(actionItems.at(i)->action->menu()->actions());
169  if (returnAction)
170  return returnAction;
171  }
172  }
173  return 0;
174 }
175 
176 static HMODULE qt_wce_get_module_handle()
177 {
178  HMODULE module = 0; //handle to resources
179  if (!(module = GetModuleHandle(L"QtGui4"))) //release dynamic
180  if (!(module = GetModuleHandle(L"QtGuid4"))) //debug dynamic
181  module = (HINSTANCE)qWinAppInst(); //static
182  Q_ASSERT_X(module, "qt_wce_get_module_handle()", "cannot get handle to module?");
183  return module;
184 }
185 
186 static void qt_wce_change_command(HWND menuHandle, int item, int command)
187 {
188 TBBUTTONINFOA tbbi;
189  memset(&tbbi,0,sizeof(tbbi));
190  tbbi.cbSize = sizeof(tbbi);
191  tbbi.dwMask = TBIF_COMMAND;
192  tbbi.idCommand = command;
193  SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi);
194 }
195 
196 static void qt_wce_rename_menu_item(HWND menuHandle, int item, const QString &newText)
197 {
198  TBBUTTONINFOA tbbi;
199  memset(&tbbi,0,sizeof(tbbi));
200  tbbi.cbSize = sizeof(tbbi);
201  tbbi.dwMask = TBIF_TEXT;
202  QString text = newText;
203  text.remove(QChar::fromLatin1('&'));
204  tbbi.pszText = (LPSTR) text.utf16();
205  SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi);
206 }
207 
208 static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, int toolbarID, int flags = 0)
209 {
210  resolveAygLibs();
211 
212  if (ptrCreateMenuBar) {
213  qt_SHMENUBARINFO mbi;
214  memset(&mbi, 0, sizeof(qt_SHMENUBARINFO));
215  mbi.cbSize = sizeof(qt_SHMENUBARINFO);
216  mbi.hwndParent = parentHandle;
217  mbi.hInstRes = resourceHandle;
218  mbi.dwFlags = flags;
219  mbi.nToolBarId = toolbarID;
220 
221  if (ptrCreateMenuBar(&mbi)) {
222 #ifdef Q_OS_WINCE_WM
223  // Tell the menu bar that we want to override hot key behaviour.
224  LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
225  SHMBOF_NODEFAULT | SHMBOF_NOTIFY);
226  SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam);
227 #endif
228  return mbi.hwndMB;
229  }
230  }
231  return 0;
232 }
233 
234 static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action)
235 {
236  Q_ASSERT_X(menu, "AppendMenu", "menu is 0");
237  if (action->action->isVisible()) {
238  int flags;
239  action->action->isEnabled() ? flags = MF_ENABLED : flags = MF_GRAYED;
240 
241  QString text = action->action->iconText();
242  text.remove(QChar::fromLatin1('&'));
243  if (action->action->isSeparator()) {
244  AppendMenu (menu, MF_SEPARATOR , 0, 0);
245  }
246  else if (action->action->menu()) {
247  text.remove(QChar::fromLatin1('&'));
248  AppendMenu (menu, MF_STRING | flags | MF_POPUP,
249  (UINT) action->action->menu()->wceMenu(), reinterpret_cast<const wchar_t *> (text.utf16()));
250  }
251  else {
252  AppendMenu (menu, MF_STRING | flags, action->command, reinterpret_cast<const wchar_t *> (text.utf16()));
253  }
254  if (action->action->isCheckable())
255  if (action->action->isChecked())
256  CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_CHECKED);
257  else
258  CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_UNCHECKED);
259  }
260 }
261 
262 // Removes all items from the menu without destroying the handles.
263 static void qt_wce_clear_menu(HMENU hMenu)
264 {
265  while (RemoveMenu(hMenu, 0, MF_BYPOSITION));
266 }
267 
278 {
279  for (int i = 0; i < nativeMenuBars.size(); ++i)
280  nativeMenuBars.at(i)->d_func()->wceRefresh();
281 }
282 
284 {
285  DrawMenuBar(wce_menubar->menubarHandle);
286 }
287 
298 {
299  Q_D(QMenu);
300  return d->wceCommands(command);
301 }
302 
314 {
315  const HWND hwndActiveWindow = GetActiveWindow();
316  for (int i = 0; i < nativeMenuBars.size(); ++i) {
317  QMenuBarPrivate* nativeMenuBar = nativeMenuBars.at(i)->d_func();
318  if (hwndActiveWindow == nativeMenuBar->wce_menubar->parentWindowHandle)
319  nativeMenuBar->wceCommands(command);
320  }
321 }
322 
324 {
325  QAction *foundAction = 0;
326  for (int i = 0; i < actions.size(); ++i) {
327  QWceMenuAction *action = actions.at(i);
328  if (action->action->menu()) {
329  foundAction = action->action->menu()->wceCommands(command);
330  if (foundAction)
331  break;
332  }
333  else if (action->command == command) {
334  action->action->activate(QAction::Trigger);
335  return true;
336  }
337  }
338  if (foundAction) {
339  emit q_func()->triggered(foundAction);
340  return true;
341  }
342  return false;
343 }
344 
346 {
347  if (wceClassicMenu) {
348  for (int i = 0; i < wce_menubar->actionItemsClassic.size(); ++i)
349  wceEmitSignals(wce_menubar->actionItemsClassic.at(i), command);
350  } else {
351  if (wceEmitSignals(wce_menubar->actionItems, command)) {
352  return;
353  }
354  else if (wce_menubar->leftButtonIsMenu) {//check if command is on the left quick button
355  wceEmitSignals(wce_menubar->actionItemsLeftButton, command);
356  }
357  else if ((wce_menubar->leftButtonAction) && (command == wce_menubar->leftButtonCommand)) {
358  emit q_func()->triggered(wce_menubar->leftButtonAction);
359  wce_menubar->leftButtonAction->activate(QAction::Trigger);
360  }
361  }
362 }
363 
365 {
366  QAction *foundAction = 0;
367  for (int i = 0; i < wce_menu->actionItems.size(); ++i) {
368  if (foundAction)
369  break;
370  QWceMenuAction *action = wce_menu->actionItems.at(i);
371  if (action->action->menu()) {
372  foundAction = action->action->menu()->d_func()->wceCommands(command);
373  }
374  else if (action->command == command) {
375  activateAction(action->action, QAction::Trigger);
376  return action->action;
377  }
378  }
379  if (foundAction)
380  emit q_func()->triggered(foundAction);
381  return foundAction;
382 }
383 
385 {
386  Q_Q(QMenuBar);
387  wce_menubar = new QWceMenuBarPrivate(this);
388 
389  wce_menubar->parentWindowHandle = parent ? parent->winId() : q->winId();
390  wce_menubar->leftButtonAction = defaultAction;
391 
392  wce_menubar->menubarHandle = qt_wce_create_menubar(wce_menubar->parentWindowHandle, (HINSTANCE)qWinAppInst(), 0, SHCMBF_EMPTYBAR);
393  Q_ASSERT_X(wce_menubar->menubarHandle, "wceCreateMenuBar", "cannot create empty menu bar");
394  DrawMenuBar(wce_menubar->menubarHandle);
395  nativeMenuBars.append(q);
396  wceClassicMenu = (!qt_wince_is_smartphone() && !qt_wince_is_pocket_pc());
397 }
398 
400 {
401  Q_Q(QMenuBar);
402  int index = nativeMenuBars.indexOf(q);
403  nativeMenuBars.removeAt(index);
404  if (wce_menubar) {
405  delete wce_menubar;
406  wce_menubar = 0;
407  }
408 }
409 
411 : menubarHandle(0), menuHandle(0), leftButtonMenuHandle(0),
412  leftButtonAction(0), leftButtonIsMenu(false), d(menubar)
413 {
414 }
415 
417 {
418  if (menubarHandle)
419  DestroyWindow(menubarHandle);
422 
423  for (int i=0; i<actionItemsClassic.size(); ++i)
424  if (!actionItemsClassic.value(i).empty())
427 
428  menubarHandle = 0;
429  menuHandle = 0;
431  leftButtonCommand = 0;
433 }
434 
436 : menuHandle(0)
437 {
438 }
439 
441 {
443  if (menuHandle)
444  DestroyMenu(menuHandle);
445 }
446 
448 {
449  QWceMenuAction *action = new QWceMenuAction;
450  action->action = a;
452  addAction(action, before);
453 }
454 
456 {
457  if (!action)
458  return;
459  int before_index = actionItems.indexOf(before);
460  if (before_index < 0) {
461  before = 0;
462  before_index = actionItems.size();
463  }
464  actionItems.insert(before_index, action);
465  rebuild();
466 }
467 
479 {
480  return d_func()->wceMenu();
481 }
482 
484 {
485  if (!wce_menu)
487  if (!wce_menu->menuHandle)
488  wce_menu->rebuild();
489  return wce_menu->menuHandle;
490 }
491 
493 {
494  if (!menuHandle)
495  menuHandle = CreatePopupMenu();
496  else
498 
499  for (int i = 0; i < actionItems.size(); ++i) {
500  QWceMenuAction *action = actionItems.at(i);
501  action->menuHandle = menuHandle;
503  }
505 }
506 
508 {
509  rebuild();
510 }
511 
513 {
514  actionItems.removeAll(action);
515  delete action;
516  rebuild();
517 }
518 
520 {
521  QWceMenuAction *action = new QWceMenuAction;
522  action->action = a;
524  addAction(action, findAction(before));
525 }
526 
528 {
529  if (!action)
530  return;
531  int before_index = actionItems.indexOf(before);
532  if (before_index < 0) {
533  before = 0;
534  before_index = actionItems.size();
535  }
536  actionItems.insert(before_index, action);
537  rebuild();
538 }
539 
541 {
543  rebuild();
544 }
545 
547 {
548  actionItems.removeAll(action);
549  delete action;
550  rebuild();
551 }
552 
554 {
555  if (wce_menubar)
556  wce_menubar->rebuild();
557 }
558 
560 {
561  d->q_func()->resize(0,0);
562  parentWindowHandle = d->q_func()->parentWidget() ? d->q_func()->parentWidget()->winId() : d->q_func()->winId();
563  if (d->wceClassicMenu) {
564  QList<QAction*> actions = d->actions;
565  int maxEntries;
566  int resourceHandle;
567  if (actions.size() < 5) {
568  maxEntries = 4;
569  resourceHandle = IDR_MAIN_MENU3;
570  } else if (actions.size() < 7) {
571  maxEntries = 6;
572  resourceHandle = IDR_MAIN_MENU4;
573  }
574  else {
575  maxEntries = 8;
576  resourceHandle = IDR_MAIN_MENU5;
577  }
578  Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted");
580  DestroyWindow(menubarHandle);
581  menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), resourceHandle);
582  Q_ASSERT_X(menubarHandle, "rebuild classic menu", "cannot create menubar from resource");
583  DrawMenuBar(menubarHandle);
584  QList<int> menu_ids;
585  QList<int> item_ids;
586  menu_ids << IDM_MENU1 << IDM_MENU2 << IDM_MENU3 << IDM_MENU4 << IDM_MENU5 << IDM_MENU6 << IDM_MENU7 << IDM_MENU8;
587  item_ids << IDM_ITEM1 << IDM_ITEM2 << IDM_ITEM3 << IDM_ITEM4 << IDM_ITEM5 << IDM_ITEM6 << IDM_ITEM7 << IDM_ITEM8;
588 
589  for (int i = 0; i < actionItemsClassic.size(); ++i)
590  if (!actionItemsClassic.value(i).empty())
591  qt_wce_delete_action_list(&actionItemsClassic[i]);
592  actionItemsClassic.clear();
593 
594  for (int i = 0; i < actions.size(); ++i) {
595  qt_wce_rename_menu_item(menubarHandle, menu_ids.at(i), actions.at(i)->text());
596  QList<QAction *> subActions = actions.at(i)->menu()->actions();
597  HMENU subMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0 , menu_ids.at(i));
598  DeleteMenu(subMenuHandle, item_ids.at(i), MF_BYCOMMAND);
599  for (int c = 0; c < subActions.size(); ++c) {
601  actionItemsClassic.append(list);
602  QWceMenuAction *action = new QWceMenuAction;
603  action->action = subActions.at(c);
605  action->menuHandle = subMenuHandle;
606  actionItemsClassic.last().append(action);
607  qt_wce_insert_action(subMenuHandle, action);
608  }
609  }
610  for (int i = actions.size();i<maxEntries;++i) {
611  qt_wce_rename_menu_item(menubarHandle, menu_ids.at(i), QString());
612  qt_wce_disable_soft_key(menubarHandle, menu_ids.at(i));
613  }
614  } else {
615  leftButtonAction = d->defaultAction;
616  if (!leftButtonAction)
617  leftButtonAction = qt_wce_get_quit_action(actionItems);
618 
619  leftButtonIsMenu = (leftButtonAction && leftButtonAction->menu());
620  Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted");
622  DestroyWindow(menubarHandle);
623  if (leftButtonIsMenu) {
624  menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU2);
625  Q_ASSERT_X(menubarHandle, "rebuild !created left menubar", "cannot create menubar from resource");
626  menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU);
627  Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?");
628  DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND);
629  leftButtonMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_LEFTMENU);
630  Q_ASSERT_X(leftButtonMenuHandle, "rebuild !created", "IDM_LEFTMENU not found - invalid resource?");
631  DeleteMenu(leftButtonMenuHandle, IDM_VIEW, MF_BYCOMMAND);
632  } else {
633  menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU);
634  Q_ASSERT_X(menubarHandle, "rebuild !created no left menubar", "cannot create menubar from resource");
635  menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU);
636  Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?");
637  DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND);
638  leftButtonMenuHandle = 0;
639  leftButtonCommand = qt_wce_menu_static_cmd_id++;
640  qt_wce_change_command(menubarHandle, IDM_EXIT, leftButtonCommand);
641  }
642 
643  if (actionItems.size() == 0) {
644  qt_wce_rename_menu_item(menubarHandle, IDM_MENU, QLatin1String(""));
645  qt_wce_disable_soft_key(menubarHandle, IDM_MENU);
646  }
647  for (int i = 0; i < actionItems.size(); ++i) {
648  QWceMenuAction *action = actionItems.at(i);
649  action->menuHandle = menuHandle;
651  }
652  if (!leftButtonIsMenu) {
653  if (leftButtonAction) {
654  qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, leftButtonAction->text());
655  qt_wce_enable_soft_key(menubarHandle, leftButtonCommand);
656  } else {
657  qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, QLatin1String(""));
658  qt_wce_disable_soft_key(menubarHandle, leftButtonCommand);
659  }
660  } else {
661  qt_wce_rename_menu_item(menubarHandle, IDM_LEFTMENU, leftButtonAction->text());
662  QList<QAction *> actions = leftButtonAction->menu()->actions();
663  qt_wce_delete_action_list(&actionItemsLeftButton);
664  for (int i=0; i<actions.size(); ++i) {
665  QWceMenuAction *action = new QWceMenuAction;
666  action->action = actions.at(i);
668  action->menuHandle = leftButtonMenuHandle;
669  actionItemsLeftButton.append(action);
670  qt_wce_insert_action(leftButtonMenuHandle, action);
671  }
672  }
673  }
674  DrawMenuBar(menubarHandle);
675 }
676 
678 
679 #endif //QT_NO_MENUBAR
680 #endif //Q_WS_WINCE
bool isSeparator() const
Returns true if this action is a separator action; otherwise it returns false.
Definition: qaction.cpp:839
double d
Definition: qnumeric_p.h:62
#define IDR_MAIN_MENU2
QList< QList< QWceMenuAction * > > actionItemsClassic
Definition: qmenubar_p.h:228
void wceCommands(uint command)
static AygEnableSoftKey ptrEnableSoftKey
bool isEnabled() const
Definition: qaction.cpp:1208
struct QMenuBarPrivate::QWceMenuBarPrivate * wce_menubar
#define IDM_MENU3
QList< QWceMenuAction * > actionItems
Definition: qmenubar_p.h:226
#define IDM_EXIT
unsigned char c[8]
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void syncAction(QWceMenuAction *)
#define IDM_ITEM8
void activate(ActionEvent event)
Sends the relevant signals for ActionEvent event.
Definition: qaction.cpp:1326
#define it(className, varName)
#define IDM_MENU7
HMENU menuHandle
Definition: qmenu_p.h:130
QWceMenuBarPrivate(QMenuBarPrivate *menubar)
struct QMenuPrivate::QWceMenuPrivate * wce_menu
QString text
the action&#39;s descriptive text
Definition: qaction.h:76
bool empty() const
This function is provided for STL compatibility.
Definition: qlist.h:304
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static void qt_wce_enable_soft_key(HWND handle, uint command)
static void wceRefresh()
This function refreshes the native Windows CE menu.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
void removeAction(QWceMenuAction *)
static void wceCommands(uint command)
This function sends native Windows CE commands to Qt menu bars and all their child menus...
QList< QWceMenuAction * > actionItemsLeftButton
Definition: qmenubar_p.h:227
#define SHCMBF_EMPTYBAR
Definition: qmenu_wince.cpp:70
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
#define IDM_MENU
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
long ASN1_INTEGER_get ASN1_INTEGER * a
void * resolve(const char *symbol)
Returns the address of the exported symbol symbol.
Definition: qlibrary.cpp:1155
static bool aygResolved
#define IDM_ITEM2
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define IDM_ABOUT
QList< QWceMenuAction * > actionItems
Definition: qmenu_p.h:345
#define Q_D(Class)
Definition: qglobal.h:2482
bool qt_wince_is_pocket_pc()
BOOL(WINAPI * AygCreateMenuBar)(qt_SHMENUBARINFO *)
QAction * wceCommands(uint command)
This function sends native Windows CE commands to Qt menus.
MenuRole menuRole
the action&#39;s menu role
Definition: qaction.h:88
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isVisible() const
Definition: qaction.cpp:1246
bool wceEmitSignals(QList< QWceMenuAction *> actions, uint command)
static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action)
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void wceCreateMenuBar(QWidget *)
#define IDM_MENU4
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
#define IDM_ITEM1
static QList< QMenuBar * > nativeMenuBars
Definition: qmenu_wince.cpp:89
static void resolveAygLibs()
#define IDM_ITEM6
QWceMenuAction * findAction(QAction *a)
Definition: qmenu_p.h:356
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define IDM_ITEM4
#define emit
Definition: qobjectdefs.h:76
#define IDM_ITEM7
#define IDR_MAIN_MENU5
static void qt_wce_disable_soft_key(HWND handle, uint command)
unsigned int uint
Definition: qglobal.h:996
static AygCreateMenuBar ptrCreateMenuBar
#define IDR_MAIN_MENU
static void qt_wce_change_command(HWND menuHandle, int item, int command)
#define IDM_ITEM5
static QChar fromLatin1(char c)
Converts the Latin-1 character c to its equivalent QChar.
Definition: qchar.h:378
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
void clear()
Removes all items from the list.
Definition: qlist.h:764
static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, int toolbarID, int flags=0)
static HMODULE qt_wce_get_module_handle()
#define IDM_MENU8
static void qt_wce_rename_menu_item(HWND menuHandle, int item, const QString &newText)
void syncAction(QWceMenuAction *)
QAction * wceCommands(uint command)
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
static uint qt_wce_menu_static_cmd_id
Definition: qmenu_wince.cpp:88
HINSTANCE hInstRes
Definition: qmenu_wince.cpp:97
#define IDM_MENU1
long HRESULT
#define SHCMBM_GETSUBMENU
Definition: qmenu_wince.cpp:74
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
QMenu * menu() const
Returns the menu contained by this action.
Definition: qaction.cpp:793
void addAction(QAction *, QAction *=0)
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
QPointer< QAction > action
Definition: qmenu_p.h:129
#define IDM_ITEM3
#define IDR_MAIN_MENU3
#define IDR_MAIN_MENU4
HMENU wceMenu()
#define IDM_VIEW
static void qt_wce_delete_action_list(QList< QWceMenuAction *> *list)
void removeAction(QWceMenuAction *)
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
bool isCheckable() const
Definition: qaction.cpp:1105
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget&#39;s actions.
Definition: qwidget.cpp:3407
HMENU wceMenu()
This function will return the HMENU used to create the native Windows CE menu bar bindings...
uint command
Definition: qmenu_p.h:128
static QAction * qt_wce_get_quit_action(QList< QAction *> actionItems)
#define IDM_MENU6
QList< QAction * > actions
Definition: qwidget_p.h:760
QString iconText
the action&#39;s descriptive icon text
Definition: qaction.h:77
bool isChecked() const
Definition: qaction.cpp:1151
quint16 index
#define IDM_MENU5
void addAction(QAction *, QWceMenuAction *=0)
Q_CORE_EXPORT HINSTANCE qWinAppInst()
void wceDestroyMenuBar()
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557
void _q_updateDefaultAction()
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867
HRESULT(WINAPI * AygEnableSoftKey)(HWND, UINT, BOOL, BOOL)
#define IDM_MENU2
#define IDM_LEFTMENU
bool qt_wince_is_smartphone()
static void qt_wce_clear_menu(HMENU hMenu)
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
#define text
Definition: qobjectdefs.h:80
The QLibrary class loads shared libraries at runtime.
Definition: qlibrary.h:62
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
const ushort * utf16() const
Returns the QString as a &#39;\0\&#39;-terminated array of unsigned shorts.
Definition: qstring.cpp:5290
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480