Qt 4.8
Public Functions | Public Variables | List of all members
QMenuBarPrivate::QWceMenuBarPrivate Struct Reference

#include <qmenubar_p.h>

Public Functions

void addAction (QAction *, QAction *=0)
 
void addAction (QWceMenuAction *, QWceMenuAction *=0)
 
QWceMenuActionfindAction (QAction *a)
 
 QWceMenuBarPrivate (QMenuBarPrivate *menubar)
 
void rebuild ()
 
void removeAction (QWceMenuAction *)
 
void removeAction (QAction *a)
 
void syncAction (QWceMenuAction *)
 
void syncAction (QAction *a)
 
 ~QWceMenuBarPrivate ()
 

Public Variables

QList< QWceMenuAction * > actionItems
 
QList< QList< QWceMenuAction * > > actionItemsClassic
 
QList< QWceMenuAction * > actionItemsLeftButton
 
QMenuBarPrivated
 
QPointer< QActionleftButtonAction
 
int leftButtonCommand
 
bool leftButtonIsMenu
 
HMENU leftButtonMenuHandle
 
HWND menubarHandle
 
HMENU menuHandle
 
HWND parentWindowHandle
 

Detailed Description

Definition at line 225 of file qmenubar_p.h.

Constructors and Destructors

◆ QWceMenuBarPrivate()

QMenuBarPrivate::QWceMenuBarPrivate::QWceMenuBarPrivate ( QMenuBarPrivate menubar)

◆ ~QWceMenuBarPrivate()

QMenuBarPrivate::QWceMenuBarPrivate::~QWceMenuBarPrivate ( )

Definition at line 416 of file qmenu_wince.cpp.

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 }
QList< QList< QWceMenuAction * > > actionItemsClassic
Definition: qmenubar_p.h:228
QList< QWceMenuAction * > actionItems
Definition: qmenubar_p.h:226
bool empty() const
This function is provided for STL compatibility.
Definition: qlist.h:304
static void wceRefresh()
This function refreshes the native Windows CE menu.
QList< QWceMenuAction * > actionItemsLeftButton
Definition: qmenubar_p.h:227
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 void qt_wce_delete_action_list(QList< QWceMenuAction *> *list)
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

Functions

◆ addAction() [1/2]

void QMenuBarPrivate::QWceMenuBarPrivate::addAction ( QAction a,
QAction before = 0 
)

Definition at line 519 of file qmenu_wince.cpp.

Referenced by QMenuBar::actionEvent().

520 {
521  QWceMenuAction *action = new QWceMenuAction;
522  action->action = a;
524  addAction(action, findAction(before));
525 }
long ASN1_INTEGER_get ASN1_INTEGER * a
static uint qt_wce_menu_static_cmd_id
Definition: qmenu_wince.cpp:88
void addAction(QAction *, QAction *=0)
QPointer< QAction > action
Definition: qmenu_p.h:129
uint command
Definition: qmenu_p.h:128
QWceMenuAction * findAction(QAction *a)
Definition: qmenubar_p.h:247

◆ addAction() [2/2]

void QMenuBarPrivate::QWceMenuBarPrivate::addAction ( QWceMenuAction action,
QWceMenuAction before = 0 
)

Definition at line 527 of file qmenu_wince.cpp.

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 }
QList< QWceMenuAction * > actionItems
Definition: qmenubar_p.h:226
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
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
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ findAction()

QWceMenuAction* QMenuBarPrivate::QWceMenuBarPrivate::findAction ( QAction a)
inline

Definition at line 247 of file qmenubar_p.h.

247  {
248  for(int i = 0; i < actionItems.size(); i++) {
249  QWceMenuAction *act = actionItems[i];
250  if(a == act->action)
251  return act;
252  }
253  return 0;
254  }
QList< QWceMenuAction * > actionItems
Definition: qmenubar_p.h:226
QPointer< QAction > action
Definition: qmenu_p.h:129
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ rebuild()

void QMenuBarPrivate::QWceMenuBarPrivate::rebuild ( )

Definition at line 559 of file qmenu_wince.cpp.

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) {
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);
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())
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) {
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) {
613  }
614  } else {
616  if (!leftButtonAction)
618 
620  Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted");
622  DestroyWindow(menubarHandle);
623  if (leftButtonIsMenu) {
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);
630  Q_ASSERT_X(leftButtonMenuHandle, "rebuild !created", "IDM_LEFTMENU not found - invalid resource?");
631  DeleteMenu(leftButtonMenuHandle, IDM_VIEW, MF_BYCOMMAND);
632  } else {
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);
641  }
642 
643  if (actionItems.size() == 0) {
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) {
656  } else {
659  }
660  } else {
664  for (int i=0; i<actions.size(); ++i) {
665  QWceMenuAction *action = new QWceMenuAction;
666  action->action = actions.at(i);
671  }
672  }
673  }
674  DrawMenuBar(menubarHandle);
675 }
#define IDR_MAIN_MENU2
QList< QList< QWceMenuAction * > > actionItemsClassic
Definition: qmenubar_p.h:228
QList< QWceMenuAction * > actionItems
Definition: qmenubar_p.h:226
#define IDM_MENU3
#define IDM_EXIT
unsigned char c[8]
Definition: qnumeric_p.h:62
#define IDM_ITEM8
#define IDM_MENU7
HMENU menuHandle
Definition: qmenu_p.h:130
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
static void qt_wce_enable_soft_key(HWND handle, uint command)
QList< QWceMenuAction * > actionItemsLeftButton
Definition: qmenubar_p.h:227
#define IDM_MENU
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define IDM_ITEM2
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define IDM_ABOUT
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
#define IDM_MENU4
#define IDM_ITEM1
#define IDM_ITEM6
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define IDM_ITEM4
#define IDM_ITEM7
#define IDR_MAIN_MENU5
static void qt_wce_disable_soft_key(HWND handle, uint command)
#define IDR_MAIN_MENU
static void qt_wce_change_command(HWND menuHandle, int item, int command)
#define IDM_ITEM5
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)
static uint qt_wce_menu_static_cmd_id
Definition: qmenu_wince.cpp:88
#define IDM_MENU1
#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
QPointer< QAction > defaultAction
Definition: qmenubar_p.h:184
QPointer< QAction > action
Definition: qmenu_p.h:129
#define IDM_ITEM3
#define IDR_MAIN_MENU3
#define IDR_MAIN_MENU4
#define IDM_VIEW
static void qt_wce_delete_action_list(QList< QWceMenuAction *> *list)
T & last()
Returns a reference to the last item in the list.
Definition: qlist.h:284
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget&#39;s actions.
Definition: qwidget.cpp:3407
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
#define IDM_MENU5
QPointer< QAction > leftButtonAction
Definition: qmenubar_p.h:234
#define IDM_MENU2
#define IDM_LEFTMENU
static void qt_wce_clear_menu(HMENU hMenu)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ removeAction() [1/2]

void QMenuBarPrivate::QWceMenuBarPrivate::removeAction ( QWceMenuAction action)

Definition at line 546 of file qmenu_wince.cpp.

Referenced by QMenuBar::actionEvent().

547 {
548  actionItems.removeAll(action);
549  delete action;
550  rebuild();
551 }
QList< QWceMenuAction * > actionItems
Definition: qmenubar_p.h:226
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ removeAction() [2/2]

void QMenuBarPrivate::QWceMenuBarPrivate::removeAction ( QAction a)
inline

Definition at line 246 of file qmenubar_p.h.

Referenced by removeAction().

246 { removeAction(findAction(a)); }
void removeAction(QWceMenuAction *)
QWceMenuAction * findAction(QAction *a)
Definition: qmenubar_p.h:247

◆ syncAction() [1/2]

void QMenuBarPrivate::QWceMenuBarPrivate::syncAction ( QWceMenuAction )

Definition at line 540 of file qmenu_wince.cpp.

Referenced by QMenuBar::actionEvent().

541 {
543  rebuild();
544 }
static void wceRefresh()
This function refreshes the native Windows CE menu.

◆ syncAction() [2/2]

void QMenuBarPrivate::QWceMenuBarPrivate::syncAction ( QAction a)
inline

Definition at line 243 of file qmenubar_p.h.

Referenced by syncAction().

243 { syncAction(findAction(a)); }
void syncAction(QWceMenuAction *)
QWceMenuAction * findAction(QAction *a)
Definition: qmenubar_p.h:247

Properties

◆ actionItems

QList<QWceMenuAction*> QMenuBarPrivate::QWceMenuBarPrivate::actionItems

Definition at line 226 of file qmenubar_p.h.

Referenced by ~QWceMenuBarPrivate().

◆ actionItemsClassic

QList<QList<QWceMenuAction*> > QMenuBarPrivate::QWceMenuBarPrivate::actionItemsClassic

Definition at line 228 of file qmenubar_p.h.

Referenced by ~QWceMenuBarPrivate().

◆ actionItemsLeftButton

QList<QWceMenuAction*> QMenuBarPrivate::QWceMenuBarPrivate::actionItemsLeftButton

Definition at line 227 of file qmenubar_p.h.

Referenced by ~QWceMenuBarPrivate().

◆ d

QMenuBarPrivate* QMenuBarPrivate::QWceMenuBarPrivate::d

Definition at line 235 of file qmenubar_p.h.

◆ leftButtonAction

QPointer<QAction> QMenuBarPrivate::QWceMenuBarPrivate::leftButtonAction

Definition at line 234 of file qmenubar_p.h.

◆ leftButtonCommand

int QMenuBarPrivate::QWceMenuBarPrivate::leftButtonCommand

Definition at line 236 of file qmenubar_p.h.

Referenced by ~QWceMenuBarPrivate().

◆ leftButtonIsMenu

bool QMenuBarPrivate::QWceMenuBarPrivate::leftButtonIsMenu

Definition at line 233 of file qmenubar_p.h.

◆ leftButtonMenuHandle

HMENU QMenuBarPrivate::QWceMenuBarPrivate::leftButtonMenuHandle

Definition at line 230 of file qmenubar_p.h.

Referenced by ~QWceMenuBarPrivate().

◆ menubarHandle

HWND QMenuBarPrivate::QWceMenuBarPrivate::menubarHandle

Definition at line 231 of file qmenubar_p.h.

Referenced by ~QWceMenuBarPrivate().

◆ menuHandle

HMENU QMenuBarPrivate::QWceMenuBarPrivate::menuHandle

Definition at line 229 of file qmenubar_p.h.

Referenced by ~QWceMenuBarPrivate().

◆ parentWindowHandle

HWND QMenuBarPrivate::QWceMenuBarPrivate::parentWindowHandle

Definition at line 232 of file qmenubar_p.h.

Referenced by QMenuBar::wceCommands().


The documentation for this struct was generated from the following files: