M68KDasmBrowserWindow::M68KDasmBrowserWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog),
//	layout(new QVBoxLayout), text(new QTextBrowser),
	layout(new QVBoxLayout), text(new QLabel),
	refresh(new QPushButton(tr("Refresh"))),
	address(new QLineEdit),
	go(new QPushButton(tr("Go"))),
	memBase(0x4000)
{
	setWindowTitle(tr("M68K Disassembly Browser"));

	address->setInputMask("hhhhhh");
	QHBoxLayout * hbox1 = new QHBoxLayout;
	hbox1->addWidget(refresh);
	hbox1->addWidget(address);
	hbox1->addWidget(go);

	// Need to set the size as well...
//	resize(560, 480);

	QFont fixedFont("Lucida Console", 8, QFont::Normal);
	text->setFont(fixedFont);
////	layout->setSizeConstraint(QLayout::SetFixedSize);
	setLayout(layout);

	layout->addWidget(text);
//	layout->addWidget(refresh);
	layout->addLayout(hbox1);

	connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents()));
	connect(go, SIGNAL(clicked()), this, SLOT(GoToAddress()));
}
示例#2
0
MeshTreeWidgetItem::MeshTreeWidgetItem(MeshTree* /*meshTree*/, vcg::AlignPair::Result *A, MeshTreeWidgetItem *parent)
{
		n=0;
		a=A;
		parent->addChild(this);
		QString buf=QString("Arc: %1 -> %2 Area: %3 Err: %4 Sample# %5 (%6)")
			.arg((*A).FixName)
			.arg((*A).MovName)
			.arg((*A).area, 6,'f',3)
			.arg((*A).err,  6,'f',3)
			.arg((*A).ap.SampleNum,6)
			.arg((*A).as.LastSampleUsed() );
			setText(3,buf);

			QFont fixedFont("Courier");
			std::vector<vcg::AlignPair::Stat::IterInfo> &I= (*A).as.I;
			QTreeWidgetItem *itemArcIter;
			buf.sprintf("Iter - MinD -  Error - Sample - Used - DistR - BordR - AnglR  ");
			//          " 12   123456  1234567   12345  12345   12345   12345   12345
			itemArcIter = new QTreeWidgetItem(this);
			itemArcIter->setFont(3,fixedFont);
			itemArcIter->setText(3,buf);
			for(int qi=0;qi<I.size();++qi)
			{
				buf.sprintf(" %02i   %6.2f  %7.4f   %05i  %05i  %5i  %5i  %5i",
										qi, I[qi].MinDistAbs, I[qi].pcl50,
										I[qi].SampleTested,I[qi].SampleUsed,I[qi].DistanceDiscarded,I[qi].BorderDiscarded,I[qi].AngleDiscarded );
				itemArcIter = new QTreeWidgetItem(this);
				itemArcIter->setFont(3,fixedFont);
				itemArcIter->setText(3,buf);
			}
}
void ByteArrayColumnViewPrivate::init()
{
    Q_Q( ByteArrayColumnView );

    // creating the columns in the needed order
    mValueColumn =
        new ValueByteArrayColumnRenderer( mStylist, mByteArrayModel, mTableLayout, mTableRanges );
    mMiddleBorderColumn =
        new BorderColumnRenderer( mStylist, true );
    mCharColumn =
        new CharByteArrayColumnRenderer( mStylist, mByteArrayModel, mTableLayout, mTableRanges );

    q->addColumn( mOffsetColumn );
    q->addColumn( mOffsetBorderColumn );
    q->addColumn( mValueColumn );
    q->addColumn( mMiddleBorderColumn );
    q->addColumn( mCharColumn );

    // select the active column
    mActiveColumn = mCharColumn;
    mInactiveColumn = mValueColumn;

    // set char encoding
    mValueColumn->setValueCodec( (ValueCoding)mValueCoding, mValueCodec );
    mValueColumn->setCharCodec( mCharCodec );
    mCharColumn->setCharCodec( mCharCodec );

    adaptController();

    // do here, not in base class, as changeEvent(fontEvent) needs this init run before
    QFont fixedFont( QLatin1String("fixed") );
    fixedFont.setFixedPitch( true );
    q->setFont( fixedFont );
}
示例#4
0
confirmAchOK::confirmAchOK(QWidget* parent, const char* name, Qt::WFlags fl)
    : XDialog(parent, name, fl)
{
  setupUi(this);
  QFont fixedFont("Courier");
  fixedFont.setStyleHint(QFont::TypeWriter);
  fixedFont.setPointSize(fixedFont.pointSize() - 2);
  _fileContents->setFont(fixedFont);
}
示例#5
0
CodeEdit::CodeEdit(QWidget *parent) :
    QTextEdit(parent)
{
    QFont fixedFont("Courier", 10);
    setFont( fixedFont );

    /*
    QPalette palette;
    palette.setColor(QPalette::Base,Qt::black);
    palette.setColor(QPalette::Text,Qt::white);

    setPalette(palette);*/
}
示例#6
0
文件: DasmWin.cpp 项目: djipi/GitHub
//DasmWindow::DasmWindow(QMdiArea * parent/*= 0*/) : QMdiSubWindow(parent, Qt::Dialog),
DasmWindow::DasmWindow(QWidget * parent /*= 0*/): QWidget(parent, Qt::Dialog),
//	layout(new QVBoxLayout), text(new QTextBrowser),
	layout1(new QDockWidget), layout(new QVBoxLayout), text(new QLabel),
	refresh(new QPushButton(tr("Refresh"))),
	address(new QLineEdit),
	go(new QPushButton(tr("Go"))),
	memBase(0x4000)
{
//	m68kDasmWindow *m68kDasmWin = new m68kDasmWindow();
	setWindowTitle(tr("Jaguar Disassembly Window"));
	layout1->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	//addDockWidget(Qt::RightDockWidgetArea, layout1);
	//layout1->addTab(new m68KDasmWindow(), tr("M68K Disassembly"));
	//layout = new QTabWidget;
	//layout->QWidget();

	//QDockWidget *shapesDockWidget = new QDockWidget(tr("Shapes"));
	//shapesDockWidget->setObjectName("shapesDockWidget");
	//shapesDockWidget->setWidget(treeWidget);
	//shapesDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	//shapesDockWidget->show();

#if 0
	address->setInputMask("hhhhhh");
	QHBoxLayout * hbox1 = new QHBoxLayout;
	hbox1->addWidget(refresh);
	hbox1->addWidget(address);
	hbox1->addWidget(go);

	// Need to set the size as well...
//	resize(560, 480);

	QFont fixedFont("Lucida Console", 8, QFont::Normal);
//	QFont fixedFont("", 8, QFont::Normal);
	fixedFont.setStyleHint(QFont::TypeWriter);
	text->setFont(fixedFont);
////	layout->setSizeConstraint(QLayout::SetFixedSize);
	setLayout(layout);

	layout->addWidget(text);
//	layout->addWidget(refresh);
	layout->addLayout(hbox1);

	connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents()));
	connect(go, SIGNAL(clicked()), this, SLOT(GoToAddress()));
#endif
}
CPUBrowserWindow::CPUBrowserWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog),
//	layout(new QVBoxLayout), text(new QTextBrowser),
	layout(new QVBoxLayout), text(new QLabel),
	refresh(new QPushButton(tr("Refresh"))),
	memBase(0)
{
	setWindowTitle(tr("CPU Browser"));

	// Need to set the size as well...
//	resize(560, 480);

	QFont fixedFont("Lucida Console", 8, QFont::Normal);
	text->setFont(fixedFont);
////	layout->setSizeConstraint(QLayout::SetFixedSize);
	setLayout(layout);

	layout->addWidget(text);
	layout->addWidget(refresh);

	connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents()));
}
示例#8
0
TextOutputWidget::TextOutputWidget(QWidget *parent)
: QWidget(parent)
{
  m_succesTextColor = QColor::fromRgb(3, 191, 3);
  m_succesBackgroundColor = QColor::fromRgb(231, 247, 231);

  m_errorTextColor = QColor::fromRgb(191, 3, 3);
  m_errorBackgroundColor = QColor::fromRgb(247, 231, 231);

  m_layout = new QHBoxLayout(this);

  m_output = new QTextEdit();
  m_output->setReadOnly(true);

  QFont fixedFont(KGlobalSettings::fixedFont());

  m_output->setCurrentFont(fixedFont);

  KToolBar *toolbar = new KToolBar(this);
  toolbar->setOrientation(Qt::Vertical);
  toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
  toolbar->setIconSize(QSize(16, 16));

  /// TODO: disable actions if no results are displayed

  KAction *action;

  action = new KAction( KIcon("edit-clear"), i18nc("@action:intoolbar", "Clear"), this);
  toolbar->addAction(action);
  connect(action, SIGNAL(triggered()), m_output, SLOT(clear()));

  m_layout->addWidget(toolbar);
  m_layout->addWidget(m_output, 1);

  setLayout(m_layout);
}
示例#9
0
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
jdlvFrame::jdlvFrame (const char *fileToLoad) : nextWorld(NULL),
  isChanged(false),
    eM(elModeView), genNo(0), curColor(0), speed(3), timerID(0)
{
  QFont fixedFont(jdlvFONTFACENAME, jdlvFONTSIZE);
        fixedFont.setStyleHint(QFont::TypeWriter);
  primeWorld = new_elMundoA();
  vista = new elVista (this, primeWorld); setCentralWidget(vista);
  vista->setMinimumSize(720, 480);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QToolBar *bottom = new permanentToolBar("ctrl", this);
  bottom->setFloatable(false);
  bottom->setMovable  (false);
  bottom->setIconSize(QSize(28,25));
  showTimeCB = new QAction(QIcon(":/time.png"), QString("time"), this);
  showInfoPB = new QAction(QIcon(":/info.png"), QString("info"), this);
  connect(showTimeCB, SIGNAL(triggered(bool)), this, SLOT(ToggleTime(bool)));
  connect(showInfoPB, SIGNAL(triggered()),     this, SLOT(ShowInfo()));
  bottom->addAction(showTimeCB);
  bottom->addAction(showInfoPB);         showInfoPB->setEnabled(false); //+
  bottom->addWidget(new QLabel(" "));
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QActionGroup *modeGroup = new QActionGroup(this);
  modeEdit = new QAction(QIcon(":/pen-in-box.png"),QString("Edit (X)"),  this);
  modeView = new QAction(QIcon(":/eye-half.png"),  QString("View (Z)"),  this);
  setColor = new QAction(QIcon(":/empty1.png"),    QString("color"),     this);
  connect(modeView, SIGNAL(triggered()), this, SLOT(SetModeView()));
  connect(modeEdit, SIGNAL(triggered()), this, SLOT(SetModeEdit()));
  connect(setColor, SIGNAL(triggered()), this, SLOT(PopupColorMenu()));
  showTimeCB->setCheckable(true);
  modeEdit  ->setCheckable(true); modeEdit->setShortcut(QKeySequence("X"));
  modeView  ->setCheckable(true); modeView->setShortcut(QKeySequence("Z"));
  modeView  ->setChecked  (true);
  modeGroup->addAction(modeView); bottom->addAction(modeView);
  modeGroup->addAction(modeEdit); bottom->addAction(modeEdit);
                                  bottom->addAction(setColor);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QMenu *file_menu = menuBar()->addMenu("File");
  openFile =  new QAction(QIcon(":/book.png"), QString("Open.."), this);
  reLoad = new QAction(QIcon(":/reload1.png"), QString("reload"), this);
  connect(openFile, SIGNAL(triggered()), this, SLOT(OpenFile()));
  connect(reLoad,   SIGNAL(triggered()), this, SLOT(DoReload()));
  file_menu->addAction(openFile);
  file_menu->addAction(reLoad);        reLoad->setEnabled(false);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QMenu *edit_menu = menuBar()->addMenu("Edit");
  deleteSelected = new QAction(QString("delete"), this);
  deleteSelected->setShortcut(QKeySequence("Del"));
  cropSelected   = new QAction(QString("crop"), this);
  pasteClipboard =
            new QAction(QIcon(":/win-paste.png"),   QString("paste"),    this);
  copyCLR = new QAction(QIcon(":/export-blue.png"), QString("copy"),     this);
  copyBnW = new QAction(QIcon(":/export-mono.png"), QString("copy b/w"), this);
  newWin = new QAction(QIcon(":/windows1.png"),   QString("new window"), this);
  bottom->addAction(pasteClipboard);     pasteClipboard->setEnabled(false); //+
  bottom->addAction(copyCLR); copyCLR->setShortcut(QKeySequence("Ctrl+C"));
  bottom->addAction(copyBnW);
  bottom->addAction(newWin);       newWin->setEnabled(false); //+
  connect(deleteSelected, SIGNAL(triggered()), this, SLOT(DeleteSelected()));
  connect(  cropSelected, SIGNAL(triggered()), this, SLOT(  CropSelected()));
  connect(pasteClipboard, SIGNAL(triggered()), this, SLOT(PasteClipboard()));
  connect(copyCLR, SIGNAL(triggered()), this, SLOT(CopyCLR()));
  connect(copyBnW, SIGNAL(triggered()), this, SLOT(CopyBnW()));
  connect(newWin, SIGNAL(triggered()), this, SLOT(NewWindow()));
  edit_menu->addAction(deleteSelected);
  edit_menu->addAction(  cropSelected); edit_menu->addSeparator();
  edit_menu->addAction(pasteClipboard); edit_menu->addAction(copyCLR);
                                        edit_menu->addAction(copyBnW);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  colorMenu = menuBar()->addMenu("Color");
#define ADD_colorMenu(ico,text,shortcut) \
  colorMenu->addAction(*ico,text)->setShortcut(QKeySequence(shortcut))
  ADD_colorMenu(enBlancoIco,            "blanco",     "B");
  ADD_colorMenu(enRojoIco,              "rojo (red)", "R");
  ADD_colorMenu(enCastanoIco, Utf8("castaño (brown)"),"C");
  ADD_colorMenu(enVerdeIco,          "verde (green)", "V");
  ADD_colorMenu(enAzulIco,             "azul (blue)", "A");
  colorMenu->addSeparator();
  colorMenu->addAction("random Bicolor")->setShortcut(QKeySequence("Ctrl+B"));
  colorMenu->addAction("random Recolor")->setShortcut(QKeySequence("Ctrl+R"));
  colorMenu->addAction("Un-color all")  ->setShortcut(QKeySequence("Ctrl+U"));
  connect(colorMenu, SIGNAL(triggered(QAction*)),
               this, SLOT(SelectColor(QAction*)));
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QLabel *magIcon = new QLabel; magIcon->setPixmap(QPixmap(":/zoom3.png"));
  magText = new QLabel(QString("+1"));
  magText->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  magText->setFont(fixedFont);
  magText->setMinimumSize(QSize(30,25));     bottom->addWidget(magText);
                                             bottom->addWidget(magIcon);
  fitView = new QAction(QIcon(":/full-size.png"), QString("fit"), this);
  connect(fitView, SIGNAL(triggered()), this, SLOT(DoFitView()));
  bottom->addAction(fitView);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QMenu *play_menu = menuBar()->addMenu("Play");
  playGen = new QLabel(QString("0"));
  playGen->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  playGen->setMinimumSize(QSize(66,25));
  prevGen =  new QAction(QIcon(":/step-back.png"),    QString("back"), this);
  nextGen =  new QAction(QIcon(":/go-forward.png") ,  QString("step"), this);
  playStop = new QAction(QIcon(":/fast-forward.png"), QString("go!"),  this);
  connect(prevGen,  SIGNAL(triggered()), this, SLOT(DoPrevGen()));
  connect(nextGen,  SIGNAL(triggered()), this, SLOT(DoNextGen()));
  connect(playStop, SIGNAL(triggered()), this, SLOT(DoPlayStop()));
  play_menu->addAction(nextGen);
  play_menu->addAction(playStop);
  play_menu->addAction(prevGen); prevGen->setEnabled(false);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  speedSlider = new QSlider(Qt::Horizontal, this);
  speedSlider->setMinimum(1); speedSlider->setValue(speed);
  speedSlider->setMaximum(4); speedSlider->setMaximumSize(50,22);
  speedSlider->setSingleStep(1);
  speedSlider->setTickInterval(1);
  speedSlider->setTickPosition(QSlider::TicksBelow);
  connect(speedSlider, SIGNAL(valueChanged(int)), this, SLOT(ChangeSpeed(int)));
  bottom->addWidget(playGen);
  bottom->addAction(nextGen);
  bottom->addWidget(speedSlider);
  bottom->addAction(playStop);
  addToolBar(Qt::BottomToolBarArea, bottom);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  if (fileToLoad) LoadTheWorld(fileToLoad);
  else                       SetWinTitle();
  show(); raise();
}
DataSetValuesView::DataSetValuesView(DataSetValues* dsv) : WorkspaceDockWidget(dsv,dsv->GetName()), m_bufferValues(dsv), m_loading(false)
{
   setAcceptDrops(true);

   SetupKeyboardShortcuts();

   m_table = new QTableView();
   m_tableModel = new DataSetValuesViewTableModel(dsv);
   m_table->setModel(m_tableModel);
   m_table->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

   m_scroll = new BigScrollbar(this, Qt::Vertical);

   QFont fixedFont("Monospace");
   fixedFont.setStyleHint(QFont::TypeWriter);
   m_table->setFont(fixedFont);

   m_valueColumns = new QComboBox();
   for (int i = 1; i <=16; ++i)
   {
      m_valueColumns->addItem(QString::number(i),i);
   }

   m_valueFormat = new QComboBox();
   m_valueFormat->addItem(tr("Value"),DataSetValues::DISPLAY_FORMAT_VALUE);
   m_valueFormat->addItem(tr("Hex"),DataSetValues::DISPLAY_FORMAT_HEX);
   m_valueFormat->addItem(tr("Octal"),DataSetValues::DISPLAY_FORMAT_OCT);

   m_valueDataType = new QComboBox();
   m_valueDataType->addItem(tr("uint8"),TERBIT_UINT8);
   m_valueDataType->addItem(tr("uint16"),TERBIT_UINT16);
   m_valueDataType->addItem(tr("uint32"),TERBIT_UINT32);
   m_valueDataType->addItem(tr("uint64"),TERBIT_UINT64);
   m_valueDataType->addItem(tr("int8"),TERBIT_INT8);
   m_valueDataType->addItem(tr("int16"),TERBIT_INT16);
   m_valueDataType->addItem(tr("int32"),TERBIT_INT32);
   m_valueDataType->addItem(tr("int64"),TERBIT_INT64);
   m_valueDataType->addItem(tr("float"),TERBIT_FLOAT);
   m_valueDataType->addItem(tr("double"),TERBIT_DOUBLE);

   m_indexFormat = new QComboBox();
   m_indexFormat->addItem(tr("Value"),DataSetValues::DISPLAY_FORMAT_VALUE);
   m_indexFormat->addItem(tr("Hex"),DataSetValues::DISPLAY_FORMAT_HEX);
   m_indexFormat->addItem(tr("Octal"),DataSetValues::DISPLAY_FORMAT_OCT);

   m_gotoIndex = new QLineEdit();

   m_refresh = new QPushButton(tr("Refresh"));

   QVBoxLayout* l = new QVBoxLayout();

   QHBoxLayout* settingsLayout = new QHBoxLayout();
   settingsLayout->addWidget(new QLabel(tr("Index")));
   settingsLayout->addWidget(new QLabel(tr("Format")));
   settingsLayout->addWidget(m_indexFormat);
   settingsLayout->addWidget(m_gotoIndex);
   QPushButton* btnGotoAddress = new QPushButton(tr("Go To"));
   settingsLayout->addWidget(btnGotoAddress);
   settingsLayout->addStretch();
   l->addLayout(settingsLayout);

   settingsLayout = new QHBoxLayout();
   settingsLayout->addWidget(new QLabel(tr("Data Type")));
   settingsLayout->addWidget(m_valueDataType);
   settingsLayout->addStretch();
   l->addLayout(settingsLayout);

   settingsLayout = new QHBoxLayout();
   settingsLayout->addWidget(new QLabel(tr("Format")));
   settingsLayout->addWidget(m_valueFormat);
   settingsLayout->addWidget(new QLabel(tr("Columns")));
   settingsLayout->addWidget(m_valueColumns);
   settingsLayout->addStretch();
   settingsLayout->addWidget(m_refresh);
   l->addLayout(settingsLayout);

   settingsLayout = new QHBoxLayout();
   settingsLayout->setSpacing(2);
   settingsLayout->setMargin(0);
   settingsLayout->addWidget(m_table,1);
   settingsLayout->addWidget(m_scroll,0);
   l->addLayout(settingsLayout);

   QWidget* wrapper = new QWidget();
   wrapper->setLayout(l);
   setWidget(wrapper); //must use wrapper widget for dockwidget stuffs

   //listen for gui events
   connect(m_valueDataType,SIGNAL(currentIndexChanged(int)), this, SLOT(OnDataTypeChanged(int)));
   connect(m_valueFormat,SIGNAL(currentIndexChanged(int)), this, SLOT(OnFormatChanged(int)));
   connect(m_valueColumns,SIGNAL(currentIndexChanged(int)), this, SLOT(OnColumnsChanged(int)));
   connect(m_indexFormat,SIGNAL(currentIndexChanged(int)), this, SLOT(OnIndexFormatChanged(int)));
   connect(btnGotoAddress,SIGNAL(clicked()),this,SLOT(GotoIndex()));
   connect(m_refresh,SIGNAL(clicked()),this,SLOT(OnRefreshData()));
   connect(m_scroll,SIGNAL(PositionChanged()),this,SLOT(OnTableScrolled()));

   //listen for model events
   connect(m_bufferValues,SIGNAL(ModelNewData()),this, SLOT(OnModelNewData()));
   connect(m_bufferValues,SIGNAL(ModelStructureChanged()), this, SLOT(OnModelStructureChanged()));
   connect(m_bufferValues,SIGNAL(NameChanged(DataClass*)),this, SLOT(OnModelNameChanged(DataClass*)));

   //get gui in sync with settings . . . simulate structure change
   OnModelStructureChanged();
   m_table->horizontalHeader()->resizeSections(QHeaderView::Stretch);
}
/*!	\brief		This function creates and updates the BPopUpMenu.
 *		\details		The created menu is updated every time the TimeRepresentation
 *						changes.
 */
void CalendarControl::CreateMenu( void ) {

	// The whole menu will be created in fixed font.
	BFont fixedFont(be_fixed_font);
	BFont plainFont(be_plain_font);
	BRect rectangle;
	BPoint	topLeftCorner( 0, 0 );
	BSize	rectSize;
	BString sb;
	
	// Which month shall we represent?
	map<int, BString> dayNames = fCalModule->GetDayNamesForLocalYearMonth(
			this->fRepresentedTime.tm_year,
			this->fRepresentedTime.tm_mon);
	map<int, DoubleNames> monthNames = fCalModule->GetMonthNamesForLocalYear(
			this->fRepresentedTime.tm_year);			
	
	int daysInMonth = dayNames.size();
	int daysInWeek = ( int )fCalModule->GetDaysInWeek();
	
	// We need to determine the bounding rectangle for the menu.
	// For this, we need to obtain the maximum bounding rectangle for a string.
	font_height fontHeightStruct;
	fixedFont.GetHeight( &fontHeightStruct );
	float fixedFontHeightString = fontHeightStruct.ascent + 
											fontHeightStruct.descent +
											fontHeightStruct.leading + SPACING;
	plainFont.GetHeight( &fontHeightStruct );
	float plainFontHeightString = fontHeightStruct.ascent + 
											fontHeightStruct.descent +
											fontHeightStruct.leading + SPACING;
	// Now fixedFontHeightString is surely big enough to enclose every string in 
	// height. How many lines will we need? One for name of month and year,
	// one for weekday names, and several more for the dates themselves. At the
	// bottom, there is an additional line for "Return to today" option.
	
	
	// tempDay is a running date in current month. Each day item will be initialized
	// from the tempDay.
	TimeRepresentation tempDay( this->fRepresentedTime );
	tempDay.tm_mday = 1;
	
	int firstDayOfMonthWD = fCalModule->GetWeekDayForLocalDateAsInt( tempDay );
	int firstDayOfWeek = ( int )fFirstDayOfEveryWeek;
	
	int firstDayOfMonthInFirstWeek =
		(firstDayOfMonthWD + daysInWeek - firstDayOfWeek) % daysInWeek;
	
	// This is the menu we're adding items to.
	if ( fDateSelector ) {
		BMenuItem* item = NULL;
		while ( fDateSelector->ItemAt( 0 ) ) {
			item = fDateSelector->RemoveItem( ( int32 )0 );
			delete item;
		}
	} else {
		fDateSelector = new BMenu("⇩", B_ITEMS_IN_MATRIX );
	}
	// Sanity check
	if ( !fDateSelector )
	{
		// Panic!
		fLastError = B_NO_MEMORY;
		return;
	}
	
	fDateSelector->SetViewColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
	fDateSelector->SetFont( &fixedFont );
	
	topLeftCorner.x = SPACING + 5;
	topLeftCorner.y = SPACING;	
	
	// Build the list of months.
	BPopUpMenu* listOfMonths = CreateMonthsMenu(monthNames);
	
	//-----------------------------------------------------
	// FIRST ROW.
	//-----------------------------------------------------
	
	/*----------------------------------------------------------------------------
	 *			Adding months menu with option to scroll forward and backward
	 *----------------------------------------------------------------------------*/
	
	// Add the item to scroll list of months back
	BMessage* messageOfItem = new BMessage( kMonthDecreased );
	DayItem* itemToAdd = new DayItem("‹", messageOfItem);
	if ( !itemToAdd ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	itemToAdd->SetServiceItem( true );
	itemToAdd->SetFrontColor( fColorForServiceItems );
	itemToAdd->SetBackColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
	itemToAdd->SetEnabled( true );
	rectSize.SetHeight( fixedFontHeightString );
	rectSize.SetWidth( 25 );
//	rectSize.SetWidth( ( float )fixedFont.StringWidth("‹") + SPACING );
	fDateSelector->AddItem(	itemToAdd, 
									BRect( topLeftCorner, rectSize ) );
	itemToAdd->SetTarget( this );

	topLeftCorner.x += rectSize.Width() + SPACING;

	// Add the list of months
	BString longestMonth = monthNames[ 1 ].longName;
	for ( int i = 2; i < ( int )monthNames.size(); i++ )
	{
		if ( ( ( BString )( monthNames[ i ].longName ) ).Length() > longestMonth.Length() )
		{
			longestMonth = monthNames[i].longName;
		}	
	}
	rectSize.SetHeight( plainFontHeightString );
	rectSize.SetWidth( (float)plainFont.StringWidth( longestMonth.String() ) + 10 + SPACING );
	fDateSelector->AddItem( listOfMonths, 
									BRect(topLeftCorner, rectSize) );
	topLeftCorner.x += rectSize.Width() + SPACING;

	// Add the item to scroll list of months forward.
	messageOfItem = new BMessage( kMonthIncreased );
	if ( !messageOfItem ) {
		// Panic! 
		fLastError = B_NO_MEMORY;
		return;
	}		
	itemToAdd = new DayItem( "›", messageOfItem );
	if ( !itemToAdd ) {
		/* Panic! */ 
		fLastError = B_NO_MEMORY; 
		return;
	}
	itemToAdd->SetServiceItem(true);
	itemToAdd->SetFrontColor( fColorForServiceItems );
	itemToAdd->SetBackColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
	itemToAdd->SetEnabled( true );
	rectSize.SetHeight( fixedFontHeightString );
	rectSize.SetWidth( 25 );
//	rectSize.SetWidth( ( float )fixedFont.StringWidth("›") + SPACING );
	fDateSelector->AddItem( itemToAdd, 
									BRect( topLeftCorner, rectSize ) );
	itemToAdd->SetTarget( this );

	topLeftCorner.x += rectSize.Width() + 10 + SPACING;


	/*----------------------------------------------------------------------------
	 *			Adding years menu with option to scroll forward and backward
	 *----------------------------------------------------------------------------*/

	// Add the item to scroll list of years down.
	messageOfItem = new BMessage( kYearDecreased );
	if ( !messageOfItem ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	itemToAdd = new DayItem( "‒", messageOfItem );
	if ( !itemToAdd ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	itemToAdd->SetServiceItem(true);
	itemToAdd->SetFrontColor( fColorForServiceItems );
	itemToAdd->SetBackColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
	itemToAdd->SetEnabled( true );
	rectSize.SetHeight( fixedFontHeightString );
	rectSize.SetWidth( 25 );
//	rectSize.SetWidth( ( float )fixedFont.StringWidth("‒") + SPACING );
	fDateSelector->AddItem( itemToAdd, 
									BRect( topLeftCorner, rectSize ) );
	itemToAdd->SetTarget( this );
	
	topLeftCorner.x += rectSize.Width() + SPACING;
	
	// Add year
	sb.Truncate( 0 );
	sb << fRepresentedTime.tm_year;
	rectSize.SetHeight( plainFontHeightString );
	rectSize.SetWidth( ( float )plainFont.StringWidth( sb.String() ) + 10 + SPACING );
	BPopUpMenu* listOfYears = CreateYearsMenu(this->fRepresentedTime.tm_year);
	if ( !listOfYears ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	fDateSelector->AddItem( listOfYears,
									BRect( topLeftCorner, rectSize ) );
	topLeftCorner.x += rectSize.Width() + SPACING;

	// Add item to scroll list of years up.
	messageOfItem = new BMessage( kYearIncreased );
	if ( !messageOfItem ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	itemToAdd = new DayItem( "+", messageOfItem );
	if ( !itemToAdd ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	itemToAdd->SetServiceItem(true);
	itemToAdd->SetFrontColor( fColorForServiceItems );
	itemToAdd->SetBackColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
	itemToAdd->SetEnabled(true);
	rectSize.SetHeight( fixedFontHeightString );
	rectSize.SetWidth( 25 );
//	rectSize.SetWidth( ( float )fixedFont.StringWidth( "+" ) + SPACING );
	fDateSelector->AddItem( itemToAdd, 
									BRect( topLeftCorner, rectSize ) );

	//-----------------------------------------------------
	// SECOND ROW.	WEEKDAY NAMES
	//-----------------------------------------------------
	sb.Truncate( 0 );
	rectSize.SetHeight( fixedFontHeightString );
	sb << ( int )fCalModule->GetLongestMonthLength();
	rectSize.SetWidth( fixedFont.StringWidth( sb.String() ) + SPACING );
	float rowHeight = rectSize.Height() + SPACING;
	float itemWidth = rectSize.Width() + 15 + SPACING;
	rectSize.SetWidth( itemWidth  );
	rectSize.SetHeight( rowHeight );
	
	topLeftCorner.x = SPACING; 
	topLeftCorner.y += rowHeight + ( SPACING * 2 );
	
	map<uint32, DoubleNames> weekdayNames = fCalModule->GetWeekdayNames();
	uint32 limit = ( uint32 )fCalModule->GetDaysInWeek();
	uint32 curDay;
	
	for (uint32 i = firstDayOfWeek; i < limit+firstDayOfWeek; ++i) {	
		curDay = ( (i - 1) % limit ) + 1;
		
		itemToAdd = new DayItem( weekdayNames[ curDay ].shortName.String(), NULL );
		if (!itemToAdd) {
			/* Panic! */
			fLastError = B_NO_MEMORY;
			return;
		}
		itemToAdd->SetServiceItem( true );
			// If this is a weekend, we shold display it in another color
		if ( fWeekends.HasItem( (void*)i ) ||
			  fWeekends.HasItem( (void*)( i % daysInWeek ) ) )
		{
			itemToAdd->SetFrontColor( fColorForWeekends );
		} else {
			itemToAdd->SetFrontColor( fColorForServiceItems );;
		}
		itemToAdd->SetEnabled(false);
		itemToAdd->SetBackColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
		fDateSelector->AddItem( itemToAdd, 
										BRect( topLeftCorner, rectSize ) );
		topLeftCorner.x += itemWidth + SPACING;
	}
	
	topLeftCorner.x = SPACING;
	topLeftCorner.y += rowHeight + SPACING;
	
	//-----------------------------------------------------------------------
	// THIRD ROW AND DOWN - THE WEEK INDIVIDUAL DAYS.
	//----------------------------------------------------------------------
	uint32 currentWeekday = ( uint32 )firstDayOfMonthInFirstWeek;
	topLeftCorner.x += ( itemWidth + SPACING ) * firstDayOfMonthInFirstWeek;
	
	for (int day = 1; day <= daysInMonth; ++day )
	{
		messageOfItem = new BMessage(kTodayModified);
		if ( !messageOfItem ) {
			/* Panic! */
			fLastError = B_NO_MEMORY;
			return;
		}
		messageOfItem->AddInt32( "Date", day );

		sb.Truncate( 0 );
		char padding = ' ';	// <-- For proper aligning of the items
		( day < 10 ) ? sb << padding << day : sb << day;
		itemToAdd = new DayItem( sb.String(), messageOfItem );
		if ( !itemToAdd ) {
			/* Panic! */
			fLastError = B_NO_MEMORY;
			return;
		}
		itemToAdd->SetEnabled( true );
		itemToAdd->SetServiceItem( false );
		messageOfItem->AddPointer( "Item", &itemToAdd );
		if ( fWeekends.HasItem( ( void* )( ( fFirstDayOfEveryWeek + currentWeekday ) % daysInWeek ) ) ||
		     fWeekends.HasItem( ( void* )( ( fFirstDayOfEveryWeek + currentWeekday ) ) ) )
		{
			itemToAdd->SetFrontColor( weekendDateColor );
		} else {
			itemToAdd->SetFrontColor( ui_color( B_MENU_ITEM_TEXT_COLOR ) );
		}
		// Does this item represent today?
		if ( fRepresentedTime.tm_mday == day ) {
			itemToAdd->SetToday( true );
			itemToAdd->SetBackColor( fColorForServiceItems );
			itemToAdd->SetMarked( true );
		}
		fDateSelector->AddItem( itemToAdd,
										BRect( topLeftCorner, rectSize ) );
		itemToAdd->SetTarget( this );
		
		topLeftCorner.x += itemWidth + SPACING;
	
		++currentWeekday;
		if ( ( currentWeekday % daysInWeek == 0 ) &&
		     ( day < daysInMonth ) )
		{
			topLeftCorner.x = SPACING;
			topLeftCorner.y += rowHeight+SPACING;
			currentWeekday = 0;
		}	
	}
	
	//-----------------------------------------------------------------------
	// LAST ROW - The option to return to current date.
	//----------------------------------------------------------------------
	topLeftCorner.y += rowHeight + SPACING;
	messageOfItem = new BMessage( kReturnToToday );
	if ( !messageOfItem ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	sb.Truncate( 0 );
	sb << "Go to today";		// Label
	itemToAdd = new DayItem( sb.String(), messageOfItem );
	if ( !itemToAdd ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	// Setting the color to blue
	itemToAdd->SetServiceItem(true);
	itemToAdd->SetFrontColor( fColorForServiceItems );
	itemToAdd->SetBackColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
	itemToAdd->SetEnabled( true );
	itemToAdd->SetTarget( this );
	// The new v-alignment was already set above. Now it's time to set the
	// x-alignment. I'd like to align this item to the center of Menu's rec-
	// tangle, which require some additional calculations.
	float currentWidth = itemWidth * daysInWeek + ( SPACING * 2 );
	float desiredWidth = plainFont.StringWidth( sb.String()) ;
	topLeftCorner.x = SPACING + 0.5 * ( currentWidth - desiredWidth );
	rectSize.SetHeight( plainFontHeightString );
	rectSize.SetWidth( desiredWidth + 30 ); 
	fDateSelector->AddItem( itemToAdd,
									BRect( topLeftCorner, rectSize ) );
	
	fDateSelector->SetTargetForItems( this );
	
	UpdateTargets( fDateSelector );
}