popupmenu.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2009 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 **    Harry Storbacka
00028 */
00029 
00032 
00033 #pragma once
00034 
00035 #include "../api_gui.h"
00036 #include "../gui_component.h"
00037 #include "../../Display/Window/input_event.h"
00038 #include "popupmenu_item.h"
00039 
00040 class CL_PixelBuffer;
00041 class CL_PopupMenu;
00042 
00043 class CL_PopupMenu_Impl;
00044 
00048 class CL_API_GUI CL_PopupMenu
00049 {
00052 public:
00053         CL_PopupMenu();
00054 
00055         virtual ~CL_PopupMenu();
00056 
00060         static CL_PopupMenu create_null_object();
00061 
00065 public:
00069         bool is_null() const;
00070 
00074         CL_String get_class_name() const;
00075 
00081         CL_PopupMenuItem get_item(int id);
00082 
00088         CL_PopupMenuItem get_item_at(int index);
00089 
00093         int get_item_count() const;
00094 
00098         int get_minimum_width() const;
00099 
00103         virtual CL_Size get_preferred_size() const;
00104 
00108 public:
00110         CL_Callback_v0 &func_close();
00111 
00115 public:
00117         void start(CL_GUIComponent *parent, const CL_Point &pos);
00118 
00126         CL_PopupMenuItem insert_item(const CL_StringRef &text, int id = -1, int index = -1);
00127 
00134         CL_PopupMenuItem insert_item_accel(const CL_StringRef &text, const CL_StringRef &accel_text=cl_text(""), int id = -1, int index = -1);
00135 
00141         CL_PopupMenuItem insert_separator(int index = -1);
00142 
00146         void set_minimum_width(int width_pixels);
00147 
00151         void set_maximum_height(int height_pixels);
00152 
00156         void set_class_name(const CL_StringRef &class_name);
00157 
00159         int find_item(const CL_StringRef &text, bool case_sensitive = false);
00160 
00164 private:
00165         CL_SharedPtr<CL_PopupMenu_Impl> impl;
00166 
00167         friend class CL_MenuBar;
00168         friend class CL_MenuBar_Impl;
00169         friend class CL_PopupMenuWindow;
00171 };
00172 

Generated on Thu Dec 3 02:39:30 2009 for ClanLib by  doxygen 1.4.6