CExtStatusControlBar - Managing status bar's panes is getting easier

Is your email address OK? You are signed up for our newsletters but your email address is either unconfirmed, or has not been reconfirmed in a long time. Please click here to have a confirmation email sent so we can confirm your email address and start sending you newsletters again.

Introduction

The article introduces an enhanced version of the standard MFC status bar control. The new class should enable you to easily add/remove panes to/from the application's status bar, on-the-fly. The status bar's panes may contain almost any control you need: buttons, edits, animations, progress bars, and etc.

The class is partially based on the status bar presented in the freeware version of the Prof-UIS library available here.

How to use it

The CExtStatusControlBar class is simple to use. To add it to your project, please follow the steps below:

  1. Put its source files (CExtStatusControlBar.cpp and CExtStatusControlBar.h) into the proper folder and add their file names to your Visual Studio project.
  2. Include its header to the appropriate header file. If you plan to use CExtStatusControlBar in several places of your application, it's reasonable to add it to your stdafx.h file.

    CollapseCopy Code

    #include "CExtStatusControlBar.h"
  3. If you used CStatusBar, you should replace it with CExtStatusControlBar everywhere in the project.

    CollapseCopy Code

    CExtStatusControlBar  m_wndStatusBar;

Sample

The StatusPanes sample project shows how to use the class in practice (including how to place controls into the control bar's panes).

List of methods

  • BOOL AddPane(UINT nID, int nIndex)

    Inserts a new pane into the status bar.

    Parameters
    nID
    ID of the pane to be added.
    nIndex
    The index of the newly created pane.
    Return Value
    Nonzero if successful.

  • BOOL RemovePane(UINT nID)

    Deletes a pane from the status bar.

    Parameters
    nID
    ID of the pane to be deleted.
    Return Value
    Nonzero if successful.

  • BOOL AddPaneControl(CWnd* pWnd, UINT nID, BOOL bAutoDestroy)

    Inserts a control into a specified pane.

    Parameters
    pWnd
    Pointer to the control to be added.
    nID
    ID of the target pane.
    bAutoDestroy
    Specifies whether the control should be destroyed when the pane is removed.
    Return Value
    Nonzero if successful; otherwise zero.

  • BOOL AddPaneControl(HWND hWnd, UINT nID, BOOL bAutoDestroy)

    Inserts a control into a specified pane.

    Parameters
    hWnd
    Handle to the control to be added.
    nID
    ID of the target pane.
    bAutoDestroy
    Specifies whether the control should be destroyed when the pane is removed.
    Return Value
    Nonzero if successful.

  • void DisableControl( int nIndex, BOOL bDisable=TRUE)

    Disables the control at a specified pane.

    Parameters
    nIndex
    Index of the pane.
    bDisable
    Flag specifying that the control is enabled if it is set to TRUE.
     

  • int GetPanesCount() const

    Retrieves the current number of panes in the status bar.


  • void SetPaneWidth(int nIndex, int nWidth)

    Sets a width in pixels for a specified pane.

    Parameters
    nIndex
    Index of the pane.
    nStyle
    Width to be set.

     


  • void SetPaneInfo(int nIndex, UINT nID, UINT nStyle, int cxWidth)

    Sets the specified pane to a new ID, style and width.

    Parameters
    nIndex
    Index of the pane whose style is to be set.
    nID
    New ID for the pane.
    nStyle
    New style for the pane.
    cxWidth
    New width for the pane.

  • void SetPaneStyle(int nIndex, UINT nStyle)

    Sets the style of a status bar's pane. A pane's style determines how the pane appears.

    Parameters
    nIndex
    Index of the pane whose style is to be set.
    nStyle
    Style of the pane whose style is to be set.

Copyright

You can use these sources for absolutely free.

Reporting bugs

Your questions, suggestions and bug reports may be posted either to the forum below or to the forum at the Prof-UIS website.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

时间: 2024-09-24 04:25:19

CExtStatusControlBar - Managing status bar's panes is getting easier的相关文章

ios7 设置status bar风格

How to change status bar style during launch on iOS 7 up vote4down votefavorite   When I launch my app, it shows the launch image and a black status bar. How can I change it so the status bar is light during launch? I have set the status bar appearan

Android ApiDemos示例解析(29):App->Notification->Status Bar

这个例子的Icons Only 和 Icons and marquee 没有什么特别好说明的. 而Use Remote views in balloon 介绍了可 以自定义在Extended Status bar显示Notification的Layout,Extended Status Bar缺省显示Notification 是一个图标后接文 字,对应大多数情况是够用了.但如果有需要也可以使用自定义的Layout在Extented Status bar显示Notification,方法是通 过R

Status bar and navigation bar appear over my view's bounds in iOS 7

186down votefavorite 122 I recently downloaded Xcode 5 DP to test my apps in iOS 7. The first thing I noticed and confirmed is that my view's bounds is not always resized to account for the status bar and navigation bar. In viewDidLayoutSubviews, I p

Android开发指南(38) —— Status Bar Notifications

前言 本章内容为Android开发者指南的 Framework Topics/User Interface/Notifications/Status Bar Notifications章节,译为"状态栏通知",版本为Android 4.0 r1,翻译来自:"呆呆大虾",欢迎访问他的微博:"http://weibo.com/popapa",再次感谢"呆呆大虾" !期待你一起参与翻译Android的相关资料,联系我over140@

android:在 status bar 上添加 notification

问题描述 android:在 status bar 上添加 notification 我使用 NotificationCompat.Builder 创建了一个 notification,但是不知道如何在 status bar 中显示出来? 我使用代码: NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificatio

notificaion-如何在status bar中显示通知?

问题描述 如何在status bar中显示通知? 我在 activity 中创建了 notification Notification n = new Notification.Builder(getApplicationContext()) .setContentTitle("New mail from " + sender) .setContentText(subject) .setSmallIcon(R.drawable.notification) .build(); 现在在st

android图库竖屏不显示status bar的解决方法_Android

图库在JB和JB2的版本上显示的行为是:横屏全屏显示,竖屏会显示status bar.如何使竖屏也不显示status bar. 修改alps/packages/apps/Gallery2/src/com/android/gallery3d/app/AbstractGalleryActivity.java中toggleStatusBarByOrientation() 方法: 复制代码 代码如下: private void toggleStatusBarByOrientation() { if (m

android图库竖屏不显示status bar的解决方法

图库在JB和JB2的版本上显示的行为是:横屏全屏显示,竖屏会显示status bar.如何使竖屏也不显示status bar. 修改alps/packages/apps/Gallery2/src/com/android/gallery3d/app/AbstractGalleryActivity.java中toggleStatusBarByOrientation() 方法: 复制代码 代码如下: private void toggleStatusBarByOrientation() { if (m

ios7适配--隐藏status bar

//viewDidload if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { // iOS 7 [self prefersStatusBarHidden]; [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; } else { // iOS 6 [[UIApplication sharedApplicati